Set span and periodicity on the newChart call

Set span and periodicity on the newChart call

by sonylnagale

HTML

<link rel="stylesheet" href="https://jsfiddle.chartiq.com/chart/css/stx-chart.css">
<div class="chartContainer" style="width:100%;height:400px;position:relative;"></div>

<!--[if IE 8]><script>alert("This template is not compatible with IE8");</script><![endif]-->

<script src="https://jsfiddle.chartiq.com/chart/js/chartiq.js"></script>
<script src="https://jsfiddle.chartiq.com/chart/examples/feeds/quoteFeedSimulator.js"></script>

JavaScript

// instantiate your chart engine and configure defaults
var stxx = new CIQ.ChartEngine({
  container: $$$(".chartContainer")
});

// initialize the data feed (this can be called for initial data as well as updates for all instruments on the chart)
stxx.attachQuoteFeed(quoteFeedSimulator, {
  refreshInterval: 0 // no updates on this sample.
});

// turn crosshair on
stxx.layout.crosshair = true

// draw the main chart

stxx.loadChart(
  'IBM',
  function() {}, {
    span: {
      base: 'day',
      multiplier: 2
    },
    periodicity: {
      period: 1,
      interval: 5,
      timeUnit: 'minute'
    }
  }
);

stxx.setRange({
	dtLeft: "2019-12-21T20:55:08",
  dtRight: "2019-12-25T20:55:08"
})

stxx.chart.yAxis.max = 100