You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
2.0 KiB
46 lines
2.0 KiB
3 years ago
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
|
||
|
<meta content="utf-8" http-equiv="encoding">
|
||
|
|
||
2 years ago
|
<script src="../dist/index.dev.js" type="text/javascript"></script>
|
||
3 years ago
|
</head>
|
||
|
<body>
|
||
3 years ago
|
<div id="chart" style="width: 50%; height: 500px;"></div>
|
||
3 years ago
|
|
||
|
<script type="text/javascript">
|
||
|
const startTime = 1590590148;
|
||
|
const arrayLength = 20;
|
||
3 years ago
|
const data1 = Array.from({ length: arrayLength }, (el, idx) => [startTime + idx * 10000, Math.floor(Math.random() * 40)]);
|
||
2 years ago
|
const data2 = Array.from({ length: arrayLength }, (el, idx) => [startTime + idx * 10000, Math.floor(Math.random() * 10)]);
|
||
3 years ago
|
const data3 = Array.from({ length: arrayLength }, (el, idx) => [startTime + idx * 10000, Math.floor(Math.random() * 20) + 90]);
|
||
3 years ago
|
const zoomIn = (ranges) => { const xRange = ranges[0]; options.axis.x.range = xRange; pod.updateData(undefined, options); }
|
||
|
const panningEnd = (ranges) => { const xRange = ranges[0]; options.axis.x.range = xRange; pod.updateData(undefined, options); }
|
||
3 years ago
|
let options = {
|
||
2 years ago
|
renderLegend: false, usePanning: false,
|
||
|
axis: {
|
||
|
y: { invert: false, range: [0, 350] },
|
||
|
y1: { isActive: true, range: [0, 10], ticksCount: 8 },
|
||
|
x: { format: 'time' }
|
||
|
},
|
||
3 years ago
|
zoomEvents: {
|
||
3 years ago
|
mouse: { zoom: { isActive: true, orientation: 'horizontal' } },
|
||
3 years ago
|
scroll: { zoom: { isActive: true, orientation: 'horizontal' } }
|
||
|
},
|
||
3 years ago
|
eventsCallbacks: { zoomIn: zoomIn, panningEnd }
|
||
3 years ago
|
}
|
||
3 years ago
|
var pod = new LinePod(
|
||
3 years ago
|
document.getElementById('chart'),
|
||
|
[
|
||
3 years ago
|
{ target: 'test1', datapoints: data1, color: 'green', dashArray: '5,3', class: 'first', renderArea: true },
|
||
2 years ago
|
{ target: 'test2', datapoints: data2, color: 'blue', yOrientation: 'right' },
|
||
3 years ago
|
{ target: 'test3', datapoints: data3, color: 'orange' },
|
||
3 years ago
|
],
|
||
|
options
|
||
|
);
|
||
|
pod.render();
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|