HighCharts stack totals on top for percent stacking

戏子无情 提交于 2019-12-13 01:16:26

问题


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/


回答1:


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.




回答2:


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/



来源:https://stackoverflow.com/questions/21190252/highcharts-stack-totals-on-top-for-percent-stacking

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!