forked from carbon-design-system/carbon-charts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
56 lines (48 loc) · 1.49 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
<!doctype html>
<html lang="en">
<head>
<title>Carbon Charts Vanilla JavaScript Tests</title>
<meta charset="UTF-8" />
<link rel="preconnect" crossorigin="anonymous" href="https://fonts.googleapis.com" />
<link
href="https://fonts.googleapis.com/css?family=IBM+Plex+Sans+Condensed:300,400|IBM+Plex+Sans:400,600&display=swap"
rel="stylesheet"
crossorigin="anonymous" />
<link rel="stylesheet" href="scss/index.scss" />
<style>
.container {
width: 60rem;
}
.chart-container {
margin-bottom: 5rem;
}
</style>
</head>
<body>
<h1>Carbon Charts Vanilla JavaScript</h1>
<h2>Component Test Harness</h2>
<div id="app" class="container"></div>
<script type="module">
import * as ChartComponents from './src/charts/index.ts'
import charts from '../docs/src/charts'
const chartHolder = document.getElementById('app')
for (const chart of charts) {
const header = document.createElement('h3')
header.textContent = chart.types.vanilla
chartHolder.appendChild(header)
for (const example of chart.examples) {
if (example.tags && example.tags.includes('test')) {
const chartContainer = document.createElement('div')
chartContainer.className = 'chart-container'
chartHolder.appendChild(chartContainer)
const ChartConstructor = ChartComponents[chart.types.vanilla]
new ChartConstructor(chartContainer, {
data: example.data,
options: example.options
})
}
}
}
</script>
</body>
</html>