53 lines
1.2 KiB
JavaScript
53 lines
1.2 KiB
JavaScript
function InitSummaryChart() {
|
|
// Summary чарт
|
|
window.summary_chart = new Chart(
|
|
document.getElementById('summary-chart'), {
|
|
type: 'pie',
|
|
data: {
|
|
labels: [],
|
|
datasets: []
|
|
},
|
|
options: {
|
|
scales: {
|
|
x: {
|
|
title: {
|
|
display: true,
|
|
text: "Категория"
|
|
}
|
|
},
|
|
y: {
|
|
beginAtZero: true,
|
|
title: {
|
|
display: true,
|
|
text: "Количество"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
);
|
|
|
|
window.summary_chart.render();
|
|
}
|
|
|
|
function InitDispatcher() {
|
|
window.dispatcher = new Dispatcher();
|
|
window.dispatcher.AddCommand("anomaly_logs", window.anomaly_logs);
|
|
window.dispatcher.AddCommand("statistics", window.statistics);
|
|
}
|
|
|
|
// Инициализация документа
|
|
document.addEventListener("DOMContentLoaded", function() {
|
|
let url = "ws://localhost:9555";
|
|
|
|
InitStatistics(url);
|
|
InitAnomalyLogs(url);
|
|
|
|
InitDispatcher();
|
|
|
|
var intervalId = setInterval(function() {
|
|
UpdateStatistics();
|
|
UpdateAnomalyLogs();
|
|
}, 2000);
|
|
});
|