You can create the chart one time (with new
google.visualization.PieChart()) and draw it multiple times with different
data and options each time.

On Thu, May 25, 2017 at 9:33 AM, Andrew Barker <andrewbarke...@gmail.com>
wrote:

> Hi I am using google charts API, im calling a pie chart here is the code
>
> google.setOnLoadCallback(drawChart);
>
> function drawChart() {
>         $.ajax({
>             url: "http://X3/playeruptime/system/?class=PlayerUptime&;
> method=playerUptimePie&data={%22start%22:%222017-05-01%22,%
> 22end%22:%222017-05-23%22}
> <http://X3/playeruptime/system/?class=PlayerUptime&method=playerUptimePie&data=%7B%22start%22:%222017-05-01%22,%22end%22:%222017-05-23%22%7D>
> ",
>             success: function(result){
>                 var dat = JSON.parse(result);
>                 var data = new google.visualization.DataTable();
>                 data.addColumn('string', 'key');
>                 data.addColumn('number', 'value');
>                 data.addRows(dat);
>
>                 // Set chart options
>                 var options = {
>                     'width':500,
>                     'height':315,
>                     is3D: true,
>                     colors: [
>                         "#64cc34",
>                         "#ff0000"
>                     ],
>                     animation: {
>                         startup: true,
>                         duration: 2000,
>                         easing: 'in'
>                     },
>                     legend: {
>                         position: 'right',
>                         alignment:'center',
>                         textStyle: {
>                             fontSize: 35,
>                             color: '#616161'
>                         }
>                     },
>                     chartArea: {left: 0, top: 0, right:50, width: "100%",
> height: "100%"}
>                 };
>
>                 // Instantiate and draw our chart, passing in some options.
>                 var chart = new google.visualization.PieChart(
> document.getElementById('AverageUptimePie'));
>                 chart.draw(data, options);
>
>                 var onNum = dat[0][1];
>                 var offNum = dat[1][1];
>
> I need to know how do I reload the data in the charts periodically without
> redrawing the charts in the sense that I dont want the chart to disappear
> once data has been reloaded
>
> Is there a redraw method that updates data to what it should be without
> deleting chart
>
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Chart API" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-chart-api+unsubscr...@googlegroups.com.
> To post to this group, send email to google-chart-api@googlegroups.com.
> Visit this group at https://groups.google.com/group/google-chart-api.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
dlalibe...@google.com <dlalibe...@google.com>   5CC, Cambridge MA

-- 
You received this message because you are subscribed to the Google Groups 
"Google Chart API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-chart-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-chart-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-chart-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to