plotly / plotly/plotly.py

Missing functionality in `px.timeline` against `create_gantt()` figure factory

オープン
#3,675 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug P3 regression
主要言語
Python
スター
18.8k
フォーク
2.8k
平均マージ
16時間 26分
マージ済み PR(30日)
21

説明

create_gantt() figure factory is deprecated in favor of px.timeline, but create_gantt() has the feature (argument) group_tasks that is not present with px.timeline.
An additional issue is that the group_task argument is not explained in the create_gantt() documentation check here.

For example, the code:

import plotly.express as px
import pandas as pd

df = pd.DataFrame([
    dict(Task="Job A", Start='2009-01-01', Finish='2009-02-28', Resource='Alex'),
    dict(Task="Job B", Start='2009-03-05', Finish='2009-04-15', Resource='Max'),
    dict(Task="Job C", Start='2009-02-20', Finish='2009-05-30', Resource='Max'),
    dict(Task="Job A", Start='2009-03-02', Finish='2009-05-30', Resource='Alex')
])

fig = px.timeline(df, x_start="Start", x_end="Finish", y="Task", color = "Resource")
fig.update_yaxes(autorange="reversed") # otherwise tasks are listed from the bottom up
fig.show()

Produces:
enter image description here

And I would like to have each tasks in the input data frame into its own line in the y-axis, even for repeating tasks:
enter image description here

We can obtain this using create_gantt() like:

from plotly.figure_factory import create_gantt

fig = create_gantt(df, index_col='Resource', 
                      showgrid_x=True, showgrid_y=True,
                      show_colorbar=True,
                      group_tasks=False
                      )
fig.update_yaxes(autorange="reversed")
fig.show()

Obtaining:
2022-04-11 19_51_14-127 0 0 1_1586

The order follows the order in the df which I found a correct behavior, but an extra input to define the order in create_gantt() would be useful.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

px.timeline のエントリポイントから始め、特に例に示されている group_tasks 引数に注目して、その動作を create_gantt() Figure Factory と比較してください。create_gantt() の API ドキュメントを確認し、不足している引数の説明を調べてください。繰り返しのタスクを、定義された順序で y 軸の別々の行に描画でき、関連する動作がドキュメント化されていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
data-visualization
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。