Show Indicator at last point on Highchart spline chart

前端 未结 1 694
情书的邮戳
情书的邮戳 2021-01-16 07:07

I know how to show marker at last point like this.

When the data is dynamic, don\'t know how to mark the last point.

plotOptions: {
        column: {         


        
相关标签:
1条回答
  • 2021-01-16 07:50

    When you are adding new points dynamically you can simultaneously remove the marker from the current last point (Point.update), while adding a new point with marker enabled (Series.addPoint).

    For example (JSFiddle):

    // get the series
    series = $('#container').highcharts().series[0]
    
    // remove marker from last point
    series.points[series.points.length-1].update({
        marker: {
            enabled:false
        }
    }, false);
    
    // add new point with marker
    series.addPoint({
        y: Math.random()*100,
        marker: {
            enabled: true
        }
    });
    

    The false parameter for the Point.update is to prevent redrawing, as you are going to redraw after the Series.addPoint anyway, which should save some processing.

    0 讨论(0)
提交回复
热议问题