Hello there,
New to Node Red and I'm trying to plot quadratic equation using function below:
// Quadratic coefficients
const a = 1;
const b = -2;
const c = 1;
// Generate data points
const points = [];
for (let x = -10; x <= 10; x += 0.5) {
const y = a * x * x + b * x + c;
points.push({ x: x, y: y });
}
// Format for ui_chart (Dashboard 2.0)
msg.payload = [
{
label: "y = ax² + bx + c",
data: points
}
];
return msg;
problem with plotting with ui_chart. it doesn't accept data as array but it can only read data in object pair of { x: x, y: y } with only plot one point. how can I plot whole graphic for x =-10 to 10 using ui_chart?