-
Notifications
You must be signed in to change notification settings - Fork 5
DRAFT | SystemLink Data Frames Data Source | Enable high resolution zoom for numerical data in Plotly panel #364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| processedQuery.columns = replaceVariables(processedQuery.columns, this.templateSrv); | ||
| const properties = await this.getTableProperties(processedQuery.tableId); | ||
|
|
||
| this.initializeFetchHighResolutionData( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "Plotly" panel is updated to handle zoom based on the query params state.
Hence, when the dashboard is loaded for the first time, the query params need to be updated.
I've added this here because this was the only place in the data source where both query and request values are available.
| const xField = columns[0].name; | ||
| const xMin = queryParams[`${xField}-min`]; | ||
| const xMax = queryParams[`${xField}-max`]; | ||
| if ( xMin !== '' && xMax !== '') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the user zooms in plot, the "Plotly" panel will update the query params and trigger a whole dashboard refresh.
Those range values are used to form filters for the query decimated data API call.
| const queryParams = locationService.getSearchObject(); | ||
| const fetchHighResolutionDataOnZoom = queryParams['fetchHighResolutionData']; | ||
|
|
||
| if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When fetchHighResolutionDataOnZoom is enabled in a panel, and if the user zooms in plot, the "Plotly" panel will update the query params and trigger a whole dashboard refresh.
We need to refresh the dashboard as a whole because there aren't any out-of-the-box APIs available to handle this in any other optimised way.
Pull Request
🤨 Rationale
👩💻 Implementation
Problem
Grafana’s architecture strictly separates the panel and data source plugins. Communication is one-way: data flows from the data source to the panel, not the other way around.
Data sources are responsible for fetching data based on the query model (query object) and the time range. Only changes to the query model (via the Query Editor or dashboard variables) or the time range picker can trigger new queries.
Panels are responsible for visualizing data. They receive data from the data source and render it, but do not control how or when the data source fetches data.
Updates in UI
Renames the "Use time range" control as "Fetch high resolution data" to have that as a common control for both TIMESTAMP and numerical types of data.
Future UI update plans
There will be a new control added to choose the "xColumn" for decimation. Currently assumed that the "xColumn" as the first column selected in the "Columns" control.
Solution
fetchHighResolutionData=1,2.Issues which are yet to be fixed
As we refresh the whole page while zooming, the scroll position is lost.
🧪 Testing
To be updated in the production version of the PR.
✅ Checklist