Permalink
Browse files

fix additional edge cases in stacked code

single stack mode erroneously triggered with areaMode=stacked
more drawAsInfinite edge cases
  • Loading branch information...
mleinart committed Mar 15, 2013
1 parent 034878a commit a8dd81a37b755beedb70ab36007a6077fc0bea30
Showing with 13 additions and 13 deletions.
  1. +13 −13 webapp/graphite/render/glyph.py
@@ -767,33 +767,33 @@ def drawLines(self, width=None, dash=None, linecap='butt', linejoin='miter'):
'bevel' : cairo.LINE_JOIN_BEVEL,
}[linejoin])
+ # check whether there is an stacked metric
+ singleStacked = False
+ for series in self.data:
+ if 'stacked' in series.options:
+ singleStacked = True
+ if singleStacked:
+ self.data = sort_stacked(self.data)
+
# stack the values
if self.areaMode == 'stacked' and not self.secondYAxis: #TODO Allow stacked area mode with secondYAxis
total = []
for series in self.data:
if 'drawAsInfinite' in series.options:
continue
+
+ series.options['stacked'] = True
for i in range(len(series)):
if len(total) <= i: total.append(0)
if series[i] is not None:
original = series[i]
series[i] += total[i]
total[i] += original
-
- # check whether there is an stacked metric
- singleStacked = False
- for series in self.data:
- if 'stacked' in series.options:
- singleStacked = True
- if singleStacked:
- self.data = sort_stacked(self.data)
-
- # apply stacked setting on series based on areaMode
- if self.areaMode == 'first':
+ elif self.areaMode == 'first':
self.data[0].options['stacked'] = True
- elif self.areaMode != 'none':
- for series in self.data:
+ elif self.areaMode == 'all':
+ if 'drawAsInfinite' not in series.options:
series.options['stacked'] = True
# apply alpha channel and create separate stroke series

1 comment on commit a8dd81a

@piotr1212

This comment has been minimized.

Show comment Hide comment
@piotr1212

piotr1212 Apr 27, 2013

Contributor

this commit breaks areaMode=all. When using areaMode=all it seems that only the last series is drawn with filled area. fixed in #307

Contributor

piotr1212 commented on a8dd81a Apr 27, 2013

this commit breaks areaMode=all. When using areaMode=all it seems that only the last series is drawn with filled area. fixed in #307

Please sign in to comment.