我正在尝试对从这里获取的生动的甘特图进行一些更改:https://plotly.com/python/gantt/
我想添加一个名为“事件”的额外条目,它采用任务在开始和完成之间实际发生的次数,而不是开始和完成之间的持续时间
例如,在2009-01-01到2009-02-28之间,“作业A”发生了100次。所以我希望“作业A”的水平长度是100,“作业B”的长度是50,“作业C”的长度分别是25
import plotly.express as px
import pandas as pd
df = pd.DataFrame([
dict(Task="Job A", Start='2009-01-01', Finish='2009-02-28', Occurrence = 100, Resource="Alex"),
dict(Task="Job B", Start='2009-03-05', Finish='2009-04-15', Occurrence = 50, Resource="Alex"),
dict(Task="Job C", Start='2009-02-20', Finish='2009-05-30', Occurrence = 25, Resource="Max")
])
fig = px.timeline(df, x_start="Start", x_end="Finish", y="Task", color="Resource")
fig.update_yaxes(autorange="reversed")
fig.show()
我怎样才能做到这一点
目前没有回答
相关问题 更多 >
编程相关推荐