IMD SolutionComputing LibraryShop main store

Troubleshooting

Why a Node-RED dashboard chart flattens to a straight line

Edge computing and IIoT Published 5 min read

Short answer

Two separate faults produce this symptom. The Node-RED container ran six hours off the controller clock because it applies a different timezone label to the shared host clock; set the TZ environment variable and recreate the container. The flatten on reopen is the dashboard chart losing its stored points at restore, reproduced in three cleared browsers, so persist the chart data with a save-and-reload subflow instead of rebuilding the chart each time.

On this page
  1. Separate the two faults first
  2. Give the container the right timezone label
  3. Rule the browser out, then stop
  4. Read the runtime versions from the startup log
  5. Persist the chart points across a reopen
  6. Questions asked

A Node-RED chart that plots correctly when you build it and collapses to a straight line after you close and reopen the dashboard is failing at chart-state restore, not in the browser and not in the OPC UA data path. The reported installation ran Node-RED 1.2.6 with node-red-dashboard 2.25.0 in Docker on an edge controller, and it carried two separate faults: the container ran six hours off the controller clock, and the chart lost its stored series at every reopen. Fix the clock first, because every timestamp the chart stores inherits it, then persist the chart points across a reopen instead of rebuilding the chart every shift. The checks below separate the two faults and end with the decision for each.

Separate the two faults first #

Work from reported observations before touching configuration. The table lists what the reported installation showed and what each result supports; the numbers are that installation's, not tolerances that transfer to every controller.

Check Reported result What it supports
Controller terminal date output Matched local wall-clock time The controller clock is healthy
Container time Six hours off the controller Two timezone labels, not two clocks
Rebuilt chart Plotted the live OPC UA value Server, subscription and data path are healthy
Dashboard reopened Chart flattened every time The restore of stored chart state
Browsers after a cache clear Firefox, Chrome and Edge identical Browser cache ruled out
Same flow on Windows Plotted correctly Flow logic ruled out

A rebuilt chart that plots the live value also separates this fault from the one where a Node-RED OPC UA server updates values only when a client reads; that fault draws stale values, never a flat line, and it is covered in Why a Node-RED OPC UA server updates values only when a client reads.

Give the container the right timezone label #

A container has no clock of its own: it reads the kernel clock of the machine it runs on and applies a timezone label of its own, defaulting to UTC. With Docker on the controller, controller and container read one kernel clock, so any gap between them is two labels, not two clocks, on the same reasoning as Node-RED in Docker uses the host clock, not its own time. Node-RED's Docker guide documents the TZ environment variable for exactly this label: set it to your IANA zone name when the container is created, for example docker run -e TZ=Europe/Berlin -p 1880:1880 nodered/node-red, then recreate the container. A variable added to an already-running container never reaches its runtime.

  1. Run date on the controller terminal and note the time and zone suffix.
  2. Note the timestamp Node-RED puts on a debug message received at the same moment, or the time in the startup log.
  3. Subtract one from the other and write the gap down.
  4. Set TZ to your zone at container creation and recreate the container.
  5. Compare again. With both sides on one kernel clock, matching labels must give matching times.

Worked example, with times chosen to reproduce the reported gap: the controller terminal reads 14:20 on a summer afternoon, Germany on CEST, which is UTC+2, and the Node-RED log stamps the same event 08:20. Offset = 14:20 - 08:20 = 6 hours. Two views of one kernel clock that far apart means the container applies a label six hours behind the controller's, for example a zone at UTC-4 against the controller's UTC+2. A container left in plain UTC would sit only one hour behind in winter and two in summer, so a gap that size was already a sign that the label pointed at the wrong zone, not merely at a default.

Decision: set TZ to your IANA zone at container creation and recreate the container; on one kernel clock that closes the gap completely. If a gap survives, the variable never reached the runtime, so confirm the environment entry and recreate again. When Node-RED in Docker runs on a separate host instead of the controller, compare the host clock with the controller over NTP before blaming the container.

Rule the browser out, then stop #

The flatten survived a cache clear in Firefox, Google Chrome and Microsoft Edge; three independent renders of the same restored state drew the same wrong line. A client-side cache fault does not behave that way, so for this installation the browser is ruled out. Decision: stop clearing caches and re-testing browsers. The fault follows the chart node's restore, so the remaining checks are the runtime versions and the stored state, not the client.

Read the runtime versions from the startup log #

The Node-RED startup log prints the Node-RED, Node.js and dashboard versions in one place when the runtime starts; read all three from that line. The reported installation ran Node-RED 1.2.6 with node-red-dashboard 2.25.0, and its Node.js version stayed unidentified because the controller shell had no node command; inside a container, the startup log is the source that always works. The versions matter because the flatten matches what the dashboard project's issue tracker records for this chart family: chart data does not survive a restart or a page reopen on its own, and issue 1362 on the tracker records a subflow that saves the chart data and reloads it after a restart, reported working.

Persist the chart points across a reopen #

While the page stays open, the chart node holds the series in the Node-RED runtime and the browser only draws what arrives; the flatten appears when the page reloads and the node rebuilds its stored state. With the clock fixed, the stored timestamps are trustworthy, so give the restore something correct to rebuild from: keep every arriving point in storage that survives a restart and replay the stored series into the chart node when Node-RED starts or when the dashboard first reconnects.

Decision: rebuilding the chart is not a fix, because in the reported case the fresh plot lasted exactly until the next reopen. Persist the points with the save-and-reload subflow pattern from issue 1362, or move the runtime to a current Node-RED and dashboard release and re-run the acceptance test on your own versions: build the chart, close the dashboard, reopen, and confirm the full series redraws.

Questions asked

How do I tell a timezone fault from a real clock fault?

A timezone fault produces a gap that is a whole number of hours and does not drift, because the container reads the same host clock under a different label. A clock fault is wrong by an arbitrary amount and drifts with uptime. Watch which pattern your installation shows over a day: a gap stable to the minute points at the timezone label, creeping error points at the host clock and its time source.

How do I get the Node.js version when the controller shell has no node command?

Read all three versions from the Node-RED startup log, which prints the Node.js, Node-RED and dashboard versions when the runtime starts. If the log is not at hand, open a shell inside the running container and run node -v there. The controller's own shell needs no Node.js installation for that to work, which is why the controller terminal alone could not answer it in the reported case.

Can a browser extension or a cached page cause the flat chart?

In the reported installation, no: Firefox, Google Chrome and Microsoft Edge all reproduced the flatten after their caches were cleared. If your case differs and one browser draws correctly while another flattens, re-test the failing browser with extensions disabled and a fresh profile before blaming the dashboard node, because a client-side fault always stays inside one client.

What exactly should the save-and-reload subflow store?

Each point as a timestamp and value pair, written to a context store configured for file storage so it survives a Node-RED restart. On startup, or on the first dashboard connection after a reload, replay the stored pairs into the chart node in time order. The subflow reported working in the dashboard issue tracker performs exactly this save-then-replay round trip for the classic chart.

Why does the same flow work on Windows but not on the controller?

The flow is the same and the fresh chart proves the data path, so the variable is the runtime. On Windows, Node-RED runs directly on the operating system clock with the system timezone and without a container layer, so neither the timezone-label fault nor the same restore path exists in the same form. Compare runtimes, not flows, when one flow behaves differently on two systems.

Keep reading

  • Troubleshooting

    Node-RED in Docker uses the host clock, not its own time

    A Docker container does not keep its own clock: it reads the host Linux kernel's system time. Set the time inside Node-RED's container and you change the controller clock, not a container clock. Compare date -u on host and container, correct the controller's time synchronization, then check the timestamp field feeding the chart.

    Edge computing and IIoT

  • Troubleshooting

    Fix empty pin dropdowns in Node-RED RevPi nodes

    The pin list in the RevPi nodes is served by the separate noderedrevpinodes-server systemd unit, not by the Node-RED runtime. Start and enable that unit, save the PiCtory layout as start-config in physical module order, confirm node-red-contrib-revpi-nodes at 1.0.6 or newer, and restart the server before the nodered service. If pins vanish after the first read, re-configure the DIO inputs in PiCtory and reboot.

    Edge computing and IIoT

  • Troubleshooting

    Why S7 nodes disappear from the Node-RED palette

    Installing an S7 package such as node-red-contrib-s7 can break another package's startup registration, which empties its node types out of the Node-RED palette; the flows and the S7-1200 are untouched. Compare the installed-package list and startup log against your baseline, reinstall the missing package through the deployment's supported method, restart and hard-refresh, then set the S7-1200's PUT/GET permission, rack and slot, and a non-optimized test block.

    Edge computing and IIoT