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 { .legends .legend text {
font-family: monospace; font-family: monospace;
font-size: {{ font_sizes.legend }}; font-size: {{ font_sizes.legend }};
stroke: {{ style.foreground }};
fill: {{ style.foreground }};
} }
.legends .legend:hover text { .legends .legend:hover text {
stroke: {{ style.foreground_light }}; stroke: {{ style.foreground_light }};
fill: {{ style.foreground_light }};
} }
.axis text { .axis text {
@ -121,7 +124,7 @@ svg * {
fill-opacity: {{ style.opacity }}; fill-opacity: {{ style.opacity }};
} }
.reactive.active { .reactive.active, .active .reactive {
fill-opacity: {{ style.opacity_hover }}; 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.left + self.view.width + 10,
self.margin.top + 10)) self.margin.top + 10))
for i, title in enumerate(self._legends): for i, title in enumerate(self._legends):
legend = self.svg.node(legends, class_='legend') legend = self.svg.node(
self.svg.node(legend, 'rect', legends, class_='legend reactive activate-serie',
x=0, id="activate-serie-%d" % i)
y=1.5 * i * self.legend_box_size, self.svg.node(
width=self.legend_box_size, legend, 'rect',
height=self.legend_box_size, x=0,
class_="color-%d activate-serie reactive" % i, y=1.5 * i * self.legend_box_size,
id="activate-serie-%d" % i width=self.legend_box_size,
).text = title height=self.legend_box_size,
class_="color-%d reactive" % i
).text = title
# Serious magical numbers here # Serious magical numbers here
self.svg.node(legend, 'text', self.svg.node(
x=self.legend_box_size + 5, legend, 'text',
y=1.5 * i * self.legend_box_size x=self.legend_box_size + 5,
+ .5 * self.legend_box_size y=1.5 * i * self.legend_box_size
+ .3 * self.legend_font_size + .5 * self.legend_box_size
+ .3 * self.legend_font_size
).text = title ).text = title
def _title(self): def _title(self):

Loading…
Cancel
Save