2023-03-16 07:51:24 +01:00
|
|
|
if (!window.appTopItems) {
|
2023-09-14 02:26:47 +02:00
|
|
|
window.appTopItems = {
|
|
|
|
dataLoaded (model) {
|
|
|
|
const id = `AppTopItems-${model.id}`;
|
2023-03-16 07:51:24 +01:00
|
|
|
const series = model.salesCount;
|
2024-08-30 08:58:50 +01:00
|
|
|
const labels = model.entries.map(e => e.title);
|
|
|
|
const tooltip = Chartist.plugins.tooltip2({
|
|
|
|
template: '<div class="chartist-tooltip-inner">{{meta}} - Sales: {{value}}</div>',
|
|
|
|
offset: {
|
|
|
|
x: 0,
|
|
|
|
y: -8
|
|
|
|
}
|
|
|
|
});
|
|
|
|
new Chartist.Bar(`#${id} .ct-chart`, { series, labels }, {
|
2023-03-16 07:51:24 +01:00
|
|
|
distributeSeries: true,
|
|
|
|
horizontalBars: true,
|
|
|
|
showLabel: false,
|
|
|
|
stackBars: true,
|
|
|
|
axisY: {
|
|
|
|
offset: 0
|
2024-08-30 08:58:50 +01:00
|
|
|
},
|
|
|
|
plugins: [tooltip]
|
2023-03-16 07:51:24 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|