Various updates; Add logAxis patch for graphite; Add namespaces to summary scripts.
[myops.git] / web / view / graphite.render.glyph.patch
diff --git a/web/view/graphite.render.glyph.patch b/web/view/graphite.render.glyph.patch
new file mode 100644 (file)
index 0000000..b73ad20
--- /dev/null
@@ -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)