function NewChart() {
$.get("test.csv", function(csvString) {
// transform the CSV string into a 2-dimensional array
var arrayData = $.csv.toArrays(csvString, {onParseValue: $.csv.hooks.castToScalar});
// this new DataTable object holds all the data
var data = new google.visualization.arrayToDataTable(arrayData);
var view = new google.visualization.DataView(data);
view.setColumns([
{
sourceColumn: 0,
type: 'datetime',
calc: function(table, row) {
var value = table.getValue(row, 0);
return moment(value).toDate();
}
},2,3,4
]);
var newChart1 = new google.visualization.ChartWrapper({
chartType: 'LineChart',
containerId: 'chartContainer1',
dataTable: view,
options:{
title: 'New Chart',
explorer: {
actions: ["dragToZoom", "rightClickToReset"],
maxZoomIn: 0.2,
maxZoomOut: 1.0,
zoomDelta: 10,
axis: "horizontal",
keepInBounds: true
},
titleTextStyle : {color: 'grey', fontSize: 20},
legend: { position: 'bottom'},
hAxis: {
format: 'yyyy-MM-d',
gridlines: {count: 3},
slantedTextAngle: 85
},
vAxis: {
title: 'Utilization %',
minValue: 0,
maxValue: 100,
},
chartArea: {
left: 50,
right: 15,
width: '100%'
},
animation: {
duration: 2000,
easing: 'out',
startup: true
},
}
});
newChart1.draw();
});
}