Skip to content

Commit

Permalink
Merge pull request #27 from AntoineKM/fix/final-prod
Browse files Browse the repository at this point in the history
fix - charts calculation
  • Loading branch information
JulienMorel76350 authored Jan 15, 2021
2 parents c8df597 + 8ade181 commit 3211168
Showing 1 changed file with 5 additions and 41 deletions.
46 changes: 5 additions & 41 deletions assets/js/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,10 @@ const initRequest = (logsOrder) => {
chartAmountPerRequests = new Chart($('#chartAmountPerRequests'), {
type: 'bar',
data: {
labels: ['trames'],
labels: [''],
datasets: chartAmountPerRequestsDatasets
},
options: {
legend: {
display: false
},
maintainAspectRatio: false,
scales: {
yAxes: [{
Expand All @@ -156,13 +153,6 @@ const initRequest = (logsOrder) => {
title: {
display: true,
text: 'Nombre de trames par type de requête'
},
tooltips: {
callbacks: {
label: (tooltipItem) => {
return tooltipItem.yLabel;
}
}
}
}
});
Expand All @@ -175,7 +165,7 @@ const initRequest = (logsOrder) => {

protocols.forEach(obj => {
chartTTLPerRequestsLabels.push(obj.protocolName);
chartTTLPerRequestsData.push(obj.ttl);
chartTTLPerRequestsData.push(128 - obj.ttl / obj.amount );
chartTTLPerRequestsBackgroundColor.push('rgba(' + obj.color + ', .25)');
chartTTLPerRequestsBorderColor.push('rgba(' + obj.color + ', .75)');
});
Expand All @@ -196,12 +186,12 @@ const initRequest = (logsOrder) => {
maintainAspectRatio: false,
title: {
display: true,
text: 'Nombre de TTL par type de requête'
text: 'Nombre moyen de TTL perdu par type de requête'
}
}
});

// chartTTLPerRequests
// chartTimemoutPerRequests
let chartTimeoutPerRequestsLabels = [];
let chartTimeoutPerRequestsData = [];
let chartTimeoutPerRequestsBackgroundColor = [];
Expand Down Expand Up @@ -230,7 +220,7 @@ const initRequest = (logsOrder) => {
maintainAspectRatio: false,
title: {
display: true,
text: 'Nombre de Timeout par type de requête'
text: 'Nombre d\'échec par type de requête'
}
}
});
Expand Down Expand Up @@ -362,32 +352,6 @@ const initError = (errors) => {
});
}

const initChart = (title, selector, type, labels, datasets) => {
var chart = new Chart($(selector), {
type: type,
data: {
labels: labels,
datasets: datasets
},
options: {
maintainAspectRatio: false,
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
},
title: {
display: true,
text: title
},
responsive: true
}
});
return chart;
}

const initLogoutBtn = () => {
$('[role="btn-logout"]').click((e) => {
e.preventDefault();
Expand Down

0 comments on commit 3211168

Please sign in to comment.