-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathnon-react-example.html
More file actions
29 lines (26 loc) · 918 Bytes
/
non-react-example.html
File metadata and controls
29 lines (26 loc) · 918 Bytes
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Non React Test</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.0.2/react.min.js"></script>
<script src="https://unpkg.com/binary-charts/lib/binary-charts.js"></script>
</head>
<body>
<div id="chart"></div>
<script>
const PlainChart = window['binary-charts'].PlainChart;
const chart = PlainChart('chart', { type: 'area', ticks: [], pipSize: 2 });
const random = () =>
Math.random() * (20 - 10) + 10;
const nowEpoch = () =>
new Date().getTime() / 1000;
let ticks = [];
window.setInterval(() => {
const newTick = { epoch: nowEpoch(), quote: random() };
ticks = ticks.concat(newTick);
chart.updateChart({ type: 'area', ticks: ticks, pipSize: 4 });
}, 1000);
</script>
</body>
</html>