Open nimesh1997 opened 5 years ago
There is too much content above, let me summarize it.
I dont need this anymore, but it seems unfair that so long has passed and this issue has not been solved. Maybe I'll try and provide my implementation to close this issue soon
I tried the idea by @Abhilash-Chandran and it almost worked, but I was having an issue where most of the time it wouldn't detect the horizontal drag, probably due to the LineChart
taking priority. The modification I came up with was just using the touchCallBack
property in LineTouchData
to handle the dragging event instead of putting it in GestureDetector
:
touchCallback: (touchEvent, lineTouchRsp) {
if (touchEvent is FlPanUpdateEvent) {
setState(
() {
var dx = touchEvent.details.delta.dx;
if (dx != 0) {
if (dx.isNegative) {
minX += (maxX - minX) * 0.01;
maxX += (maxX - minX) * 0.01;
} else {
minX -= (maxX - minX) * 0.01;
maxX -= (maxX - minX) * 0.01;
}
}
},
);
}
},
I tried the idea by @Abhilash-Chandran and it almost worked, but I was having an issue where most of the time it wouldn't detect the horizontal drag, probably due to the
LineChart
taking priority. The modification I came up with was just using thetouchCallBack
property inLineTouchData
to handle the dragging event instead of putting it inGestureDetector
:touchCallback: (touchEvent, lineTouchRsp) { if (touchEvent is FlPanUpdateEvent) { setState( () { var dx = touchEvent.details.delta.dx; if (dx != 0) { if (dx.isNegative) { minX += (maxX - minX) * 0.01; maxX += (maxX - minX) * 0.01; } else { minX -= (maxX - minX) * 0.01; maxX -= (maxX - minX) * 0.01; } } }, ); } },
other solution would be to use onScaleUpdate
for both scaling and panning instead of two competing GestureDetecotors
I wanted to share my hacky workaround for making the chart zoomable and placing the (bottom) titles above the chart to be able to show whatever additional data.
It's not the most elegant solution, but maybe it can help someone else out there. bases on older solutions of @theovogel here and @techhouse here
minimal demo: repo
I use this to display week ticks across the chart, like so.
cheers :vulcan_salute:
hey. gays! It's already 2024, why don't fix this issue
@wuao kind of tall order for a one-man open source project, hm?.. see my post just before (!) yours for a solid workaround
感谢您的来信!请您有事去我的新博客:[恒星]http://my.oschina.net/wuao/blog生命不灭的恒星 当梦想擦撞到现实 请不要轻言放弃!
One of the biggest flaws of Flutter is the lack of official support (monetary) to such great plugins I'm going to start a Flutter Fund to support libraries like this Until then to speed up things and to make the whole community benefit from the solution I'm donating 100$ to who ever fix this issue Pinch zoom in & out, Horizonal scroll Mouse scroll for desktop No hacks, compete integration
Let me know when the PR is ready Cheers!
感谢您的来信!请您有事去我的新博客:[恒星]http://my.oschina.net/wuao/blog生命不灭的恒星 当梦想擦撞到现实 请不要轻言放弃!
I'm donating 100$ to who ever fix this issue
Willing to add another 100€/$ into the pool.
@imaNNeo Interested in doing this for the sake of code quality?
OMG ... 5 years passed...
Bar chart is very compact in nature if there are many values on the x-axis. How to make it less compact if there are so many values on x-axis. I want it to horizontal scrollable?