问题
So, I have a price time series I wrote a moving average for the prices of different retailers 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 Is it possible to make it to dynamically change? Maybe reload the graph or something?
回答1:
I made an example based on my comment above.
This example does not calculate a moving average - I wrote a simple function to calculate the overall average for the sake of simplicity.
The purpose of the example is to demonstrate how to do it on legendItemClick
, making use of only the visible series.
Example:
- http://jsfiddle.net/jlbriggs/gejgquxh/
来源:https://stackoverflow.com/questions/28063671/highcharts-moving-average-based-on-visible-data-only