diff --git a/examples/demo.html b/examples/demo.html index cdf57d0..30dad1e 100755 --- a/examples/demo.html +++ b/examples/demo.html @@ -15,11 +15,12 @@ const data1 = Array.from({ length: arrayLength }, (el, idx) => [startTime + idx * 10000, Math.floor(Math.random() * 40)]); const data2 = Array.from({ length: arrayLength }, (el, idx) => [startTime + idx * 10000, Math.floor(Math.random() * 100)]); const data3 = Array.from({ length: arrayLength }, (el, idx) => [startTime + idx * 10000, Math.floor(Math.random() * 20) + 90]); - const zoomIn = (ranges) => { pod.render(); } - const zoomOut = (ranges) => { pod.state.xValueRange = [startTime, startTime + arrayLength * 10000]; pod.render(); } + const zoomIn = (ranges) => { const xRange = ranges[0]; options.axis.x.range = xRange; pod.updateData(undefined, options); } + const zoomOut = (ranges) => { options.axis.x.range = [startTime, startTime + arrayLength * 10000]; pod.updateData(undefined, options); } + const panningEnd = (ranges) => { const xRange = ranges[0]; options.axis.x.range = xRange; pod.updateData(undefined, options); } let options = { renderLegend: false, usePanning: false, axis: { y: { invert: false, range: [0, 350] }, x: { format: 'time' } }, - eventsCallbacks: { zoomIn: zoomIn, zoomOut } + eventsCallbacks: { zoomIn: zoomIn, zoomOut, panningEnd } } var pod = new LinePod( document.getElementById('chart'), diff --git a/examples/demo_live.html b/examples/demo_live.html index 2c9a4d9..0e1e625 100755 --- a/examples/demo_live.html +++ b/examples/demo_live.html @@ -14,10 +14,13 @@