Replace this:
<? while($u3 = mysql_fetch_array($u3Row)) : ?>
[
new Date(<?=date('Y', strtotime($u3['month']))?>, <?=(date('n',
strtotime($u3['month'])) - 1)?>, <?=date('j', strtotime($u3['month']))?>),
<?=$u3['san_diego']?>,
<?=$u3['california']?>,
<?=$u3['united_states']?>
],
<? endwhile ?>
with this:
<?
$rows = array();
while($u3 = mysql_fetch_array($u3Row)) {
$year = date('Y', strtotime($u3['month']));
$month = date('n', strtotime($u3['month'])) - 1;
$day = date('j', strtotime($u3['month']));
$rows[] = "[new Date($year, $month, $day), {$u3['san_diego']},
{$u3['california']}, {$u3['united_states']}]"
}
echo implode(',', $rows);
?>
On Friday, November 8, 2013 12:58:05 PM UTC-5, David Graham wrote:
>
> We hired a developer to do some charting and I didn't thoroughly test it
> before we closed the contract. Our charts are breaking in IE8 because the
> data.AddRows function is adding trailing commas. Problem is I only know
> enough about Javascript/PHP to be dangerous, so I'm hoping that somebody is
> willing to suggest a fix for this code (below).
>
> You can see it in action here: http://lmi.workforce.org
>
> TIA,
>
> Dave
>
> <script type="text/javascript">
> function drawVisualization() {
> // Create and populate the data table.
> var data = new google.visualization.DataTable();
> data.addColumn('date', 'Date');
> data.addColumn('number', 'San Diego');
> data.addColumn('number', 'California');
> data.addColumn('number', 'United States');
> data.addRows([
> <? while($u3 = mysql_fetch_array($u3Row)) : ?>
> [
> new Date(<?=date('Y', strtotime($u3['month']))?>, <?=(date('n',
> strtotime($u3['month'])) - 1)?>, <?=date('j', strtotime($u3['month']))?>),
> <?=$u3['san_diego']?>,
> <?=$u3['california']?>,
> <?=$u3['united_states']?>
> ],
> <? endwhile ?>
> ]);
> var formatter = new google.visualization.NumberFormat({pattern: '##.##%'});
> formatter.format(data, 1); formatter.format(data, 2);
> formatter.format(data, 3);
>
> // Create and draw the visualization.
> new
> google.visualization.LineChart(document.getElementById('UnemploymentGraph1')).
> draw(data, {
> curveType: "linear",
> width: 960, height: 430,
> chartArea: {height: '80%', width: '85%'},
> pointSize: 15,
> lineWidth: 4,
> tooltip: { isHtml: true, textStyle: { color: '#000', fontName: 'Lato
> Regular', fontSize: 16}},
> hAxis: {baselineColor: '#fff', format: "MMM y", gridlines: {color: '#ccc',
> count: 8}, textStyle: {color: '#3e4a86', fontName: 'Lato Bold', fontSize:
> 16}, minValue: new Date(<?=date('Y, m, d', strtotime($u3Initial) - (60 * 60
> * 24 * 45))?>), maxValue: new Date(<?=date('Y', strtotime($u3Final))?>,
> <?=(date('m', strtotime($u3Final)) - 1)?> , 15)},
> vAxis: {baselineColor: '#ccc', format: '##.#%', gridlines: {color: '#ccc',
> count: 8}, textStyle: {color: '#333333', fontName: 'Lato Bold', fontSize:
> 16}, maxValue: .12, minValue: .05},
> series: [{color: '#359A43'}, {color: '#FFC000'}, {color: '#606A9E'}],
> legend: {position: 'none'}
> //legend: {position: 'bottom', textStyle: {color: '#333333', fontName:
> 'Lato Regular', fontSize: 16}}
> }
> );
> }
> google.setOnLoadCallback(drawVisualization);
> </script>
>
>
--
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/groups/opt_out.