|
Apache/2.4.41 (Ubuntu) Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) server ip : 62.171.164.128 | your ip : 127.0.0.1 safemode OFF > / home / Mirasvit / Report / view / adminhtml / web / js / chart / |
Filename | /home/Mirasvit/Report/view/adminhtml/web/js/chart/pie.js |
Size | 2.62 kb |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 01-Jul-2024 20:52 |
Last modified | 06-Apr-2021 18:06 |
Last accessed | 23-Aug-2025 01:36 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
define([
'./abstract',
'jquery',
'underscore'
], function (Abstract, $, _) {
return Abstract.extend({
getChartConfig: function () {
return {
type: 'doughnut',
options: {
title: {
display: false
},
legend: {
display: false
},
responsive: true,
maintainAspectRatio: false
}
};
},
updateData: function () {
if (!this.chart) {
return;
}
var data = {
labels: this.getLabels(),
datasets: this.getDataSets()
};
if (this.chart.data !== data) {
this.chart.data = data;
this.chart.update(0, true);
}
},
getDataSets: function () {
var sets = [];
_.each(this.columns, function (column) {
if (column.isInternal) {
return;
}
var set = {
label: column.label,
stack: column.index,
backgroundColor: [],
borderColor: [],
borderWidth: 1,
data: [],
hidden: !column.isVisible
};
_.each(this.rows, function (row, i) {
var value = this.getCellValue(column, row);
set.data.push(value);
set.backgroundColor.push(this.getColor(i));
}, this);
sets.push(set);
}, this);
return sets;
},
getColor: function (idx) {
var colors = [
'#97CC64',
'#FF5A3E',
'#77B6E7',
'#FFD963',
'#A9B9B8',
'#DC9D6B',
'#8549ba',
'#00a950',
'#166a8f',
'#acc236',
'#537bc4',
'#f53794',
'#f67019',
'#4dc9f6'
];
while (idx >= colors.length && colors.length > 0) {
idx = idx - colors.length;
}
return colors[idx];
}
});
});
'./abstract',
'jquery',
'underscore'
], function (Abstract, $, _) {
return Abstract.extend({
getChartConfig: function () {
return {
type: 'doughnut',
options: {
title: {
display: false
},
legend: {
display: false
},
responsive: true,
maintainAspectRatio: false
}
};
},
updateData: function () {
if (!this.chart) {
return;
}
var data = {
labels: this.getLabels(),
datasets: this.getDataSets()
};
if (this.chart.data !== data) {
this.chart.data = data;
this.chart.update(0, true);
}
},
getDataSets: function () {
var sets = [];
_.each(this.columns, function (column) {
if (column.isInternal) {
return;
}
var set = {
label: column.label,
stack: column.index,
backgroundColor: [],
borderColor: [],
borderWidth: 1,
data: [],
hidden: !column.isVisible
};
_.each(this.rows, function (row, i) {
var value = this.getCellValue(column, row);
set.data.push(value);
set.backgroundColor.push(this.getColor(i));
}, this);
sets.push(set);
}, this);
return sets;
},
getColor: function (idx) {
var colors = [
'#97CC64',
'#FF5A3E',
'#77B6E7',
'#FFD963',
'#A9B9B8',
'#DC9D6B',
'#8549ba',
'#00a950',
'#166a8f',
'#acc236',
'#537bc4',
'#f53794',
'#f67019',
'#4dc9f6'
];
while (idx >= colors.length && colors.length > 0) {
idx = idx - colors.length;
}
return colors[idx];
}
});
});