http://code.google.com/apis/chart/
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
// Loading the Visualization API and the piechart package from Google.
google.load('visualization', '1', {'packages':['corechart']});
// Setting a callback function to execute once the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);
// Function that creates and fills a data table,
// initializes the pie chart, provides the data, and
// then draws it on the screen.
function drawChart() {
// Creating the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'date');
data.addColumn('number', 'Views');
data.addColumn('number', 'People');
data.addRows([
<?php echo $analytics; ?>
]);
// Initializing and drawing the chart, with specified options.
var chart = new google.visualization.AreaChart(document.getElementById('Analytics-Visualization'));
chart.draw(data, {lineWidth:3, pointSize:8, width: 745, height: 240,chartArea:{left:20,top:20,width:640}});
}
</script>
When we implement this code, it triggers certain actions.
We can potentially enhance the functionality using event listeners.