Sorry I was messing about with it. For some reason it won't load at all.
here is the new code. I had it so I had to put the code in myself, with
this new code I am using a CSV file, I got help from this link -
http://stackoverflow.com/questions/14211636/how-to-use-google-chart-with-data-from-a-csv/17776119
Any idea what s stopping it working?
John.
<!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>
Google Visualization API Sample
</title>
<script type='text/javascript'
src='https://www.google.com/jsapi'></script>
<script type="text/javascript"
src="demo/js/jquery/jquery-1.8.3.js"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['corechart']});
</script>
<script type="text/javascript">
function drawVisualization() {
// Some raw data (not necessarily accurate)
// this has to be a global function
function drawChart() {
// grab the CSV
$.get("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',
vAxis: {title: "Tickets"},
hAxis: {title: "Day"},
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: 500px; height: 600px;"></div>
</body>
</html>
On Wednesday, 2 April 2014 15:15:59 UTC+1, Sergey wrote:
> If this is your entire page, then you forgot to source jsapi, so I'm
> surprised that it work in any case.
>
>
> - Sergey
>
>
> On Wed, Apr 2, 2014 at 10:13 AM, John Brines <[email protected]<javascript:>
> > wrote:
>
>> Hi Guys,
>>
>> I can run the following script from my own computer by double clicking on
>> the HTML file, but when I run it from the web server it doesn't show the
>> chart. Any ideas?
>>
>> Any ideas/
>>
>> John
>>
>> <!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>
>> Google Visualization API Sample
>> </title>
>> <script type="text/javascript"
>> src="demo/js/jquery/jquery-1.8.3.js"></script>
>> <script type="text/javascript">
>> google.load('visualization', '1', {packages: ['corechart']});
>> google.setOnLoadCallback(drawChart);
>> </script>
>> <script type="text/javascript">
>> function drawVisualization() {
>> // Some raw data (not necessarily accurate)
>>
>> // this has to be a global function
>> function drawChart() {
>> // grab the CSV
>> $.get("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',
>> vAxis: {title: "Tickets"},
>> hAxis: {title: "Day"},
>> 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]<javascript:>
>> .
>> To post to this group, send email to
>> [email protected]<javascript:>
>> .
>> Visit this group at
>> http://groups.google.com/group/google-visualization-api.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
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.