|
@@ -144,7 +144,8 @@ function ranking_sales_product (widget) {
|
|
|
var label = [];
|
|
|
var body = [];
|
|
|
var item;
|
|
|
- var rank = 5;
|
|
|
+ var rank = 7;
|
|
|
+
|
|
|
if (ranking.length < rank)
|
|
|
rank= ranking.length;
|
|
|
|
|
@@ -152,37 +153,39 @@ function ranking_sales_product (widget) {
|
|
|
if (ranking[i]){
|
|
|
item = ranking[i];
|
|
|
}
|
|
|
+ var name=item.product.split(' ');
|
|
|
|
|
|
- label.push(item.product);
|
|
|
+ label.push(name[0]+"("+name[name.length-1]+")");
|
|
|
body.push(item.qty);
|
|
|
}
|
|
|
var chart = new Chart(this.$el.find(".widget-content").find('canvas'), {
|
|
|
- type: 'pie',
|
|
|
+ // type: 'pie',
|
|
|
+ type: 'bar',
|
|
|
data: {
|
|
|
labels: label,
|
|
|
datasets: [
|
|
|
{
|
|
|
backgroundColor: [ '#EF5350', '#EC407A', '#AB47BC', '#7E57C2', '#5C6BC0', '#42A5F5', '#26C6DA', '#26A69A', '#66BB6A', '#9CCC65'],
|
|
|
- borderWidth :0,
|
|
|
data: body,
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
options: {
|
|
|
- animation: {
|
|
|
- animateScale: true,
|
|
|
- animateRotate: true
|
|
|
- },
|
|
|
- maintainAspectRatio: false,
|
|
|
+ scales: {
|
|
|
+ xAxes: [{ stacked: true }],
|
|
|
+ yAxes: [{ stacked: true }],
|
|
|
+ },
|
|
|
+ legend: {
|
|
|
+ display: false,
|
|
|
+ },
|
|
|
layout: {
|
|
|
- padding: 20
|
|
|
- },
|
|
|
- legend: {
|
|
|
- display: false,
|
|
|
+ padding:{
|
|
|
+ top: 20,
|
|
|
+ bottom:0,
|
|
|
+ left : 0,
|
|
|
+ rigth:0,
|
|
|
+ }
|
|
|
},
|
|
|
- tooltips:{
|
|
|
- titleFontSize:7,
|
|
|
- }
|
|
|
}
|
|
|
});
|
|
|
},
|