Hi,

1. I didn't understand -- why does it matter to you if the browser retains
some information about the previous charts? Does this have any visible
symptom?
2. There are better ways to remove all elements from a div than setting
innerHTML to ''. You might have better results if you use one of those.

Regards,
     VizBoy.

On Sat, May 9, 2009 at 11:18 PM, srini <[email protected]>wrote:

>
> I create a chart div and add a chart to it. There are pagination
> controls and I would like to create the new chart destroying the old
> chart each time the user clicks on prev or next pages.
>
> But when I do that the browser seems to have all the old charts (in
> window.GChart_AllCharts). How could I delete the old chart from the
> browser?
>
> For example when i call the following method by using the 2nd method,
> it creates
>
> function drawChart(title1, title2, values, chartDiv) {
>        var data = new google.visualization.DataTable();
>        data.addColumn('string', title1);
>        data.addColumn('number', title2);
>        data.addRows(values.length);
>        for(var i=0; i<values.length; i++) {
>          data.setValue(i, 0, values[i].t);
>          data.setValue(i, 1, parseFloat(values[i].v));
>        }
>
>
>       var chart = new google.visualization.AreaChart(chartDiv);
>
>        chart.draw(data, {width: 500, height: 200 /*, legend:
> 'bottom'*/, is3D:true /*, title: 'Company Performance'*/});
>    }
>
> function loadCurrentGraph(i) {
>        var graphsDiv = document.getElementById('graphs');
>        graphsDiv.innerHTML = "";
>
>        var key = type + period;
>        var params = Analyzer.getGraphParams(key);
>        var chartDiv = document.createElement('div');
>        chartDiv.setAttribute("name", "finGraph");
>        setCssFloat(chartDiv, "left");
>        chartDiv.style.padding = "10px";
>        graphsDiv.appendChild(chartDiv);
>
>        var chartTitleDiv = document.createElement('div');
>        chartTitleDiv.appendChild(document.createTextNode(params
> [i].title));
>        setCssFloat(chartTitleDiv, "none");
>        chartDiv.appendChild(chartTitleDiv);
>
>        //sheet
>        var sheet = ns.getSheets()[key];
>        drawChart("Year", params[i].title, sheet.getValues(params[i].id),
> chartDiv);
>    }
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to