Feature Request: Expose Visible X Range (Min/Max) After Zoom or Pan
- Dominant language
- Dart
- Stars
- 7.6k
- Forks
- 2k
- Avg merge
- 9d 1h
- Merged PRs (30d)
- 2
Description
I'm working with fl_chart and using zooming and panning on a LineChart. However, there's currently no public method or callback to get the minimum (or maximum) visible X value or index after the user zooms or pans. This makes it difficult to sync data across charts or load additional data dynamically based on what's currently visible.
I’d like to request a feature that allows retrieving the visible X-axis range, specifically:
Minimum and maximum visible X values (or indexes).
Possibly via a callback or method (e.g., onViewportChanged, or TransformationController or something similar).
Or a getter on the controller/LineChart that reflects the current viewport bounds.
I considered:
Estimating the visible range manually using the zoom and offset values, but those are not exposed publicly in a reliable way.
Using touch callbacks, but they only provide touch positions, not the viewport state.
Forking the library and exposing internal state, but that's not ideal for long-term maintenance.
This feature would be useful for:
Implementing "infinite scrolling" charts.
Syncing multiple charts based on current view.
Displaying labels or data summaries for the visible region only.
Thank you!
Contributor guide
Research direction
The issue names LineChart zooming and panning, and suggests a TransformationController or viewport callback, but it identifies no files or tests. Start by tracing the LineChart viewport state and existing zoom/pan entry points; done means a documented public API exposes the current minimum and maximum visible X value or index after viewport changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100