Sign in to follow this  
Jose Ivan

#25081843 Mychart110.render Error

Recommended Posts

Hi , i got a error in js like "#25081843 Mychart110.render Error >> #25081843:IECompatibility() Chart Id is same as a JavaScript variable name. Variable naming error. Please use unique name for chart JS variable, chart-id and container id." in webkit (Crome17).

i was searching i found in yours forums that happens because my variable is named like my chartid , but this not my case , well i think.i couldn't find what is the error.

Also i was reading in the forum something like dashboard and dashlet, i'm working something like that too.

Let me explain , i'm using ASP.net and devexpress control. I 've created a user control where in there i put a literal, but i create the usercontrol dynamically and sometimes i had troubles in callback with devexpress so

i create just only in codebehind the <Div></Div> and in the clientside i render the chart with XMLurl and work's good in firefox and IE.

the problem is in Chrome and in the page load show like "no data" , until that you move the dashlet it charge the chart.

Well my part of code is like this....

In acsx -Codebehind

 

 

protected void Page_Load(object sender, EventArgs e)

{

string tipoGrafico="Bar2D.swf" ; //for example

 

Literal l = new Literal();

l.ID = string.Concat("lit_", this.ClientID); 4 example 1 and 2

l.Text = InfoSoftGlobal.FusionCharts.RenderChart(string.Concat("../FusionChart/XT/", tipoGrafico, ".swf"), "", "<chart></chart>", string.Concat("Mychart", this.DashboardID, this.DashletID), "300", "300", false, true);

}

this , create a div <div id="MyChart12"></div>

 

 

And in my file javascript i have :

 

j(document).ready(function () {

updateChart();

};

function updateChart(chart) {

var _chart = chart;

if (window.parent.bandera == false) { // this is for the first time

window.parent.bandera = true;

var cantidad = j('Div[id^=Mychart]').length; // i found how many div fusionchart i have

for (var con = 0; con < cantidad; con++) {

//I get the ID for example "
Mychart12
"

var _Chartid = j('Div[id^=Mychart]')[con].id.substring(0, j('Div[id^=Mychart]')[con].id.length - 3); //Chartid

//concat id+"Div" ="Mychart12Div"

var _chartDiv = _Chartid + "Div";

// this is logic

var _string = j("#" + _chartDiv).parent().parent().find('label').text(); //Label

var d = _string.split('&')[0].split('-')[0]; //d

var ds = _string.split('&')[0].split('-')[1]; //ds

// logic end

// this is my XMLURL

var XMLURL = "../Dashboard/fusionchart.aspx?d=" + d + "&ds=" + ds; //"&currTime=" + getTimeForURL();

if (window.parent.FusionCharts(_Chartid) != undefined) {

var Chart = FusionCharts.items[_Chartid]; // i get the object fusion

Chart.setXMLUrl(XMLURL); //set XMLURL

Chart.render(_chartDiv); // and render the chart in the div container which is the "MyChart12Div"

//here is because i want to resize() to 100% width and heigth

j("#" + _chartDiv).bind("fusionchartsdrawcomplete", function (e, args) {

var _width = j(this).width();

var _height = j(this).height();

j("#" + e.sender.id).width(_width);

j("#" + e.sender.id).height(_height);

});

}

else {

var cptype = window.parent.callbackPanelTab.cptype;

Chart = new FusionCharts("../FusionChart/XT/" + cptype + ".swf", _Chartid, "300", "300", "0", "1");

Chart = FusionCharts.items[_Chartid];

Chart.setXMLUrl(XMLURL);

Chart.render(_chartDiv);

j("#" + _chartDiv).bind("fusionchartsdrawcomplete", function (e, args) {

var _width = j(this).width();

var _height = j(this).height();

j("#" + e.sender.id).width(_width);

j("#" + e.sender.id).height(_height);

});

}

} //fin del for

} //fin de la condicion

} //fin del funcion

 

 

 

the xmlURL it's fine because i can see the xml ..... i add in my page the following scripts..but it's not work and jquery .

<script type="text/javascript" language="Javascript" src="../FusionChart/XT/FusionCharts.js"></script>

<script type="text/javascript" language="Javascript" src="../FusionChart/XT/FusionCharts.HC.Charts.js"></script>

<script type="text/javascript" language="Javascript" src="../FusionChart/XT/FusionCharts.HC.js"></script>

<script type="text/javascript" language="Javascript" src="../FusionChart/XT/FusionCharts.jqueryplugin.js"></script>

i attached a couple images

post-27839-0-03722700-1332973386_thumb.png

post-27839-0-90914500-1332973400_thumb.png

post-27839-0-33505400-1332975042_thumb.png

Share this post


Link to post
Share on other sites
Guest Sumedh

Hi,

 

This might happen, when you have a JavaScript variable in the global window scope with the same name as that of the chart's Id.

 

Could you please confirm if the chart id and the variable name are same?

 

If they are same, please make sure that they should not be same.

 

If this does not help, please feel free to revert.

Share this post


Link to post
Share on other sites

Hi,

 

This might happen, when you have a JavaScript variable in the global window scope with the same name as that of the chart's Id.

 

Could you please confirm if the chart id and the variable name are same?

 

If they are same, please make sure that they should not be same.

 

If this does not help, please feel free to revert.

 

 

 

thanks for answer me ..

 

 

well my global variables are these:

 

 

 

var postponedCallbackRequired = false;

var trayectoria;

var PanelList = '';

var open = false;

var _dialog;

var bandera = false;

var createdashboard = false;

var dl = '';

var _conect = false;

 

var index;

var value;

var dialogo;

var count;

 

well i forgot how can i resize the chart , 'cause first it show 300 x 300 and then show 100% x 100% , how can i show 100% and 100 % , in document ready for example it show me the width=0 and heigth =0 so after it draw i can resize it.

Edited by Jose Ivan

Share this post


Link to post
Share on other sites
Guest Sumedh

Hi,

 

To get over with IECompatibility error, the javascript variable name and the chart id shouldn't be same.

 

Ref. Code:

var myChart=new ( "FusionCharts/Column3D.swf","myChart", "300", "300", "0", "1" );

 

In above code, myChart is replicated as a variable name as well as a chart ID.

 

It should be like:

var myChart=new ( "FusionCharts/Column3D.swf","myChartID", "300", "300", "0", "1" );

 

For re-sizing, you would need to set the width and height of the chart in terms of percentage. The chart will automatically adjust its dimensions with respect to the parent HTML container element.

 

var myChart = new FusionCharts( "FusionCharts/Column3D.swf", "myChartId", "100%", "100%", "0", "1" );

 

For more informartion, refer this link: http://docs.fusionch...ChangeSize.html

 

Hope this helps.

Share this post


Link to post
Share on other sites

thanks again !!

well about error i got it but i'm not doing this ...... if you see i create in my codebehind i got this ...

FusionCharts.RenderChart(string.Concat("../FusionChart/XT/", tipoGrafico, ".swf"), "", "<chart></chart>", string.Concat("Mychart", this.DashboardID, this.DashletID), "300", "300", false, true);

this code creates a div empty with id="MyChart12Div" for example so in clientside i find each div and i set the UrlXml and i render it at div that itselft create in this case MyChart12Div.

for example :

in codebehind create a div call "MyChart12Div" , in my client side i search all div fusionchart with Jquery => j('Div[id^=Mychart]') and foreach i do

var cantidad = j('Div[id^=Mychart]').length;

for (var con = 0; con < cantidad; con++) {

for my variable call _Chartid i get from div name and i less the last 3 letters "Div" and i got my charid => "MyChart12"-"Div"

var _Chartid = j('Div[id^=Mychart]')[con].id.substring(0, j('Div[id^=Mychart]')[con].id.length - 3); //Chartid

var XMLURL = "../Dashboard/fusionchart.aspx?d=" + d + "&ds=" + ds; => in this case will be d=1 and ds=2

FusionCharts.items[_Chartid].setXMLUrl(XMLURL);

FusionCharts.items[_Chartid].render();

}

if i remove the instruction FusionCharts.items[_Chartid].render(); the errors disapir but i don't have chart

So if i don't remove the chart no show just only i move the panel that conteins the div .

As you can see i delete the variable var Chart in my first code , because i thougth that maybe the variable

var Chart created another chart for example with the same properties but it doesn't work ... this error i just got in Chrome ......

so I never got a var mychart=fusionchart("...urlchartswf",mychar......); i just find the object created and i set URLXML....

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Share this post


Link to post
Share on other sites
Guest Sumedh

Hey,

 

Thanks for your inputs.

 

We are glad to know that you have managed to resolve your issue.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this