Markers

37 views
Skip to first unread message

Sam

unread,
Nov 7, 2008, 3:53:54 AM11/7/08
to Python Google Chart
Is there any example of how to use markers?

http://code.google.com/apis/chart/styles.html#shape_markers

Cheers,
Sam

Gerald Kaszuba

unread,
Nov 10, 2008, 12:59:00 AM11/10/08
to pygoog...@googlegroups.com
Hi Sam,

2008/11/7 Sam <sam.ca...@gmail.com>:


> Is there any example of how to use markers?

Not on the web site, but you can see the functions in the source code:

http://pygooglechart.slowchop.com/pygooglechart/browser/trunk/pygooglechart.py#L676

Gerald

--
Gerald Kaszuba
http://geraldkaszuba.com/

Sam

unread,
Nov 14, 2008, 11:17:36 PM11/14/08
to Python Google Chart
a modification of the stripes in the line.py example

def markers():

# Set the vertical range from 0 to 100
max_y = 100

# Chart size of 200x125 pixels and specifying the range for the Y
axis
chart = SimpleLineChart(200, 125, y_range=[0, max_y])

# Add the chart data
data = [
32, 34, 34, 32, 34, 34, 32, 32, 32, 34, 34, 32, 29, 29, 34,
34, 34, 37,
37, 39, 42, 47, 50, 54, 57, 60, 60, 60, 60, 60, 60, 60, 62,
62, 60, 55,
55, 52, 47, 44, 44, 40, 40, 37, 34, 34, 32, 32, 32, 31, 32
]
chart.add_data(data)

# The Y axis labels contains 0 to 100 skipping every 25, but
remove the
# first number because it's obvious and gets in the way of the
first X
# label.
left_axis = range(0, max_y + 1, 25)
left_axis[0] = ''
chart.set_axis_labels(Axis.LEFT, left_axis)

# X axis labels
chart.set_axis_labels(Axis.BOTTOM, \
['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'])

# Add the markers
for i in range(0, len(data)):
chart.add_marker(0, i, 'c', '0000FF', 2)

chart.download('markers.png')

On Nov 10, 4:59 pm, "Gerald Kaszuba" <gerald.kasz...@gmail.com> wrote:
> Hi Sam,
>
> 2008/11/7 Sam <sam.caven...@gmail.com>:
>
> > Is there any example of how to use markers?
>
> Not on the web site, but you can see the functions in the source code:
>
> http://pygooglechart.slowchop.com/pygooglechart/browser/trunk/pygoogl...
>
> Gerald
>
> --
> Gerald Kaszubahttp://geraldkaszuba.com/
Reply all
Reply to author
Forward
0 new messages