Browse Source

Revert "Reverse horizontal series. Fix #229"

This reverts commit 3827cee67f.
pull/242/head
Florian Mounier 10 years ago
parent
commit
ed56a01b60
  1. 10
      pygal/graph/bar.py
  2. 2
      pygal/graph/base.py
  3. 2
      pygal/graph/histogram.py
  4. 2
      pygal/graph/stackedbar.py
  5. 4
      pygal/graph/verticalpyramid.py

10
pygal/graph/bar.py

@ -36,18 +36,14 @@ class Bar(Graph):
self._x_ranges = None
super(Bar, self).__init__(*args, **kwargs)
def _bar(self, serie, parent, x, y, zero, secondary=False):
def _bar(self, serie, parent, x, y, i, zero, secondary=False):
width = (self.view.x(1) - self.view.x(0)) / self._len
x, y = self.view((x, y))
series_margin = width * self._series_margin
x += series_margin
width -= 2 * series_margin
width /= self._order
if self.horizontal:
i = self._order - serie.index
else:
i = serie.index
x += i * width
x += serie.index * width
serie_margin = width * self._serie_margin
x += serie_margin
width -= 2 * serie_margin
@ -81,7 +77,7 @@ class Bar(Graph):
val = self._format(serie.values[i])
x_center, y_center = self._bar(
serie, bar, x, y, self.zero, secondary=rescale)
serie, bar, x, y, i, self.zero, secondary=rescale)
self._tooltip_data(
bar, val, x_center, y_center, classes="centered")
self._static_value(serie_node, val, x_center, y_center)

2
pygal/graph/base.py

@ -185,11 +185,11 @@ class BaseGraph(object):
if getattr(self, 'y_labels', None) is not None:
self.y_labels = list(self.y_labels)
self.state = State(self, **kwargs)
self.horizontal = getattr(self, 'horizontal', False)
self.series = self.prepare_values(
self.raw_series) or []
self.secondary_series = self.prepare_values(
self.raw_series2, len(self.series)) or []
self.horizontal = getattr(self, 'horizontal', False)
self.svg = Svg(self)
self._x_labels = None
self._y_labels = None

2
pygal/graph/histogram.py

@ -63,7 +63,7 @@ class Histogram(Graph):
sum(map(abs, self.xvals)) != 0,
sum(map(abs, self.yvals)) != 0))
def _bar(self, serie, parent, x0, x1, y, zero, secondary=False):
def _bar(self, serie, parent, x0, x1, y, i, zero, secondary=False):
x, y = self.view((x0, y))
x1, _ = self.view((x1, y))
width = x1 - x

2
pygal/graph/stackedbar.py

@ -92,7 +92,7 @@ class StackedBar(Bar):
self._secondary_max = (positive_vals and max(
max(positive_vals), self.zero)) or self.zero
def _bar(self, serie, parent, x, y, zero, secondary=False):
def _bar(self, serie, parent, x, y, i, zero, secondary=False):
if secondary:
cumulation = (self.secondary_negative_cumulation
if y < self.zero else

4
pygal/graph/verticalpyramid.py

@ -56,8 +56,8 @@ class VerticalPyramid(StackedBar):
self._secondary_max = max(max(positive_vals), max(negative_vals))
self._secondary_min = - self._secondary_max
def _bar(self, serie, parent, x, y, zero, secondary=False):
def _bar(self, serie, parent, x, y, i, zero, secondary=False):
if serie.index % 2:
y = -y
return super(VerticalPyramid, self)._bar(
serie, parent, x, y, zero, secondary)
serie, parent, x, y, i, zero, secondary)

Loading…
Cancel
Save