Display proportional pie charts

449 views
Skip to first unread message

springrider

unread,
Aug 31, 2010, 3:26:54 AM8/31/10
to Google Maps JavaScript API v3
Good morning
I am working on a project to display population statistics in the
Pacific Ocean ( proportion of male, female, age ranges etc...)
I have developed a small web mapping solution based on Google maps
API V3 and i need now to display my data using proportional pie chart.
After browsing the web, it seems that IconStyle and scale in KML can
not be used in Google maps to adapt the size of the pies according to
the zoom level.
Moreover, the display of the pies is not really good, sometimes the
default marker appears instead of the pie.

Is there any workaround for being able to display pie charts in a
google maps such as what we have in google earth?
I know that it works nicely with Google earth API but, i need to keep
the project 2D maps.

For the time being, my input data is in KML format but it can be
adapted if the solution requires it.

I tried to explore on that side:http://google-maps-utility-library-
v3.googlecode.com/svn/tags/markerclusterer/1.0/examples/
advanced_example.html? but do not really know if it could help me.

Your input on this issue would be really welcome.

Thanks in advance

Sylvain

Grok Lobster

unread,
Aug 31, 2010, 11:34:15 AM8/31/10
to Google Maps JavaScript API v3

springrider

unread,
Aug 31, 2010, 5:26:03 PM8/31/10
to Google Maps JavaScript API v3
Thanks Grok

I am fine about the code for displaying charts, my issue is about
having them displayed correctly in my google maps application.
For example, i have pies representing the proportion of male and
female by city using a KML:

<Style>
<IconStyle>
<scale>0.512429878948922</scale>
<Icon>
<href>http://chart.apis.google.com/chart?
cht=p&amp;chd=t:
0,0.200836820083682,0.799163179916318,0&amp;chs=200x200&amp;chf=bg,s,ffffff00&amp;chco=FF0000,FFFF00,00FF00,0000FF</
href>
</Icon>
</IconStyle>
</Style>
<Point>
<coordinates>122,-8.5,0</coordinates>
</Point>

My problem is that the radius of my pie is fixed and is not based on
the total population and does not change while zooming.
Moreover, sometimes, the pie is partially displayed or replaced by a
default marker.
If i use the same KML is Google Earth, it works fine but not in my 2D
maps.

Thanks in advance for your help and for your feedback.

Sylvain

On 1 sep, 02:34, Grok Lobster <discgolfm...@gmail.com> wrote:
> Take a look at this,http://code.google.com/apis/chart/docs/gallery/pie_charts.html

Grok Lobster

unread,
Aug 31, 2010, 6:12:53 PM8/31/10
to Google Maps JavaScript API v3
Can you use the image as a ground overlay? Then it will respond to
zoom, but could get too small or too big. I don't know if the API
supports screen overlays in KML, but that's another possibility. How
about as the image of a custom control (external to the kml)? Static
size but placed out of the way where it shouldn't be obstructed by
placemarkers.

On Aug 31, 2:26 pm, springrider <sylvain.cail...@gmail.com> wrote:
> Thanks Grok
>
> I am fine about the code for displaying charts, my issue is about
> having them displayed correctly in my google maps application.
> For example, i have pies representing the proportion of male and
> female by city using a KML:
>
> <Style>
>             <IconStyle>
>                 <scale>0.512429878948922</scale>
>                 <Icon>
>                     <href>http://chart.apis.google.com/chart?
> cht=p&amp;chd=t:
> 0,0.200836820083682,0.799163179916318,0&amp;chs=200x200&amp;chf=bg,s,ffffff­00&amp;chco=FF0000,FFFF00,00FF00,0000FF</
> > > Sylvain- Hide quoted text -
>
> - Show quoted text -

springrider

unread,
Sep 2, 2010, 12:37:57 AM9/2/10
to Google Maps JavaScript API v3
Thanks Grok

Would you have some code or examples to illustrate this potential
solution?
I have to make it working using Google Maps API. It is so disturbing
that it works so nicely in Google Earth and not in Google Maps.
KML input is one possibility, all the original data being in an SQL
Server DB, other formats can be used as soon as they make the deal.

Thanks for your feedback.

Sylvain
Reply all
Reply to author
Forward
0 new messages