Browse Source

Fixes

pull/8/head
Florian Mounier 13 years ago
parent
commit
21cd57f678
  1. 5
      pygal/css/graph.css
  2. 31
      pygal/graph/graph.py

5
pygal/css/graph.css

@ -53,10 +53,13 @@ svg * {
.legends .legend text {
font-family: monospace;
font-size: {{ font_sizes.legend }};
stroke: {{ style.foreground }};
fill: {{ style.foreground }};
}
.legends .legend:hover text {
stroke: {{ style.foreground_light }};
fill: {{ style.foreground_light }};
}
.axis text {
@ -121,7 +124,7 @@ svg * {
fill-opacity: {{ style.opacity }};
}
.reactive.active {
.reactive.active, .active .reactive {
fill-opacity: {{ style.opacity_hover }};
}

31
pygal/graph/graph.py

@ -104,21 +104,24 @@ class Graph(BaseGraph):
self.margin.left + self.view.width + 10,
self.margin.top + 10))
for i, title in enumerate(self._legends):
legend = self.svg.node(legends, class_='legend')
self.svg.node(legend, 'rect',
x=0,
y=1.5 * i * self.legend_box_size,
width=self.legend_box_size,
height=self.legend_box_size,
class_="color-%d activate-serie reactive" % i,
id="activate-serie-%d" % i
).text = title
legend = self.svg.node(
legends, class_='legend reactive activate-serie',
id="activate-serie-%d" % i)
self.svg.node(
legend, 'rect',
x=0,
y=1.5 * i * self.legend_box_size,
width=self.legend_box_size,
height=self.legend_box_size,
class_="color-%d reactive" % i
).text = title
# Serious magical numbers here
self.svg.node(legend, 'text',
x=self.legend_box_size + 5,
y=1.5 * i * self.legend_box_size
+ .5 * self.legend_box_size
+ .3 * self.legend_font_size
self.svg.node(
legend, 'text',
x=self.legend_box_size + 5,
y=1.5 * i * self.legend_box_size
+ .5 * self.legend_box_size
+ .3 * self.legend_font_size
).text = title
def _title(self):

Loading…
Cancel
Save