woocommerce/assets/js/admin/dashboard_sales.min.js

1 line
1.5 KiB
JavaScript
Raw Normal View History

2012-06-11 15:32:02 +00:00
jQuery(function(){function a(a){var b=[],c=new Date(a.xaxis.min);c.setUTCDate(c.getUTCDate()-(c.getUTCDay()+1)%7);c.setUTCSeconds(0);c.setUTCMinutes(0);c.setUTCHours(0);var d=c.getTime();do{b.push({xaxis:{from:d,to:d+1728e5}});d+=6048e5}while(d<a.xaxis.max);return b}function h(a,b,c){jQuery('<div id="tooltip">'+c+"</div>").css({position:"absolute",display:"none",top:b+5,left:a+5,padding:"5px 10px",border:"3px solid #3da5d5",background:"#288ab7"}).appendTo("body").fadeIn(200)}var b=jQuery.parseJSON(params.order_data.replace(/&quot;/g,'"')),c=b.order_counts,d=b.order_amounts;for(var e=0;e<c.length;++e)c[e][0]+=36e5;for(var e=0;e<d.length;++e)d[e][0]+=36e5;var f=jQuery("#placeholder"),g=jQuery.plot(f,[{label:params.number_of_sales,data:c},{label:params.sales_amount,data:d,yaxis:2}],{series:{lines:{show:!0},points:{show:!0}},grid:{show:!0,aboveData:!1,color:"#ccc",backgroundColor:"#fff",borderWidth:2,borderColor:"#ccc",clickable:!1,hoverable:!0,markings:a},xaxis:{mode:"time",timeformat:"%d %b",monthNames:params.month_names,tickLength:1,minTickSize:[1,"day"]},yaxes:[{min:0,tickSize:10,tickDecimals:0},{position:"right",min:0,tickDecimals:2}],colors:["#8a4b75","#47a03e"]});f.resize();var i=null;jQuery("#placeholder").bind("plothover",function(a,b,c){if(c){if(i!=c.dataIndex){i=c.dataIndex;jQuery("#tooltip").remove();if(c.series.label==params.number_of_sales){var d=c.datapoint[1];h(c.pageX,c.pageY,c.series.label+": "+d)}else{var d=c.datapoint[1].toFixed(2);h(c.pageX,c.pageY,c.series.label+": "+params.currency_symbol+d)}}}else{jQuery("#tooltip").remove();i=null}})});