Difference between revisions of "Web Element: Data"
Line 62: | Line 62: | ||
var chart = new google.visualization.ComboChart(document.getElementById('chart_div')); | var chart = new google.visualization.ComboChart(document.getElementById('chart_div')); | ||
+ | chart.draw(data, options); | ||
+ | } | ||
+ | </script> | ||
+ | </head> | ||
+ | |||
+ | <body> | ||
+ | <div id="chart_div"></div> | ||
+ | </body> | ||
+ | </html> | ||
+ | |||
+ | |||
+ | <html> | ||
+ | <head> | ||
+ | <!--Load the AJAX API--> | ||
+ | <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> | ||
+ | <script type="text/javascript"> | ||
+ | |||
+ | google.charts.load('current', {'packages':['corechart']}); | ||
+ | google.charts.setOnLoadCallback(drawChart); | ||
+ | |||
+ | function drawChart() { | ||
+ | var data = google.visualization.arrayToDataTable([ | ||
+ | ['Total cases', 'Daily cases'], | ||
+ | [1, 1], | ||
+ | [1, 0], | ||
+ | [5, 4], | ||
+ | [5, 0], | ||
+ | [6, 1], | ||
+ | [18, 12], | ||
+ | [47, 29], | ||
+ | [98, 51], | ||
+ | [192, 94], | ||
+ | [359, 167], | ||
+ | [670, 311], | ||
+ | [947, 277], | ||
+ | [1236, 289], | ||
+ | [ 1529, 293], | ||
+ | [ 1872, 343], | ||
+ | [ 2433, 561], | ||
+ | [ 3629, 1196], | ||
+ | [ 5698, 2069], | ||
+ | [ 7402, 1704], | ||
+ | [ 9217, 1815], | ||
+ | [ 10827, 1410], | ||
+ | [ 13531, 2904] | ||
+ | ]); | ||
+ | |||
+ | var options = { | ||
+ | title: 'Total cases vs. Daily cases (log-log)', | ||
+ | fontName: 'Old Standard TT', | ||
+ | color: '#982F00', | ||
+ | series:{ | ||
+ | 0: { | ||
+ | color: '#982F00', | ||
+ | pointSize: 2, | ||
+ | },}, | ||
+ | hAxis: {title: 'Total cases', scaleType: 'log'}, | ||
+ | vAxis: {title: 'Daily cases', scaleType: 'log'}, | ||
+ | legend: 'none' | ||
+ | }; | ||
+ | |||
+ | var chart = new google.visualization.ScatterChart(document.getElementById('chart_div')); | ||
+ | |||
chart.draw(data, options); | chart.draw(data, options); | ||
} | } |
hkilter.com by H. K. Ilter is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
© 2020 H. K. Ilter