I'm using TradingView's Lightweight Charts to display a chart where the visible time range is set by a dropdown (ex: 1D, 1Y, etc). When the selected range as set by chart.timeScale().setVisibleRange()
is wider than the timestamp range covered by the chart's data series, the chart sets the tine scale edges to match the data series rather than what was specified using setVisibleRange()
.
I would like the chart to always obey the range set by setVisibleRange()
, even when it does not yet have data points to fill that entire range. How can I force it to do this, other than by setting empty/blank data points?
Here's an example where I set the left edge of the chart to 1 June 2018, but the chart only displays from 22 Sept. The left edge of the chart should obey setVisibleRange()
and display empty space for the missing data points, without having to explicitly add empty data points:
https://jsfiddle.net/hgz9q3cy/
chart.timeScale().setVisibleRange({
from: 1527811200, //Friday, 1 June 2018 00:00:00
to: 1546300800, //Tuesday, 1 January 2019 00:00:00
});