I am wondering if Google Visualization API's pie chart has full
support for events? I have a couple things going on with a chart I'm
playing with--onmouseover/mouse hover, the tooltip will display.
However, if a slice of the chart is clicked on, I want to have it send
the window to a url. Is this something that's possible? I have been
trying to do this a few different ways and here's my latest attempt:

<script type="text/javascript">

      var PieChart;

      google.load("visualization", "1", {packages:["piechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'test');
        data.addColumn('number', 'number');

        data.addRows(3);
        data.setValue(0, 0, 'test1');
        data.setValue(0, 1,14);
        data.setValue(1, 0, test2');
        data.setValue(1, 1,70);
        data.setValue(2, 0, 'test3');
        data.setValue(2, 1,30);

Piechart = new
google.visualization.PieChart(document.getElementById('chartContainer'));
Piechart.draw(data, {width: 750, height: 450, is3D: true});


google.visualization.events.addListener(Piechart, 'select',
selectSlice);

google.visualization.events.addListener(Piechart, 'onmouseover',
pieMouseOver);

google.visualization.events.addListener(Piechart, 'onmouseout',
pieMouseOut);

      }

  function pieMouseOver(e) {
    Piechart.setSelection([e]);
  }

  function pieMouseOut(e) {
    Piechart.setSelection([]);
  }

  function selectSlice(e){
    var selection = Piechart.getSelection(e);
    var item = selection[0];
    var sliceid = sliceids[item.row];
    var url = "http://site.com/"; + sliceid;
    window.location(url);
}

    </script>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to