Highstock:如何定义和显示x和y轴?

时间:2016-10-05 04:53:00

标签: highstock

我试图用各种方式使y轴可见,但每次我改变轴的颜色时,整个图形的颜色,即系列的变化。有没有办法在不改变图形颜色的情况下使y轴和x轴可见。

xAxis: {
    gapGridLineWidth: 0
},

yAxis: {
    opposite:false,
},

navigator: {
    enabled:false,
},

rangeSelector: {
    buttons: [{
        type: 'hour',
        count: 1,
        text: '1h'
    }, {
        type: 'day',
        count: 1,
        text: '1D'
    }, {
        type: 'all',
        count: 1,
        text: 'All'
    }],
    selected: 1,
    inputEnabled: false,
},

1 个答案:

答案 0 :(得分:0)

您应该能够在不改变系列颜色的情况下更改轴的颜色。

您可以使用tickColor,lineColor,gridLineColor和labels.style来设置标签的颜色: http://api.highcharts.com/highcharts/yAxis.lineColor

yAxis: {
      lineColor: 'red',
      gridLineColor: 'red',
      tickColor: 'red',
      labels: {
        style: {
          color: 'red'
        }
      }
    },
    xAxis: {
      lineColor: 'red',
      tickColor: 'red',
      labels: {
        style: {
          color: 'red'
        }
      }
},

在这里,您可以看到一个示例:http://jsfiddle.net/c9bfmzsm/