Can't get scaling to work!

26 views
Skip to first unread message

Olav234

unread,
Feb 16, 2011, 5:48:16 PM2/16/11
to Python Google Chart
First off, great job on this wrapper. Its been super handy for me.

I am attempting to get scaling to work properly on a grouped bar
chart. Here is my code:

As you can see, the markers on the top of each bar are displaying
scaled to 100 numbers, and the bars don't seem to be the correct
height either. Can anyone help me?

Thanks!

from pygooglechart import Chart
from pygooglechart import Axis
from pygooglechart import GroupedVerticalBarChart


def grouped_vertical():
max = 30
chart = GroupedVerticalBarChart(850, 300)
chart.set_bar_width(20)
chart.set_colours(['00ff00', 'ff0000'])
chart.add_data([1,2,3,4,5])
chart.add_data([1,4,9,16,25])

chart.add_marker(0, -1, 'N*f0', '000000', 10)
chart.add_marker(1, -1, 'N*f0', '000000', 10)

chart.set_grid(0, 5, 5, 5)
x_axis = ['Jan-2010', 'Feb-2010', 'Mar-2010', 'Apr-2010',
'May-2010']
chart.set_axis_labels(Axis.BOTTOM, x_axis)

left_axis = range(0, max+1, 5)
left_axis[0] = ''
chart.set_axis_labels(Axis.LEFT, left_axis)

chart.set_legend(['New Users', 'Active Users'])
chart.set_title('New and Active Users per Month')
print chart.get_url()
chart.download('bar-vertical-grouped.png')


grouped_vertical()

Ling

unread,
Mar 2, 2011, 3:18:17 AM3/2/11
to Python Google Chart
Try using
chart.set_axis_range(Axis.LEFT, 0, max+1)
Reply all
Reply to author
Forward
0 new messages