All the examples present in the docs squish all the data points into the available width. Sometimes the number of data points are far too great to even be readable on the chart, thus warranting being the ability to scroll.
I hacked a way to make the the chart horizontally scrollable based off the minWidth property of the ResponsiveContainer primitive. I had to wrap this primitive in a div with className "overflow-x-auto" to allow scroll. I also used a useEffect to set the scrollPosition to the center, because the legend was being scrolled as well and I wanted it initially visible.
Ideally, I want the legend to be fixed and only the actual chart (the data) to be scrolled.
I think there should be an easier way to handle this kind of responsiveness. Maybe there is a simpler way than what I did. Please comment if there a better way of doing this!
This issue has been automatically closed because it received no activity for a while. If you think it was closed by accident, please leave a comment. Thank you.
Feature description
All the examples present in the docs squish all the data points into the available width. Sometimes the number of data points are far too great to even be readable on the chart, thus warranting being the ability to scroll.
I hacked a way to make the the chart horizontally scrollable based off the minWidth property of the ResponsiveContainer primitive. I had to wrap this primitive in a div with className "overflow-x-auto" to allow scroll. I also used a useEffect to set the scrollPosition to the center, because the legend was being scrolled as well and I wanted it initially visible.
Ideally, I want the legend to be fixed and only the actual chart (the data) to be scrolled.
I think there should be an easier way to handle this kind of responsiveness. Maybe there is a simpler way than what I did. Please comment if there a better way of doing this!
Affected component/components
Chart
Additional Context
No response
Before submitting