-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
basicLog.html
33 lines (31 loc) · 1003 Bytes
/
basicLog.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
<!DOCTYPE html>
<html>
<head>
<script src="https://unpkg.com/chart.js@3.8.0"></script>
<script src="../build/index.umd.js"></script>
</head>
<body>
<div style="width: 75%">
<canvas id="canvas" style="border: 1px solid black"></canvas>
</div>
<script>
fetch('https://raw.githubusercontent.com/derhuerst/mtcars/master/index.json')
.then((r) => r.json())
.then((mtcars) => {
const attrs = ['mpg', 'hp', 'wt', 'qsec', 'gear', 'drat', 'disp', 'cyl'];
const chart = new Chart(document.getElementById('canvas').getContext('2d'), {
type: 'pcp',
data: {
labels: mtcars.map((c) => c.model),
datasets: attrs.map((attr, i) => ({
type: i === 1 ? 'logarithmicPcp' : undefined,
label: attr,
data: mtcars.map((c) => c[attr]),
})),
},
options: {},
});
});
</script>
</body>
</html>