This is a migrated thread and some comments may be shown as answers.

[Solved] Element is undefined in chart init method

2 Answers 241 Views
Charts
This is a migrated thread and some comments may be shown as answers.
berkin
Top achievements
Rank 1
berkin asked on 16 Sep 2014, 07:22 AM
Hello,

We have a chart brought by an ajax call into our page. It works fine, but time to time it gives an error deep from its source code. 
The error is in this method;

renderElement: function(element) {
           var view = this,
               container = doc.createElement("div"),
               defsCurrent = doc.getElementById(view.defsId),
               defsElement,
               domElement;
 
           dataviz.renderSVG(container,
               "<?xml version='1.0' ?>" +
               "<svg xmlns='" + SVG_NS + "' version='1.1'>" +
               view.renderDefinitions() +
               element.render() +
               "</svg>"
           );
 
           defsElement = container.firstElementChild.firstChild;
           domElement = container.firstElementChild.lastChild;
 
           if (defsCurrent && defsCurrent.textContent !== defsElement.textContent) {
               defsCurrent.parentNode.replaceChild(defsElement, defsCurrent);
           }
 
           return domElement;
       },


where we get the element object as undefined, and this problem only occurs when we try to initialize the chart on ipad. I cannot seem to find the exact reason why we get this error, I am aware that I am supplying you with very little information, but I hope you can find a solution asap.

Thanks, and hope to hear back from you.

2 Answers, 1 is accepted

Sort by
0
Hristo Germanov
Telerik team
answered on 18 Sep 2014, 06:29 AM
Hi berkin,

I think that when you try to run the chart the element is no there. Could you try to wrap your javascript code in document.ready()

Regards,
Hristo Germanov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
berkin
Top achievements
Rank 1
answered on 22 Sep 2014, 07:39 AM
Hey thanks,

I think there was a problem with require.js, it was initialized before the libraries are loaded. thanks, it works now.

Tags
Charts
Asked by
berkin
Top achievements
Rank 1
Answers by
Hristo Germanov
Telerik team
berkin
Top achievements
Rank 1
Share this question
or