Here's a code for "moving average": (it should be included after amstoock.js)
Now, to add a moving average graph for some value in your data you just need to call AmCharts.addMovingAverage() function. It accepts the following parameters:
- dataSet: a reference to a DataSet object. So it must already be defined in your chart instantiation code.
- panel: a reference to StockPanel you want to add your moving average graph to.
- field: a field in your dataset's data provider that moving average will be calculated based on.
var avgGraph = AmCharts.addMovingAverage(dataSet, stockPanel1, "value"); avgGraph.useDataSetColors = false; avgGraph.color = "#ccffcc"; avgGraph.title = "Moving average";
Here's a working example: http://jsfiddle.net/amcharts/TuLpK/