I have a csv file with that :
Site,Janvier,Février,Mars,Avril,Mai,Juin,Juillet,Ao?t,Septembre,Octobre,Novembre,Décembre
CITROEN VILLEFRANCHE CARROSSERIE,0,0,14,0,18,21,0,0,0,0,0,0
CITROEN VILLEFRANCHE ,240,237,230,264,219,285,219,130,4,0,0,0
NISSAN VILLEFRANCHE ,174,202,215,181,196,244,203,107,10,1,0,0
I would like to see its data in a column chart.
But i do not know how to read the data of a csv with the API.
Here is an example of a column chart with the API :
google.charts.load("current", {packages:['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
["Element", "Density", { role: "style" } ],
["Copper", 8.94, "#b87333"],
["Silver", 10.49, "silver"],
["Gold", 19.30, "gold"],
["Platinum", 21.45, "color: #e5e4e2"]
]);
var view = new google.visualization.DataView(data);
view.setColumns([0, 1,
{ calc: "stringify",
sourceColumn: 1,
type: "string",
role: "annotation" },
2]);
var options = {
title: "Density of Precious Metals, in g/cm^3",
width: 600,
height: 400,
bar: {groupWidth: "95%"},
legend: { position: "none" },
};
var chart = new google.visualization.ColumnChart(document.getElementById("columnchart_values"));
chart.draw(view, options);
How to change the data load to use a csv file ?
See Question&Answers more detail:
os