Oscar, if you haven’t figured this out yet, you have to loop through your dataset (perhaps in a Script Transform) and create the structure that is expected. Your data probably only has a date column and an integer status column. This script might help you get started.
data = <some code that returns a dataset goes here>
prevmode = -1
prevstart = 0
events = []
modes = {0:"Unknown", 1:"Fault", 2:"Offline", 3:"Standby", 4:"Production"}
for row in range(data.getRowCount()):
mode = data.getValueAt(row,1)
time = system.date.toMillis(data.getValueAt(row,0))
if row == 0:
prevmode = mode
prevstart = system.date.toMillis(start)
if row > 0:
if mode <> prevmode:
events.append({
"mode": modes[prevmode],
"start": prevstart,
"end": time,
})
prevmode = mode
prevstart = time
data = ([
{"name": "",
"events": events
}
])
return data