Sales graph tweak
This commit is contained in:
parent
d3618ff86a
commit
d66aeaa262
|
@ -420,10 +420,12 @@ function woocommerce_dashboard_sales_js() {
|
|||
|
||||
/* Script variables */
|
||||
$params = array(
|
||||
'currency_symbol' => get_woocommerce_currency_symbol(),
|
||||
'number_of_sales' => __( 'Number of sales', 'woocommerce' ),
|
||||
'sales_amount' => __( 'Sales amount', 'woocommerce' ),
|
||||
'month_names' => array_values( $wp_locale->month_abbrev ),
|
||||
'currency_symbol' => get_woocommerce_currency_symbol(),
|
||||
'number_of_sales' => __( 'Sold', 'woocommerce' ) . ' ' . absint( array_sum( $order_counts ) ),
|
||||
'sales_amount' => __( 'Earned', 'woocommerce' ) . ' ' . woocommerce_price( array_sum( $order_amounts ) ),
|
||||
'sold' => __( 'Sold', 'woocommerce' ),
|
||||
'earned' => __( 'Earned', 'woocommerce' ),
|
||||
'month_names' => array_values( $wp_locale->month_abbrev ),
|
||||
);
|
||||
|
||||
$order_counts_array = array();
|
||||
|
|
|
@ -81,12 +81,12 @@ jQuery(function(){
|
|||
if (item.series.label==params.number_of_sales) {
|
||||
|
||||
var y = item.datapoint[1];
|
||||
showTooltip(item.pageX, item.pageY, item.series.label + ": " + y);
|
||||
showTooltip(item.pageX, item.pageY, params.sold + ": " + y);
|
||||
|
||||
} else {
|
||||
|
||||
var y = item.datapoint[1].toFixed(2);
|
||||
showTooltip(item.pageX, item.pageY, item.series.label + ": " + params.currency_symbol + y);
|
||||
showTooltip(item.pageX, item.pageY, params.earned + ": " + params.currency_symbol + y);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
jQuery(function(){function e(e){var t=[],n=new Date(e.xaxis.min);n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+1)%7);n.setUTCSeconds(0);n.setUTCMinutes(0);n.setUTCHours(0);var r=n.getTime();do{t.push({xaxis:{from:r,to:r+1728e5}});r+=6048e5}while(r<e.xaxis.max);return t}function u(e,t,n){jQuery('<div id="tooltip">'+n+"</div>").css({position:"absolute",display:"none",top:t+5,left:e+5,padding:"5px 10px",border:"3px solid #3da5d5",background:"#288ab7"}).appendTo("body").fadeIn(200)}var t=jQuery.parseJSON(params.order_data.replace(/"/g,'"')),n=t.order_counts,r=t.order_amounts;for(var i=0;i<n.length;++i)n[i][0]+=36e5;for(var i=0;i<r.length;++i)r[i][0]+=36e5;var s=jQuery("#placeholder"),o=jQuery.plot(s,[{label:params.number_of_sales,data:n},{label:params.sales_amount,data:r,yaxis:2}],{series:{lines:{show:!0,fill:!0},points:{show:!0}},grid:{show:!0,aboveData:!1,color:"#ccc",backgroundColor:"#fff",borderWidth:2,borderColor:"#ccc",clickable:!1,hoverable:!0,markings:e},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"]});s.resize();var a=null;jQuery("#placeholder").bind("plothover",function(e,t,n){if(n){if(a!=n.dataIndex){a=n.dataIndex;jQuery("#tooltip").remove();if(n.series.label==params.number_of_sales){var r=n.datapoint[1];u(n.pageX,n.pageY,n.series.label+": "+r)}else{var r=n.datapoint[1].toFixed(2);u(n.pageX,n.pageY,n.series.label+": "+params.currency_symbol+r)}}}else{jQuery("#tooltip").remove();a=null}})});
|
||||
jQuery(function(){function e(e){var t=[],n=new Date(e.xaxis.min);n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+1)%7);n.setUTCSeconds(0);n.setUTCMinutes(0);n.setUTCHours(0);var r=n.getTime();do{t.push({xaxis:{from:r,to:r+1728e5}});r+=6048e5}while(r<e.xaxis.max);return t}function u(e,t,n){jQuery('<div id="tooltip">'+n+"</div>").css({position:"absolute",display:"none",top:t+5,left:e+5,padding:"5px 10px",border:"3px solid #3da5d5",background:"#288ab7"}).appendTo("body").fadeIn(200)}var t=jQuery.parseJSON(params.order_data.replace(/"/g,'"')),n=t.order_counts,r=t.order_amounts;for(var i=0;i<n.length;++i)n[i][0]+=36e5;for(var i=0;i<r.length;++i)r[i][0]+=36e5;var s=jQuery("#placeholder"),o=jQuery.plot(s,[{label:params.number_of_sales,data:n},{label:params.sales_amount,data:r,yaxis:2}],{series:{lines:{show:!0,fill:!0},points:{show:!0}},grid:{show:!0,aboveData:!1,color:"#ccc",backgroundColor:"#fff",borderWidth:2,borderColor:"#ccc",clickable:!1,hoverable:!0,markings:e},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"]});s.resize();var a=null;jQuery("#placeholder").bind("plothover",function(e,t,n){if(n){if(a!=n.dataIndex){a=n.dataIndex;jQuery("#tooltip").remove();if(n.series.label==params.number_of_sales){var r=n.datapoint[1];u(n.pageX,n.pageY,params.sold+": "+r)}else{var r=n.datapoint[1].toFixed(2);u(n.pageX,n.pageY,params.earned+": "+params.currency_symbol+r)}}}else{jQuery("#tooltip").remove();a=null}})});
|
Loading…
Reference in New Issue