This repository has been archived by the owner on Mar 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
80 lines (67 loc) · 2.1 KB
/
index.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
77
78
79
80
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chart.js and D3.js Playground</title>
<link rel="icon" href="https://www.chartjs.org/docs/latest/favicon.ico">
<!-- Import the Chart.js library -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chart.min.js"></script>
<style>
.container {
width: 300px;
height: 250px;
border: 1px solid #a45dce;
}
.bar {
fill: #a45dce;
}
</style>
</head>
<body>
<div>
<canvas id="myChart"></canvas>
<script defer>
// Setup
const labels = [
'January',
'February',
'March',
'April',
'May',
'June',
];
const data = {
labels: labels,
datasets: [{
label: 'My First dataset',
backgroundColor: 'rgb(255, 99, 132)',
borderColor: 'rgb(255, 99, 132)',
data: [0, 10, 5, 2, 20, 30, 45],
}]
};
// Config
const config = {
type: 'line',
data: data,
// https://www.chartjs.org/docs/latest/general/options.html
options: {
layout: {
padding: 20
}
}
};
// Draw the chart, passing in the element's ID
const myChart = new Chart(
document.getElementById('myChart'),
config
);
</script>
<svg></svg>
<script src="https://d3js.org/d3.v7.min.js"></script>
<script defer src="https://cdn.skypack.dev/d3-scale@4"></script>
<script defer src="./app.js"></script>
</div>
</body>
</html>