简体   繁体   English

HighCharts:设置yAxis的值

[英]HighCharts:set the value of yAxis

I have combine tow line and column in one chart like this 我已经像这样在一张图表中组合了拖曳线和列 在此处输入图片说明

I want set the right yAxis show {0%, 20%, 40% 60%, 80%, 100%}, 我想设置正确的yAxis show {0%,20%,40%60%,80%,100%},
and left yAxis show {0, 10k, 20k, 30k, 40k, 50k} 左侧的yAxis显示{0,10k,20k,30k,40k,50k}

You can do that with tickPositions ( http://jsfiddle.net/QzXbg/1/ ): 您可以使用tickPositionshttp://jsfiddle.net/QzXbg/1/ )完成此操作:

            yAxis: [{ // Primary yAxis
                labels: {
                    style: {
                        color: '#89A54E'
                    }
                },
                title: {
                    text: 'Actual and forecast',
                    style: {
                        color: '#89A54E'
                    }
                },
                tickPositions: [0, 10000, 20000, 30000, 40000, 50000]
            }, { // Secondary yAxis
                title: {
                    text: 'MAPE',
                    style: {
                        color: '#4572A7'
                    }
                },
                tickPositions: [0, 20, 40, 60, 80, 100],
                labels: {
                    style: {
                        color: '#4572A7'
                    }
                },
                opposite: true
            }],

You can also just use the tickInterval property for each axis, and avoid having to specify each tick individually. 您也可以仅对每个轴使用tickInterval属性,而不必单独指定每个刻度。

ie: 即:

yAxis:[{
   tickInterval:10000
},{
   tickInterval:20
}]

Assuming your date for the right axis is already in the % value that you need. 假设您的右轴日期已经在所需的%值中。 If not, you will need to calculate the % in the formatter for the axis labels. 如果不是,则需要在格式器中为轴标签计算%。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM