I am facing problem with Google Visualization API only in IE. In
Firefox works properly.please help me out to solve the problem.i am
integrating motion chart in joomla.please check the sample code below.
function important_issue_operation($option , $chart)
{
$db =& JFactory::getDBO();
?>
<div align="center" class="contentheading"> <?php echo $chart; ?></
div>
<script type="text/javascript" src="http://www.google.com/jsapi"></
script>
<script type="text/javascript">
google.load('visualization', '1', {'packages':['motionchart']});
google.setOnLoadCallback(drawChart);
/*---------------------- Function Draw Chart starts Here
-------------------------*/
function drawChart()
{
var data = new google.visualization.DataTable();
data.addColumn('string', 'District');
data.addColumn('number', 'Year');
data.addColumn('number', 'Major');
data.addColumn('number', 'Minor');
<?php
for($yr=2007;$yr<=2008;)
{
for($dist=1;$dist<=34;$dist++)
{
$qry = "select value from table1 where year=$yr and
district_id=$dist and breed=22";
$res= $db->setQuery($qry);
$total_major = $db->loadResult($res);
$qry1 = "select value from table1 where year=$yr and
district_id=$dist and breed=23";
$res1= $db->setQuery($qry1);
$total_minor = $db->loadResult($res1);
$qry = "select district_name from table2 where id=$dist";
$res= $db->setQuery($qry);
$district = $db->loadResult($res);
?>
data.addRows([
['<?php echo $district;?>',<?php echo $yr;?>,<?php echo
$total_major;?>,<?php echo $total_minor;?>],
]);
<?php }
$yr=$yr+1;
}?>
var chart = new google.visualization.MotionChart
(document.getElementById('chart_div'));
chart.draw(data, {width: 700, height:450});
}
/*-------------- Draw Chart Ends Here
---------------------------------------- */
</script>
<div id="chart_div" style="width: 700px; height: 450px;"></div>
<?php
}
data.addRows([
[{v:"1", f:"Boss"}, "", ""],
[{v:"2", f:"Employee 1"}, "1", ""],
[{v:"3", f:"Employee 2"}, "1", ""],
]);
...will error out in IE because of the comma on the last row. But
this:
data.addRows([
[{v:"1", f:"Boss"}, "", ""],
[{v:"2", f:"Employee 1"}, "1", ""],
[{v:"3", f:"Employee 2"}, "1", ""]
]);
...works fine, after taking out the last comma. IE thinks there's one
more empty item in the array, I guess.
Hi,
if you're not aware of it, jslint will pick up on these trailing commas
(among other things):
regards
G.F.
--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
data.addRows(JSON.parse(dataarray));'[["Jan", 33,42], ["Feb", 9,41], ["Mar", 0,43]]'"[['Jan', 33,42], ['Feb', 9,41], ['Mar', 0,43]]"