Changing the content in the infoWindow from text to pie char

Discussion in 'Javascript' started by nat06, Jun 19, 2014.

  1. nat06

    nat06

    Joined:
    Jan 5, 2011
    Messages:
    2
    Likes Received:
    0
    Hello,

    I made my web form to display infowindows for every marker on the Google Maps, and it works good. But, when I tried to change the text in the infoWindow to pie chart it doesn't work anymore. The pie chart is not drawn, and the infowindow doesn't appear at all.

    Here is the part of the code where I define the infoboxes and the content inside

    function initMarkersE(map, markerData){var newMarkers =[],
    marker;

    for(var i =0; i < markerData.length; i++){
    bounds.extend(markerData.latLng);
    map.fitBounds(bounds);

    marker =new google.maps.Marker({
    map: map,
    draggable:true,
    position: markerData.latLng,
    visible:true}),

    newMarkers.push(marker);

    var data =[['state','cycles','Los']];

    data.push([markerData.state, markerData.cycles, markerData.Los]);

    infoboxOptions ={
    pieHole:0.4,'width':400,'height':150};var node = document.createElement("div");

    newMarkers.infobox =newInfoBox(infoboxOptions),

    chart =new google.visualization.PieChart(node);

    chart.draw(data, infoboxOptions);
    infobox.setContent(node);
    newMarkers.infobox.open(map, marker);


    google.maps.event.addListener(marker,'click',(function(marker, i){returnfunction(){

    newMarkers.infobox.open(map,this);
    map.panTo(markerData.latLng);}})(marker, i));}

    return newMarkers;}

    I changed/added only the bold part of the code, the rest is the same like when the infoboxes were displaying text data. So the same data/parameters I want to be displayed as a pie chart.

    Can anybody help me please?

    Thanks.
     
    nat06, Jun 19, 2014
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.