# Issue in displaying multi day data with range breaks

**URL:** <https://community.plotly.com/t/issue-in-displaying-multi-day-data-with-range-breaks/60660>\
**Category:** 📊 Plotly Python\
**Tags:** question\
**Created:** [February 3, 2022, 6:20am UTC](https://community.plotly.com/t/issue-in-displaying-multi-day-data-with-range-breaks/60660 "2022-02-03T06:20:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![premji2k](https://avatars.discourse-cdn.com/v4/letter/p/77aa72/32.png) [@premji2k](https://community.plotly.com/u/premji2k)\
**Post date:** [February 3, 2022, 6:20am UTC](https://community.plotly.com/t/issue-in-displaying-multi-day-data-with-range-breaks/60660/1 "2022-02-03T06:20:09Z")

</div>

Hi ,  
I am a first time user of plotly.

I am trying to display multiple day stock data - OHLC and 3 moving average.  
If I do not use the rangebreaks, then the data is showing correctly.  
However if I use range breaks, then only first day data is being displayed.

```
fig = go.Figure(go.Candlestick(
    x=in_stock_df.index, # ['datetimestamp'],
    open=in_stock_df['open'],
    high=in_stock_df['high'],
    low=in_stock_df['low'],
    close=in_stock_df['close']
))

# removing all empty dates
# build complete timeline from start date to end date
period_frequency_dict = config.c_g_period_python_freq_dict
frequency = period_frequency_dict.get(f_period) # maps broker period to python frequency
dt_all = pd.date_range(start=in_stock_df.index[0], end=in_stock_df.index[-1], freq=frequency)

# retrieve the dates that ARE in the original datset
dt_obs = [d.strftime("%Y-%m-%d %H:%M:%S") for d in pd.to_datetime(in_stock_df.index)]

# define dates with missing values
dt_breaks = [d for d in dt_all.strftime("%Y-%m-%d %H:%M:%S").tolist() if not d in dt_obs]
fig.add_trace(go.Scatter(x=in_stock_df.index, y=in_stock_df['ema10'],opacity=0.7,
                         line=dict(color='blue', width=2),name='EMA10'))
fig.add_trace(go.Scatter(x=in_stock_df.index, y=in_stock_df['ema20'], opacity=0.7,
                         line=dict(color='orange', width=2), name='EMA20'))
fig.add_trace(go.Scatter(x=in_stock_df.index, y=in_stock_df['hma50'], opacity=0.7,
                         line=dict(color='orange', width=2), name='HMA50'))
fig.update_xaxes(rangebreaks=[dict(values=dt_breaks)])
fig_title = in_stock + ' for period ' + in_period + ' for range ' + 'From: ' + str(in_stock_df.index[0]) +' To: ' + str(in_stock_df.index[-1])
fig.update_layout(title=fig_title)

```

Would appreciate any help/ guidance.

 ![ploty-with-rangebreaks](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/1/d/1d866a87cfd2cb2859f5ae850ee7619da2a2c913.jpeg)  
 ![ploty-without-rangebreaks](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/9/d/9d386c6cdf0e6f25e209ad0552d7fdbddcd37ffc.jpeg)

---

<div class="post-metadata">

**Author:** ![premji2k](https://avatars.discourse-cdn.com/v4/letter/p/77aa72/32.png) [@premji2k](https://community.plotly.com/u/premji2k)\
**Post date:** [February 3, 2022, 8:29am UTC](https://community.plotly.com/t/issue-in-displaying-multi-day-data-with-range-breaks/60660/2 "2022-02-03T08:29:07Z")

</div>

Got the solution from another thread - [How to use rangebreaks for a datetime index at levels smaller than 1 hour?](https://community.plotly.com/t/how-to-use-rangebreaks-for-a-datetime-index-at-levels-smaller-than-1-hour/46073)

Issue resolved.
