Dashboard 2 line chart confusion

This is a chart produced with a snippet of the sample chart flow from @joepavitt

If I change the name of the sample data "time" field to "timestamp", "tim" or "anniversary" and change the chart node to match


then I get a blank chart. The X axis labels are different too.

What's going on?
The X axis type is still "Timescale".
Can it be that the chart node only attempts to interpret X values as a date/time if they are called "time"?

That shouldnt be an issue - can you share a small array of sample data that you're using please?

Or is it literally the same data I inject in the example, but the key's string is changed?

One thing I could think of, is can you send an empty array to your chart first please? Then inject the new data with your updated key?

Not at laptop to be able to test this theory, but i can only think that the chart node has persisted the original data points youve sent where time is the key used, and then its added more points with timestamp (or other key name) and its trying to render all of them

After deleting all Dashboard 2 elements from Node-red and clearing the browser cache...

  1. It seems to be impossible once deployed to change the X (or Y?) key field in a chart config.
    eg You have a working temperature/time chart and copy/paste the widget to make a speed/time chart. Deploy before changing the key field from "temperature" to "speed". This new chart does not work, it remains loyal to "temperature" regardless of changes in the config.
    The issue persists after clearing the browser cache.

  2. It's a mistake to copy the format hint in the config
    image
    If your X key is msg.payload.timestamp you need to put timestamp in there.

  3. I see that if I import @joepavitt's flow multiple times, using "import copy" (because I've imported it, broken it, imported again...) I get multiple copies of the ui-page "Discourse Forums" and the ui-group "Chart Examples".
    Shouldn't it put a copy of the imported nodes into the already existing ui-page and ui-group?

  4. Selecting a MySQL DATETIME field returns eg 2024-07-06T15:00:00.000Z and the chart does understand this as a datetime.
    But with SQLite, a DATETIME field (which is stored as type affinity NUMERIC?) returns 2024-07-06 16:00:00.000 - the ISO8601 string format - and this string, though it's supposed to be an international standard format, is not understood by the chart widget despite it expecting a Timescale X axis.
    One SQLite workaround is select strftime("%Y-%m-%dT%H:%M:%SZ", timestamp) as timestamp,. Not ideal.

Good feedback - the purpose of the hint was to show that you can pass a single object, or an array of objects, but I agree. It's misleading and over-complicating. Will address it in the week for the next release

We just pass the value straight into a JavaScript Date object when youve selected "Timescale", I will look into whether there are alternayive approaches here so that we can support this.

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