Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using HighStocks with highcharts-ng

I'm using the Angular directive for HighCharts, https://github.com/pablojim/highcharts-ng.

However I want to use the HighStock option which should be possible according to the above link by setting useHighStocks: true.

When I try this the chart won't load at all, but works just fine when it's set to false. I even tried to include the highstock.js from official site but with no luck.

Original jsfiddle: http://jsfiddle.net/pablojim/7cAq3/

My non-working highstock jsfiddle: http://jsfiddle.net/achronos/7LZv4/1/

$scope.chartConfig = {
    options: {
        chart: {
            type: 'line',
            zoomType: 'x'
        }
    },
    series: [{
        data: [10, 15, 12, 8, 7, 1, 1, 19, 15, 10]
    }],
    title: {
        text: 'Hello'
    },
    xAxis: {currentMin: 0, currentMax: 10, minRange: 1},
    loading: false,
    useHighStocks: true
}

What can I do to make it work? Thanks

like image 668
Oskar Eriksson Avatar asked May 20 '14 12:05

Oskar Eriksson


1 Answers

I solved it on my own, apparenty you can't include both highcharts.js and highstock.js at the same time. When including highstock.js, the highcharts.js functionality is included, however it does not work vice versa.

So, the trick is to only include highstock.js!

like image 135
Oskar Eriksson Avatar answered Nov 15 '22 14:11

Oskar Eriksson