Ajax Google Visualization API Gauge with jquery

前端 未结 1 833
我寻月下人不归
我寻月下人不归 2021-01-20 23:15

I am looking to create a dashboard gauge that updates via ajax. Below is the code I have. I have the ajax code but just am unsure on how to update the gauge. Any suggestions?

1条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-20 23:19

    You can use the same kind of code for update too. You need to create a new data table instance and call the draw function of the chart again (very similar to how you updated 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);
    

    0 讨论(0)
提交回复
热议问题