34 lines
700 B
JavaScript
34 lines
700 B
JavaScript
function InitStatisticsChart(labels, colors) {
|
|
// Создаём чарт
|
|
let chart = new Chart(
|
|
document.getElementById("statistics-chart"), {
|
|
type: 'pie',
|
|
data: {
|
|
labels: labels,
|
|
datasets: [{
|
|
label: "Количество",
|
|
data: [0, 0],
|
|
backgroundColor: colors
|
|
}]
|
|
},
|
|
options: {
|
|
plugins: {
|
|
legend: {
|
|
display: false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
);
|
|
|
|
// Отображаем чарт
|
|
chart.update();
|
|
|
|
return chart;
|
|
}
|
|
|
|
function InitStatistics() {
|
|
window.get_statistics = new GetStatistics();
|
|
window.total_logs_amount = document.getElementById("total-logs-amount");
|
|
}
|