var lbl = new Array(); jQuery(document).ready(function(){ jQuery('#wpta_trend').hide(); jQuery('#wpta_powered').hide(); var data = [10,35,13,5,4]; lbl = ['14-November-2024','15-November-2024','16-November-2024','17-November-2024','18-November-2024']; var datapoint = new Array(); for(var i=0;i0){ if(jQuery('#trenddiv').length>0){ plot = jQuery.plot( jQuery('#trenddiv'), [ datapoint ] , plot_options ); } }else{ jQuery('#trenddiv').html("No Data Found"); } jQuery("#trenddiv").bind("plothover", function (event, pos, item) { if (item){ jQuery('#tooltip').remove(); showTooltip(pos.pageX,pos.pageY,item); }else{ jQuery('#tooltip').remove(); } } ); } ); function showTooltip(x, y, item) { var x_point = item.datapoint[0]; // => x-axis var y_point = item.datapoint[1]; // => y-axis var x_lbl = lbl[item.datapoint[0]] //=> X-Axis Label jQuery('
Date:'+x_lbl+'
Count:' + y_point + '
').css( { position: 'absolute', top: y + 5, left: x + 5, border: '1px solid #000', padding: '2px', 'background-color': '#fee', opacity: 0.80 }).appendTo("body"); var total_x_points = lbl.length; var current_x_point = x_point; var width = parseFloat(jQuery('#tooltip').css('width')); if(current_x_point >= total_x_points/2) jQuery('#tooltip').css('left', x-width ) ; }