如何更改 Highcharts 中指定曲线上方或下方线条的颜色?

How to change color of line above or below specify curve line in Highcharts?

是否可以更改 Highcharts 中指定范围的线条颜色?我附上了一张显示预期结果的图片。

我知道我可以使用分离系列,但它很不舒服。也许有一些包装器(插件)可以使这个过程更容易。

我找到了一个与您的图片类似的演示,可能正是您要找的东西(以及许多其他带有 JS.Fiddles 和代码的好例子)我找到了 this one here使用此代码:

$(function () {
    $('#container').highcharts({
        chart: {
            type: 'areaspline'
        },
        title: {
            text: 'Average fruit consumption during one week'
        },
        legend: {
            layout: 'vertical',
            align: 'left',
            verticalAlign: 'top',
            x: 150,
            y: 100,
            floating: true,
            borderWidth: 1,
            backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
        },
        xAxis: {
            categories: [
                'Monday',
                'Tuesday',
                'Wednesday',
                'Thursday',
                'Friday',
                'Saturday',
                'Sunday'
            ],
            plotBands: [{ // visualize the weekend
                from: 4.5,
                to: 6.5,
                color: 'rgba(68, 170, 213, .2)'
            }]
        },
        yAxis: {
            title: {
                text: 'Fruit units'
            }
        },
        tooltip: {
            shared: true,
            valueSuffix: ' units'
        },
        credits: {
            enabled: false
        },
        plotOptions: {
            areaspline: {
                fillOpacity: 0.5
            }
        },
        series: [{
            name: 'John',
            data: [3, 4, 3, 5, 4, 10, 12]
        }, {
            name: 'Jane',
            data: [1, 3, 4, 3, 3, 5, 4]
        }]
    });
});

并且有一个JS.Fiddle for it here。希望对您有所帮助。

据我所知,没有任何包装器。我将分两步进行:

  • 计算intersection points
  • 使用两个单独的系列 multicolor-series插件(一行内有多种颜色)。