Initializing Highstock.js causes jQuery error in getComputedStyle

I managed to get Highstock to work in a sample html file, but in the application I'm working on, the same Highstock code loads part of the path, and then gives an error: "elem.ownerDocument undefined" around line 5950 of jQuery 1.5.1 unallocated code (function getComputedStyle).

After some console logs, I found that the element that throws the error is actually a Highstock object, not a DOM element.

I also found that the jQuery function in question is not even called when starting a simple example page.

What can i skip? Some kind of crazy CSS? Why would this even be called this feature?

JS Code:

<script type="text/javascript"> var chart123; $(document).ready(function(){ chart123 = new Highcharts.StockChart({ chart: { renderTo: 'chartcontainer' }, rangeSelector: { selected: 1 }, series: [{ name: 'USD to EUR', data: [[6000000, 2], [50000000, 5]] // predefined JavaScript array }] }); }); </script> 

HTML code:

 <div id="workspace-content"> <div id="chartcontainer" style=" height: 400px"></div> </div> 

Let me emphasize once again that the exact same code works on a single page that uses the same jQuery file.

+4
source share
3 answers

Did you use the fleet in your previous application?

+4
source

You saved me a lot of trouble. I pulled my hair (what was left of him), trying to figure it out. The same as you, I did not suspect that jQuery.flot was included in the application. Thanks a lot.

+1
source

We use Smartadmin, which includes jquery-resize.js. Modify loopy () to process only the "if (elem.ownerDocument)" element. This is required for Highcharts or SVG elements.

This is another answer for the same error with a different root cause. I just put it here in the hope that it will save you from incorrect debugging.

0
source

Source: https://habr.com/ru/post/1383991/


All Articles