Chart/report fixes

This commit is contained in:
Mike Jolley 2012-01-18 16:54:05 +00:00
parent 472a2b899f
commit 197b629307
5 changed files with 12 additions and 11 deletions

View File

@ -95,11 +95,13 @@ function woocommerce_init_dashboard_widgets() {
$sales_heading = '';
if ($current_month_offset!=date('m')) :
$sales_heading .= '<a href="index.php?month='.($current_month_offset+1).'" class="next">'.date('F', strtotime('01-'.($current_month_offset+1).'-2011')).' &rarr;</a>';
$the_month_num = date('n', strtotime('NOW '.($current_month_offset-1).' MONTH'));
if ($the_month_num!=date('m')) :
$sales_heading .= '<a href="index.php?month='.($current_month_offset+1).'" class="next">'.date('F', strtotime('01-'.($the_month_num+1).'-2011')).' &rarr;</a>';
endif;
$sales_heading .= '<a href="index.php?month='.($current_month_offset-1).'" class="previous">&larr; '.date('F', strtotime('01-'.($current_month_offset-1).'-2011')).'</a><span>'.__('Monthly Sales', 'woocommerce').'</span>';
$sales_heading .= '<a href="index.php?month='.($current_month_offset-1).'" class="previous">&larr; '.date('F', strtotime('01-'.($the_month_num-1).'-2011')).'</a><span>'.__('Monthly Sales', 'woocommerce').'</span>';
wp_add_dashboard_widget('woocommmerce_dashboard_sales', $sales_heading, 'woocommmerce_dashboard_sales');
wp_add_dashboard_widget('woocommmerce_dashboard_recent_orders', __('WooCommerce recent orders', 'woocommerce'), 'woocommmerce_dashboard_recent_orders');

View File

@ -439,7 +439,7 @@ function woocommerce_sales_overview() {
tickLength: 1,
minTickSize: [1, "day"]
},
yaxes: [ { min: 0, tickSize: 1, tickDecimals: 0 }, { position: "right", min: 0, tickDecimals: 2 } ],
yaxes: [ { min: 0, tickSize: 10, tickDecimals: 0 }, { position: "right", min: 0, tickDecimals: 2 } ],
colors: ["#8a4b75", "#47a03e"]
});
@ -629,7 +629,7 @@ function woocommerce_daily_sales() {
tickLength: 1,
minTickSize: [1, "day"]
},
yaxes: [ { min: 0, tickSize: 1, tickDecimals: 0 }, { position: "right", min: 0, tickDecimals: 2 } ],
yaxes: [ { min: 0, tickSize: 10, tickDecimals: 0 }, { position: "right", min: 0, tickDecimals: 2 } ],
colors: ["#8a4b75", "#47a03e"]
});
@ -739,7 +739,7 @@ function woocommerce_monthly_sales() {
<p><label for="show_year"><?php _e('Year:', 'woocommerce'); ?></label>
<select name="show_year" id="show_year">
<?php
for ($i = $first_year; $i <= date('Y'); $i++) printf('<option value="%u" %u>%u</option>', $i, selected($current_year, $i, false), $i);
for ($i = $first_year; $i <= date('Y'); $i++) printf('<option value="%s" %s>%s</option>', $i, selected($current_year, $i, false), $i);
?>
</select> <input type="submit" class="button" value="<?php _e('Show', 'woocommerce'); ?>" /></p>
</form>
@ -825,7 +825,7 @@ function woocommerce_monthly_sales() {
tickLength: 1,
minTickSize: [1, "month"]
},
yaxes: [ { min: 0, tickSize: 1, tickDecimals: 0 }, { position: "right", min: 0, tickDecimals: 2 } ],
yaxes: [ { min: 0, tickSize: 10, tickDecimals: 0 }, { position: "right", min: 0, tickDecimals: 2 } ],
colors: ["#8a4b75", "#47a03e"]
});

View File

@ -51,7 +51,7 @@ jQuery(function(){
tickLength: 1,
minTickSize: [1, "day"]
},
yaxes: [ { min: 0, tickSize: 1, tickDecimals: 0 }, { position: "right", min: 0, tickDecimals: 2 } ],
yaxes: [ { min: 0, tickSize: 10, tickDecimals: 0 }, { position: "right", min: 0, tickDecimals: 2 } ],
colors: ["#8a4b75", "#47a03e"]
});

View File

@ -1 +1 @@
jQuery(function(){function h(n){var l=[];var o=new Date(n.xaxis.min);o.setUTCDate(o.getUTCDate()-((o.getUTCDay()+1)%7));o.setUTCSeconds(0);o.setUTCMinutes(0);o.setUTCHours(0);var m=o.getTime();do{l.push({xaxis:{from:m,to:m+2*24*60*60*1000}});m+=7*24*60*60*1000}while(m<n.xaxis.max);return l}var k=jQuery.parseJSON(params.order_data.replace(/&quot;/g,'"'));var f=k.order_counts;var a=k.order_amounts;for(var c=0;c<f.length;++c){f[c][0]+=60*60*1000}for(var c=0;c<a.length;++c){a[c][0]+=60*60*1000}var g=jQuery("#placeholder");var e=jQuery.plot(g,[{label:"Number of sales",data:f},{label:"Sales amount",data:a,yaxis:2}],{series:{lines:{show:true},points:{show:true}},grid:{show:true,aboveData:false,color:"#ccc",backgroundColor:"#fff",borderWidth:2,borderColor:"#ccc",clickable:false,hoverable:true,markings:h},xaxis:{mode:"time",timeformat:"%d %b",tickLength:1,minTickSize:[1,"day"]},yaxes:[{min:0,tickSize:1,tickDecimals:0},{position:"right",min:0,tickDecimals:2}],colors:["#8a4b75","#47a03e"]});g.resize();function j(d,l,i){jQuery('<div id="tooltip">'+i+"</div>").css({position:"absolute",display:"none",top:l+5,left:d+5,padding:"5px 10px",border:"3px solid #3da5d5",background:"#288ab7"}).appendTo("body").fadeIn(200)}var b=null;jQuery("#placeholder").bind("plothover",function(i,m,d){if(d){if(b!=d.dataIndex){b=d.dataIndex;jQuery("#tooltip").remove();if(d.series.label=="Number of sales"){var l=d.datapoint[1];j(d.pageX,d.pageY,d.series.label+" - "+l)}else{var l=d.datapoint[1].toFixed(2);j(d.pageX,d.pageY,d.series.label+" - "+params.currency_symbol+l)}}}else{jQuery("#tooltip").remove();b=null}})});
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:"Number of sales",data:c},{label:"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",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=="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}})});

View File

@ -1,3 +1,2 @@
<?php
// Silence is golden.
?>
// Silence is golden.