区域中高图负色?

时间:2019-02-13 13:37:53

标签: javascript highcharts

反正有没有设置区域负部分的颜色?

我的目的是实现这样的目标。不要注意背景上的plotBands。

enter image description here

You can use this as boilerplate.

https://jsfiddle.net/du2hobrt/

1 个答案:

答案 0 :(得分:0)

您可以减小序列fillOpacity的值,并使用Highcharts.SVGRenderer在序列下添加图层,这会影响颜色:

chart: {
    events: {
        load: function() {
            var series = this.series[0].area,
                plotLeft = this.plotLeft;

            this.renderer.path().attr({
                translateX: plotLeft,
                translateY: this.plotTop,
                d: series.d,
                fill: 'rgba(255, 0, 0, 0.6)',
                zIndex: 0
            }).add();

            this.renderer.rect(
                plotLeft,
                this.yAxis[0].toPixels(0),
                this.plotSizeX,
                this.plotTop + this.plotSizeY - this.yAxis[0].toPixels(0)

            ).attr({
                fill: '#FFF',
                zIndex: 0
            }).add()
        }
    }
}

实时演示:https://jsfiddle.net/BlackLabel/bsk3n0qz/

API:https://api.highcharts.com/highcharts/series.area.fillOpacity