Reputation: 58
I'm new to plotly and I have some tasks with start=int and finish=int (in abstract time units). But x axis is in date format as default. I want to set x axis in number format(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=[{'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!
Upvotes: 1
Views: 2046
Reputation: 61
Call this line fig['layout']['xaxis'].update({'type': None})
before py.plot(fig, filename='gantt-string-variable', world_readable=True)
.
Upvotes: 5