score:1
change your function to this:
function() {
var Highcharts = this;
var series = Highcharts.series[0];
var data = [];
var period = 2;
var sumForAverage = 0;
var i;
for(i=0;i<series.data.length;i++) {
sumForAverage += series.data[i].y;
if(i<period) {
data.push({x:series.data[i].x,y: null});
} else {
sumForAverage -= series.data[i-period].y;
data.push({x:series.data[i].x,y: sumForAverage/period});
}
}
Highcharts.addSeries({
name: 'Moving Average',
data: data
});
});
I just changed the format of the corresponding series.
Source: stackoverflow.com
Related Articles
- Moving Average Line in Highcharts Scattered Chart
- HighCharts turn animation false for line chart
- Highcharts => Getting the id of a point when clicking on a line chart
- HTML5/JS Chart with Moving Average
- Improve performance of Highcharts line chart
- Highcharts - best way to handle and display zero (or negative) values in a line chart series with logarithmic Y axis
- Highcharts line chart won't display line chart in IE
- Highcharts - Scatter chart with a line connecting the dots in the series
- Highcharts line chart tooltips not showing correctly?
- Add dynamic data to line chart from mysql database with highcharts
- Highcharts reversed line chart is partially hidden at min value
- Highcharts - Bubble chart - Moving gridlines
- Add custom buttons in Angular Highcharts Line Chart
- Highcharts column + line combination chart with multiple series. Issue aligning line over the column
- I want to add a line to each column in a Highcharts column chart
- Overlap datalabels line chart highcharts
- HighCharts Stock Chart error code 18
- How to add a horizontal line in Column bar chart in Highcharts plugin?
- How to change space value between grid and yAxis in Highcharts line chart
- Highcharts line chart with multi colored areas
- Highcharts change symbol and hover text of individual points Line Chart
- Highcharts add point to line chart with json
- Highcharts Pie chart multi line labels overlapping
- HighCharts missing data points on line chart
- Change line color in area-spline chart in Highcharts
- Line Chart Highcharts
- Highcharts add a Mean line to BoxPlot chart
- Highcharts - How to force line chart to be visible above X Axis
- Highcharts - line chart dataLabels on every other point?
- Highcharts line chart all points disappear when have more than one points with same X Axis
- Highcharts column chart returning incorrect series index on click when using shared tooltip
- Scatter chart plot on border if values are outside the bounderies
- How to shift data using Series.addPoint without shifting x axis values in highcharts
- Resize on multiple Highcharts not working after dropdown change
- Error scraping Highcharts in Python with selenium
- Legends not matching columns ticks on xAxis in Highcharts
- Is it possible to have multiple highcharts with one id?
- Add rectangle to highchart
- High Charts Center Series Label
- High chart date
- How to disable Angular Drop Down if the model is null or empty?
- Create Line in Highcharts with start and end point
- programatically change the color of a highcharts spline series?
- Showing partial legend in Highcharts BarChart
- Adding multiple series to the spline chart using dotnet high charts in asp.net mvc3
- Time setting for hour
- Javascript/jQuery plug-in Highcharts does not recognize my data array. Is it my syntax?
- enable the graph inside the navigator in Highcharts
- How replicate the value of Y Axis on both sides of the axis in Highcharts
- Create TopoJson/GeoJson map of US South East