JSFiddle - React, Tailwind, and code Playground
by mania noobie
HTML
<script src="https://www.google.com/jsapi"></script>
<div id="linechart" style="width:400; height:300"></div>
JavaScript
// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {
'packages': ['corechart']
});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);
function drawChart() {
var cols = [{
"id": "A",
"label": "Date Range",
"pattern": "",
"type": "date" //change from string to date
}, {
"id": "B",
"label": "Sessions",
"pattern": "",
"type": "number"
}, {
"id": "C",
"label": "Pageviews",
"pattern": "",
"type": "number"
}];
var rows = [{
"c": [{
"v": "Date(2015,5,23)",
"f": "Jun 23, 2015 - Jun 27, 2015"
}, {
"v": 1645
}, {
"v": 5237
}]
}, {
"c": [{
"v": "Date(2015,5,28)",
"f": "Jun 28, 2015 - Jul 04, 2015"
}, {
"v": 2189
}, {
"v": 6977
}]
}, {
"c": [{
"v": "Date(2015,6,05)",
"f": "Jul 05, 2015 - Jul 11, 2015"
}, {
"v": 2168
}, {
"v": 6862
}]
}, {
"c": [{
"v": "Date(2015,6,12)",
"f": "Jul 12, 2015 - Jul 18, 2015"
}, {
"v": 1661
}, {
"v": 5735
}]
}, {
"c": [{
"v": "Date(2015,6,19)",
"f": "Jul 19, 2015 - Jul 23, 2015"
}, {
"v": 1109
}, {
"v": 3826
}]
}];
// Set chart options
var options = {
width: 400,
height: 300,
};
data = new google.visualization.DataTable({
cols: cols,
rows: rows
});
// var formatter = new google.visualization.DateFormat({ pattern: "EEEE, MMM dd, yyyy" });
// formatter.format(data, 0);
var chart = new...