I'm writing a program that take a generated data set via Google API and displays it in PHP. This is perfectly fine and has been achieved, however I wish to add thumbnails to the code which displays different charts of the same dataset (in thumbnail form).
I am using the Google API to generate the data and display it, but I'm not sure how I would get it to change the visualisation type (currently using Pie as the main chart) so the user is able to view the different visualisations for that dataset.
Here is the code in question:
Load the AJAX API
<script type="text/javascript" src='https://www.google.com/jsapi?autoload={"modules":[{"name":"visualization","version":"1","packages":["corechart","table"]}]}'></script>
The data:
var data = new google.visualization.DataTable();
data.addColumn('string', 'City');
data.addColumn('number', 'Number of Crimes');
data.addRows([
['Cardiff', 300],
['London', 900],
['Manchester', 500],
['Dublin', 400],
['Liverpool', 600]
]);
Draw the Graph:
var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
chart.draw(data, options);
Here are the thumbnails:
<div id="left">
<p>Bar chart</p>
<a href="#"><img src="http://donsmaps.com/clickphotos/dolnivi200x100.jpg"></img></a>
<p>Another chart</p>
<a href="#"><img src="http://donsmaps.com/clickphotos/dolnivi200x100.jpg"></img></a>
<p>Another chart</p>
<a href="#"><img src="http://donsmaps.com/clickphotos/dolnivi200x100.jpg"></img></a>
</div>
<div id="right">
<p>Scatter Chart</p>
<a href="#"><img src="http://donsmaps.com/clickphotos/dolnivi200x100.jpg"></img></a>
<p>Another chart</p>
<a href="#"><img src="http://donsmaps.com/clickphotos/dolnivi200x100.jpg"></img></a>
<p>Another chart</p>
<a href="#"><img src="http://donsmaps.com/clickphotos/dolnivi200x100.jpg"></img></a>
</div>
So basically, how would I get google.visualization.BarChart (and others) into the img src for the thumbnails?
IS this even possible?
Thanks