带有区域颜色填充和yAxis的负色

时间:2018-04-11 14:54:44

标签: javascript highcharts

基本图表:

type: 'area',

https://jsfiddle.net/q3x9psdz/19/
但是当交叉价值对于治疗图表来说是巨大的时候 - yAxis正在扩大:

  plotOptions: {
            series: {
                threshold: 20,
            }
        },
        xAxis: {
            type: 'datetime',
            tickPixelInterval: 50,
            crosshair: true,
        },
    yAxis: {
        plotLines: [{
                value: 0,
                width: 1,
                color: '#808080'
            },
            {
                value: 20,
                color: 'coral',
                dashStyle: 'shortdash',
                width: 2,
            }
    ]}

https://jsfiddle.net/q3x9psdz/14/
解决方法是使用样条线或线:

    series: [{
            type: 'spline',
        name: 'Chart',
        data: [[1523195126000,1],[1523195426000,3],[1523195726000,1],[1523196026000,2],[1523196326000,6],[1523196626000,5],[1523196926000,2],[1523197226000,3],[1523197526000,1]],
        negativeColor: true,
        color: '#FF4040',
        shadow: true

    }]

https://jsfiddle.net/q3x9psdz/23/
但是在没有区域颜色的情况下:

plotOptions: {
        series: {
            threshold: 2.5,
        }
    },

https://jsfiddle.net/q3x9psdz/21/

任何具有彩色填充区域且不扩展yAxis的解决方案?

1 个答案:

答案 0 :(得分:2)

series.softThreshold设为true

plotOptions: {
  series: {
    threshold: 20,
    softThreshold: true
  }
},

直播示例:https://jsfiddle.net/j58bvw36/