You can call the chart's #clearChart method to remove it and all associated
elements from the DOM. A better solution, though, might be to reuse the
same chart object instead of creating new ones on every draw.
On Thursday, June 26, 2014 9:03:53 PM UTC-4, Yaniv Kalfa wrote:
>
> I am using google chart for live data stream - i pull data and draw/redraw
> it as a google chart. my problem is each time that a chart is drawn it also
> adds 2 tooltip div to the DOM just before < /body>.
>
> I use the following to create basic chart:
>
> [code]
>
> google.setOnLoadCallback(darw);var cleanData = new
> google.visualization.DataTable();
> cleanData.addColumn("bla bla", "oneBla");// not important for the question
> cleanData.addRow("blaa", "bla");// not important for the question
> function darw(){
> var chart = new
> google.visualization.LineChart(document.getElementById('chart_div'));
> chart.draw(cleanData, {});}
>
> [/code]
>
> The code that is being added to the DOM looks like:
>
> [code]
>
> <div style="position: absolute; display: none;">
> <div style="background: none repeat scroll 0% 0% infobackground; padding:
> 1px; border: 1px solid infotext; font-size: 12px; margin: 12px; font-family:
> Arial;">soome data</div></div>
>
> [/code]
>
>
> My question is. is there a way to "destroy" a chart or something alike to
> get rid of that extra DOM because after like 1 minute of that shenanigan i
> have like 300-400 hidden extra nodes.
>
--
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.