Skip to content
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

Clearing data list #900

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions plotly/figure_factory/_gantt.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,10 @@ def gantt_colorscale(chart, colors, title, index_col, show_colorbar, bar_width,

if show_colorbar is True:
# generate dummy data for colorscale visibility
data.append(
datalisted = data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For readability, can we changed newentries and datalisted to new_entries and data_listed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, underscores or none or naming conventions, I am good with any.

newentries = []

newentries.append(
dict(
x=[tasks[index]['x0'], tasks[index]['x0']],
y=[index, index],
Expand All @@ -286,6 +289,7 @@ def gantt_colorscale(chart, colors, title, index_col, show_colorbar, bar_width,
'cmin': 0}
)
)
data = newentries + datalisted

if isinstance(chart[0][index_col], str):
index_vals = []
Expand Down Expand Up @@ -355,9 +359,12 @@ def gantt_colorscale(chart, colors, title, index_col, show_colorbar, bar_width,

if show_colorbar is True:
# generate dummy data to generate legend
datalisted = data
newentries = []

showlegend = True
for k, index_value in enumerate(index_vals):
data.append(
newentries.append(
dict(
x=[tasks[index]['x0'], tasks[index]['x0']],
y=[k, k],
Expand All @@ -370,6 +377,7 @@ def gantt_colorscale(chart, colors, title, index_col, show_colorbar, bar_width,
)
)
)
data = newentries + datalisted

layout = dict(
title=title,
Expand Down Expand Up @@ -512,9 +520,12 @@ def gantt_dict(chart, colors, title, index_col, show_colorbar, bar_width,

if show_colorbar is True:
# generate dummy data to generate legend
datalisted = data
newentries = []

showlegend = True
for k, index_value in enumerate(index_vals):
data.append(
newentries.append(
dict(
x=[tasks[index]['x0'], tasks[index]['x0']],
y=[k, k],
Expand All @@ -527,6 +538,7 @@ def gantt_dict(chart, colors, title, index_col, show_colorbar, bar_width,
)
)
)
data = newentries + datalisted

layout = dict(
title=title,
Expand Down