Browse Source

Strugling with size

pull/8/head
Florian Mounier 13 years ago
parent
commit
30e9d95c89
  1. 3
      pygal/css/graph.css
  2. 10
      pygal/graph.py
  3. 12
      setup.py
  4. 6
      test/moulinrouge/__init__.py

3
pygal/css/graph.css

@ -4,10 +4,11 @@
font-family: helvetica;
}
.svgBackground{
fill:#ffffff;
fill: transparent;
}
.graphBackground{
fill: #e8eef6;
fill-opacity: 0.7;
}
/* graphs titles */

10
pygal/graph.py

@ -45,8 +45,8 @@ class Graph(object):
* pygal.time_series
"""
width = 1000
height = 500
ratio = .7
width = 600
show_x_guidelines = False
show_y_guidelines = True
show_data_values = True
@ -99,6 +99,10 @@ class Graph(object):
self.load_config(config)
self.clear_data()
@property
def height(self):
return int(self.width * self.ratio)
def load_config(self, config):
self.__dict__.update(config)
@ -515,7 +519,7 @@ class Graph(object):
'xlink': 'http://www.w3.org/1999/xlink',
}
self.root = etree.Element("{%s}svg" % svg_ns, attrib={
'viewBox': '0 0 100% 100%',
'viewBox': '0 0 %d %d' % (self.width, self.height)
}, nsmap=nsmap)
if hasattr(self, 'style_sheet_href'):

12
setup.py

@ -15,19 +15,10 @@ class DisabledTestCommand(Command):
"test command not supported on pygal."
" Use setup.py nosetests instead")
_this_dir = os.path.dirname(__file__)
_readme = os.path.join(_this_dir, 'readme.txt')
_long_description = open(_readme).read().strip()
# it seems that dateutil 2.0 only works under Python 3
dateutil_req = (
['python-dateutil>=1.4,<2.0dev'] if sys.version_info < (3, 0)
else ['python-dateutil>=2.0'])
setup_params = dict(
name="pygal",
description="Python svg graph abstract layer",
long_description=_long_description,
author="Jason R. Coombs, Kozea",
author_email="jaraco@jaraco.com, gayoub@kozea.fr",
url="https://github.com/Kozea/pygal",
@ -35,9 +26,8 @@ setup_params = dict(
zip_safe=True,
include_package_data=True,
install_requires=[
'cssutils>=0.9.8a3',
'lxml>=2.0',
] + dateutil_req,
],
license="MIT",
classifiers=[
"Development Status :: 5 - Production/Stable",

6
test/moulinrouge/__init__.py

@ -22,9 +22,6 @@ def random_value():
def generate_vbar(**opts):
opts.setdefault('width', 375)
opts.setdefault('height', 245)
g = VerticalBar(labels, opts)
for serie, values in series.items():
g.add_data({'data': values, 'title': serie})
@ -48,7 +45,6 @@ def create_app():
@app.route("/all-<type>.svg")
def all_svg(type):
width, height = 800, 600
series = random.randrange(1, 10)
data = random.randrange(1, 10)
@ -62,8 +58,6 @@ def create_app():
series = 1
g = Pie({'fields': labels})
g.width, g.height = width, height
for i in range(series):
values = [random_value() for i in range(data)]
g.add_data({'data': values, 'title': random_label()})

Loading…
Cancel
Save