我绘制了价格图表。 Y轴刻度设置为整个价格范围内的最小和最大价格。
当我减小范围时,例如当我显示最后一小时时,Y轴不会缩放,并且给出相同的范围。如何才能使Y轴自动缩放到可见的价格范围?
这是我的布局
layout = go.Layout(
title=title,
legend=dict(orientation="h"),
xaxis=dict(
rangeselector=dict(
buttons=list([
dict(count=1,
label='1h',
step='hour',
stepmode='backward'),
dict(count=3,
label='3h',
step='hour',
stepmode='backward'),
dict(count=6,
label='6h',
step='hour',
stepmode='backward'),
dict(count=1,
label='1d',
step='day',
stepmode='backward'),
dict(count=3,
label='3d',
step='day',
stepmode='backward'),
dict(step='all')
])
),
rangeslider=dict(),
type='date'
),
yaxis=dict(
title=y_axis_label,
showticklabels= not seperate_y_axis,
autorange=True,
type='linear'
)
)
答案 0 :(得分:3)
我不认为现在可能是阴谋(见https://community.plot.ly/t/range-slider-and-selector-in-plotly-js-without-fixed-y-axis/1475,https://community.plot.ly/t/autoscaling-the-y-axis-when-using-rangeslider/1456)
你必须使用rangelider吗?也许不同的布局可行。