javascript - Ajax Google Visualization API Gauge with jquery -
I am looking to create a dashboard gauge that updates through Ajax. I have code below. I have Ajax code but I am unsure about updating gauges. Any suggestions?
google.load ('visualization', '1', {package: ['gauge']}); Google.setOnLoadCallback (drawChart); Function drawChart () {var data = new google.visualization.DataTable (); Data.addColumn ('string', 'label'); Data.addColumn ('number', 'value'); Data.addRows (1); Data.setValue (0, 0, 'Tempature'); Data.setValue (0, 1, 76); Var chart = new google.visualization.Gauge (document.getElementById ('liveTempChart')); Var option = {width: 340, height: 130, redfrom: 90, redTo: 100, yellow to: 75, pelato: 90, minor ticks: 5}; Chart.draw (data, options); }
Ajax code ...
You can also use the same type of code for updates You need to create a new data table instance and then call the draw function of the chart (how you update for the first time).
var data = new google.visualization.DataTable); Data.addColumn ('string', 'label'); Data.addColumn ('number', 'value'); Data.addRows (1); Data.setValue (0, 0, 'Tempature'); Data.setValue (0, 1, 76); Chart.draw (data, options);
Comments
Post a Comment