Description:
Polynomial regression fails when any point has a y-axis value of 0.
Steps to reproduce:
Configure Chart with the following data:
$(function() { $('#container').highcharts({ chart: { type: 'scatter' }, legend: { verticalAlign: 'top', }, series: [{ regression: true, regressionSettings: { type: 'polynomial', order: 2 }, data: [ [1, 50], [5,0], [10, 50] ] }] }); });
Actual Result:
A linear line with the equation of y=0x^x + 0x +50 is drawn
Expected Result:
A polynomial regression curve with the equation of y=2.5x^2 -27.5x + 75 should be drawn
Demo:
http://jsfiddle.net/snoopliving/jxfgst4q/6/
Cause:
Issue is most likely caused at the following line:
https://github.com/streamlinesocial/highcharts-regression/blob/master/highcharts-regression.js#L397