66 lines
1.2 KiB
HTML
66 lines
1.2 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<!-- Load c3.css -->
|
|
<link href="/c3.css" rel="stylesheet" type=text/css>
|
|
|
|
<!-- Load d3.js and c3.js -->
|
|
<script src="/d3.v5.min.js" charset="utf-8"></script>
|
|
<script src="/c3.min.js"></script>
|
|
<script>
|
|
var chart = null
|
|
var chart2 = null
|
|
function initCharts() {
|
|
chart = c3.generate({
|
|
bindto: '#humidity-temp',
|
|
data: {
|
|
x: 'x',
|
|
columns: [
|
|
['x', 1, 2, 3, 4],
|
|
['temp', 24, 24.5, 24.3, 24.6],
|
|
['humidity', 83.1, 99.5, 74.3, 84.6],
|
|
],
|
|
axes: {
|
|
temp: 'y',
|
|
humidity: 'y2'
|
|
}
|
|
},
|
|
axis: {
|
|
y2: {
|
|
show: true
|
|
}
|
|
},
|
|
zoom: {
|
|
enabled: true
|
|
}
|
|
})
|
|
chart2 = c3.generate({
|
|
bindto: '#volts',
|
|
data: {
|
|
x: 'x',
|
|
columns: [
|
|
['x', 1, 2, 3, 4],
|
|
['voltage', 24, 24.5, 24.3, 24.6],
|
|
],
|
|
axes: {
|
|
voltage: 'y',
|
|
}
|
|
},
|
|
zoom: {
|
|
enabled: true
|
|
}
|
|
})
|
|
}
|
|
window.onload = () => {
|
|
initCharts()
|
|
const xhr = new XmlHttpRequest()
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div id="humidity-temp"></div>
|
|
<div id="volts"></div>
|
|
<p>Test!</p>
|
|
</body>
|
|
</html>
|