我可以在 highcharts 时间序列中为点着色吗?

Brk*_*Brk 1 javascript highcharts

嘿,我有一个 Highchart 时间序列的例子。在这个例子中,我将所有点作为小数组的数组(每个数组是一对 x 和 y)。我想知道是否可以使用 fillColor 属性为当前格式的特定点着色,如果可以,我该怎么做?

我想突出显示时间序列图中的特定点,我该怎么做?

$(function () {
    $.getJSON('https://www.highcharts.com/samples/data/jsonp.php?filename=usdeur.json&callback=?', function (data) {

        $('#container').highcharts({
            chart: {
                zoomType: 'x'
            },
            title: {
                text: 'USD to EUR exchange rate over time'
            },
            subtitle: {
                text: document.ontouchstart === undefined ?
                        'Click and drag in the plot area to zoom in' : 'Pinch the chart to zoom in'
            },
            xAxis: {
                type: 'datetime'
            },
            yAxis: {
                title: {
                    text: 'Exchange rate'
                }
            },
            legend: {
                enabled: false
            },
            plotOptions: {
                area: {
                    fillColor: {
                        linearGradient: {
                            x1: 0,
                            y1: 0,
                            x2: 0,
                            y2: 1
                        },
                        stops: [
                            [0, Highcharts.getOptions().colors[0]],
                            [1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
                        ]
                    },
                    marker: {
                        radius: 2
                    },
                    lineWidth: 1,
                    states: {
                        hover: {
                            lineWidth: 1
                        }
                    },
                    threshold: null
                }
            },

            series: [{
                type: 'area',
                name: 'USD to EUR',
                data: data
            }]
        });
    });
});
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>

<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
Run Code Online (Sandbox Code Playgroud)

Seb*_*han 5

你有两种可能,

1) 在点对象中声明颜色

{
   x: 0,
   y: 10,
   color: 'red'
}
Run Code Online (Sandbox Code Playgroud)

2) 通过point.update()设置颜色

chart.series[0].data[0].update({
  color: 'red'
});
Run Code Online (Sandbox Code Playgroud)