/*! * stack-admin-theme (https://pixinvent.com/bootstrap-admin-template/stack) * Copyright 2018 PIXINVENT * Licensed under the Themeforest Standard Licenses */ $(window).on("load",function(){function updateLegend(){updateLegendTimeout=null;var pos=latestPosition,axes=plot.getAxes();if(!(pos.xaxes.xaxis.max||pos.yaxes.yaxis.max)){var i,j,dataset=plot.getData();for(i=0;ipos.x);++j);var y,p1=series.data[j-1],p2=series.data[j];y=null==p1?p2[1]:null==p2?p1[1]:p1[1]+(p2[1]-p1[1])*(pos.x-p1[0])/(p2[0]-p1[0]),legends.eq(i).text(series.label.replace(/=.*/,"= "+y.toFixed(2)))}}}for(var sin=[],cos=[],i=0;i<14;i+=.1)sin.push([i,Math.sin(i)]),cos.push([i,Math.cos(i)]);plot=$.plot("#tracking",[{data:sin,label:"sin(x) = -0.00"},{data:cos,label:"cos(x) = -0.00"}],{series:{lines:{show:!0}},crosshair:{mode:"x"},grid:{borderWidth:1,borderColor:"transparent",color:"#999",minBorderMargin:20,labelMargin:10,margin:{top:8,bottom:20,left:20},hoverable:!0,autoHighlight:!1},xaxis:{tickLength:0,tickDecimals:0},yaxis:{min:-1.2,max:1.2},colors:["#00A5A8","#FF7D4D"]});var legends=$("#tracking .legendLabel");legends.each(function(){$(this).css("width",$(this).width())});var updateLegendTimeout=null,latestPosition=null;$("#tracking").bind("plothover",function(event,pos,item){latestPosition=pos,updateLegendTimeout||(updateLegendTimeout=setTimeout(updateLegend,50))})});