[Feature] Sticky X-Axis Labels with Vertical Scroll on Y-Axis
- Dominant language
- TypeScript
- Stars
- 67.3k
- Forks
- 19.8k
- Avg merge
- 11d 14h
- Merged PRs (30d)
- 8
Description
### What problem does this feature solve?
The feature of sticky X-axis labels would address a usability challenge in charts with a scrollable Y-axis, particularly when working with large datasets. When users scroll vertically through the chart, the X-axis labels (typically displayed at the top) are no longer visible, making it difficult to correlate data points with their respective X-axis values. This can be especially problematic for line charts, bar charts, or time-series data, where the X-axis represents categories or time periods. By keeping the X-axis labels fixed at the top while scrolling the Y-axis, users can maintain a clear and consistent reference for the data, improving the ease of interpretation and making it simpler to correlate data points with their respective labels. This feature would significantly enhance the user experience, particularly in charts with extensive data, by allowing users to better understand trends and relationships without losing track of the key axis information.
### What does the proposed API look like?
The proposed API for enabling sticky X-axis labels in ECharts would introduce a new option under the xAxis configuration, such as `stickyXAxis: true`. When this option is enabled, the X-axis labels would remain fixed at the top of the chart even as the user scrolls vertically through the Y-axis. This behavior would work similarly to the CSS `position: sticky`, where the labels stay in place while the rest of the chart content scrolls. Additionally, a customizable `stickyXAxisOffset` option could allow users to adjust the positioning of the sticky labels, for example, to account for other UI elements like headers or toolbars. The feature would seamlessly integrate with existing chart settings and work with different chart types, such as line, bar, or scatter charts. It would be especially useful in scenarios where large datasets require vertical scrolling, as it would help users maintain a clear reference to the X-axis values while interpreting the data. To ensure smooth performance, this feature would need to be optimized to handle charts with many data points, preventing reflows or performance issues during scrolling. Overall, this simple addition would improve the user experience by allowing users to always see the X-axis labels, making it easier to correlate data points with their corresponding labels.
Contributor guide
Assessment
This issue has not been assessed yet.