-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
datastructures.html
76 lines (74 loc) · 1.94 KB
/
datastructures.html
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!DOCTYPE html>
<html>
<head>
<title>Box Plot Chart</title>
<script src="https://unpkg.com/chart.js@3.8.0/dist/chart.js"></script>
<script src="../build/index.umd.js"></script>
<script src="https://unpkg.com/d3-random@latest/dist/d3-random.min.js"></script>
<script src="./utils.js"></script>
</head>
<body>
<div id="container" style="width: 75%">
<canvas id="canvas"></canvas>
</div>
<script>
const boxplotData = {
// define label tree
labels: ['array', '{boxplot values}', 'with items', 'as outliers'],
datasets: [
{
label: 'Dataset 1',
backgroundColor: 'rgba(255,0,0,0.2)',
borderColor: 'red',
borderWidth: 1,
padding: 10,
itemRadius: 2,
itemStyle: 'circle',
itemBackgroundColor: '#000',
outlierBackgroundColor: '#000',
data: [
[1, 2, 3, 4, 5],
{
min: 1,
q1: 2,
median: 3,
q3: 4,
max: 5,
},
{
min: 1,
q1: 2,
median: 3,
q3: 4,
max: 5,
items: [1, 2, 3, 4, 5],
},
{
min: 1,
q1: 2,
median: 3,
q3: 4,
max: 5,
outliers: [1, 2, 3, 4, 5],
},
],
},
],
};
window.onload = () => {
const ctx = document.getElementById('canvas').getContext('2d');
const myBar = new Chart(ctx, {
type: 'boxplot',
data: boxplotData,
options: {
responsive: true,
title: {
display: true,
text: 'Chart.js Box Plot Chart',
},
},
});
};
</script>
</body>
</html>