Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highcharts.stockChart is not a function

I'm trying to make a graph using Hightcharts.js, but get an error

TypeError: Highcharts.stockChart is not a function.

I install it using npm(package.json)

"highcharts": "^5.0.6"

Сall

var Highcharts = require('highcharts');

And use

var options = {
    chart: {
        alignTicks: false,
        renderTo: 'container'
    },

    rangeSelector: {
        selected: 1
    },

    title: {
        text: 'AAPL Stock Volume'
    },

    series: [{
        type: 'column',
        name: 'AAPL Stock Volume',
        data: [],
        dataGrouping: {
            units: [[
                'week', // unit name
                [1] // allowed multiples
            ], [
                'month',
                [1, 2, 3, 4, 6]
            ]]
        }
    }];
};
var chart = Highcharts.stockChart(options);

Highstock is not a separate module, and belongs to Highcharts, I do not understand what could be the problem?

like image 511
iGanza Avatar asked Dec 19 '22 11:12

iGanza


1 Answers

npm install highcharts-angular, then

import * as Highcharts from 'highcharts/highstock';
like image 63
Spikolynn Avatar answered Dec 27 '22 04:12

Spikolynn