62 lines
1.4 KiB
HTML
62 lines
1.4 KiB
HTML
<div>
|
|
<canvas id="myChart"></canvas>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/chart.js@^3"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/moment@^2"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-moment@^1"></script>
|
|
|
|
<script>
|
|
const ctx = document.getElementById('myChart');
|
|
|
|
const fails = [
|
|
{{.Data}}
|
|
]
|
|
|
|
new Chart(ctx, {
|
|
type: 'line',
|
|
data: {
|
|
datasets: [
|
|
{
|
|
label: 'Public Network',
|
|
data: fails.filter(el=>el.name=='Public'),
|
|
borderColor: 'rgb(255, 99, 132)',
|
|
backgroundColor: 'rgb(255, 99, 132)',
|
|
},
|
|
{
|
|
label: 'DSL',
|
|
data: fails.filter(el=>el.name=='DSL'),
|
|
borderColor: 'rgb(75, 192, 192)',
|
|
backgroundColor: 'rgb(75, 192, 192)'
|
|
},
|
|
{
|
|
label: 'Asus Router',
|
|
data: fails.filter(el=>el.name=='Asus'),
|
|
borderColor: 'rgb(255, 205, 86)',
|
|
backgroundColor: 'rgb(255, 205, 86)'
|
|
}
|
|
]
|
|
},
|
|
options: {
|
|
scales: {
|
|
x: {
|
|
type: 'time',
|
|
time: {
|
|
unit: 'second'
|
|
},
|
|
position: 'bottom'
|
|
},
|
|
y: {
|
|
type: 'category',
|
|
labels: ['', 'ok','failed','']
|
|
}
|
|
},
|
|
decimation: {
|
|
enabled: true,
|
|
algorithm: 'lttb'
|
|
}
|
|
}
|
|
});
|
|
</script> |