Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function showTooltip(x, y, contents) {
- $('<div id="tooltip">' + contents + '</div>').css( {
- position: 'absolute',
- top: y + 5,
- left: x + 5,
- border: '1px solid #fdd',
- padding: '2px',
- 'background-color': '#fee',
- opacity: 0.80
- }).appendTo("body");//.fadeIn(200);
- }
- var previousPoint = null;
- $('#placeholder').bind('mouseout', function() {
- plot.unhighlight();
- $("#tooltip").remove();
- $(this).data('previous-post', -1);
- });
- $('#placeholder').bind('plothover', function(event, pos, item) {
- if (item) {
- if ($(this).data('previous-post') != item.seriesIndex) {
- plot.unhighlight();
- plot.highlight(item.series, item.datapoint);
- $(this).data('previous-post', item.seriesIndex);
- }
- $("#tooltip").remove();
- y = 'on ' + (new Date(item.datapoint[0])).toDateString() + ': ' + item.datapoint[1];
- showTooltip(pos.pageX, pos.pageY, item.series.label + " " + y);
- } else {
- plot.unhighlight();
- $("#tooltip").remove();
- previousPost = $(this).data('previous-post', -1);
- }
- });
Add Comment
Please, Sign In to add comment