-
Notifications
You must be signed in to change notification settings - Fork 12k
Expand file tree
/
Copy pathstack-cache.js
More file actions
56 lines (54 loc) · 969 Bytes
/
stack-cache.js
File metadata and controls
56 lines (54 loc) · 969 Bytes
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
51
52
53
54
55
56
function makeDs(label, offset) {
return {
label,
data: [
[0, 12],
[1, 19],
[2, 3],
[2, 5],
[3, 2],
[4, 3],
].map(([x, y]) => ({x, y: y === null ? null : y + offset})),
showLine: true,
spanGaps: false,
stack: `stack${label}`,
borderColor: label === 'A' ? '#c00' : '#00c'
};
}
const dsA = makeDs('A', 0);
const dsB = makeDs('B', 1);
module.exports = {
config: {
type: 'scatter',
data: {
datasets: [dsA, dsB],
},
options: {
scales: {
x: {display: false},
y: {display: false},
},
elements: {
point: {
backgroundColor: '#444',
},
},
layout: {
padding: {
left: 24,
right: 24,
},
},
},
},
options: {
canvas: {
height: 128,
width: 256,
},
async run(chart) {
chart.data = {datasets: [dsB, dsA]};
chart.update();
}
},
};