2016-05-30 39 views
0

我使用以下選項製作了谷歌折線圖。谷歌折線圖中的軸動態數

var options = { 
       pointSize: 10, 
       pointShape: 'circle', 
       backgroundColor: '#FFFFFF', 
       legend: {position: 'none'}, 
       vAxis: { 
        viewWindowMode: 'explicit', 
        viewWindow: {min: 0}, 
        gridlines: {color: '#CCCCCC'}, 
        textStyle: {color: '#444444'} 
       }, 
       hAxis: { 
        viewWindowMode: 'explicit', 
        viewWindow: {min: 0}, 
        textStyle: {color: '#444444'} 
       }, 
       chartArea: {left: 40, top: 10, width: 900, height: 150}, 
       colors: ['#FF9900', '#2A96FF', '#424242'], 
       animation: {duration: 1000, easing: 'out'}, 
       smoothLine: true, 
       tooltip: {isHtml: true} 
      }; 

此折線圖是使用上述選項生成的。

line chart

當值是變化x的軸數總是5.如何設置這是動態的,所以會有在y軸沒有小數標籤/值。

對於上面的例子,我只需要0和1.不需要0.25,0.50和0.75。

回答

0

您可以提供自己的刻度線的任一軸...

vAxis: { 
    ticks: [0, 1], 
    ...