add series的时候速度非常慢,关闭了动画,datagroup也关了。打开网页还是非常慢。

查看addSeries函数:

addSeries(options [, redraw] [, animation])

Add a series to the chart after render time. Note that this method should never be used when adding data synchronously at chart render time, as it adds expense to the calculations and rendering. When adding data at the same time as the chart is initialized, add the series as a configuration option instead. With multiple axes, the offset is dynamically adjusted.

NameTypeArgumentDefaultDescription
optionsHighcharts.
SeriesOptionsType
The config options for the series.
redrawboolean<optional>trueWhether to redraw the chart after adding.
animationboolean | Highcharts.
AnimationOptionsObject
<optional>Whether to apply animation, and optionally animation configuration.

redraw:第二个参数用来说明,当add series之后,是否重新画图,默认是True。如果动态加载很多Series,那么设置为False,加载完所有数据后,再画一次图。

设置True的时候,每次加载数据重新画图也看不到画面有刷新,都是白板。

addSeries例子:

    for (i in zs_ranges){
      console.log(i);
      stock_chart.addSeries({
        showInLegend: false,
        name:'中枢',
        data: zs_ranges[i],
        type: 'arearange',
        lineWidth: 0,
        linkedTo: 'pingan-ohlc', // 与上一个数据列进行关联,或者直接赋值 0
        color: Highcharts.getOptions().colors[0],
        fillOpacity: 0.5,
        zIndex: 0,
        marker: {
          enabled: false
        }
      },false);
    }//end for

    stock_chart.redraw(); 

https://www.highcharts.com/forum/viewtopic.php?t=29931


如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!



0 条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注