# Quadratic equation plot with ui\_chart - Dashboard 2.0

**URL:** <https://discourse.nodered.org/t/quadratic-equation-plot-with-ui-chart-dashboard-2-0/99579>\
**Category:** Dashboard\
**Created:** [4 November 2025 11:41 UTC](https://discourse.nodered.org/t/quadratic-equation-plot-with-ui-chart-dashboard-2-0/99579 "2025-11-04T11:41:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mahmoud\_S](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@Mahmoud\_S](https://discourse.nodered.org/u/Mahmoud_S)\
**Post date:** [4 November 2025 11:41 UTC](https://discourse.nodered.org/t/quadratic-equation-plot-with-ui-chart-dashboard-2-0/99579/1 "2025-11-04T11:41:01Z")

</div>

Hello there,

New to Node Red and I'm trying to plot quadratic equation using function below:

```auto
// 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?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [4 November 2025 11:57 UTC](https://discourse.nodered.org/t/quadratic-equation-plot-with-ui-chart-dashboard-2-0/99579/2 "2025-11-04T11:57:45Z")

</div>

> [@Mahmoud\_S](#):
>
> it doesn't accept data as array

Sure it does. Just put your data in the shape expected as per several of the documented examples in the [online documentation](https://dashboard.flowfuse.com/).

Try this (untested)

```auto
// 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 });
}

msg.payload = points
return msg;

```

Be sure to set the label in the chart edit panel (or use dynamic props as described in docs)

also, set the x to come from `key`.`x` and y to come from `key`.`y`

---

<div class="post-metadata">

**Author:** ![Mahmoud\_S](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@Mahmoud\_S](https://discourse.nodered.org/u/Mahmoud_S)\
**Post date:** [4 November 2025 12:26 UTC](https://discourse.nodered.org/t/quadratic-equation-plot-with-ui-chart-dashboard-2-0/99579/3 "2025-11-04T12:26:46Z")

</div>

> [@Steve-Mcl](#):
>
> ```auto
> 
> ```

Great, this is exactly what I needed.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [18 November 2025 12:27 UTC](https://discourse.nodered.org/t/quadratic-equation-plot-with-ui-chart-dashboard-2-0/99579/4 "2025-11-18T12:27:21Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
