fail to update_xaxes rangebreaks by datetime
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 18.8k
- 派生
- 2.8k
- 平均合并
- 16 小时 26 分钟
- 30 天内合并 PR
- 21
描述
data df:
`
id date_time time_hms time_second price time_date
0 2021-05-31 09:25:00 09:25:00 33900 7 2021-05-31
1 2021-05-31 09:30:00 09:30:00 34200 8 2021-05-31
2 2021-05-31 09:30:01 09:30:01 34201 7 2021-05-31
3 2021-05-31 09:30:02 09:30:02 34202 6 2021-05-31
4 2021-05-31 09:30:03 09:30:03 34203 5 2021-05-31
... ... ... ... ...
24264 2021-06-04 14:56:56 14:56:56 53816 7 2021-06-04
24265 2021-06-04 14:56:57 14:56:57 53817 6 2021-06-04
24266 2021-06-04 14:56:58 14:56:58 53818 4 2021-06-04
24267 2021-06-04 14:56:59 14:56:59 53819 7 2021-06-04
24268 2021-06-04 15:00:00 15:00:00 54000 8 2021-06-04
`
code:
`
import pandas as pd
import plotly.express as px
import plotly.io as pio
fig = px.line(df,
x = "date_time",
y = "price"
)
fig.update_xaxes(
rangebreaks=[
dict(bounds=["2021-06-01 09:25:00", "2021-06-04 09:25:01"]) # hide by datetime
]
)
pio.write_html(fig, file="stock_graph_px.html", auto_open=True)
`
the result html page is blank.
as document, rangebreaks only work for "date" .
but, how to deal with datetime breaks?
is there a simple way to set axis datetime breaks?
plotly==4.14.3
Python 3.8.5
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先使用 Plotly 4.14.3 运行提供的 pandas、Plotly Express 和 pio.write_html 示例,然后检查 update_xaxes 如何处理 datetime rangebreaks 的边界。确认该失败,并确定 datetime breaks 是否应生成非空的 HTML 页面;使用相同的复现验证结果。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100