
Misc
Contents
What's New
|
Disable Tooltip Animation in HighCharts JS (v2.2.1)by justin carlson on 04/24/2012Here's a quick post to explain the issue (which the Highcharts folks know about and may already be fixing), and how to remedy it.
/** * The tooltip object * @param {Object} options Tooltip options */ function Tooltip(options) { var currentSeries, borderWidth = options.borderWidth, crosshairsOptions = options.crosshairs, crosshairs = [], style = options.style, shared = options.shared, padding = pInt(style.padding), tooltipIsHidden = true, currentX = 0, currentY = 0; /** * The tooltip object * @param {Object} options Tooltip options */ function Tooltip(options) { var currentSeries, borderWidth = options.borderWidth, crosshairsOptions = options.crosshairs, crosshairs = [], style = options.style, shared = options.shared, padding = pInt(style.padding), tooltipIsHidden = true, currentX = 0, currentY = 0, animate = true; /** * Provide a soft movement for the tooltip * * @param {Number} finalX * @param {Number} finalY */ function move(finalX, finalY) { /** * Provide a soft movement for the tooltip * * @param {Number} finalX * @param {Number} finalY */ function move(finalX, finalY) { // if tooltip animation is enabled if (options.animation) { // get intermediate values for animation currentX = tooltipIsHidden ? finalX : (2 * currentX + finalX) / 3; currentY = tooltipIsHidden ? finalY : (currentY + finalY) / 2; // move to the intermediate value label.attr({ x: currentX, y: currentY }); // run on next tick of the mouse tracker if (mathAbs(finalX - currentX) > 1 || mathAbs(finalY - currentY) > 1) { tooltipTick = function () { //sally console.log() move(finalX, finalY); }; } else { tooltipTick = null; } } else { // animation disabled, just move to the final position label.attr({ x: finalX, y: finalY }); } } chart = new Highcharts.Chart({ tooltip: { useHTML: true, backgroundColor: '#ffffff', crosshairs: true, enabled: true, animation:false } }); chart = new Highcharts.Chart({ tooltip: { useHTML: true, backgroundColor: '#ffffff', crosshairs: true, enabled: true, animation: ('msie' in jQuery.browser) ? false : true } }); /** * Provide a soft movement for the tooltip * * @param {Number} finalX * @param {Number} finalY */ function move(finalX, finalY) { label.attr({ x: finalX, y: finalY }); }
TrackbackTrackback URL for this entry: http://www.tehuber.com/trackback.php?id=20120424082911788 No trackback comments for this entry.Disable Tooltip Animation in HighCharts JS (v2.2.1)
Authored by: Anonymous on
Tuesday, August 14 2012 @ 08:11 CDT
Thank you so much! That was my problem. I spent a day looking into this before I found the magic phrase to turn up this post in Google. The key was realizing that the tooltip was "tearing" because of the animation. Your post saved me digging through the highcharts source for a couple more hours, so thanks very much. Hopefully highcharts will add this option soon!
[ Reply to This | # ]
|