|
@@ -113,9 +113,9 @@ function ranking_sales_product (widget) {
|
|
|
}, 0);
|
|
|
lineUnik = itemLine.shift();
|
|
|
ranking.push({
|
|
|
- product: lineUnik.product_id[1],
|
|
|
- qty: cat,
|
|
|
- id: lineUnik.product_id[0]
|
|
|
+ product : itemProduct.name_template,
|
|
|
+ qty : cat,
|
|
|
+ id : lineUnik.product_id[0]
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -128,7 +128,6 @@ function ranking_sales_product (widget) {
|
|
|
var fecha = new Date();
|
|
|
var meses = new Array ("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre");
|
|
|
self.$el.find('.widget-title').find('span').text("Ranking de productos más vendidos del mes de " + meses[fecha.getMonth()]);
|
|
|
- // self.$el.find('.widget-title').find('span').text("Ranking de productos más vendidos");
|
|
|
self.ranking=ranking;
|
|
|
self.fetchChart(ranking);
|
|
|
},
|
|
@@ -145,8 +144,8 @@ function ranking_sales_product (widget) {
|
|
|
var label = [];
|
|
|
var body = [];
|
|
|
var item;
|
|
|
- var rank = 10;
|
|
|
- if (ranking.length < 10)
|
|
|
+ var rank = 5;
|
|
|
+ if (ranking.length < rank)
|
|
|
rank= ranking.length;
|
|
|
|
|
|
for (var i = 0; i < rank; i++) {
|
|
@@ -158,13 +157,11 @@ function ranking_sales_product (widget) {
|
|
|
body.push(item.qty);
|
|
|
}
|
|
|
var chart = new Chart(this.$el.find(".widget-content").find('canvas'), {
|
|
|
- // type: 'doughnut',
|
|
|
type: 'pie',
|
|
|
data: {
|
|
|
labels: label,
|
|
|
datasets: [
|
|
|
{
|
|
|
- // backgroundColor: ['#01579B','#0277BD','#0288D1','#039BE5','#03A9F4','#29B6F6','#4FC3F7','#81D4FA','#B3E5FC','#E1F5FE'],
|
|
|
backgroundColor: [ '#EF5350', '#EC407A', '#AB47BC', '#7E57C2', '#5C6BC0', '#42A5F5', '#26C6DA', '#26A69A', '#66BB6A', '#9CCC65'],
|
|
|
borderWidth :0,
|
|
|
data: body,
|
|
@@ -183,6 +180,9 @@ function ranking_sales_product (widget) {
|
|
|
legend: {
|
|
|
display: false,
|
|
|
},
|
|
|
+ tooltips:{
|
|
|
+ titleFontSize:7,
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
},
|