Search code examples
javascriptangularjshighchartshighcharts-ng

Adding stacklabels to highcharts-ng


I'm trying to add stack labels (http://api.highcharts.com/highcharts#yAxis.stackLabels) to my chart

http://jsfiddle.net/Hjdnw/970/

According to the docs, https://github.com/pablojim/highcharts-ng all options should go into options object.

$scope.chartConfig = {
        options: {
            chart: {
                type: 'bar'
            },
            yAxis: {
              stackLabels: {
                style: {
              color: 'black'
            },
            enabled: true
          }
        },
        },

        series: [{
            data: [10, 15, 12, 8, 7]
        }],
        title: {
            text: 'Hello'
        },

        loading: false
    }

What am I doing wrong?


Solution

  • You just need to add the bar stacking method to plotOptions, in chartConfig.options:

    plotOptions: {
        bar: {
            stacking: 'normal'
        }
    }
    

    When this value is null (or not specified), the stack values are disabled.

    Here is a working demo: http://jsfiddle.net/scfy8w53/