Forked from slawekkolodziej/touch-tooltip-fix.js
Last active
December 15, 2015 22:48
-
-
Save ricardoferreira1980/5335186 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Highcharts.Chart.prototype.callbacks.push(function(chart) { | |
var hasTouch = document.documentElement.ontouchstart !== undefined, | |
mouseTracker = chart.pointer, | |
container = chart.container, | |
mouseMove; | |
mouseMove = function (e) { | |
if (hasTouch) { | |
if (e && e.touches && e.touches.length > 1) { | |
mouseTracker.onContainerTouchMove(e); | |
} else { | |
return; | |
} | |
} else { | |
mouseTracker.onContainerMouseMove(e); | |
} | |
}; | |
click = function (e) { | |
if (hasTouch) { | |
mouseTracker.onContainerMouseMove(e); | |
} | |
mouseTracker.onContainerClick(e); | |
} | |
container.onmousemove = container.ontouchstart = container.ontouchmove = mouseMove; | |
container.onclick = click; | |
}); |
Thanks for this! Exactly what I was looking for.
This version let's the system handle multitouch operations like two finger scroll and pinching:
https://gist.github.com/nicholasklick/6083417
I am using Highcharts JS v3.0Beta (2013-02-21)
just tested this on Android Jelly Bean and IOS 7. Normal operations work well, but zoomable charts have issues. The primary issue is that I can't swipe to scroll across a graph, once I've zoomed in. I know that might cause weird issues with website navigation, but my webapp doesn't scroll horizontally.
Is there a way to feed swipes to both highcharts AND the browser?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This version works correctly with Highcharts 3.0. Line tooltips are shown, and you can bind click events to certain datapoints.