mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-10 09:19:24 +01:00
* Include hover to display total sales per day * Add label to top items as well * Bring in recent Chart modifications from app --------- Co-authored-by: Dennis Reimann <mail@dennisreimann.de>
26 lines
865 B
JavaScript
26 lines
865 B
JavaScript
if (!window.appTopItems) {
|
|
window.appTopItems = {
|
|
dataLoaded (model) {
|
|
const id = `AppTopItems-${model.id}`;
|
|
const series = model.salesCount;
|
|
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 }, {
|
|
distributeSeries: true,
|
|
horizontalBars: true,
|
|
showLabel: false,
|
|
stackBars: true,
|
|
axisY: {
|
|
offset: 0
|
|
},
|
|
plugins: [tooltip]
|
|
});
|
|
}
|
|
};
|
|
}
|