IMD SolutionComputing LibraryShop main store

Troubleshooting

Why a Node-RED dashboard chart ignores extra y axes

Edge computing and IIoT Published 7 min read By IMD Solution engineering team

Short answer

The dashboard chart node consumes msg.topic and msg.payload and has exactly one y-axis; msg.yAxis is not a field it reads, and the scales from ui_control appear but carry no data because no dataset is bound to them. Build the multi-axis trend in a ui_template node where each dataset carries a yAxisID matching a scale id, thin the browser feed, and keep full-rate history in InfluxDB and Grafana.

On this page
  1. What the chart node really reads from your messages
  2. Work through these checks in order
  3. Why the extra axes render but the series stays on the first one
  4. Bind each dataset to its scale in a template chart
  5. What the full-rate stream costs the PC
  6. The decision for this panel
  7. Questions asked

Your series lands on the first axis because the dashboard chart node has exactly one y-axis and no way to send a series to another one. The three scales your ui_control message creates are real — you watched them render — but defining a scale is not binding a dataset to it, and msg.yAxis is a property the node never reads. That is a limitation of the ui_chart node itself, not a mistake in your options block. The working fix is to draw the chart from a ui_template node with Chart.js, where each dataset names its scale, and to split the load: a thinned feed to the browser, full-rate history to InfluxDB and Grafana. The checks below run in order, the template shows the exact binding, and the arithmetic at the end sizes what 30 sensors at 4 Hz cost the PC.

What the chart node really reads from your messages #

The live chart input defines a series by its msg.topic and appends the number in msg.payload. The static array form carries series, data and labels. That is the whole contract: one dataset per stable topic, every dataset on the same single vertical scale, and nowhere in either format to express a scale binding. A field like msg.yAxis is extra weight the node discards on arrival, which is why series C stays on the first axis no matter what you set it to.

Series identity rides on the same fields, so a topic that drifts between messages of one signal spawns phantom series instead of extending the right line; the variant where one series swallows the whole stream and the chart flattens is covered in why a Node-RED dashboard chart flattens to a straight line.

Work through these checks in order #

  1. Reconcile the channel count first. The groups you list add to 20 + 3 + 3 + 1 = 27 named signals; find the remaining channels in the PLC read configuration before any axis grouping means anything.
  2. Watch the raw input with a debug node: one array per read, constant length, steady cadence. Compare the observed read rate with the configured acquisition rate before touching the chart.
  3. Map every array position to a signal name, engineering unit and quantity. A value that maps nowhere gets dropped or flagged, never charted as zero: a failed read and a true zero are different facts.
  4. Stamp each value with the acquisition time from the PLC read, not the moment it reached Node-RED; queuing skews arrival times and drags the apparent phase between signals.
  5. Send the ui_control configuration once from an inject node, never from the data path, and note whether the freezes stop. That separates the options block from the message rate as the trigger.
  6. Audit the axis table against intent: the scale you assigned to temperature carries the label for flow, and speed has no scale at all.
  7. Split any freeze into browser and runtime. If the editor stays responsive and the flows keep running while only the dashboard tab locks, the render path is the suspect; open that browser's console first. The page-death case is covered in why a Node-RED dashboard page goes blank in the browser.

Why the extra axes render but the series stays on the first one #

ui_control reaches the chart and merges your options block into its configuration, so the three scales appear — that part works. But the message only touches options. The datasets are rebuilt by the chart node from msg.topic and msg.payload, and the node attaches no scale reference to any of them. In Chart.js, a dataset with no scale binding falls back to the first vertical scale, which is exactly where your series C lands.

Binding lives in the dataset configuration, not in options and not in the message: the documented dataset property is yAxisID, set to the id string of a scale. ui_control cannot add it, because options and datasets are separate parts of the chart configuration. No message shape you can post to this node closes the gap, and the standing answer to this request is that the ui_chart node does not support multiple y-axes.

Bind each dataset to its scale in a template chart #

A ui_template node gives you the chart object directly. The combination that works for a fast live trend is Chart.js for drawing, Luxon with its Chart.js adapter for time handling, and the Chart.js streaming plugin for the scrolling live buffer; load all of them in the template. The scales block below is written in the array style your ui_control message already uses; newer Chart.js releases define scales as named objects instead, so match the block to the major version your template actually loads.

<canvas id='trend'></canvas>
<script>
  // created once, after the chart libraries have loaded
  var chart = new Chart(document.getElementById('trend'), {
    type: 'line',
    data: { datasets: [
      { label: 'Pressure',    yAxisID: '1', data: [] },
      { label: 'Temperature', yAxisID: '2', data: [] },
      { label: 'Flow',        yAxisID: '3', data: [] },
      { label: 'Speed',       yAxisID: '4', data: [] }
    ] },
    options: {
      animation: { duration: 0 },
      scales: { yAxes: [
        { id: '1', scaleLabel: { display: true, labelString: 'pressure [bar]' },
          ticks: { min: -10, max: 10, stepSize: 2 } },
        { id: '2', scaleLabel: { display: true, labelString: 'Temperature [°C]' },
          ticks: { min: 0, max: 20, stepSize: 4 } },
        { id: '3', scaleLabel: { display: true, labelString: 'Flow [L/min]' },
          ticks: { min: 0, max: 20, stepSize: 4 } },
        { id: '4', scaleLabel: { display: true, labelString: 'Speed' },
          ticks: { } }
      ] }
    }
  });
</script>

Each dataset now names its scale through yAxisID, the property your ui_control message could never set. The table is the corrected axis plan, with the label mix-up fixed and a fourth scale for speed whose tick range stays empty so it auto-scales:

Scale id Quantity Label Ticks
1 pressure pressure (bar) min -10, max 10, step 2
2 temperature Temperature (°C) min 0, max 20, step 4
3 flow Flow (L/min) min 0, max 20, step 4
4 speed Speed empty, auto-scale

Feed the template from the function node upstream, one message per group, and route inside the template script. The field names in the snippet are this example's own; your function node decides what they are called:

// msg.group (text) selects the dataset, msg.stamp (epoch ms) is the acquisition time
var groupAxis = { Pressure: 0, Temperature: 1, Flow: 2, Speed: 3 };
chart.data.datasets[groupAxis[msg.group]].data.push({ x: msg.stamp, y: msg.payload });
chart.update('none');

With the streaming plugin loaded, the plugin keeps and discards the scrolling window itself; manual trimming only matters without it.

What the full-rate stream costs the PC #

Work the load from the rates. One PLC read per cycle returns the whole 30-value array, so at 4 Hz the stream is 4 × 30 = 120 values/s; formatted as one message per value, that is 120 chart messages/s. Over a 10 s window that is 120 × 10 = 1,200 points, which matches the count measured on this panel. A five-minute window (300 s) at that rate holds 120 × 300 = 36,000 points in the browser, and if the chart redraws per message the canvas refreshes up to 120 times/s over that buffer.

Throttle before the chart instead of after. One update per series per second cuts the feed by three quarters, and a five-minute window then holds 30 × 300 = 9,000 points instead of 36,000. Nothing is lost for analysis, because the full-rate stream still reaches the historian: batch-write every read into InfluxDB with its acquisition timestamps and draw the long windows in Grafana.

That pairing — InfluxDB as the store, Grafana for history — is a common choice for plant data collection, and the selection reasoning is on the page about choosing pymodbus, InfluxDB and Grafana for SCADA. The capacity side is worked through in sizing a self-hosted Node-RED, InfluxDB and Grafana historian.

Keep Grafana for history and the template chart for the live panel: a Grafana view that re-queries at the full read rate is the heavier instrument for a moving trend. And if the dashboard PC also runs the historian and sits near its CPU ceiling, move the historian stack onto its own fanless mini PC and leave the operator station drawing only.

The decision for this panel #

  • Standard chart node: keep it for single-scale views; it cannot display a second y-axis, and no message field will change that.
  • Live multi-axis trend: ui_template with Chart.js, one dataset per quantity group, each bound by yAxisID to its scale id — pressure on 1, temperature on 2, flow on 3, speed on a new fourth id with auto-scale ticks.
  • Feed rates: browser chart at one update per series per second; every sample reaches InfluxDB at the read rate; Grafana draws the long history windows.
  • Freezes: configuration sent once from an inject node; browser console against runtime logs decides whether the render path or Node-RED itself is stalling.
  • Keep the chart display-only. Nothing in the control path may read from the dashboard or act on what the browser shows; a trend that drives a decision about the process travels through the runtime, not through a web page.

Questions asked

Can the standard dashboard chart node ever display a second y-axis?

No. The chart node renders one y-axis, builds its datasets from topic and payload, and offers no message field that assigns a series to a scale. ui_control options can restyle the single axis you already have. For two or more scales, draw the chart from a template node, or check the release notes of your dashboard package for documented multi-axis support before counting on an upgrade.

Which Chart.js property ties a line to one of the extra scales?

The dataset property yAxisID. Set it to the id string you gave the scale in the configuration; a dataset without it falls back to the first vertical scale. The property is documented in Chart.js, but the shape of the surrounding scales block differs by release: older versions take an array of scale objects, each carrying its own id, newer versions use scales named directly in the configuration. Match your template to whichever shape its loaded version documents.

Why did Node-RED freeze right after sending the ui_control message?

Treat it as a symptom to split, not a verdict on the options block. If the Node-RED editor and the flows keep running while only the dashboard tab locks up, the browser rendering path is carrying the load; open that browser's console first. If the editor itself stops responding and the runtime log goes quiet, the problem is on the Node-RED side. Send the configuration once from an inject node and watch which side stalls.

Should the browser chart double as the plant historian?

No. The browser chart is presentation: a short rolling window drawn in the operator's browser, and it is gone when the page closes. The historian keeps every sample of every read with its acquisition timestamp, so hour-long and week-long windows, comparisons and exports remain possible after the fact. Write the full-rate stream into InfluxDB and draw history in Grafana; keep the template chart for the live panel only.

Keep reading

  • How-to

    Auto restart Node-RED in Docker after exit code 255

    Run the container with `--restart unless-stopped` so Docker restarts Node-RED on its own whenever the process exits with code 255, while a deliberate stop still holds. Then set the console log level in `/data/settings.js` to `debug` until one failure is captured, because exit 255 names an abnormal end, not the fault.

    Edge computing and IIoT

  • Troubleshooting

    Fixing MQTT cloud broker data not reaching SCADA tags

    Get the gate right first: MQTT over TLS belongs on port 8883, with the TLS mode and client identity the broker actually requires. An independent client such as MQTT Explorer on the same PC proves only its own settings, not the driver's. If the driver cannot perform the service-specific handshake Azure IoT Hub needs, no tag mapping will ever fill.

    Edge computing and IIoT

  • 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

Using AF templates to monitor tags across multiple PI historians