plotly / plotly/plotly.py

fail to update_xaxes rangebreaks by datetime

未關閉
#3,224 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

bug P3
主要語言
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

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 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

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。