Accepted answer

body.In your mouseover event you can get the mouse position with pageX and pageY. Then you know where the mouse is on the screen. With this information you can create a div and position it where the mouse is. You can use your html string that is returned from createLegendTooltip and apply it to the div with .innerHTML

Very generic example below. Theres more you have to do. For example set the z-index and also creates a function that updates the position of the coolDiv if you want it to move when the mouse moves.

var coolDiv = document.createElement('div');
coolDiv.innerHTML = createLegendTooltip(data); = yourValueYouGetFrom_pageX; = yourValueYouGetFrom_pageY;

Related Query

More Query from same tag