I've never used the google-o-meter charts, but from looking at the
docs they
look similar to pie charts. Simpler, actually, because you don't have
to
worry about all the sizes adding up to 100. This snippet almost
works,
actually (but the 50 gets converted to 100%):
from graphy.backends import google_chart_api as g
p = g.PieChart()
p.AddSegment(50, label="X")
p.display.extra_params['cht'] = 'gom' # cheating
p.display.Url(200, 100)
I think adding a Meter class which behaves similarly to PieChart would
be
easy. I think the hardest part would be going through the docs to
find all
the possibilties (can you have 2 meters, like you can have 2 pie
charts?
Can you have multiple pointers? How do you change the color? etc.)
I'm about to leave for vacation, so I won't have a chance to look into
this
until October. If you wanted to look into this before then, I would
suggest
these steps:
1. Make a new chart class (maybe called Meter?) that subclasses
common.BaseChart.
2. Copy most of the logic from the PieChart over. I wouldn't bother
copying
the Segment class, though, just use single-element data series. Make
an
AddPointer method instead of AddSegment.
3. In the google_chart_api backend, add a new encoder for the Meter
class.
Again, I think it would be similar to the PieChartEncoder but leave
out the
value-conversion code.
4. Add a new "Meter" helper in google_chart_api/__init__.py to
construct one
of the Meter objects with the correct encoder.