@@ -1761,7 +1761,10 @@ def _gantt(chart, colors, title, bar_width, showgrid_x, showgrid_y,
17611761 # name is not already in the list
17621762 if not group_tasks or tn not in task_names :
17631763 task_names .append (tn )
1764- task_names .reverse ()
1764+ # Gurantees that for grouped tasks the tasks that are inserted first
1765+ # are shown at the top
1766+ if group_tasks :
1767+ task_names .reverse ()
17651768
17661769
17671770 color_index = 0
@@ -1900,7 +1903,10 @@ def _gantt_colorscale(chart, colors, title, index_col, show_colorbar,
19001903 # name is not already in the list
19011904 if not group_tasks or tn not in task_names :
19021905 task_names .append (tn )
1903- task_names .reverse ()
1906+ # Gurantees that for grouped tasks the tasks that are inserted first
1907+ # are shown at the top
1908+ if group_tasks :
1909+ task_names .reverse ()
19041910
19051911 for index in range (len (tasks )):
19061912 tn = tasks [index ]['name' ]
@@ -1996,7 +2002,10 @@ def _gantt_colorscale(chart, colors, title, index_col, show_colorbar,
19962002 # name is not already in the list
19972003 if not group_tasks or tn not in task_names :
19982004 task_names .append (tn )
1999- task_names .reverse ()
2005+ # Gurantees that for grouped tasks the tasks that are inserted first
2006+ # are shown at the top
2007+ if group_tasks :
2008+ task_names .reverse ()
20002009
20012010 for index in range (len (tasks )):
20022011 tn = tasks [index ]['name' ]
@@ -2152,7 +2161,10 @@ def _gantt_dict(chart, colors, title, index_col, show_colorbar, bar_width,
21522161 # name is not already in the list
21532162 if not group_tasks or tn not in task_names :
21542163 task_names .append (tn )
2155- task_names .reverse ()
2164+ # Gurantees that for grouped tasks the tasks that are inserted first
2165+ # are shown at the top
2166+ if group_tasks :
2167+ task_names .reverse ()
21562168
21572169 for index in range (len (tasks )):
21582170 tn = tasks [index ]['name' ]
0 commit comments