Highcharts: initializing StockChart with the new Highchart

I am trying to initialize a HighStock Chart. If I use this method:

var chart = new Highcharts.Chart('StockChart', dataObject);

I get an error that div div was not found. If I use this method:

$('#container').highcharts('StockChart', dataObject);

The chart is canceled as expected. What am I doing wrong in the first method?

Regards, Marko

Here is the fiddle: http://jsfiddle.net/mkeuschn/K4Cj6/

+4
source share
1 answer

If you create the chart as the first method, you need to remove the first parameter "StockChart". Heres the api: Highstock api

So this should be the code:

var chart = new Highcharts.StockChart(dataObject);

Working fiddle: jsfiddle

+7
source

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


All Articles