0.2 breaking GChart.img() ?

12 views
Skip to first unread message

Hans

unread,
Apr 11, 2008, 4:13:31 AM4/11/08
to GChartWrapper
Hi,
I pass in
> F=[13171, 12025, 11783, 12315, 11984]
to
> G = GChart('lc', F)
but only get
> G.img()
'<img alt="None" title="None" src="http://chart.apis.google.com/chart?
chd=e:..........&chs=300x150&cht=lc" >'

I have also tried to pass in strings.

Has anything been changed?

justquick

unread,
Apr 13, 2008, 1:46:08 PM4/13/08
to GChartWrapper
Nothing has changed but passing datasets is a touch and go endeavor.
You should try using text encoding since the values in your dataset
are beyond the limit of extended encoding (thats what all those
periods mean). Try this:

F = [13171, 12025, 11783, 12315, 11984]
G = GChart('lc', F, encoding='text')
G.img()

Hans

unread,
Apr 13, 2008, 4:41:52 PM4/13/08
to GChartWrapper
Aha!

That didn't work completely, but I see that I can somehow normalize my
values by the max-value.

/Hans

justquick

unread,
Apr 13, 2008, 5:27:15 PM4/13/08
to GChartWrapper
Try the scale kwarg for GChart...

Hans

unread,
Apr 15, 2008, 4:04:55 PM4/15/08
to GChartWrapper
Yes, I see that by manually applying the 'chds' parameter from the
google API to the generated url solves the problem. And I see in the
doc folder of the gchartwrapper that there is a scale argument.

But how does it work? How could I pass in the values?

justin quick

unread,
Apr 15, 2008, 4:44:58 PM4/15/08
to gchart...@googlegroups.com
It can all be done as keyword arguments to the GChart instance
construction like so:

F = [13171, 12025, 11783, 12315, 11984]

GChart('lc', F, encoding='text', scale=13171)
OR
GChart('lc', F, encoding='text', chds='<data set 1 minimum
value>,<data set 1 maximum value>...')
(see the api doc for more help on chds)

Using the scale kwarg does the scaling before hand on the dataset,
chds is a new api feature and *should* do the same thing.

The scale kwarg can be a number for the maxValue, or a tuple of
(minValue, maxValue)

Hans

unread,
Apr 15, 2008, 4:58:00 PM4/15/08
to GChartWrapper
Great! I tried the 'scale' parameter, though, without any success.
'chds' works like a charm!

On 15 Apr, 22:44, "justin quick" <justqu...@gmail.com> wrote:
> It can all be done as keyword arguments to the GChart instance
> construction like so:
>
> F = [13171, 12025, 11783, 12315, 11984]
> GChart('lc', F, encoding='text', scale=13171)
> OR
> GChart('lc', F, encoding='text', chds='<data set 1 minimum
> value>,<data set 1 maximum value>...')
> (see the api doc for more help on chds)
>
> Using the scale kwarg does the scaling before hand on the dataset,
> chds is a new api feature and *should* do the same thing.
>
> The scale kwarg can be a number for the maxValue, or a tuple of
> (minValue, maxValue)
>

justquick

unread,
Apr 16, 2008, 4:40:02 PM4/16/08
to GChartWrapper
Yup... The scale kwarg is really questionable, we made it before the
chds param was available. Look for future versions to use scale for
chds instead of internal dataset scaling...

justquick

unread,
Apr 20, 2008, 8:14:19 PM4/20/08
to GChartWrapper
New version 0.3 is out now and has updates for data scaling (with text
encoding) and maps. Use the scale function like this for a min/max of
0 to 100

G = GChart(..., encoding='text')
G.scale(0,100)

On Apr 15, 4:58 pm, Hans <hans.bjell...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages