feat(dialog-sdk): interactive zoom on ChartPreviewWidget with onChartViewChanged event#57
Merged
Merged
Conversation
…ViewChanged event
f6b8d95 to
ef0a4c1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
ChartPreviewWidgetfor embedded charts, but it is static — no zoom, no pan, no events.This PR adds interactive zoom to
ChartPreviewWidgetso plugins can replicate this behavior: the user zooms in the embedded chart, the plugin receivesonChartViewChanged(), and reacts accordingly.Summary
WidgetData::setChartZoomEnabled(name)— plugin declares which charts should be interactiveChartPreviewWidget::setZoomEnabled()— enables rubber band zoom + mouse wheel zoomviewChanged()signal emitted on zoom/pan with the new axis rangeWidgetEventBuilder::chartViewChanged(x_min, x_max, y_min, y_max)— event JSONWidgetEvent::chartViewChanged()— parser withChartViewStatestructDialogPluginTyped::onChartViewChanged()— virtual for the plugin to overridewidget_bindingwiresviewChangedto the event callback inconnectWidgetSignals()Test plan
pj_plugins— no compile errorssetChartZoomEnabled("my_chart")— chart becomes zoomable (rubber band + wheel)onChartViewChangedfires with correct axis rangesetChartZoomEnabled— remains static (unchanged behavior)