On Jul 27, 2:40 pm, Dan <
danbr...@gmail.com> wrote:
> Hello- I'm just starting to use the GChartWrapper, and have a few
> questions that I was not able to answer by looking at the examples and
> epydocs (apologies if I missed them in there).
>
> 1) Does GCW handle encoding a list of floats into Google Chart's 61
> quantized levels (ABCD...) ? (or some other format that reduces the
> length of the URL)
OK, I found the Encoder() object and its encode() method, so I think I
understand how to translate from numbers to the URL-friendly levels
understood by the google chart API. But scaling is a different process
that I would need...
>
> 2) Related to (1), does GCW work with negative numbers in line charts
> and bar charts?
It looks like this should be done with the Encoder.scalevalue() method
-- but it appears to have been disabled with the wistful comment "one
day..." ?
def scalevalue(self, value):
return value # one day...
if self.encoding != 'text' and self.scale and \
isinstance(value, int) or isinstance(value, float):
if type(self.scale) == type(()):
lower,upper = self.scale
else:
lower,upper = 0,float(self.scale)
value = int(round(float(value - lower) * self.codeset
['max_value'] / upper))
return min(value, self.codeset['max_value'])