Skip to content

feat(dialog-sdk): interactive zoom on ChartPreviewWidget with onChartViewChanged event#57

Merged
pabloinigoblasco merged 1 commit into
developmentfrom
feat/dialog-sdk-chart-zoom
Apr 15, 2026
Merged

feat(dialog-sdk): interactive zoom on ChartPreviewWidget with onChartViewChanged event#57
pabloinigoblasco merged 1 commit into
developmentfrom
feat/dialog-sdk-chart-zoom

Conversation

@pabloinigoblasco
Copy link
Copy Markdown
Collaborator

@pabloinigoblasco pabloinigoblasco commented Apr 15, 2026

Motivation

In PJ 3.x, the FFT toolbox has a "Only data in zoomed area" mode where the user zooms in the embedded input chart and the FFT recalculates using only the visible range. The current Dialog SDK has ChartPreviewWidget for embedded charts, but it is static — no zoom, no pan, no events.

This PR adds interactive zoom to ChartPreviewWidget so plugins can replicate this behavior: the user zooms in the embedded chart, the plugin receives onChartViewChanged(), and reacts accordingly.

Summary

  • WidgetData::setChartZoomEnabled(name) — plugin declares which charts should be interactive
  • ChartPreviewWidget::setZoomEnabled() — enables rubber band zoom + mouse wheel zoom
  • viewChanged() signal emitted on zoom/pan with the new axis range
  • WidgetEventBuilder::chartViewChanged(x_min, x_max, y_min, y_max) — event JSON
  • WidgetEvent::chartViewChanged() — parser with ChartViewState struct
  • DialogPluginTyped::onChartViewChanged() — virtual for the plugin to override
  • widget_binding wires viewChanged to the event callback in connectWidgetSignals()

Test plan

  • Build pj_plugins — no compile errors
  • Set setChartZoomEnabled("my_chart") — chart becomes zoomable (rubber band + wheel)
  • Zoom the chart — onChartViewChanged fires with correct axis range
  • Chart without setChartZoomEnabled — remains static (unchanged behavior)

@pabloinigoblasco pabloinigoblasco force-pushed the feat/dialog-sdk-chart-zoom branch from f6b8d95 to ef0a4c1 Compare April 15, 2026 22:32
@pabloinigoblasco pabloinigoblasco merged commit 75be7e3 into development Apr 15, 2026
2 checks passed
@pabloinigoblasco pabloinigoblasco deleted the feat/dialog-sdk-chart-zoom branch May 4, 2026 12:36
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