locked
Update Google chart with dynamic data RRS feed

  • Question

  • <!DOCTYPEhtml><html><head><scripttype="text/javascript"src="https://www.gstatic.com/charts/loader.js"></script><script>         google.charts.load('current', { packages: ['corechart''line'] });                            function drawBasic() {                                       var xValue = Number(document.getElementById("xValue").value);             var yValue = Number(document.getElementById("yValue").value);             var data = newgoogle.visualization.DataTable();             data.addColumn('number''X');             data.addColumn('number''Packet');             data.addRows([[xValue, yValue] ]);             var options = {                 hAxis: {                     title: 'Time'                 },                 vAxis: {                     title: 'Packet'                 }             };                          var chart = newgoogle.visualization.LineChart(document.getElementById('chart_div'));             chart.draw(data, options);                       }     </script></head><body><a>moved to </a><divid="chart_div"></div><inputid="xValue"type="number"step="any"placeholder="Enter X-Value"> Y Value: <inputid="yValue"type="number"step="any"placeholder="Enter Y-Value"><buttononclick="drawBasic();">Demo</button></body></html>

    When ever user click the button with new input from text box the graph should be plotted accordingly.

    Got struck for entire day. Any peice of code is appericated.

                                     

    • Edited by Its me Gopi Thursday, July 19, 2018 8:12 AM
    Wednesday, July 18, 2018 1:53 PM