Closed magic7s closed 3 years ago
Looks like its working. The Static Code Analysis is failing because I don't use variable i
. I goggled a workaround and nothing is clean in python. Let me know what you think.
The loop should be simplified as:
for _ in range(len(df)):
ok, tested. I merge your contribution, I will fix it as soon as the commit appears in the master branch
I think the set of colors should be generated from tasks and/or resource names. Indeed, with random colors, the Gantt chart colors change each time the solver is called, and it's not easy to compare two different charts. From one Gantt chart to the other, there should be the same color for each task/resource, and because names are unique they can be the basis of the color algorithm.
@tpaviot I like your idea of keeping the colors consistent. I guess a smaller change would have been to just path through colors to the end user so they could add whatever they want. I'll let you take it from here. Thanks for the quick merge.
Yes, both are possible: let the user choose its own colormap, or create a set of colors consistent with task and resources names. That should not be too much work, I keep you posted
An option would be this one:
colors = ['green', 'blue', 'red', 'yellow', 'grey', 'pink']
N = len(colors)
task_or_resource_name = 'Hello world'
list_of_ascii_numbers = [str(num) for num in map(ord,task_or_resource_name)]
encoding = int(''.join(list_of_ascii_numbers))
chosen_color = colors[encoding%N]
print(chosen_color)
I ran into an issue where I ran out of colors when rendering the plotly gantt.