simplyvikram / google-chartwrapper

Automatically exported from code.google.com/p/google-chartwrapper
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Forcing labels and ranges in order means no random access. #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Say I want to have 3 axis labels: x,y,t to include a top label.

And suppose I'm happy with the API's default labelling for x and y, as
values, but want to change "t" to something else. I can only get to the
third axis if I specify labels for the first two, then the third target
axis in order.

With scaling and other such features, it might be tricky to re-manufacture
the automatic label text.

With the "raw" API one can indicate which axis one wants to mess with:

&chxl=2:|my label is here&...

Here's a full example of a chart that can't be currently done with the wrapper:
http://chart.apis.google.com/chart?chxt=x,y,t&chds=0,100,0,10&chd=t:0.0,5.0,25.0
,50.0,75.0,100.0|0.0,0.3,1.3,2.3,3.3,4.3&chxr=0,0,100|1,0,0.393700787402&chs=300
x150&cht=lxy&chtt=Title&chxl=2:|my+label+here&chxp=2,50

This sort of in-order-only pattern is common in the wrapper.

Original issue reported on code.google.com by matt.fei...@gmail.com on 14 Aug 2008 at 7:54

GoogleCodeExporter commented 9 years ago
You still can set the 'raw' api params via the dict instance or kwargs

G = LineXY(dataset, chxl='2:|my label is here&...')

and renders w/ no questions asked. 

Thank you so much for trying to poke holes in the module, and im sure there is a
better way to do this. If you could show programatically how u would like to 
achieve
this using the wrapper ANY OTHER WAY, i would be happy to view it.

Original comment by justquick on 14 Aug 2008 at 9:10

GoogleCodeExporter commented 9 years ago
Excellent.

I didn't know that capability was present. (maybe an example or some docs would 
help
that ; wink wink).

As far as other ways to do it, I think your way (in order) could stay the 
default,
but perhaps an optional index argument could be passed.

Thanks again.

Original comment by matt.fei...@gmail.com on 16 Aug 2008 at 5:55

GoogleCodeExporter commented 9 years ago
Actually this still doesn't work.

Either you can just skip your wrapper and send in __init__ args, as you 
suggest, OR
you can use the wrapper.

What if I want to use the wrapper but don't want to specify in order?

Original comment by matt.fei...@gmail.com on 28 Aug 2008 at 6:59

GoogleCodeExporter commented 9 years ago
Here's a more thorough example...

gc = GChart('lxy', ([0,1,2,3,4,5], [0.1, 0.2, .05, 0.3, 0.5, 0.2]))
gc.scale(0,6) # sets the X scale
gc.scale(0,10) # sets the Y scale
gc.axes.type('xytr') # sets up four axes
gc.axes.range(0,60) # sets the scale on the labels; we want to KEEP these 
auto-labels
gc['chxl'] = '2:|my label here' # doesn't show up in output
gc['chxl'] += '2:|my label here' # KeyError

Original comment by matt.fei...@gmail.com on 28 Aug 2008 at 7:05

GoogleCodeExporter commented 9 years ago
After much thought and deliberation I have decided to implement assigned 
indexing for
axes functions. Here is what has changed in v0.8

{{{
# Old Way
>>> G.axes.type('xy')
>>> G.axes.label('Mar','Apr','May')
>>> G.axes.label(None,'50+Kb')

# New Way
>>> G.axes('xy')
>>> G.axes.label(0, 'Mar','Apr','May')
>>> G.axes.label(1, None,'50+Kb')
}}}

Original comment by justquick on 3 May 2009 at 9:03