plotly - 范围选择器内的 Dash Plotly 日期选择器
问题描述
我正在尝试在范围选择器内的按钮上设置日期选择器,将我的选择增加到 1M、6M、1Y 等之外。按照显示新按钮的代码。我只是不知道如何添加动作。感谢任何帮助。
def drawGraph():
return html.Div([
dbc.Card(
dbc.CardBody([
dcc.Graph(
figure = px.area(
stocks_close.AMZN, title = 'Amazon',
height=600
).update_xaxes(
title_text = 'Data',
rangeslider_visible = True,
rangeselector = dict(
buttons = list([
dict(count = 0, label = 'Date Range', step = 'all', stepmode = 'backward'),
dict(count = 5, label = '5D', step = 'day', stepmode = 'backward'),
dict(count = 1, label = '1M', step = 'month', stepmode = 'backward'),
dict(count = 6, label = '6M', step = 'month', stepmode = 'backward'),
dict(count = 1, label = 'YTD', step = 'year', stepmode = 'todate'),
dict(count = 1, label = '1Y', step = 'year', stepmode = 'backward'),
dict(count = 2, label = '2Y', step = 'year', stepmode = 'backward'),
dict(step = 'all')]))
解决方案
推荐阅读
- django - Wagtail - 如何在管理表单中预先填充字段?
- vue.js - 如何动态呈现不同数据表的列表
- python-3.x - 在 Python 3 中安装 SOAPpy
- python - Python re.findall 发现奇怪的错误模式
- django - 如何在 Pycharm 中运行 Django 函数?
- r - 如何将 cat 的输出作为字符串而不是打印出来?
- go - 未定义:尝试为 armv7 构建 go 应用程序时的 SQLiteConn
- django - django 视图循环在 html 模板中不起作用
- c++ - 了解浮点数的二进制表示
- sql-server - 从 SQL 中的连接尾记录中删除回车和换行?