BarChart Block
Visualizes data as bars
Open BarChart in BlockWerk →# BarChart Block
Description
The BarChart block renders an array of scalar values as a vertical bar chart, updating in real time during simulation. Each element of the input array is displayed as a separate bar, allowing instant visual comparison of multiple signal values side by side.
Typical uses include monitoring the magnitude of a multi-channel signal at a snapshot in time, comparing actuator commands across multiple axes, or displaying the frequency components of a discretised spectrum vector.
Parameters
labels
Comma-separated category labels assigned to each bar (e.g. A,B,C,D). The number of labels should match the length of the input array; surplus labels are ignored and missing labels fall back to their index.
colors
Comma-separated CSS colour values (hex or named) applied to each bar in order (e.g. #ff6384,#36a2eb,#cc65fe,#ffce56). Surplus colours are cycled; missing colours reuse the last defined value.
Examples
Comparing four motor currents
Mux(4) → BarChart
Connect four scalar current signals into a Mux block set to 4 channels, then feed its array output to the BarChart. Set labels to M1,M2,M3,M4.
Visualising FFT magnitude bins
FFT → BarChart
Drive the BarChart directly from the array output of an FFT block to display the amplitude spectrum.
Remarks
- Sink block: BarChart has no output ports. It is a terminal display node and does not feed any downstream computation.
- Array input: The single input port expects an array (vector) signal. Scalar signals must be packed into an array first (e.g. via a Mux block).
- Label/colour count: If the input vector length changes at runtime, extra bars appear using cycled colours and numeric index labels.
- Live update: The chart redraws every simulation step, so it reflects the instantaneous value of the input array at each time point.
See Also
- Histogram: Displays the statistical distribution of a data set rather than per-element values.
- XYPlot: Plots two scalar signals against each other in a phase-plane view.
- uPlotDisplay: Time-series scope for continuous waveform monitoring over a simulation run.