Browse Source

reverse the legend in horizontal bar. Adresses #56

pull/54/head
Christian Ledermann 12 years ago
parent
commit
615c9c3e50
  1. 17
      pygal/graph/horizontalbar.py

17
pygal/graph/horizontalbar.py

@ -22,7 +22,22 @@ Horizontal bar graph
"""
from pygal.graph.horizontal import HorizontalGraph
from pygal.graph.bar import Bar
from pygal.util import cached_property
class HorizontalBar(HorizontalGraph, Bar):
"""Horizontal Bar graph"""
@cached_property
def _legends(self):
"""Getter for series title"""
return [serie.title for serie in self.series][::-1]
def _plot(self):
for index, serie in enumerate(self.series):
num = len(self.series) - index - 1
self.bar(self._serie(num), serie, index)
for index, serie in enumerate(self.secondary_series, len(self.series)):
#XXX
self.bar(self._serie(index), serie, index, True)

Loading…
Cancel
Save