Skip to content

Gantt chart legend scrolls dues to extra legend entries #1493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jonmmease opened this issue Apr 4, 2019 · 1 comment
Closed

Gantt chart legend scrolls dues to extra legend entries #1493

jonmmease opened this issue Apr 4, 2019 · 1 comment
Labels
bug something broken

Comments

@jonmmease
Copy link
Contributor

The gantt chart legend sometimes scrolls unnecessarily.

Cross references:

import pandas as pd
from plotly.offline import init_notebook_mode, iplot
import plotly.figure_factory as ff
init_notebook_mode()

df1 = pd.DataFrame({'TaskName': ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'I', 'J', 'K'],
                'StartDate1' : ['2019-03-27 00:00:00','2019-03-27 00:00:30', '2019-03-27 00:01:00', '2019-03-27 00:01:30', '2019-03-27 00:01:40',
                             '2019-03-27 00:02:30', '2019-03-27 00:03:00', '2019-03-27 00:03:30', '2019-03-27 00:04:00', '2019-03-27 00:04:30'],
                'EndDate1': ['2019-03-27 00:03:00', '2019-03-27 00:03:20', '2019-03-27 00:04:10', '2019-03-27 00:03:40', '2019-03-27 00:05:50',
                            '2019-03-27 00:06:40', '2019-03-27 00:07:10', '2019-03-27 00:08:00', '2019-03-27 00:08:20', '2019-03-27 00:08:40'],
                'StartDate2' : ['2019-03-27 00:03:00', '2019-03-27 00:03:20', '2019-03-27 00:04:10', '2019-03-27 00:03:40', '2019-03-27 00:05:50',
                            '2019-03-27 00:06:40', '2019-03-27 00:07:10', '2019-03-27 00:08:00', '2019-03-27 00:08:20', '2019-03-27 00:08:40'],
                'EndDate2': ['2019-03-27 00:04:00', '2019-03-27 00:04:20', '2019-03-27 00:05:10', '2019-03-27 00:05:40', '2019-03-27 00:06:50',
                            '2019-03-27 00:07:40', '2019-03-27 00:08:10', '2019-03-27 00:09:00', '2019-03-27 00:09:20', '2019-03-27 00:09:40']})

def gantt_fig3(df1):
    data3 = []
    for row in df1.itertuples():
        data3.append(dict(Task=str(row.TaskName), Start=str(row.StartDate1),
                      Finish=str(row.EndDate1), Resource='Resource1'))
        data3.append(dict(Task=str(row.TaskName), Start=str(row.StartDate2),
                      Finish=str(row.EndDate2), Resource='Resource2'))


    fig = ff.create_gantt(data3, index_col='Resource', title='Gantt Chart', show_colorbar = True, group_tasks = True , height=500, width=1300 )
    fig['layout'].update(legend=dict(traceorder='reversed'))
    return fig

iplot(gantt_fig3(df1))

Screenshot_20190404_072724

@jonmmease jonmmease added the bug something broken label Apr 4, 2019
@gvwilson
Copy link
Contributor

Hi - we are currently trying to tidy up Plotly's public repositories to help us focus our efforts on things that will help users most. Since this issue has been sitting for several years, I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our backlog. Thanks for your help - @gvwilson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

No branches or pull requests

2 participants