2014-07-08 152 views
4

我有一个y轴上有三个数据范围的高图。两个货币金额和一个“生存概率”,这是一个百分比。Highcharts多y轴最小最大问题

我需要限制百分比轴的范围为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' 
     ] 
    }); 
+0

为什么这个问题吸引了选票的原因? –

+1

不是我可以看到...我会为你转过身。 –

回答

7

只需设置alignTicksfalse生存概率轴。而已。

+0

天才!谢谢。我花了很长时间查看yAxis文档:o) –

+0

OMG谢谢谢谢谢谢youuuuuuuuuuuuuuu:___) – Graph