You should not have to destroy the event handlers after creating new 
charts, but I suppose it is possible that they don't clean up 
automatically, so manually destroying them wouldn't hurt.

The ChartWrapper does not impose any limitations on the charts it wraps.

There are different ways of handling DataViews with a ChartWrapper.  You 
can pass a view directly to the wrapper in it's "dataTable" parameter, in 
which case the wrapper will treat the view exactly the same way it treats 
DataTables, and fetch the view via the #getDataTable method.  You can also 
specify the parameters of a view in the wrapper's "view" parameter, which 
you can fetch with the #getView method.  This method returns only the 
parameters, and not a DataView, so you have to construct a DataView using 
these parameters if you want to do some filtering, eg:

var dt = chart.getDataTable();
var viewParams = chart.getView();
var view = new google.visualization.DataView(dt);
if (viewParams.columns.constructor == Array && viewParams.columns.length) {
    view.setColumns(viewParams.columns);
}
if (viewParams.rows.constructor == Array && viewParams.rows.length) {
    view.setRows(viewParams.rows);
}
// use "view"

On Monday, April 28, 2014 7:44:30 AM UTC-4, cyb wrote:
>
> Hi,
>
> and if i create after each chart change a new error handler, must i 
> destory the error handler then manually after each change ?
>
> and second question..
>
> are there any limitations if i use a chartwrapper ?
>
> can a chartwrapper return a view object so that i can work with a view so 
> that it not change the original data?
> and can i use the view methods like getFilteredRows or setColumn and so on 
> ?
> and last question.. at the moment i must sometimes tranforms an Column 
> from type "date" to type "string" i do this with a view like that:
>
>
> dataView.setColumns([{
>                             type: 'string',
>                             label: dataView.getColumnLabel(0),
>                             calc: function (dt, row) {
>                                 return dt.getFormattedValue(row, 0);
>                             }
>                         }, 1]);
>
> can i do the same with a charwrapper? and this operation should not change 
> the original dataTable..
>
> Best regards and thx for your help
>
> Am Sonntag, 27. April 2014 21:36:02 UTC+2 schrieb cyb:
>>
>> 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.

Reply via email to