Skip to content
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

ondragstart and ondragend callbacks prevent scrolling on touch devices #215

Closed
sandrolino opened this issue May 5, 2014 · 15 comments
Closed
Labels
C-bug Category: This is a bug R-needs-docs Request for changes: The PR needs documentation resolved maybe

Comments

@sandrolino
Copy link

I noticed that c3js graphs disable somewhat scrolling on touch devices, probably due to their interactivity.
Disabling Tooltip still results in interactivity when hovering over data points.
Is there away to completely disable hovering over data points (i.e an svg) such that scrolling works on c3js graph works also on touch devices ?

Thanks for your help.
s

@masayuki0812
Copy link
Member

Hi @sandrolino , I'll check this. Please give me some time.

@masayuki0812
Copy link
Member

Hi @sandrolino , I added interaction.enabled option. By setting false, it is possible to disable all of interactions on chart and enables to scroll on touch device. Could you try this option?

The latest version 0.1.37 does not include this commit, so please use the latest code from github repository.

@masayuki0812
Copy link
Member

Hi @sandrolino , I updated the version to 0.1.38 that includes this commit. Please try this solution on that version. Thank you.

@adrianbj
Copy link

Hi there,

interaction: {
    enabled: false
}

works for me as far as making scrolling on touch devices work, but I'm afraid I really don't see it as a good enough solution for my needs as I need to keep the interaction functional. I know this is a tricky problem to deal with, but there are some scripts out there that are designed to detect tap vs swipe. At a minimum, I think the interaction.enabled option needs the possibility to ignore on non-touch devices. The other thing I noticed is that with it set to false, the c3-event-rect-x items are not created. I interact with these programmatically, so removing completely makes interaction.enabeled: false not an option unfortunately.

Thanks for considering :)

@moklick
Copy link

moklick commented Jan 8, 2015

It would be very helpful if you could add something like swipe detection. By doing this we could interact with the charts even on mobile devices. Right now we have project where we have several charts in an article. Users can't scroll on the charts, so we have to disable interaction which is sad, because interaction works great on mobile devices.

@aendra-rininsland
Copy link
Member

I started a new issue about this recently (since closed) due to having not noticed this one. I'm moving discussion to this thread (and reopening) because there's been more work done here.

Important point from #798: the problem is in the ondragstart and ondragend callbacks. Disabling those on ln. 233 in interaction.js fixes the scrolling issue while preserving interactivity.

@aendra-rininsland aendra-rininsland changed the title Charts on touch devices Charts don't scroll on touch devices Jan 8, 2015
@moklick
Copy link

moklick commented Jan 8, 2015

@Aendrew wow!! thanks you very much. commenting out these lines fixes the problem for us. awesome!

@aendra-rininsland aendra-rininsland changed the title Charts don't scroll on touch devices ondragstart and ondragend callbacks prevent scrolling on touch devices Jan 8, 2015
@aendra-rininsland aendra-rininsland added C-bug Category: This is a bug and removed question resolved maybe labels Jan 10, 2015
@aendra-rininsland
Copy link
Member

@masayuki0812 Any update on removing those callbacks? Would it help if I did a PR?

I'm currently integrating axisJS into a Node app that allows C3 charts to be used really effortlessly in news stories; however, it totally causes issues on the iPad due to this issue. I can run off a fork for the moment, but it'd be really nice to be able to get that into core...

@masayuki0812
Copy link
Member

I added data.selection.draggable option that enables dragging to select the points. The default of this option is false and then drag interaction will not be added to the chart, so it means we can scroll even if it's on the chart as default.
On the other hand, if we want dragging for data selection, we need to set this option true, but I think it's acceptable because the use case seems not much and the scrolling is more important as default interaction.
I believe this fix works for this issue and I'll release the fix in the next version v0.4.9 shortly.

@masayuki0812
Copy link
Member

v0.4.9 has been released, so please let me close.

@aendra-rininsland
Copy link
Member

Yay! 👍 :shipit: Nicely done, @masayuki0812!

@aendra-rininsland aendra-rininsland added the R-needs-docs Request for changes: The PR needs documentation label Jan 18, 2015
@aendra-rininsland
Copy link
Member

Adding documentation tag re: data.selection.draggable.

@moklick
Copy link

moklick commented Jan 19, 2015

nice! thanks @masayuki0812

@subu28
Copy link

subu28 commented Mar 5, 2015

This issue seems to be persist while using multiple axis using data.xs.

can be checked at http://c3js.org/samples/simple_xy_multiple.html

@bibounet
Copy link

@subu28 same issue for me (using data.xs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug R-needs-docs Request for changes: The PR needs documentation resolved maybe
Projects
None yet
Development

No branches or pull requests

7 participants