There is nothing wrong with passing your data from PHP to javascript like
that (though there are more preferred ways, depending on how dynamic your
data retrieval needs to be). You can clean up a bunch of unnecessary quotes
and concatenators in your PHP, though:
echo "data.addRow(['$timestamp', $power, $pb2w2, $pb2w3, $pb2w4, $pb1w3,
$pb1w1, $pb1w2]);";
You can hide columns with a click on the legend like this:
/* assumes:
* chart is the visualization chart object
* options is an object with option settings to draw the chart with
* data is the dataTable object
* hideCols is an array of columns that should be hidden (can start
empty)
* view is a visualization dataView object
* this event listener detects clicks on the legend and redraws the chart
with the
* clicked-on column hidden
*/
google.visualization.events.addListener(chart, 'select', function () {
// if row is undefined, we clicked on the legend
if (typeof chart.getSelection()[0]["row"] === 'undefined') {
hideCols.push(chart.getSelection()[0]["column"]);
view.hideColumns(hideCols);
chart.draw(view, options);
}
});
Charts should load quickly. How large is the data set you are passing to
them? Are they slow in a particular browser, or is it a cross-browser
problem? Can you share a sample of the javascript generated by the PHP or
post a link we can test on?
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/9O4ffcK3B2AJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.