I have a chart that makes a highcharts regression polynomial line and I need the equation.
The problem is that the equation shows :
0x2 + 0x + 29.93
The correct must be : −0.0000357x2+0.0048927x+28.9340796
when I change the :
decimalPlaces: 4,
it only change in R and R2.
How can I change the decimals in que equation formula or have the individual parts of the regression equation with decimals ?
Thanks
Code: Select all
$(function() {
$('#container').highcharts({
chart: {
type: 'scatter', //spline
zoomType: 'xy',
events: {
load: function() {
let chart = this;
console.log(chart.legend.allItems[1].name);
output = chart.legend.allItems[1].name;
console.log(output)
}
}
},
title: {
text: 'Polynomial regression - with extrapolation and different style'
},
subtitle: {
text: 'Grupo BME '
},
xAxis: {
title: {
enabled: true,
text: 'Caudal (l/m)'
},
startOnTick: true,
endOnTick: true,
showLastLabel: true
},
yAxis: {
title: {
text: 'Altura (mt)'
}
},
legend: {
layout: 'vertical',
align: 'left',
verticalAlign: 'top',
x: 100,
y: 70,
floating: true,
backgroundColor: '#FFFFFF',
borderWidth: 1
},
plotOptions: {
scatter: {
marker: {
radius: 5,
states: {
hover: {
enabled: true,
lineColor: 'rgb(100,100,100)'
}
}
},
states: {
hover: {
marker: {
enabled: false
}
}
},
tooltip: {
headerFormat: '<b>{series.name}</b><br>',
pointFormat: '{point.x} l/m, {point.y} mt'
}
}
},
series: [{
regression: true,
regressionSettings: {
type: 'polynomial',
order: 2,
lineWidth: 5,
decimalPlaces: 4,
name: "%eq | r2: %r",
//name: 'equat'+'%eq' +'r:'+ '%r'+'r2:'+ '%r2',
hideInLegend: false ,
color: 'rgba(223, 183, 83, .9)',
dashStyle: 'dash'
},
name: 'Test input',
color: 'rgba(223, 83, 83, .5)',
data: [
[925.5,2],
[912,3.8],
[889.5,4.8],
[876,6.3],
[725.25,14.3],
[583.5,20.5],
[447.75,23.5],
[391.5,24.8],
[230.25,28],
[144,28.5],
[58.5,29.3],
[0.2,29.3],
]
}]
});
});