Chartjs-Change the graph from 1 Day to 15 mins when it is being loaded for the 1st time in ChartIQ

0👍

I am assuming you are using the default ‘sample-template-advanced.html’ as your starting point.

This template uses localStorage to save and restore the chart state. So the 1 Day periodicity will only be the default on your very first load ever. After that, the state will be restored from your last interaction with the chart, at whatever periodicity that as.

But if that very first load is what you want to change, just look for function loadTheChart() in the HTML file and in there, replace this:

if(!stxx.chart.symbol){
    UIContext.UISymbolLookup.selectItem({symbol:"AAPL"}); // load an initial symbol
}

with this:

if(!stxx.chart.symbol){
    stxx.setPeriodicity({period:15, timeUnit:"minute"});
    UIContext.UISymbolLookup.selectItem({symbol:"AAPL"}); // load an initial symbol
}

If you have any more questions, please contacts direct at support@chartiq.com.

Thanks!!

Gus

Leave a comment