Skip to content

Instantly share code, notes, and snippets.

@frhack
Last active June 12, 2019 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frhack/1305eea8aa1c848fc301849911fa6d3c to your computer and use it in GitHub Desktop.
Save frhack/1305eea8aa1c848fc301849911fa6d3c to your computer and use it in GitHub Desktop.
Google Column Chart bug
<script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1.1','packages':['bar','corechart', 'gauge', 'annotatedtimeline', 'annotationchart']}]}"></script>
<script>
google.setOnLoadCallback(drawChart);
var data = {"cols":[{"id":"","label":"Giorno","pattern":"","type":"date"},{"id":"","label":"CS Blindo 3 (kWh/Pz) ","pattern":"","type":"number"}],"rows":[{"c":[{"v":"Date(2019, 5, 3)","f":"03/06/19"},{"v":null}]},{"c":[{"v":"Date(2019, 5, 4)","f":"04/06/19"},{"v":1.15}]},{"c":[{"v":"Date(2019, 5, 5)","f":"05/06/19"},{"v":1.51}]},{"c":[{"v":"Date(2019, 5, 6)","f":"06/06/19"},{"v":0.97}]},{"c":[{"v":"Date(2019, 5, 7)","f":"07/06/19"},{"v":0.84}]},{"c":[{"v":"Date(2019, 5, 8)","f":"08/06/19"},{"v":0.9}]},{"c":[{"v":"Date(2019, 5, 9)","f":"09/06/19"},{"v":null}]}]}
var opt = {
"hAxis":{
"slantedText":true,
"slantedTextAngle":45,
"format":"dd/MM/yy",
"ticks":[
new Date("2019-06-02T22:00:00.000Z"),new Date("2019-06-03T22:00:00.000Z"),new Date("2019-06-04T22:00:00.000Z"),new Date("2019-06-05T22:00:00.000Z"),
new Date("2019-06-06T22:00:00.000Z"),new Date("2019-06-07T22:00:00.000Z"),new Date("2019-06-08T22:00:00.000Z")]
},
"vAxis":{"minorGridlines":{"count":4}},
"title":"CS Blindo 3 (kWh/Pz) ",
"titleTextStyle":{"color":"black"},"position":"top","fontsize":"10px","chartArea":{"top":30,"height":"72%","width":"80%"},
"is3D":true,
"colors":["#147A88","#92D050","#FFC000","#dc3131","#cece95","#6699ff","#808080","#f6c7b6","#22556E","#fcf600","#5BA80F","#F700FF","#0070c0","#c8c8c8",
"#9900ff","#A5A500","#474747","#00ffff","#960101","#f5b661"],
"animation":{"startup":true,"duration":1000,"easing":"out"},
"legend":{"position":"none"},
"dateFormat":"dd/MM/yy"
};
var DataTable = new google.visualization.DataTable(data);
function drawChart() {
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
chart.draw(DataTable, opt);
}
</script>
<div id="chart_div" style="height: 500px;"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment