-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgui.js
50 lines (47 loc) · 1.01 KB
/
gui.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
class GraphXY extends Chart {
constructor() {
let canvas = document.createElement("canvas");
canvas.width = canvas.height = 100;
super(canvas, {
type: 'line',
options: {
scales: {
xAxes: [{
type: 'linear',
position: 'bottom',
ticks: {
stepSize: 10,
suggestedMin: -200,
suggestedMax: 200
},
scaleLabel: {display:false}
}],
yAxes: [{
type: 'linear',
position: 'left',
ticks: {
stepSize: 10,
suggestedMin: -200,
suggestedMax: 200
},
scaleLabel: {display:false}
}]
}
},
data: {datasets: [{
backgroundColor: 'green',
borderColor: 'green',
pointRadius: 10,
data: [{x:0, y:0}]
}]}
});
}
updatePos(x, y) {
this.data.datasets[0].data[0] = {x:x, y:y};
this.update();
}
}
Chart.defaults.global.legend.display = false;
Chart.defaults.global.animation = 0;
Chart.defaults.global.tooltips.enabled = false;
Chart.defaults.global.elements.line.tension = 0;