Highcharts多y轴最小值和最大值问题

5
我有一个带有三个数据范围的高级图表,其中包含两个货币金额和一个“生存概率”百分比。我需要将百分比轴的范围限制在0-100%之间,但无论我做什么似乎都没有任何效果。你有什么建议吗?
以下是示例链接及代码的一部分:
链接:http://jsfiddle.net/moonspace/2jnrp/
jQuery('#chartContainer').highcharts({
        chart: { width: 600, height: 500 },
        title: { text: '' },
        credits: { enabled: false },
        xAxis: {
            categories: client_age_array,
            title: {
                text: 'Client age',
                style:{ color: '#000000', fontWeight: 'bold', fontSize: '12px' }
            },
            labels: { 
                step: 5,
                staggerLines: 1
            }
        },
        yAxis: [{ // First yAxis - Income
                    labels: {
                        style: {
                            color: gradTop,
                            fontSize: '12px'
                         }
                    },
                    title: {
                        text: 'Income',
                        style: {
                            color: gradTop,
                            fontSize: '12px'
                         }
                    },
                    opposite: true,
                    min: null,
                    max: null                   
                },
                { // Second yAxis - Fund value
                    gridLineWidth: 0,
                    labels: {
                        style: {
                            color: '#003466',
                            fontSize: '12px'
                         }
                    },
                    title: { 
                        text: 'Fund value',
                        style: {
                            color: '#003466',
                            fontSize: '12px'
                         }
                    },
                    min: null,
                    max: null
                },
                { // Third yAxis - Survival probability
                    gridLineWidth: 0,
                    labels: { 
                        format: '{value}%',
                        style: {
                            color: '#fe6f01',
                            fontSize: '12px'
                         }
                    },
                    title: { 
                        text: 'Survival probability',
                        style: {
                            color: '#fe6f01',
                            fontSize: '12px'
                        }
                    },
                    opposite: true,
                    min: 0,
                    max: 100
            }],
            tooltip: {
                formatter: function() {
                    var toolTip = '<b>Age : '+ this.x +'</b><br />';
                    jQuery.each(this.points, function(i, point) {
                        if( point.series.name == 'Survival probability' ){
                            if( isNaN(point.y) ){
                                // -- do nothing
                            }else{
                                toolTip += point.series.name + ' : ' + point.y + '<br />';
                            }
                        }else{
                            toolTip += point.series.name + ' : ' + point.y + '<br />';
                        }
                    });

                    return toolTip;
                },
                shared: true
            },
            navigation: {
                buttonOptions: {
                    verticalAlign: 'bottom',
                    y: -5
                }
            },          
        series: [
            {
                name: 'Income',
                type: 'column',
                yAxis: 0,
                data: income_array
            },
            {
                name: 'Fund value',
                type: 'spline',
                yAxis: 1,
                data: fund_value_array,
                marker: {
                    enabled: false
                }
            },
            {
                name: 'Survival probability',
                type: 'line',
                lineWidth: 0,
                yAxis: 2,
                data: survival_array_2
            }
        ],
        colors: [{
            linearGradient: perShapeGradient,
            stops: [ [0, gradTop], [1, gradBottom] ]
            },
            '#003466',
            '#fe6f01'
        ]
    });

这个问题为什么会吸引到负评? - Pat Dobson
1
我看不出来...我会为你调整一下。 - John Chrysostom
1个回答

8

只需将生存概率轴的alignTicks设置为false。就是这样。


太棒了!谢谢。我花了太长时间查看yAxis文档 :o) - Pat Dobson
哇塞,谢谢你,谢谢你,谢谢你!:___) - Graph

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接