Highcharts nodeName of undefined
When playing with a diagram created with tall diagrams and exporting it to SVG I get a lot of errors, around 1000 (node name from undefined) in 6 seconds
Responsible code:
element = wrapper.element, nodeName = element.nodeName, // <---- Here (Cannot read property 'nodeName' of undefined) renderer = wrapper.renderer, skipAttr, attrSetters = wrapper.attrSetters, shadows = wrapper.shadows, hasSetSymbolSize, ret = wrapper;
Stacktrace element (in Chrome 17.0.963)
Uncaught TypeError: Cannot read property 'nodeName' of undefined
SVGElement.attr highcharts.src.js:2008
init.Effect.HighchartsTransition.Class.create.update prototype-adapter.src.js:86
(anonymous function) effects.js:1
Effect.Base.Class.create.loop effects.js:1
Effect.ScopedQueue.Class.create.loop effects.js:1
b prototype.js:1
Violin to re-create : here to replay a click on a line on / off and then click on a link My Download
, turn on / off again and click on a link again My Download
.
My question is this: is this my code or a bug in highcharts; and how can i fix this?
source to share
I'm not very familiar with Framework Prototype, but I did some tests and looked at this code:
function getGraphSVG(options) {
var svg;
if (window.charts) {
window.charts.each(function(pair) {
svg = pair.value.getSVG(options);
throw $break;
});
}
return svg;
}
Somehow this method each
returns 2 objects, one of which is undefined
. So, a simple check:
if (pair.value)
svg = pair.value.getSVG(options);
or in one line
pair.value && ( svg = pair.value.getSVG(options) );
and it should work.
source to share