I’d like to create a Gantt chart where each task (horizontal bar) can have more than one start_time/end_time entries.
My data source is like this
taskId,subtask,time,duration,state
0,0,0,10,OFF
0,1,10,20,ON
0,2,30,5,OFF
0,3,35,20,ON
defining that task 0 starts with a state OFF at time 0, then at time 10 it goes ON, then at time 30 OFF again, and finally at time 35 it goes on for 20 more units of time.
I know how to do a Gantt chart where each line of my data above is a separate bar in the bar chart (see top chart in the image below).
However, I’d like all those bars to be “collapsed” and colored according to the state (ON/OFF). I’ve been able to collapse them by creating a new field so that each entry has a unique value to group by (bottom chart of the image below).
But I cannot find how to then color each bar based on the state.
Is there a way to group by one field but then color based on another one?