Last active
March 15, 2018 03:15
-
-
Save klei22/1a88ba62a69939de727f8c9cda24cbfa to your computer and use it in GitHub Desktop.
Lithium Energy Graph - Google Charts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div id="chart_div" style="width: 900px; height: 500px;"> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| google.load("visualization", "1.1", { | |
| packages: ["corechart"] | |
| }); | |
| google.setOnLoadCallback(drawChart); | |
| function drawChart() { | |
| var transactions = [[0, 39, 10], | |
| [12, 21, 7], | |
| [13, 23, 7], | |
| [14, 37, 6], | |
| [15, 38, 6], | |
| [16, 40, 6], | |
| [17, 43, 5], | |
| [18, 40, 8]]; | |
| var i=0,j=0; | |
| var tps = transactions.slice(0); | |
| for(i=0;i<tps.length;i++){ | |
| for(j=1;j<tps[i].length;j++){ | |
| tps[i][j]=tps[i][j]/1.0; | |
| tps[i][j]=Number(tps[i][j].toFixed(2)); | |
| } | |
| } | |
| var data = new google.visualization.DataTable(); | |
| data.addColumn('number', 'Hour'); | |
| data.addColumn('number', 'Positive Tweets - 2018-03-14'); | |
| data.addColumn('number', 'Negative Tweets - 2018-03-14'); | |
| data.addRows(tps); | |
| var options = { | |
| title: 'Lithium Twitter Sentimental Analysis Percentage By Hour', | |
| curveType: 'function', | |
| pointSize: 5, | |
| legend: { | |
| position: 'right', | |
| alignment: 'center' | |
| }, | |
| hAxis: { | |
| title: 'Hour' | |
| }, | |
| vAxis: { | |
| title: 'TPS' | |
| } | |
| }; | |
| var chart = new google.visualization.LineChart(document.getElementById('chart_div')); | |
| chart.draw(data, options); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script src="https://www.google.com/jsapi"></script> |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Lithium Twitter Sentimental Analysis Percentage By Hour