You would need to create an error event handler each time you change the
chart type, as you are creating a new object each time and assigning the
new object to the same variable. This would likely be easier to do with a
ChartWrapper object, as you can assign an "error" event handler for the
ChartWrapper.
The ChartWrapper should only load code that isn't already loaded, so if you
preload a package, the ChartWrapper should not reload it.
On Sunday, April 27, 2014 3:36:02 PM UTC-4, cyb wrote:
>
> Hi,
>
> at the moment i use a switch case for changing different charts like this:
>
> var chart=null;
>> switch (chartType) {
>> case 1:
>> chart=new google.visualization.LineChart(id);
>>
>> break;
>> case 2:
>> chart=new google.visualization.ColumnChart(id);
>>
>> break;
>> }
>> chart.draw(...);
>
>
>
> i have only one chart object for all charts, if i add a error listener
> like this :
>
> google.visualization.events.addListener(chart, 'error', function (err)
> {.....});
>
> must i do this for every chart ? i mean an extra listener for the
> LineChart and one for the ColumChart or can i only create one listener with
> the chart object?
>
>
> or is it better to use a chartWrapper ? if i use a chart wrapper i can add
> only this chartwarapper to the error handler !?
>
> and last question.. the chartWrapper loads the charts dynamicly, but if i
> add this in my code "google.load("visualization", "1", {packages:["table",
> "controls", "corechart","geomap","geochart"]});"
> did the charWrapper then load the charts from my HDD(because the charts
> already loaded) or did he trys to load the charts form the internet ?
>
>
>
>
>
--
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/d/optout.