Various updates; Add logAxis patch for graphite; Add namespaces to summary scripts.
[myops.git] / web / view / graphite.render.glyph.patch
1 --- glyph.py.orig       2011-11-24 01:51:01.000000000 +0000
2 +++ glyph.py    2011-11-24 01:53:12.000000000 +0000
3 @@ -314,7 +314,7 @@
4                    'minorGridLineColor','thickness','min','max', \
5                    'graphOnly','yMin','yMax','yLimit','yStep','areaMode', \
6                    'areaAlpha','drawNullAsZero','tz', 'yAxisSide','pieMode', \
7 -                  'yUnitSystem')
8 +                  'yUnitSystem', 'yAxisType')
9    validLineModes = ('staircase','slope')
10    validAreaModes = ('none','first','all','stacked')
11    validPieModes = ('maximum', 'minimum', 'average')
12 @@ -326,6 +326,7 @@
13        params['hideGrid'] = True
14        params['hideAxes'] = True
15        params['yAxisSide'] = 'left'
16 +      params['yAxisType'] = 'linear'
17        params['title'] = ''
18        params['vtitle'] = ''
19        params['margin'] = 0
20 @@ -345,6 +346,8 @@
21        params['yAxisSide'] = 'left'
22      if 'yUnitSystem' not in params:
23        params['yUnitSystem'] = 'si'
24 +    if 'yAxisType' not in params:
25 +      params['yAxisType'] = 'linear'
26      self.params = params
27      # When Y Axis is labeled on the right, we subtract x-axis positions from the max,
28      # instead of adding to the minimum
29 @@ -642,17 +645,30 @@
30          ySpan, spanPrefix = format_units(self.ySpan, self.yStep,
31                  system=self.params.get('yUnitSystem'))
32
33 -        if ySpan > 10 or spanPrefix != prefix:
34 -          return "%d %s " % (int(yValue), prefix)
35 +        if self.params.get('yAxisType') == 'linear':
36 +            if ySpan > 10 or spanPrefix != prefix:
37 +              return "%d %s " % (int(yValue), prefix)
38
39 -        elif ySpan > 3:
40 -          return "%.1f %s " % (float(yValue), prefix)
41 +            elif ySpan > 3:
42 +              return "%.1f %s " % (float(yValue), prefix)
43
44 -        elif ySpan > 0.1:
45 -          return "%.2f %s " % (float(yValue), prefix)
46 +            elif ySpan > 0.1:
47 +              return "%.2f %s " % (float(yValue), prefix)
48
49 -        else:
50 -          return "%g %s" % (float(yValue), prefix)
51 +            else:
52 +              return "%g %s" % (float(yValue), prefix)
53 +        elif self.params.get('yAxisType') == 'log':
54 +            if ySpan > 10 or spanPrefix != prefix:
55 +              return "%d %s " % (math.pow(10,int(yValue)), prefix)
56 +
57 +            elif ySpan > 3:
58 +              return "%.1f %s " % (math.pow(10,float(yValue)), prefix)
59 +
60 +            elif ySpan > 0.1:
61 +              return "%.2f %s " % (math.pow(10,float(yValue)), prefix)
62 +
63 +            else:
64 +              return "%g %s " % (math.pow(10,float(yValue)), prefix)
65
66        self.yLabelValues = list( frange(self.yBottom,self.yTop,self.yStep) )
67        self.yLabels = map(makeLabel,self.yLabelValues)