# Help chart multiple series. Migration code D1 to D2

**URL:** <https://discourse.nodered.org/t/help-chart-multiple-series-migration-code-d1-to-d2/89328>\
**Category:** Dashboard\
**Tags:** dashboard-2\
**Created:** [7 July 2024 08:11 UTC](https://discourse.nodered.org/t/help-chart-multiple-series-migration-code-d1-to-d2/89328 "2024-07-07T08:11:48Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![joepavitt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/joepavitt/32/59722_2.png) [@joepavitt](https://discourse.nodered.org/u/joepavitt)\
**Post date:** [9 July 2024 08:58 UTC](https://discourse.nodered.org/t/help-chart-multiple-series-migration-code-d1-to-d2/89328/4 "2024-07-09T08:58:52Z")

</div>

Just to provide a cleaner (Dashboard 2.0) approach to this, no need to have multiple arrays/structures:

```auto
var i = 0;
var data = []

while (i < 360) {
    data.push({
        label: i,
        "Axe X": msg.payload.data.x_axis.axis_data[(i)],
        "Axe Y": msg.payload.data.y_axis.axis_data[(i)],
        "Axe Z": msg.payload.data.z_axis.axis_data[(i)],
    })
    i++;
}
msg.payload = data
return msg;

```

Then, on the `ui-chart` node, define the `x` `key` as `label`, then the "Series" property can be "JSON", and you can provide an array of strings here `["Axe X", "Axe Y", "Axe Z"]`, then it will draw the three lines for you

---

_[View the full topic](https://discourse.nodered.org/t/help-chart-multiple-series-migration-code-d1-to-d2/89328)._
