Open tlebreton opened 3 years ago
Do you handle correctly a regression with two value axis or not?
No, I'm afraid.
It will work only on regularly spaced data items.
We'll need to update the docs. Sorry for the confusion.
Hi
Ok it's not a real problem :)
Do you think that in the future you will implement this kind of regression ? I think it will be more usefull that the "regression" that is allready implemented
Thanks for the answer.
There's no plan for that, but who knows :)
I'm gonna leave this open for now.
I've also been looking for the ability to add trend lines to a scatter / bubble chart with multiple series
If anyone (maybe @ChazUK) is interested in a simple solution I used ml-regression-simple-linear
to calculate the linear regression of my scatter charts:
import SimpleLinearRegression from 'ml-regression-simple-linear';
// ...
if (graphData.length > 1) {
const x = graphData.map(({ x }) => x);
const y = graphData.map(({ y }) => y);
const regression = new SimpleLinearRegression(x, y);
var fixedLinearRegression = chart.series.push(new am4charts.LineSeries());
fixedLinearRegression.data = [
{ x: x[0], y: regression.predict(x[0]) },
{ x: x[x.length - 1], y: regression.predict(x[x.length - 1]) },
];
fixedLinearRegression.dataFields.valueX = "x";
fixedLinearRegression.dataFields.valueY = "y";
fixedLinearRegression.strokeWidth = 2;
fixedLinearRegression.stroke = am4core.color("#ff6860");
fixedLinearRegression.name = "Linear Regression";
}
before:
after:
Hi
I got a question about the regression plugin.
With a very simple graph i don't understand the equation result.
The result of the equation is strange for me. I expect to get this result :
In debugging the result i found that the point are strange :
It appears to me that the x value is ignored and replace by the index of the array which doesn't make sense to me.
In the docs there is this sentence :
Do you handle correctly a regression with two value axis or not?