Skip to content

Conversation

@Ahalya-ni
Copy link
Collaborator

@Ahalya-ni Ahalya-ni commented Dec 18, 2025

🤨 Rationale

Task 3654861: Update Plotly component to add query params and refresh the dashboard

To sync x-axis range in the URL query parameters when a user zooms or pans a numerical X-axis.

Please refer to HLD for further details.

👩‍💻 Implementation

  • Created events.ts to store the NIRefreshDashboardEvent class.
  • Introduced conditional updating URL params that check if the current panel is listed in the nisl-syncXAxisRangeTargets URL parameter before applying updates.
  • publishXAxisRangeUpdate uses useMemo because it memoizes the debounced function instance across re-renders. useCallback would create a new debounced function each render, breaking the debouncing behaviour.
  • Added debounced URL parameter updates to prevent excessive writes during user interactions.
  • X-axis range values are standardized to 6-decimal precision.
  • Integrated locationService and related dependencies to enable URL parameter manipulation.
  • Published NIRefreshDashboardEvent to trigger data refresh across all panels, after URL query parameter updates.

🧪 Testing

Test coverage is currently scoped to the newly introduced X-axis URL parameter synchronization feature. Additional test cases for existing functionality are tracked under a Technical Debt 3638375: Add unit tests for the Plotly panel component

✅ Checklist

Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
@Ahalya-ni Ahalya-ni changed the title Implement X-axis zoom synchronization via URL parameters feat(plotly): Implement X-axis zoom synchronization via URL parameters Dec 19, 2025
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
@kartheeswaran-ni kartheeswaran-ni changed the title feat(plotly): Implement X-axis zoom synchronization via URL parameters feat(plotly): Sync x-axis range in URL query params when panelId is available in syncXAxisRangeTargets Jan 14, 2026
@kartheeswaran-ni kartheeswaran-ni changed the title feat(plotly): Sync x-axis range in URL query params when panelId is available in syncXAxisRangeTargets feat(plotly): Sync numerical x-axis range in URL query params Jan 14, 2026
@kartheeswaran-ni kartheeswaran-ni changed the title feat(plotly): Sync numerical x-axis range in URL query params feat(plotly): sync numerical x-axis range in URL query params Jan 14, 2026
@Ahalya-ni Ahalya-ni marked this pull request as ready for review January 19, 2026 09:22
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds X-axis range synchronization to URL query parameters for the Plotly panel component. When users zoom or pan a numerical X-axis, the range is synced to the URL, enabling coordinated behavior across multiple panels and dashboard refresh triggers.

Changes:

  • Introduced NIRefreshDashboardEvent for triggering dashboard-wide data refreshes
  • Added debounced X-axis range synchronization to URL parameters with 6-decimal precision
  • Implemented conditional synchronization based on panel IDs specified in nisl-syncXAxisRangeTargets URL parameter

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 11 comments.

File Description
src/panels/plotly/events.ts New event class for publishing dashboard refresh events
src/panels/plotly/PlotlyPanel.tsx Core implementation of X-axis range synchronization with URL parameter management and debouncing
src/panels/plotly/PlotlyPanel.test.tsx Comprehensive test suite for X-axis range synchronization feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kartheeswaran-ni
Copy link
Collaborator

Please resolve the Copilot comments.

@rajsite
Copy link
Member

rajsite commented Jan 20, 2026

As mentioned in the Grafana Discussions channel Grafana Ownership has transitioned to NIR.

Just to make sure notifications are properly enabled I'll explicitly mention @kkerezsi and @saradei-ni as the primary owners in the @ni/grafana-codeowners-team. Please give them patience as they ramp up and can give Owners review.

… into users/ahalya/feat/high-res/plotly-introduce-xaxis-params
@Ahalya-ni
Copy link
Collaborator Author

Hi @kkerezsi @saradei-ni, gentle reminder to review this PR. Happy to provide any context if that would help with the review. Thanks!

@Ahalya-ni Ahalya-ni merged commit 5f251a1 into main Jan 27, 2026
2 checks passed
@Ahalya-ni Ahalya-ni deleted the users/ahalya/feat/high-res/plotly-introduce-xaxis-params branch January 27, 2026 09:39
robert-bob-1 pushed a commit that referenced this pull request Jan 27, 2026
## [4.119.0](v4.118.0...v4.119.0) (2026-01-27)

### Features

* **plotly:** sync numerical x-axis range in URL query params ([#637](#637)) ([5f251a1](5f251a1))
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.

5 participants