gyrogpsc/static/scripts/accuracy.js

45 lines
1.0 KiB
JavaScript

var ctx = document.getElementById("accuracy").getContext('2d');
var barChart = new Chart(ctx, {
type: 'horizontalBar',
data: {
labels: ["Horizontal Acc.", "Vertical Acc."],
datasets: [{
label: 'Ublox',
data: [0, 0],
backgroundColor: "rgba(214, 69, 65, 1)"
}, {
label: 'Smartphone',
data: [0, 0],
backgroundColor: "rgba(30, 139, 195, 1)"
}]
},
options: {
scales: {
xAxes: [{
ticks: {
min: 0,
max: 10
}
}]
},
legend: {
display: true,
enabled: true
},
tooltips: {
enabled: false,
display: false
}
}
});
function addSerialAccuracy(hacc, vacc){
barChart.data.datasets[0].data = [hacc, vacc];
barChart.update();
}
function addTCPAccuracy(hacc, vacc){
barChart.data.datasets[1].data = [hacc, vacc];
barChart.update();
}