2013-10-23 9 views
18

Sto usando highcharts per la prima volta, e sto cercando di capire come impostare i punti dell'asse Y statici.come impostare l'intervallo di punti su Y - Axis highcharts

Ho usato min = 0 e max = 140, ei punti su asse y si presentano come 0,25,50,75,100,125 e 150. In cui lo voglio come 0,20,40,60,80,100,140.

Qualcuno può farmi sapere come potrei ottenere questo.

di seguito riportate le optins highchart:

var chart1 = new Highcharts.Chart({ 
     chart: { 
      renderTo: 'Div1', 
      width: 600, 
      height: 400 

     }, 
     yAxis:{ 
      min: 0, max: 140, 

      lineColor: '#FF0000', 
      lineWidth: 1, 
      title: { 
       text: 'Values' 

     }, 
     plotLines: [{ 
       value: 0, 
       width: 10, 
       color: '#808080' 
      }] 
     }, 
     series: [{ 
      name: 'Value', 
      data: YaxisValuesArray 
     }] 
    }); 

}); 

Points on X axis

risposta

36

È possibile impostare il tickInterval (http://api.highcharts.com/highstock#yAxis.tickInterval) sull'asse http://jsfiddle.net/blaird/KdHME/

$(function() { 
    var chart1 = new Highcharts.Chart({ 
     chart: { 
      renderTo: 'Div1', 
      width: 600, 
      height: 400 

     }, 

     credits: { 
      enabled: false 
     }, 


     title: { 
      text: 'Productivity Report', 

      x: -20 //center 
     }, 

     xAxis: { 
      lineColor: '#FF0000', 
      categories: [1, 2, 3] 
     }, 
     yAxis: { 
      min: 0, 
      max: 140, 
      tickInterval: 20, 
      lineColor: '#FF0000', 
      lineWidth: 1, 
      title: { 
       text: 'Values' 

      }, 
      plotLines: [{ 
       value: 0, 
       width: 10, 
       color: '#808080' 
      }] 
     }, 
     tooltip: { 
      valueSuffix: '' 
     }, 
     legend: { 
      layout: 'vertical', 
      align: 'right', 
      verticalAlign: 'middle', 
      borderWidth: 0 
     }, 


     series: [{ 
      name: 'Value', 
      data: [ 
       [1, 10], 
       [2, 20], 
       [3, 30] 
      ] 
     }] 
    }); 

}); 
+1

Grazie mille! Mi hai salvato la giornata, stavo usando tickinterval in precedenza. Ma non funzionava ... E ora ho notato che stavo usando tickinterval invece di tickInterval (sensibile al maiuscolo/minuscolo): D – Janet

+0

Ho un'altra domanda per te come faccio ad aggiungere il simbolo "%" accanto ai punti dell'asse Y come il 20%, 40%, 60% ecc. – Janet

+0

Usa il formato delle etichette: http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/yaxis/ labels-format/http://api.highcharts.com/highcharts#yAxis.labels.format –

0

di farlo usando HighChart in un StockChart modalità, ho solo bisogno di impostare la proprietà tickPixelInterval.

yAxis: { 
      ... 
      tickPixelInterval: 35 
      ... 
     } 
Problemi correlati