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 Query
- 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
More Query from same tag
- Putting select element to div with z-index position to Highcharts container
- How do i set the X-Axis as Date Array in highcharts.js simple highcharts.chart plot or .stockChart?
- Is there any option in Highcharts for simplifyng a line graph?
- Highchart throws errors when zoom out and hover point
- Highcharts & Mysql
- Is possible to set min and max zoom in Time series Highcharts?
- How to use data in rChart Highcharts
- Reveal.js with highcharts
- HighCharts - Need more space between bottom of chart and Xaxis labels
- PHP mySQL Highcharts Json Multiselect
- Highcharts Scatter Plot - How to Fix Overlapping Data Labels?
- Displaying max value in bottom of the pie chart - highcharts
- xAxis labels refuse to align with columns
- How to exchange data between a form, a php file and a javascript file
- How do I stop Highcharts creating a new gridline at the extremities of the chart unless a data point exceeds the min/max gridline?
- react-highcharts Y-axis categories catch event click in react way
- How can I populate my highchart using Ajax.
- highcharts polar chart with gradient color fills
- Display series labels at the end of each line in Highcharts Editor
- HighCharts: How to get a specific color for value 0
- Highcharts form submit var not working
- Highcharts two date compare
- Is there a maximum number of x-Axis items in HighCharts
- Mouse wheel event, not working as expected in Firefox, when using Highcharts with PerfectScrollbar
- javascript/highchart append value to an existing series
- Setting yaxis as logarithmic with Highcharts cakephp plugin
- Highcharts Area chart gradient fill
- How to draw two lines in HighStocks using candlestick with intraday
- Style Highchart line chart from psd
- Bar chart labels