Browse Source

Styles

pull/8/head
Florian Mounier 13 years ago
parent
commit
20fec69159
  1. 19
      out.py
  2. 14
      pygal/css/graph.css
  3. 1
      pygal/svg.py

19
out.py

@ -1,5 +1,6 @@
#!/usr/bin/env python
from pygal import Line, Bar, XY, Pie, StackedBar, Config
from pygal.style import NeonStyle
from math import cos, sin
bar = Bar()
@ -11,19 +12,23 @@ bar.title = "Bar test"
with open('out-bar.svg', 'w') as f:
f.write(bar.render())
stackedbar = StackedBar()
rng = [3, -32, 39, 12]
stackedbar.add('@@@@@@@', rng)
rng2 = [24, -8, 18, 12]
stackedbar.add('++++++', rng2)
rng3 = [6, 1, -10, 0]
stackedbar.add('--->', rng3)
stackedbar.x_label_rotation = 35
stackedbar.x_labels = map(lambda x: '%s / %s / %s' % x,
config = Config()
config.x_label_rotation = 35
config.x_labels = map(lambda x: '%s / %s / %s' % x,
zip(map(str, rng),
map(str, rng2),
map(str, rng3)))
stackedbar.title = "Stackedbar test"
config.title = "Config test"
config.style = NeonStyle
stackedbar = StackedBar(config)
stackedbar.add('@@@@@@@', rng)
stackedbar.add('++++++', rng2)
stackedbar.add('--->', rng3)
with open('out-stackedbar.svg', 'w') as f:
f.write(stackedbar.render())

14
pygal/css/graph.css

@ -93,6 +93,10 @@ svg * {
stroke-width: 5px;
}
.series .rect, .series .slice {
fill-opacity: {{ style.opacity }};
}
.series text {
opacity: 0;
font-size: {{ font_sizes.values }};
@ -106,6 +110,10 @@ svg * {
opacity: 1;
}
.series .bar:hover .rect, .series .slice:hover path{
fill-opacity: 1;
}
.series .line {
fill: none;
stroke-width: 1px;
@ -116,13 +124,7 @@ svg * {
stroke-width: 2px;
}
.series .rect, .series .slice {
fill-opacity: {{ style.opacity }};
}
.series .rect:hover, .series .slice:hover {
fill-opacity: 1;
}
{{ style.colors }}

1
pygal/svg.py

@ -1,7 +1,6 @@
import os
from lxml import etree
from pygal.view import View
from pygal.style import DefaultStyle
from math import cos, sin, pi

Loading…
Cancel
Save