Open GoogleCodeExporter opened 9 years ago
The potential fix has no effect on the outcome of the example you provided.
What is
the expected output? Im looking for the proper chart URL. I can kinda imagine
what it
should look like, but my imagination tends to suck in general.
Original comment by justquick
on 2 Dec 2009 at 4:21
Justin,
Try that:
>>> import GChartWrapper as gchart
>>> G = gchart.VerticalBarStack([43.56,-35.62,-48.34,57.50,67.30,60.91])
>>> G.show()
>>> print G.url
"http://chart.apis.google.com/chart?chd=t:43.6,57.5,67.3,60.9&chs=300x150&cht=bv
s"
Negative values have been dropped, resulting in only 4 bars.
I would expect to get the following URL
"http://chart.apis.google.com/chart?chd=t:43.6,-35.6,-48.3,57.5,67.3,60.9&chs=30
0x150&cht=bvs"
where bars 2 and 3 are missing.
Likewise, with a `scale` input:
>>> G = gchart.VerticalBarStack([43.56,-35.62,-48.34,57.50,67.30,60.91])
>>> G.scale(-40,+70)
>>> G.show()
The current code still drops the bars w/ negative values
"http://chart.apis.google.com/chart?chds=-40,70&chd=t:43.6,57.5,67.3,60.9&chs=30
0x150&cht=bvs"
I expect to see get that URL
"http://chart.apis.google.com/chart?chd=t:43.6,-35.6,-48.3,57.5,67.3,60.9&chds=-
40,70&chs=300x150&cht=bvs"
where now only bar #3 is missing (it's below the lowest range)
Original comment by pierregmcode@gmail.com
on 2 Dec 2009 at 10:38
[deleted comment]
The problem lies in encodedata in encoding.py. All values below -1 are ignored.
def encodedata(self, data):
sub_data = []
enc_size = len(self.codeset['coding'])
for value in data:
if value in (None,'None'):
sub_data.append(self.codeset['none'])
elif isinstance(value, str):
sub_data.append(value)
elif value >= -1:
try:
sub_data.append(self.codeset['value'](self.scalevalue(value)))
except:
raise ValueError('cannot encode value: %s'%value)
return self.codeset['dchar'].join(sub_data)
Original comment by pie...@musmato.com
on 14 Apr 2012 at 2:31
Original issue reported on code.google.com by
pierregmcode@gmail.com
on 2 Dec 2009 at 4:55