Created
March 18, 2019 07:04
-
-
Save nutch31/ce04235d87c357fe41ce0b5ea1b20162 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<?php $array = [ | |
['2011', 98, '98 calls', 53, '53 forms'], | |
['2012', 151, '151 calls', 34, '34 forms'], | |
['2013', 69, '69 calls', 27, '27 forms'] | |
]; | |
$jsonTable = json_encode($array); | |
?> | |
<script src="http://www.google.com/jsapi?fake=.js"></script> | |
<div id="chart_div"></div> | |
<script type="text/javascript"> | |
google.load("visualization", "1", { | |
packages: ["corechart"] | |
}); | |
google.setOnLoadCallback(drawChart); | |
function drawChart() { | |
var data = google.visualization.arrayToDataTable([ | |
['Leads', | |
'Calls', { | |
role: 'annotation' | |
}, | |
'Forms', { | |
role: 'annotation' | |
} | |
], | |
['2011', 98, '98 calls', 53, '53 forms'], | |
['2012', 151, '151 calls', 34, '34 forms'], | |
['2013', 69, '69 calls', 27, '27 forms'] | |
]); | |
var options = { | |
width: 1000, | |
height: 550, | |
legend: { | |
position: 'top', | |
maxLines: 3, | |
textStyle: { | |
color: 'black', | |
fontSize: 16 | |
} | |
}, | |
isStacked: true, | |
chartArea: {backgroundColor: '#fffff0'}, | |
hAxis: { | |
textStyle: { | |
color: '#993300' | |
}, | |
title: 'Subjects', | |
titleTextStyle: { | |
color: '#993300', | |
fontName: 'Verdana', | |
fontSize: 22 | |
} | |
}, | |
vAxis: { | |
maxValue: 1000, | |
textStyle: { | |
fontName: 'Verdana', | |
color: '#993300' | |
}, | |
title: 'A Quick Basic ChartWrapper Setup from a Remote Google Sheet Source', | |
titleTextStyle: { | |
color: 'blue', | |
fontName: 'Arial', | |
fontSize: 16 | |
} | |
} | |
// Displays tooltip on selection. | |
//tooltip: { trigger: 'selection' }, | |
}; | |
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div')); | |
chart.draw(data, options); | |
// Selects a set point on chart. | |
// chart.setSelection([{row:0,column:1}]) | |
// Renders chart as PNG image | |
// chart_div.innerHTML = '<img src="' + chart.getImageURI() + '">'; | |
} | |
</script> | |
</head> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment