X-Git-Url: http://git.onelab.eu/?p=myops.git;a=blobdiff_plain;f=web%2Fview%2Fgraphite.render.glyph.patch;fp=web%2Fview%2Fgraphite.render.glyph.patch;h=b73ad206851b64ede4728cce85d60a25cc4af395;hp=0000000000000000000000000000000000000000;hb=3ebc599db4bc491de0dd4195b2e6dc858dbd3d22;hpb=2c16b9ee5acc1b619824df8d4e4fb57c6a02dee7 diff --git a/web/view/graphite.render.glyph.patch b/web/view/graphite.render.glyph.patch new file mode 100644 index 0000000..b73ad20 --- /dev/null +++ b/web/view/graphite.render.glyph.patch @@ -0,0 +1,67 @@ +--- glyph.py.orig 2011-11-24 01:51:01.000000000 +0000 ++++ glyph.py 2011-11-24 01:53:12.000000000 +0000 +@@ -314,7 +314,7 @@ + 'minorGridLineColor','thickness','min','max', \ + 'graphOnly','yMin','yMax','yLimit','yStep','areaMode', \ + 'areaAlpha','drawNullAsZero','tz', 'yAxisSide','pieMode', \ +- 'yUnitSystem') ++ 'yUnitSystem', 'yAxisType') + validLineModes = ('staircase','slope') + validAreaModes = ('none','first','all','stacked') + validPieModes = ('maximum', 'minimum', 'average') +@@ -326,6 +326,7 @@ + params['hideGrid'] = True + params['hideAxes'] = True + params['yAxisSide'] = 'left' ++ params['yAxisType'] = 'linear' + params['title'] = '' + params['vtitle'] = '' + params['margin'] = 0 +@@ -345,6 +346,8 @@ + params['yAxisSide'] = 'left' + if 'yUnitSystem' not in params: + params['yUnitSystem'] = 'si' ++ if 'yAxisType' not in params: ++ params['yAxisType'] = 'linear' + self.params = params + # When Y Axis is labeled on the right, we subtract x-axis positions from the max, + # instead of adding to the minimum +@@ -642,17 +645,30 @@ + ySpan, spanPrefix = format_units(self.ySpan, self.yStep, + system=self.params.get('yUnitSystem')) + +- if ySpan > 10 or spanPrefix != prefix: +- return "%d %s " % (int(yValue), prefix) ++ if self.params.get('yAxisType') == 'linear': ++ if ySpan > 10 or spanPrefix != prefix: ++ return "%d %s " % (int(yValue), prefix) + +- elif ySpan > 3: +- return "%.1f %s " % (float(yValue), prefix) ++ elif ySpan > 3: ++ return "%.1f %s " % (float(yValue), prefix) + +- elif ySpan > 0.1: +- return "%.2f %s " % (float(yValue), prefix) ++ elif ySpan > 0.1: ++ return "%.2f %s " % (float(yValue), prefix) + +- else: +- return "%g %s" % (float(yValue), prefix) ++ else: ++ return "%g %s" % (float(yValue), prefix) ++ elif self.params.get('yAxisType') == 'log': ++ if ySpan > 10 or spanPrefix != prefix: ++ return "%d %s " % (math.pow(10,int(yValue)), prefix) ++ ++ elif ySpan > 3: ++ return "%.1f %s " % (math.pow(10,float(yValue)), prefix) ++ ++ elif ySpan > 0.1: ++ return "%.2f %s " % (math.pow(10,float(yValue)), prefix) ++ ++ else: ++ return "%g %s " % (math.pow(10,float(yValue)), prefix) + + self.yLabelValues = list( frange(self.yBottom,self.yTop,self.yStep) ) + self.yLabels = map(makeLabel,self.yLabelValues)