Skip to content

Add datetime X-axis support#2

Merged
HanSur94 merged 6 commits into
masterfrom
feature/datetime-axis
Mar 6, 2026
Merged

Add datetime X-axis support#2
HanSur94 merged 6 commits into
masterfrom
feature/datetime-axis

Conversation

@HanSur94
Copy link
Copy Markdown
Owner

@HanSur94 HanSur94 commented Mar 6, 2026

Summary

  • Add XType property ('numeric' or 'datenum') to FastPlot with auto-detection of MATLAB datetime objects
  • Add zoom-aware tick formatting: adapts between mmm dd HH:MM, HH:MM, and HH:MM:SS based on visible range
  • Update toolbar crosshair and data cursor to display datetime-formatted X values
  • Add datetime example to example_toolbar.m and README documentation

Test Plan

  • test_datetime passes — XType property, datenum detection, datetime auto-convert, tick label formatting, zoom format change, toolbar formatX
  • All 18 existing test suites pass (no regressions)

🤖 Generated with Claude Code

HanSur94 and others added 6 commits March 7, 2026 00:07
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@HanSur94 HanSur94 merged commit b518700 into master Mar 6, 2026
HanSur94 added a commit that referenced this pull request Apr 23, 2026
…ooks, time axis, axis labels (#62)

* fix(quick-260423-q3v-01): add title rendering to 5 chart widgets

- BarChart/Histogram/Scatter/Heatmap/Image widgets now render Title on axes
- Uses canonical title block from RawAxesWidget (fg color + WidgetTitleFontSize)
- ImageWidget keeps axes invisible but forces title Visible='on'

* fix(quick-260423-q3v-02): IconCardWidget Tag branch falls back to Tag.Y(end)

- valueAt(now) returns [] when Tag.X is seconds (not serial date)
- Added Tag.Y(end) fallback mirroring the Sensor branch
- Preserves Units inheritance block unchanged

* fix(quick-260423-q3v-03): ImageWidget uses imagesc with explicit colormap for 2D data

- Branch on ndims(imgData)==2: imagesc+parula for matrices, image() for RGB
- image() was clipping scalar-field matrices to colormap 1..64, rendering a dark block
- Title kept visible in refresh() too (idempotent with render() setting)
- Scaling property untouched (API compat)

* fix(quick-260423-q3v-04): add SizeChangedFcn+relayout_ to 7 pixel-dependent widgets

- ChipBar/IconCard/MultiStatus/Number/Sparkline/Status/Text now rescale on resize
- relayout_ tears down uicontrols+axes children and re-renders (idempotent)
- try/catch guards SizeChangedFcn for Octave versions that reject it
- New private methods block added to SparklineCardWidget and TextWidget

* fix(quick-260423-q3v-05): human-readable time-axis labels via formatTimeAxis_

- FastSenseWidget: call formatTimeAxis_ after fp.render() in render/rebuildForTag_
  and after updateData() in refresh/update paths
- EventTimelineWidget: call formatTimeAxis_ at end of refresh()
- Helper converts numeric seconds to HH:MM:SS (range >= 1h) or MM:SS (< 1h)
  via datestr(xt/86400, fmt); no-op for ranges <= 300s
- Cosmetic-only: underlying numeric X data untouched, zoom may regenerate
  numeric ticks (known limitation)

* fix(quick-260423-q3v-06): ScatterWidget auto-derives xlabel/ylabel from SensorX/SensorY

- refresh() now calls xlabel/ylabel after plot when SensorX/SensorY set
- axisLabelForSensor_ helper builds 'Name (Units)' with graceful Key/empty fallback
- No-op when sensors unset (preserves current behavior)

* fix(widgets): title re-apply in refresh + thermometer aspect ratio

BarChartWidget.refresh and HistogramWidget.refresh now re-apply the
title after bar()/plot() calls. Those plot commands internally call
newplot which clears the axes title, so the render-time title was
being wiped the moment data rendered.

GaugeWidget.renderThermometer drops the fixed DataAspectRatio [1 2 1]
and widens its axes Position ([0.15 0.10 0.7 0.80]) so the thermometer
fills a narrow 4-column panel instead of cramping the bulb, value, and
min/max labels on top of each other.

Follow-up to quick-task 260423-q3v audit bugs.

* fix(IconCardWidget): stop self-erasing Tag via Sensor alias

The constructor's "if Tag is set, clear Sensor" block was destructive:
after Phase 1011 migrated Sensor to a Dependent alias for Tag (see
DashboardWidget.set.Sensor), `obj.Sensor = []` resolves to
`obj.Tag = []` and wipes the Tag we just assigned. The refresh loop
then hits the empty-Tag branch and the widget shows "--" forever,
even with a fully populated SensorTag bound.

This was the real root cause of bug #2 in the widget audit — the
valueAt(now)/Y(end) fallback I added in quick-260423-q3v-02 never
ran because Tag was already empty by the time refresh fired.

Kept the Threshold clear (Threshold is a real independent property).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant