How to add a horizontal scroll to a plot with 100 of Candlesticks ( can display first 10 )

How to add a horizontal scroll to a plot with 100 of Candlesticks

for vidx, (xd, yad, aclr, ytd, tclr, asr) in enumerate(zip(x_data, a_data, a_colors, t_data, t_colors, ysr)):
     boxplot_fig.add_trace(go.Candlestick(x=[x_data[vidx]],open=[yad[1]], high=[yad[0]],low=[yad[2]], close=[yad[3]]))

Note My x axis are characters not index

Answering myself

It helped solving

1 Like

@yogi_dhiman

Tou can also add a rangeslider. For simplicity let us suppose that on x-axis you have the list of strings (chars):
[“A”, “B”, … "“R”]
Then define:

ticktext=["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R"]
tickvals= list(range(len(ticktext)))
figb.update_xaxes(type="category", rangeslider_visible=True, range=[-0.5, 10], 
                  tickvals=tickvals, ticktext=ticktext)

and you can move rangeslider to display your boxplots, successively.

For more information on xaxis_rangeslider read its attributes displayed by:

help(go.layout.XAxis.rangeslider)
1 Like