Removing Chartid
#1
Posted 26 June 2012 - 11:42 AM
how can i delete the older chartid for charts?
For example if i use one chartid like myChartID in chart
var myChart = new FusionCharts("AngularGauge.swf","myChartID","265", "135", "0", "0");
i should use uniqueid in fusion charts XT so if i use myChartID for one more chart its giving error.
but i am creating more charts dynamically using same id like myChartID
my idea is that can i delete chartid before using the same chartid for other chart?
please suggest me
#2
Posted 26 June 2012 - 12:35 PM
Hi Team,
how can i delete the older chartid for charts?
For example if i use one chartid like myChartID in chart
var myChart = new FusionCharts("AngularGauge.swf","myChartID","265", "135", "0", "0");
i should use uniqueid in fusion charts XT so if i use myChartID for one more chart its giving error.
but i am creating more charts dynamically using same id like myChartID
my idea is that can i delete chartid before using the same chartid for other chart?
please suggest me
Hi,
You can remove a chart instance from page and memory using dispose() function.
Ref. Code:
FusionCharts("myChartId").dispose();
#4
Posted 26 June 2012 - 02:09 PM
I am generating 6 charts using dojo Ajax dynamically as shown below.
<BR style="mso-special-character: line-break"><BR style="mso-special-character: line-break">
function ajaxLink(divID, url,chartIDM) {
alert(chartIDM);
var dataContainer = document.getElementById(divID);
dojo.io.bind(
{
url: url,
content:
{
ajax:true,
engine: 'dojo'
},
load:function(type, data, event)
{
dataContainer.innerHTML = data;
var myAjax = new FusionCharts("AngularGauge.swf",chartIDM,"265", "135", "0", "0");
myAjax.setDataXML(data);
myAjax.addParam("WMode", "Transparent");
myAjax.render(divID);
}
});
}
calling the above functionlike
ajaxLink('chartdiv1',encodeURI(str),'myChartIdB1')
ajaxLink('chartdiv2',encodeURI(str),'myChartIdB2')
……………..
ajaxLink('chartdiv6',encodeURI(str),'myChartIdB6')
<BR style="mso-special-character: line-break"><BR style="mso-special-character: line-break">
I am generating chart in the above function by passing unique div and chart ids.
If I go for click on another segment on multipiechart it’s giving me the error like chartid is already exists so please rename it.
My worry is how I can generate unique chart ids for each segment of multipiechart?
As you suggested, I would like to dispose the old chart instances then I think it works for me
Please guide me how to dispose in my ajax function?
Thanks in advance
Thanks for your reply. where should i put the code which u send?
can i use that in jsp?
#5
Posted 27 June 2012 - 06:20 AM
You would need to call this function before defining the FusionCharts instance.
Thus, it will dispose the chart ID, if the chart has been already rendered.
{
dataContainer.innerHTML = data;
if(FusionCharts("chartIDM")){
FusionCharts("chartIDM").dispose();
}
var myAjax = new FusionCharts("AngularGauge.swf",chartIDM,"265", "135", "0", "0");
myAjax.setDataXML(data);
myAjax.addParam("WMode", "Transparent");
myAjax.render(divID);
}
#6
Posted 27 June 2012 - 07:00 AM
Hi,
You would need to call this function before defining the FusionCharts instance.
Thus, it will dispose the chart ID, if the chart has been already rendered.{ dataContainer.innerHTML = data; if(FusionCharts("chartIDM")){ FusionCharts("chartIDM").dispose(); } var myAjax = new FusionCharts("AngularGauge.swf",chartIDM,"265", "135", "0", "0"); myAjax.setDataXML(data); myAjax.addParam("WMode", "Transparent"); myAjax.render(divID); }











