score:7

Accepted answer

I see three questions in your case:

1) To get object when creating chart, you have two ways:

  • with jQuery:

    var chart = $(element).highcharts('StockChart', options).highcharts();
    
  • without jQuery:

    var chart = new Highcharts.StockChart(options);
    

2) Error #17:

"The requested series type does not exist"

Is caused by type : 'StockChart'. type is reserved for a series type. As @Raeen Hashemi said, to create Highstock, use different constructor: new Highcharts.StockChart(options).

3) Yes, you can pass an object to renderTo: http://jsfiddle.net/yvxwa6oq/

new Highcharts.StockChart({
    chart: {
        renderTo: document.getElementsByClassName("container")[0] 
    },

    series: [{
        name: 'USD to EUR',
        data: [10, 20]
    }]
});

4) this - honestly, I'm not sure why you need access to this somewhere else than event handlers. Instead use Highcharts.charts[index] or stored variables like chart or $(element).highcharts()

score:0

for ES6, use it in below method.

import * as Highcharts from "highcharts";
import * as highchartsTree from 'highcharts/modules/treemap';

also, any highchart type can be added instead of treemap

highchartsTree(Highcharts);

Related Query

More Query from same tag