Browse Source

Bug fix on box plot modes.

pull/133/head
Gabriel Queiroz 11 years ago
parent
commit
0e2272e0a4
  1. 4
      pygal/config.py
  2. 7
      pygal/graph/box.py

4
pygal/config.py

@ -320,6 +320,10 @@ class Config(CommonConfig):
"ie: For hermite interpolation, you can set the cardinal tension with"
"{'type': 'cardinal', 'c': .5}", int)
mode = Key(
None, str, "Value", "Sets the mode to be used. (Currently only supported on box plot)",
"May be %s" % ' or '.join(["1.5IQR", "extremes"]))
order_min = Key(
None, int, "Value", "Minimum order of scale, defaults to None")

7
pygal/graph/box.py

@ -47,7 +47,10 @@ class Box(Graph):
def format_maybe_quartile(x):
if is_list_like(x):
return 'Q1: %s Q2: %s Q3: %s' % tuple(map(sup, x[1:4]))
if self.mode == "extremes":
return 'Min: %s Q1: %s Q2: %s Q3: %s Max: %s' % tuple(map(sup, x))
else:
return 'Q1: %s Q2: %s Q3: %s' % tuple(map(sup, x[1:4]))
else:
return sup(x)
return format_maybe_quartile
@ -58,7 +61,7 @@ class Box(Graph):
within the rendering process
"""
for serie in self.series:
serie.values = self._box_points(serie.values)
serie.values = self._box_points(serie.values, self.mode)
if self._min:
self._box.ymin = min(self._min, self.zero)

Loading…
Cancel
Save