0

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?

4

2 回答 2

1

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/

于 2014-12-17T20:41:58.853 回答
0

The xAxis should be an object and not an array. The config should be set up like so:

xAxis: {
  categories: ['Option 1', 'Option 2 ']
}

And the update should be:

$scope.chartConfig.xAxis.categories = ['Option New 1', 'Option New 2'];

Fiddle URL

于 2014-12-17T18:06:15.057 回答