仅基于可见数据的 Highcharts 移动平均线

Highcharts moving average based on visible data only

所以,我有一个价格时间序列,我为不同零售商的价格写了一个移动平均线 http://i.imgur.com/dn3EdM6.png . So far so good, but I want to only see the moving average of the visible retailers. For example, here I have only one shop shown, but the moving average is calculated on all of them. http://i.imgur.com/ZpK5gsG.png 是否可以让它动态变化?也许重新加载图表或其他东西?

我根据上面的评论做了一个例子。

这个例子不计算移动平均线——为了简单起见,我写了一个简单的函数来计算整体平均线。

该示例的目的是演示如何在 legendItemClick 上执行此操作,仅使用可见系列。

示例: