This Answer says xaxis=dict(type = "category") but I don't know where to use that argument (fresh from matplotlib only for candlesticks)
Following some Links, I found that running the below code on Day data, I can easily remove gaps:
dt_all = pd.date_range(start=stocks.iloc[0,0],end=stocks.iloc[-1,0], freq = f'{freq}min')
dt_obs = [d.strftime("%Y-%m-%d %H:%M:%S") for d in pd.to_datetime(stocks.DATE)]
dt_breaks = [d for d in dt_all.strftime("%Y-%m-%d %H:%M:%S").tolist() if not d in dt_obs]
range_selector = dict(buttons = list([
dict(count = 5, label = '5Min', step = 'minute', stepmode = 'backward'),
dict(count = 15, label = '15Min', step = 'minute', stepmode = 'backward'),
dict(count = 75, label = '75M', step = 'minute', stepmode = 'backward'),
dict(count = 1, label = '1D', step = 'day', stepmode = 'backward'),
dict(step = 'all')]))
candle = go.Figure(data = [go.Candlestick(opacity = 0.9,x = stocks['Date'], name = 'X',
open = stocks['Open'],
high = stocks['High'],
low = stocks['Low'],
close = stocks['Close']),])
candle.update_xaxes(
title_text = 'Date',
rangeslider_visible = True,
rangebreaks=[dict(values=dt_breaks)],
range_selector = range_selector)
But I have 5 Minute Data as:
DATE OPEN HIGH LOW CLOSE 52W H 52W L SYMBOL
374 2022-01-14 15:25:00+05:30 720.25 722.35 720.25 721.55 NaN NaN BHARTIARTL
373 2022-01-14 15:20:00+05:30 720.30 720.45 719.45 720.25 NaN NaN BHARTIARTL
372 2022-01-14 15:15:00+05:30 720.75 720.90 720.15 720.30 NaN NaN BHARTIARTL
371 2022-01-14 15:10:00+05:30 720.35 720.90 720.20 720.70 NaN NaN BHARTIARTL
370 2022-01-14 15:05:00+05:30 720.70 720.90 720.05 720.20 NaN NaN BHARTIARTL
... ... ... ... ... ... ... ... ...
4 2022-01-10 09:35:00+05:30 706.05 707.15 705.65 706.55 NaN NaN BHARTIARTL
3 2022-01-10 09:30:00+05:30 705.90 706.40 705.05 706.05 NaN NaN BHARTIARTL
2 2022-01-10 09:25:00+05:30 707.10 707.95 705.60 705.60 NaN NaN BHARTIARTL
1 2022-01-10 09:20:00+05:30 709.00 709.40 706.15 707.10 NaN NaN BHARTIARTL
0 2022-01-10 09:15:00+05:30 705.40 709.00 705.40 708.55 NaN NaN BHARTIARTL
Using the above code gives me results as:


