64 lines
1.8 KiB
JavaScript
64 lines
1.8 KiB
JavaScript
var options2 = {
|
|
type: 'doughnut',
|
|
data: {
|
|
datasets: [
|
|
{
|
|
label: 'compassTCP',
|
|
data: [50,50,50,50],
|
|
backgroundColor: [
|
|
'rgba(191, 191, 191, 1)',
|
|
'rgba(191, 191, 191, 1)',
|
|
'rgba(30, 139, 195, 1)',
|
|
'rgba(30, 139, 195, 1)'
|
|
],
|
|
borderColor: [
|
|
'rgba(255, 255, 255 ,1)',
|
|
'rgba(255, 255, 255 ,1)',
|
|
'rgba(255, 255, 255 ,1)',
|
|
'rgba(255, 255, 255 ,1)'
|
|
],
|
|
borderWidth: 4
|
|
},
|
|
{
|
|
label: 'compassSERIAL',
|
|
data: [50,50,50,50],
|
|
backgroundColor: [
|
|
'rgba(191, 191, 191, 1)',
|
|
'rgba(191, 191, 191, 1)',
|
|
'rgba(214, 69, 65, 1)',
|
|
'rgba(214, 69, 65, 1)'
|
|
],
|
|
borderColor: [
|
|
'rgba(255, 255, 255 ,1)',
|
|
'rgba(255, 255, 255 ,1)',
|
|
'rgba(255, 255, 255 ,1)',
|
|
'rgba(255, 255, 255 ,1)'
|
|
],
|
|
borderWidth: 4
|
|
}
|
|
]
|
|
},
|
|
options: {
|
|
rotation: 2 * Math.PI,
|
|
circumference: 2 * Math.PI,
|
|
legend: {
|
|
display: false,
|
|
enabled: false
|
|
},
|
|
tooltips: {
|
|
enabled: false,
|
|
display: false
|
|
},
|
|
cutoutPercentage: 50
|
|
}
|
|
}
|
|
|
|
var ctx2 = document.getElementById('compass').getContext('2d');
|
|
var myCompass = new Chart(ctx2, options2);
|
|
|
|
|
|
function addCompassSerial(deg){
|
|
myCompass.data.datasets[1].data = [0,0,0,0];
|
|
myCompass.update();
|
|
}
|