Can't get the chart working with dataset

I have next example data:

let dataArray = [
    {
        name: "room 1",
        tempdata: [
            { time: 1710584361161, temp: 21.1 },
            { time: 1710584371161, temp: 22.0 },
            { time: 1710584381161, temp: 21.5 }
        ]
    },
    {
        name: "room 2",
        tempdata: [
            { time: 1710584361161, temp: 19.2 },
            { time: 1710584371161, temp: 20.3 },
            { time: 1710584381161, temp: 18.9 }
        ]
    }
];

And then I use this function to format it:

let formattedData = dataArray.map(series => {
    return {
        topic: series.name,  // Label for the series
        payload: series.tempdata.map(point => ({
            x: new Date(point.time).toISOString(),  // Convert to UTC ISO string
            y: point.temp  // Temperature as y value
        }))
    };
});

msg.payload = formattedData;

So the data I send to the chart looks like this:

But the data doesn't get trough. All I see is this:

These are my chart settings:

How could one get that example data trough to a chart?

The dashboard 2 chart does not need the same x: .., y: .. formatted data as dashboard 1.

Instead you should aim for a flatter data structure like this (you see that data for the two lines do not need to be kept separate)

msg.payload = [
            { name: "room 1", time: 1710584361161, temp: 21.1 },
            { name: "room 2", time: 1710584361161, temp: 19.2 },
            { name: "room 1", time: 1710584371161, temp: 22.0 },
            { name: "room 2", time: 1710584371161, temp: 20.3 },
            { name: "room 1", time: 1710584381161, temp: 21.5 },
            { name: "room 2", time: 1710584381161, temp: 18.9 }
        ]
return msg;

If your data was sourced from an SQL database the query might be as simple as
SELECT name, time, temp FROM tablename

And the chart config is like this

I made this as my message:

But it didn't work.

I noticed that you have dropdown buttons here and I don't:

So I then updated to a newer version. And now I got a lot more options:

But still no data:

Since it was remembering the Y-scale, I deleted the chart object and made a new one. And now finally I get the data :smiley:

So thanks for you repply! I did earlier try this format also but didn't get it to work. The overall issue was that I had some old version.

Yes, after changing a dashboard widget you have to send an empty array to clear the chart, reload the browser tab, reload it with ctrl f5 or even clear the browser cache.
I think recent changes have improved the behaviour but it's best always to reload.