SijuMathew
SijuMathew

Reputation: 362

HighCharts stack totals on top for percent stacking

I'm displaying a stacked percent column chart. I want the total to be displayed on top. I added following to YAxis:

stackLabels: {
    enabled: true, // This is ignored <<<<<<
    style: {
      fontWeight: 'bold',
      color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
    }
}

But this works only if the stacking is not "percent". How can I achieve what I want (showing total on top of the stacked column?

The code can be checked at : http://jsfiddle.net/Bzs2k/1/

Upvotes: 1

Views: 1863

Answers (2)

Sebastian Bochan
Sebastian Bochan

Reputation: 37578

You can also set y value as positive value.

stackLabels: {
                 y:10,
                enabled: true, // This is ignored <<<<<<
                style: {
                    fontWeight: 'bold',
                    color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
                }
}

http://jsfiddle.net/Bzs2k/4/

Upvotes: 0

Mark
Mark

Reputation: 108512

Actually the stackLabels option is working, but there is not enough room for the labels at the top of the plot. Add this to the yAxis to pad some space:

yAxis: {
    min: 0,
    max: 105,
    endOnTick: false,
    etc...

Updated fiddle here.

enter image description here

Upvotes: 2

Related Questions