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
- Highcharts.stockChart Range Selector (zoom) Button Position After the Chart Container
- Export Highcharts data in excel with values as a string
- HighCharts column to pie
- Use classic mode instead of styled mode in Highcharts with Angular
- response with status 200: ok
- fixing label overlapping in second level of grouped categories plugin used in highchart
- Array not in correct format in Javascript for use by HighChart
- Two y Axis in Highcharter in R
- Hide Highcharts series through legend without having an empty space between them
- Highcharts Bar - Display DataLabel at the right end of the plot
- HighCharts adding a multi-select dropdown for each column of a series
- Plotting time series with different scales with Hichcharts
- Need to join x axis and y axis label highcharts
- how to pass multi sereis data with dual y axis chart in highchart
- How to use a reactive list with reactive dataframe and R Highcharter in Shiny App
- How can I do in Highchart to have 1px space between the columns and the y Axis?
- Align y-axis title of high charts to begin exactly at 0 position
- Vertical line within bars of a stacked bar chart using recharts or highcharts
- Highcharts 6.0 Synchronization Bug
- Highcharts - append % to first axis label?
- Bar with negative stack and positive labels
- Using modified JS version in Highcharts to bring back the pre-3.0 export buttons
- Highcharts Legend titles changing after drilldown and back?
- How can I show all Timeline Highcharts data without any overlapping?
- Hiding items in highchart legend
- Highcharts: dynamically change the tooltip formatter?
- On Page With Numerous HighCharts, One Particular Chart Not Displaying.
- Highcharts tooltip is not working for large data
- Mootools Highcharts radio button toggle between charts, working jQuery version
- Highchart-graph does not appear in internet explorer