How to remove a YUI Chart from a page
I need to create and remo开发者_高级运维ve YUI charts from a page. To remove, I am doing $('.chart').remove()
to get rid of the containing DIV. However, this raises a null reference exception in this script:
try {
document.getElementById("yuiswf1").SetReturnValue(__flash__toXML(YAHOO.widget.SWF.eventHandler("yuiswf1",
({category:"info",message:"resize (width: 0, height: 0)",type:"log"})
)) ); }
catch (e) {
document.getElementById("yuiswf1").SetReturnValue("<exception>" + e + "</exception>");
}
I assume YUI attaches this code for some event handler which is failing since the DIV has been removed.
How can I remove a YUI chart without causing this exception?
Try calling the destroy method on your chart object before removing its parent div.
mychart.destroy(); (assuming your variable for the chart is mychart)
If you still have issues, you can try posting back on yui library's forum. http://yuilibrary.com/forum/
Tripp
精彩评论