Skip to content

Instantly share code, notes, and snippets.

@ricardoferreira1980
Forked from slawekkolodziej/touch-tooltip-fix.js
Last active December 15, 2015 22:48
Show Gist options
  • Save ricardoferreira1980/5335186 to your computer and use it in GitHub Desktop.
Save ricardoferreira1980/5335186 to your computer and use it in GitHub Desktop.
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;
});
@gschoppe
Copy link

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