-
Notifications
You must be signed in to change notification settings - Fork 0
API Reference: Dashboard
Inherits from:
handle
obj = DashboardEngine(name, varargin)| Property | Default | Description |
|---|---|---|
| Name | '' |
|
| Theme | 'light' |
|
| LiveInterval | 5 |
|
| InfoFile | '' |
ADDPAGE Add a named page and make it the active page for addWidget. pg = d.addPage('Overview') creates a DashboardPage and appends it to Pages. Sets ActivePage to the last-added page index. When Pages is non-empty, addWidget routes to the active page.
SWITCHPAGE Switch the active page using panel visibility toggling. d.switchPage(2) sets ActivePage = 2 and toggles panel visibility.
Accept a pre-constructed widget object directly
ADDCOLLAPSIBLE Convenience: add a GroupWidget with Mode='collapsible'. w = d.addCollapsible('Sensors', {w1, w2}) w = d.addCollapsible('Sensors', {w1, w2}, 'Collapsed', true)
GETCACHEDTHEME Return cached theme struct, recomputing only when Theme changes.
PREVIEW Print ASCII representation of the dashboard to console. d.preview() % default 120 chars wide d.preview('Width', 120) % custom width
SHOWINFO Display the linked Markdown info file in a browser.
CLEANUPINFOTEMPFILE Delete the temporary HTML file if it exists.
REMOVEWIDGET Remove widget at given index and re-layout.
SETWIDGETPOSITION Set the grid position of a widget by index. Clamps width to grid columns and resolves overlaps with other widgets.
GETWIDGETBYTITLE Find a widget by its Title property. Returns the widget object, or empty if not found.
DETACHWIDGET Pop a widget out as a standalone figure window.
REMOVEDETACHED Remove stale mirrors from the registry.
SETCONTENTAREA Update the Layout content area. Provided so that DashboardBuilder can modify the layout without direct write-access to the Layout property (required for Octave compatibility).
RERENDERWIDGETS Delete all widget panels and recreate them.
UPDATEGLOBALTIMERANGE Scan all widgets for data time bounds.
UPDATELIVETIMERANGE Update DataTimeRange without resetting sliders. Called during live mode to expand the time range as data grows.
UPDATELIVETIMERANGEFROM Update DataTimeRange from pre-fetched widget list. Like updateLiveTimeRange but accepts ws to avoid re-fetching activePageWidgets().
BROADCASTTIMERANGE Push time range to widgets using global time.
RESETGLOBALTIME Re-attach all widgets to global time and apply.
REALIZEBATCH Render widgets in batches with drawnow between.
ONSCROLLREALIZE Realize widgets that scroll into view.
MARKALLDIRTY Flag all widgets as needing refresh. Called on theme change, figure resize, or other global state changes.
ONRESIZE Handle figure resize: reposition all widget panels.
WIDGETTYPES List supported widget type strings.
Inherits from:
handle
Provides drag/resize overlays, a widget palette sidebar, and a properties panel. Activated via the Edit button in DashboardToolbar.
builder = DashboardBuilder(engine); builder.enterEditMode(); builder.exitEditMode();
obj = DashboardBuilder(engine)| Property | Default | Description |
|---|---|---|
| IsActive | false |
|
| MockCurrentPoint | [] |
ADDICONCARD Add an IconCardWidget via the builder.
ADDCHIPBAR Add a ChipBarWidget via the builder.
ADDSPARKLINE Add a SparklineCardWidget via the builder.
Inherits from:
handle
Subclasses must implement: render(parentPanel) — create graphics objects inside the panel refresh() — update data/display (called by live timer) getType() — return widget type string (e.g. 'fastsense')
Subclasses must also provide a static fromStruct(s) method.
obj = DashboardWidget(varargin)| Property | Default | Description |
|---|---|---|
| Title | '' |
Widget title displayed in header |
| Position | [1 1 6 2] |
[col, row, width, height] in grid units |
| ThemeOverride | struct() |
Per-widget theme overrides (merged on top of dashboard theme) |
| UseGlobalTime | true |
false when user manually zooms this widget |
| Description | '' |
Optional tooltip text shown via info icon hover |
| Sensor | [] |
Sensor object for data binding (primary source) |
| ParentTheme | [] |
Theme inherited from DashboardEngine |
| Dirty | true |
true when widget needs refresh (data changed) |
| hPanel | [] |
Handle to the uipanel this widget renders into |
MARKDIRTY Flag this widget as needing a refresh.
MARKREALIZED Mark this widget as having been rendered.
MARKUNREALIZED Mark this widget as needing re-render.
Override in subclasses to respond to global time changes.
Override in subclasses to report data time range.
ASCIIRENDER Return ASCII representation of this widget. lines = asciiRender(obj, width, height) returns a cell array of strings, each exactly WIDTH characters. HEIGHT is the available number of lines. Default implementation shows [type] Title; subclasses override for richer content.
Inherits from:
DashboardWidget
Supports three data binding modes: Sensor: w = FastSenseWidget('Sensor', sensorObj) DataStore: w = FastSenseWidget('DataStore', dsObj) Inline: w = FastSenseWidget('XData', x, 'YData', y) File: w = FastSenseWidget('File', 'path.mat', 'XVar', 'x', 'YVar', 'y')
When bound to a Sensor, ThresholdRules apply automatically.
obj = FastSenseWidget(varargin)| Property | Default | Description |
|---|---|---|
| DataStoreObj | [] |
|
| XData | [] |
|
| YData | [] |
|
| File | '' |
|
| XVar | '' |
|
| YVar | '' |
|
| Thresholds | 'auto' |
|
| XLabel | '' |
X-axis label (auto-set from Sensor if empty) |
| YLabel | '' |
Y-axis label (auto-set from Sensor if empty) |
| YLimits | [] |
Fixed Y-axis range [min max]; empty = auto-scale |
| ShowThresholdLabels | false |
show inline name labels on threshold lines |
Re-render sensor-bound widgets so updated data + violations show. Preserves current zoom state (xlim) across the rebuild.
UPDATE Incrementally update sensor data without full axes rebuild. Uses FastSenseObj.updateData() to replace data and re-downsample, avoiding the expensive delete/recreate cycle of refresh(). Falls back to refresh() if FastSenseObj is not in a renderable state.
If xlim changed by user zoom/pan (not by setTimeRange), detach this widget from global time.
Inherits from:
DashboardWidget
w = GaugeWidget('Title', 'Pressure', 'ValueFcn', @() getPressure(), ... 'Range', [0 100], 'Units', 'bar'); w = GaugeWidget('Sensor', mySensor, 'Style', 'donut');
obj = GaugeWidget(varargin)| Property | Default | Description |
|---|---|---|
| ValueFcn | [] |
|
| Range | [] |
Empty default for auto-derivation cascade |
| Units | '' |
|
| StaticValue | [] |
|
| Style | 'arc' |
'arc', 'donut', 'bar', 'thermometer' |
Inherits from:
DashboardWidget
w = NumberWidget('Title', 'Temp', 'ValueFcn', @() readTemp(), 'Units', 'degC');
ValueFcn returns either: - A scalar (displayed as-is) - A struct with fields: value, unit, trend ('up'/'down'/'flat')
obj = NumberWidget(varargin)| Property | Default | Description |
|---|---|---|
| ValueFcn | [] |
function_handle returning scalar or struct |
| Units | '' |
unit label string |
| Format | '%.1f' |
sprintf format for value |
| StaticValue | [] |
fixed value (no callback needed) |
Inherits from:
DashboardWidget
Sensor-first: w = StatusWidget('Sensor', sensorObj);
Legacy (still supported): w = StatusWidget('Title', 'Pump 1', 'StatusFcn', @() 'ok');
obj = StatusWidget(varargin)| Property | Default | Description |
|---|---|---|
| StatusFcn | [] |
function_handle returning 'ok'/'warning'/'alarm' (legacy) |
| StaticStatus | '' |
fixed status string (legacy) |
Inherits from:
DashboardWidget
w = TextWidget('Title', 'Section A', 'Content', 'Sensor overview');
obj = TextWidget(varargin)| Property | Default | Description |
|---|---|---|
| Content | '' |
body text |
| FontSize | 0 |
0 = use theme default |
| Alignment | 'left' |
'left', 'center', 'right' |
Static widget — nothing to refresh
Inherits from:
DashboardWidget
w = TableWidget('Title', 'Sensor Data', 'DataFcn', @() getData()); w = TableWidget('Title', 'Static', 'Data', {{'A',1;'B',2}}, ... 'ColumnNames', {'Name','Value'}); w = TableWidget('Sensor', sensorObj); % last N data rows w = TableWidget('Sensor', sensorObj, 'Mode', 'events', 'EventStoreObj', store);
obj = TableWidget(varargin)| Property | Default | Description |
|---|---|---|
| DataFcn | [] |
|
| Data | {} |
|
| ColumnNames | {} |
|
| Mode | 'data' |
'data' or 'events' |
| N | 10 |
number of rows to display |
| EventStoreObj | [] |
EventStore for event mode |
Inherits from:
DashboardWidget
w = RawAxesWidget('Title', 'Histogram', ... 'PlotFcn', @(ax) histogram(ax, randn(1,1000)));
When bound to a Sensor, the PlotFcn receives (ax, sensor) or (ax, sensor, timeRange) depending on its nargin.
obj = RawAxesWidget(varargin)| Property | Default | Description |
|---|---|---|
| PlotFcn | [] |
@(ax) or @(ax, sensor[, tRange]) or @(ax, tRange) |
| DataRangeFcn | [] |
@() returning [tMin tMax] for global time range detection |
Inherits from:
DashboardWidget
Preferred: bind to an EventStore from the event detection system: w = EventTimelineWidget('Title', 'Events', 'EventStoreObj', store);
Legacy (still supported for backwards compatibility): w = EventTimelineWidget('Title', 'Events', 'EventFcn', @() getEvents()); w = EventTimelineWidget('Title', 'Events', 'Events', eventArray);
Events must be a struct array with fields: startTime, endTime, label, color (optional)
obj = EventTimelineWidget(varargin)| Property | Default | Description |
|---|---|---|
| EventStoreObj | [] |
EventStore handle — primary data source |
| Events | [] |
struct array of events (legacy) |
| EventFcn | [] |
function_handle returning events (legacy) |
| FilterSensors | {} |
Cell array of Sensor names to filter |
| ColorSource | 'event' |
'event' or 'theme' |
SAVE Write dashboard config as a MATLAB function file. The output is a function returning a DashboardEngine.
SAVEJSON Write dashboard config struct to JSON file. Handles both single-page (widgets field) and multi-page (pages field). Widgets/pages may have heterogeneous fields, so encode each entry individually and assemble the JSON array by hand.
LOAD Load dashboard config from file. For .m files: uses feval to execute the function and return the engine. For .json files: uses legacy JSON parsing.
LOADJSON Legacy: read dashboard config from JSON file.
WIDGETSTOCONFIG Build a config struct from widget objects.
DashboardSerializer.config = widgetsPagesToConfig(name, theme, liveInterval, pages, activePage, infoFile)
WIDGETSPAGESTOCONFIG Build a multi-page config struct from page objects. pages is a cell array of DashboardPage objects. activePage is the Name string of the active page.
CONFIGTOWIDGETS Create widget objects from config struct. configToWidgets(config) — no sensor resolution configToWidgets(config, resolver) — resolver is a function handle @(name) that returns a Sensor object by name.
CREATEWIDGETFROMSTRUCT Create a single widget from a struct.
EXPORTSCRIPT Generate a readable .m script from config.
EXPORTSCRIPTPAGES Generate a MATLAB function file from a multi-page config. The output is a function returning a DashboardEngine so that DashboardEngine.load() can use feval(funcname) to reconstruct it. Emits d.addPage('Name') + d.switchPage(N) before each page's widget block so that addWidget routes to the correct page.
EMITCHILDWIDGET Emit .m constructor lines for a child widget. Used by DashboardSerializer.save() to emit child code for GroupWidget children. Children are created by constructor, not d.addWidget(). Returns the generated code lines, the variable name assigned, and the updated groupCount (in case the child is itself a GroupWidget).
Inherits from:
handle
Converts widget grid positions [col, row, width, height] to normalized canvas coordinates [x, y, w, h]. Handles overlap resolution, row calculation, and scrollable canvas when content exceeds the viewport.
obj = DashboardLayout(varargin)| Property | Default | Description |
|---|---|---|
| Columns | 24 |
|
| TotalRows | 4 |
|
| ContentArea | [0 0 1 1] |
|
| Padding | [0.02 0.02 0.02 0.02] |
|
| GapH | 0.008 |
|
| GapV | 0.015 |
|
| RowHeight | 0.22 |
|
| ScrollbarWidth | 0.015 |
|
| OnScrollCallback | [] |
function handle: @(topRow, bottomRow) |
| DetachCallback | [] |
function handle: @(widget) — set by DashboardEngine |
| VisibleRows | [1 Inf] |
[topRow bottomRow] currently visible |
| hFigure | [] |
Figure handle for popup dismiss callbacks |
| hInfoPopup | [] |
Handle to active info popup uipanel (at most one) |
CANVASRATIO Ratio of canvas height to viewport height. Returns 1 when content fits, >1 when scrolling is needed.
COMPUTEPOSITION Convert grid position to canvas-normalized coords.
CANVASSTEPSIZES Grid step sizes in canvas-normalized coords.
FIGURETOCANVASDELTA Convert figure-normalized deltas to canvas deltas.
ALLOCATEPANELS Create viewport, canvas, scrollbar and placeholder panels. Like createPanels but does NOT call widget.render(). Instead, each widget gets its hPanel assigned and a placeholder label.
REALIZEWIDGET Render a single widget into its pre-allocated panel.
CREATEPANELS Create and render all widget panels (legacy path).
Re-run layout after dynamic changes (e.g., group collapse/expand). Tears down and recreates all panels, calling render() on each widget.
ONSCROLL Adjust canvas position from scrollbar value. val=1 shows top, val=0 shows bottom.
COMPUTEVISIBLEROWS Derive visible row range from scroll position.
ISWIDGETVISIBLE Check if widget rows overlap visible range + buffer.
OPENINFOPOPUP Open a modal figure window showing widget Description.
CLOSEINFOPOPUP Close and delete the active info popup panel.
ONFIGURECLICKFORDISMISS Dismiss popup if click was outside the popup panel.
ONKEYPRESSFORDISMISS Dismiss popup when Escape is pressed.
Inherits from:
handle
Provides buttons for: Live mode toggle, Edit mode, Save, Export. Sits at the top of the dashboard figure.
obj = DashboardToolbar(engine, hFigure, theme)| Property | Default | Description |
|---|---|---|
| Height | 0.04 |
SETLASTUPDATETIME Update the last-update label with a timestamp.
Inherits from:
DashboardWidget
obj = BarChartWidget(varargin)| Property | Default | Description |
|---|---|---|
| DataFcn | [] |
@() struct('categories',{},'values',[]) |
| Orientation | 'vertical' |
'vertical' or 'horizontal' |
| Stacked | false |
Inherits from:
DashboardWidget
Displays N colored circle icons with labels in a compact horizontal strip. Designed as a dense multi-sensor status overview at a glance.
obj = ChipBarWidget(varargin)CHIPBARWIDGET Construct a ChipBarWidget with optional name-value pairs.
| Property | Default | Description |
|---|---|---|
| Chips | {} |
Cell array of chip structs (label, statusFcn, sensor, iconColor) |
RENDER Draw all chips in a single shared axes inside parentPanel.
REFRESH Update chip circle colors from statusFcn or sensor state.
GETTYPE Return widget type string.
TOSTRUCT Serialize widget to struct for JSON export.
FROMSTRUCT Reconstruct ChipBarWidget from a saved struct.
Inherits from:
handle
Each DashboardPage holds a list of widgets to be rendered when the page is active. DashboardEngine maintains a Pages cell array of DashboardPage objects and routes addWidget() to the active page.
obj = DashboardPage(name)DASHBOARDPAGE Construct a named page container. pg = DashboardPage() creates page with Name = '' pg = DashboardPage('Name') creates page with given Name
| Property | Default | Description |
|---|---|---|
| Name | '' |
|
| Widgets | {} |
ADDWIDGET Append widget w to the Widgets list. pg.addWidget(w) appends w to obj.Widgets.
TOSTRUCT Serialize the page to a struct with name and widgets fields. s = pg.toStruct() returns s.name (char) and s.widgets (cell).
Inherits from:
handle
DetachedMirror wraps a cloned DashboardWidget in a standalone MATLAB figure window. The clone is produced via toStruct/fromStruct with post- clone live-reference restoration for FastSenseWidget and RawAxesWidget.
The mirror is NOT a DashboardWidget subclass — it wraps one. It belongs to DashboardEngine.DetachedMirrors and is ticked by the engine's existing LiveTimer via the engine's onLiveTick() loop.
Usage (called internally by DashboardEngine.detachWidget()): theme = DashboardTheme(obj.Theme); cb = @() obj.removeDetached(mirror); mirror = DetachedMirror(originalWidget, theme, cb);
Properties (SetAccess = private): hFigure — standalone MATLAB figure window handle hPanel — full-figure uipanel that hosts the cloned widget Widget — cloned DashboardWidget instance RemoveCallback — @() called by onFigureClose() before delete(hFigure)
obj = DetachedMirror(originalWidget, themeStruct, removeCallback)DETACHEDMIRROR Create a detached live-mirror window for originalWidget.
TICK Refresh the cloned widget; no-op if figure is stale.
ISSTALE Return true when the mirror's figure has been closed or destroyed.
Inherits from:
DashboardWidget
DividerWidget renders a horizontal colored line using the theme's WidgetBorderColor (or a custom Color override). It is a static widget with no data binding.
obj = DividerWidget(varargin)DIVIDERWIDGET Construct a DividerWidget. obj = DividerWidget() creates with defaults. obj = DividerWidget('Thickness', 2, 'Color', [1 0 0]) sets props.
| Property | Default | Description |
|---|---|---|
| Thickness | 1 |
Relative line thickness (1=thin, 2=medium, 3=thick) |
| Color | [] |
RGB override; empty = use theme WidgetBorderColor |
RENDER Create the divider line inside parentPanel. render(obj, parentPanel) creates a uipanel that acts as a horizontal colored line centered vertically in the panel.
REFRESH No-op for static widget.
GETTYPE Return widget type string.
ASCIIRENDER Return ASCII representation of the divider. First line is a row of dashes; remaining lines are blank.
TOSTRUCT Serialize to struct. Omits 'thickness' at default (1) and 'color' when empty.
FROMSTRUCT Reconstruct DividerWidget from serialized struct.
Inherits from:
DashboardWidget
obj = GroupWidget(varargin)| Property | Default | Description |
|---|---|---|
| Mode | 'panel' |
'panel', 'collapsible', 'tabbed' |
| Label | '' |
Title shown in header bar |
| Collapsed | false |
Collapsed state (collapsible mode only) |
| Children | {} |
Cell array of DashboardWidget (panel/collapsible) |
| Tabs | {} |
Cell array of struct('name','...','widgets',{{}}) |
| ActiveTab | '' |
Current tab name (tabbed mode) |
| ChildColumns | 24 |
Sub-grid column count |
| ChildAutoFlow | true |
Auto-arrange children |
| ReflowCallback | [] |
Callback invoked after collapse/expand (injected by DashboardEngine) |
Check nesting depth for GroupWidget children
GETTIMERANGE Aggregate time range from all children and tabs.
Inherits from:
DashboardWidget
obj = HeatmapWidget(varargin)| Property | Default | Description |
|---|---|---|
| DataFcn | [] |
function_handle returning matrix |
| Colormap | 'parula' |
colormap name or Nx3 matrix |
| ShowColorbar | true |
|
| XLabels | {} |
cell array of axis labels |
| YLabels | {} |
cell array of axis labels |
Inherits from:
DashboardWidget
obj = HistogramWidget(varargin)| Property | Default | Description |
|---|---|---|
| DataFcn | [] |
|
| NumBins | [] |
empty = auto |
| ShowNormalFit | false |
|
| EdgeColor | [] |
RGB or empty for default |
Inherits from:
DashboardWidget
Displays a state-colored circle icon at the left, a primary numeric value in the center, and a secondary label below the value. Icon color reflects the current threshold state (ok/warn/alarm/info/inactive).
obj = IconCardWidget(varargin)ICONCARDWIDGET Construct an IconCardWidget with optional name-value pairs.
| Property | Default | Description |
|---|---|---|
| IconColor | 'auto' |
RGB triplet or 'auto' (derive from state) |
| StaticValue | [] |
Fixed static value (number) |
| ValueFcn | [] |
Function handle returning scalar or struct |
| StaticState | '' |
'ok','warn','alarm','info','inactive','' |
| Units | '' |
Display units string |
| Format | '%.1f' |
sprintf format for numeric value |
| SecondaryLabel | '' |
Subtitle text below primary value |
RENDER Create icon, value text, and label inside parentPanel.
REFRESH Update icon color, value display, and label.
GETTYPE Return widget type string.
TOSTRUCT Serialize widget to struct for JSON export.
FROMSTRUCT Reconstruct IconCardWidget from a serialized struct.
Inherits from:
DashboardWidget
obj = ImageWidget(varargin)| Property | Default | Description |
|---|---|---|
| File | '' |
Path to image file (PNG, JPG) |
| ImageFcn | [] |
function_handle returning image matrix |
| Scaling | 'fit' |
'fit', 'fill', 'stretch' |
| Caption | '' |
html = MarkdownRenderer.render(mdText) html = MarkdownRenderer.render(mdText, themeName) html = MarkdownRenderer.render(mdText, themeName, basePath)
Converts a subset of Markdown to a self-contained HTML document.
Supported: headings (#-###), bold, italic, inline code,
fenced code blocks, [links](url), , unordered/ordered
lists, horizontal rules (---), tables (pipe-delimited), and paragraph
breaks.
The optional themeName ('light', 'dark', etc.) controls the CSS color scheme. Unrecognized themes default to 'light'.
Inherits from:
DashboardWidget
obj = MultiStatusWidget(varargin)| Property | Default | Description |
|---|---|---|
| Sensors | {} |
Cell array of Sensor objects |
| Columns | [] |
Grid columns (empty = auto) |
| ShowLabels | true |
|
| IconStyle | 'dot' |
'dot', 'square', 'icon' |
Fully override — does not use base Sensor property
Inherits from:
DashboardWidget
obj = ScatterWidget(varargin)| Property | Default | Description |
|---|---|---|
| SensorX | [] |
Sensor for X axis |
| SensorY | [] |
Sensor for Y axis |
| SensorColor | [] |
Optional: color-code by third sensor |
| MarkerSize | 6 |
|
| Colormap | 'parula' |
SparklineCardWidget --- KPI card combining a big-number display with a mini sparkline chart and delta indicator.
Inherits from:
DashboardWidget
w = SparklineCardWidget('Title', 'CPU', 'StaticValue', 42.0, ... 'SparkData', cpuHistory, 'Units', '%');
The card is divided into three zones: Top row — title (left) and delta indicator (right) Middle — large primary value Bottom — sparkline mini-chart (bottom 35% of card)
Data binding (three-path, resolved in priority order): 1. Sensor — uses Sensor.Y for both value and sparkline 2. ValueFcn — function_handle returning scalar or struct 3. StaticValue + SparkData — static numeric value with separate sparkline vector
Properties: StaticValue — fixed scalar value ValueFcn — function handle returning scalar or struct(.value, .unit) Units — display unit string Format — sprintf format for primary value (default '%.1f') NSparkPoints — number of tail points shown in sparkline (default 50) ShowDelta — show delta indicator (default true) DeltaFormat — sprintf format for delta (default '%+.1f') SparkColor — sparkline line color; empty => theme.DragHandleColor SparkData — numeric vector for sparkline (used when no Sensor)
obj = SparklineCardWidget(varargin)SPARKLINECARDWIDGET Construct a SparklineCardWidget. Accepts name-value pairs for any public property.
| Property | Default | Description |
|---|---|---|
| StaticValue | [] |
Fixed scalar value displayed in the card |
| ValueFcn | [] |
Function handle returning scalar or struct |
| Units | '' |
Unit label appended to primary value |
| Format | '%.1f' |
sprintf format string for primary value |
| NSparkPoints | 50 |
Number of tail data points in sparkline |
| ShowDelta | true |
Whether to show the delta indicator |
| DeltaFormat | '%+.1f' |
sprintf format string for delta value |
| SparkColor | [] |
Sparkline line color (empty = theme default) |
| SparkData | [] |
Numeric vector for sparkline (alternative to Sensor) |
RENDER Create all graphics objects inside parentPanel.
REFRESH Update displayed value, sparkline, and delta indicator.
GETTYPE Return widget type string.
TOSTRUCT Serialize widget to a struct for JSON export.
FROMSTRUCT Deserialize a SparklineCardWidget from a struct.
FastSense Wiki
API Reference
Guides
Use Cases
Internals
Resources