Chart ScrollTo example

In this fiddle we show how to implement chart scrolling with the chart engine's scrollTo method

by ChartIQ Library

HTML

<link rel="stylesheet" type="text/css" href="https://jsfiddle.chartiq.com/chart/css/stx-chart.css" media="screen" />

<div class="chartContainer" style="width:100%;height:400px;position:relative;"></div>

JavaScript

import { CIQ } from "https://jsfiddle.chartiq.com/chart/js/advanced.js";

// Activate the License Key
import getLicenseKey from "https://jsfiddle.chartiq.com/chart/key.js";
getLicenseKey(CIQ);

import sampleData from "https://jsfiddle.chartiq.com/chart/examples/data/STX_SAMPLE_DAILY.js";

const stxx = new CIQ.ChartEngine({
  container: document.querySelector('.chartContainer')
})
stxx.loadChart("SPY", sampleData);

setInterval(function() {
  stxx.scrollTo(stxx.chart, 20, () => stxx.scrollTo(stxx.chart, 100))
}, 5000)