[英]Set x axis to plotly Gantt chart
I'm new to plotly and I have some tasks with start=int and finish=int (in abstract time units). 我是plotly的新手,我有一些start = int和finish = int(以抽象时间单位)的任务。 But x axis is in date format as default. 但是x轴默认为日期格式。 I want to set x axis in number format(0,1,2...) 我想将x轴设置为数字格式(0,1,2 ...)
Here is my code: 这是我的代码:
df=list(df.values())
pprint(df)
colors = ['#ff1919', '#0000ff']
fig = ff.create_gantt(df, colors=colors, index_col='Resource',
reverse_colors=True, show_colorbar=True)
py.plot(fig, filename='gantt-string-variable', world_readable=True)
df looks like: df看起来像:
df=[{'Finish': 5, 'Resource': 'Red', 'Start': 0, 'Task': 'task1'},
{'Finish': 13, 'Resource': 'Red', 'Start': 5, 'Task': 'task2'},
{'Finish': 8, 'Resource': 'Blue', 'Start': 5, 'Task': 'task3'},
{'Finish': 11, 'Resource': 'Blue', 'Start': 5, 'Task': 'task4'},
{'Finish': 20, 'Resource': 'Red', 'Start': 13, 'Task': 'task5'},
{'Finish': 19, 'Resource': 'Blue', 'Start': 13, 'Task': 'task6'},
{'Finish': 24, 'Resource': 'Red', 'Start': 20, 'Task': 'task7'}]
any advice! 任何建议!
在py.plot(fig, filename='gantt-string-variable', world_readable=True)
之前py.plot(fig, filename='gantt-string-variable', world_readable=True)
将此行fig['layout']['xaxis'].update({'type': None})
py.plot(fig, filename='gantt-string-variable', world_readable=True)
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.