Hi Guys,
I have a chart that imports data from a CSV file, I would like to add more
than one chart on the page but I am not sure how to go about it.
I know to add Var Data, Var Date1 and Var Option and Var Option1 but as I
am getting the data from a CSV is there anything else I need to do. below
is my code with one chart.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>
March 2014 Chart
</title>
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script type="text/javascript" src="js/jquery-csv.js"></script>
<script type="text/javascript" src="
https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['corechart']});
</script>
<script type="text/javascript">
function drawVisualization() {
// grab the CSV
$.get("CSVFiles/march2014.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);
// this view can select a subset of the data at a time
var view = new google.visualization.DataView(data);
view.setColumns([0,1]);
var options = {
title : 'March 2014 Helpdesk Tickets',
titleTextStyle: {fontSize: '30', color: 'darkblue', italic: 'true' },
vAxis: {title: "Tickets", titleTextStyle: {color: 'darkblue',
italic: 'false', bold: 'true'}},
hAxis: {title: "Day", titleTextStyle: {color: 'darkblue',
italic: 'false', bold: 'true'}},
seriesType: "bars",
series: {
2: {type: "line"},
3: {type: "line"},
4: {type: "line"}}
};
var chart = new
google.visualization.ComboChart(document.getElementById('chart_div'));
chart.draw(data, options);
});
}
google.setOnLoadCallback(drawVisualization);
</script>
</head>
<body>
<div id="chart_div" style="width: 1500px; height: 600px;"></div>
</body>
</html>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.