timeInterval property
- Last UpdatedOct 10, 2025
- 3 minute read
The following items fall under the timeInterval property under the globalSetting.
Note: To show time interval, the showTimeRange property has to be set to True.
-
interval
This is a string in "hh:mm" or "hh:mm:ss" where
-
hh = hour (0 - any numeric value)
-
mm = minute (0 - 59)
-
ss = second (0 - 59)
-
-
intervalDisplay
This is a numeric value that represents that following options to display:
-
1 - Date and time
-
2 - Time only (default)
-
Example 1
control.findByXmlNode("Widget1").widgetProperties.data = JSON.stringify(
{
globalSetting:
{
barThickness: 50,
timePeriod: 0,
duration: 10, // will be used when timePeriod is 0.
timeRangeStartTime: "", // will be used when timePeriod is 1.
timeRangeEndTime: "", // will be used when timePeriod is 1.
widgetTitle: "",
showBarLabel: true,
showDetailsPane: true,
showTimeRange: true,
showLegend: true,
showCurvedBar: true,
segmentLabelPosition: 0,
enableTimerRefresh: true,
timerRefreshRate: 30,
enableAction1: true,
action1Title: "Split",
enableAction2: true,
action2Title: "Merge",
enableAction3: true,
action3Title: "Edit",
columnNameMapping:
{
eventState : "state_desc",
eventStartTimeutc : "event_time_utc",
eventEndTimeutc : "event_end_time_utc",
eventName : "reas_desc",
eventColor : "state_color",
},
timeInterval:
{
interval:"00:30",
intervalDisplay: 1,
},
},
datasets:
[
{
barLabel: "Filler1",
barThickness: 80,
segmentLabelPosition:1,
columnNameMapping :
{
eventState : "state_desc",
eventStartTimeutc : "event_time_utc",
eventEndTimeutc : "event_end_time_utc",
eventName : "reas_desc",
eventColor : "state_color",
},
dataSegments:
[
{
ent_id: 11,
log_id: 1198853,
event_time_utc: "2022-10-07T06:00:00.000Z",
event_end_time_utc: "2022-10-07T06:55:00.000Z",
state_cd: 2,
state_cd: 1,
state_desc: "RUNNING1",
state_color: "#F5A623",
reas_desc: "Changeover2M",
},
],
}
],
legends:
[
{"name":"Running","color":"red"},
{"name":"Down","color":"green"},
],
});
Example 2
If you have a single Gantt Chart and using a Work Tasks lookup, you can use a similar script like the following with the On Initialize event to pass the lookup data into the widget.
var parameterCollection =
[
{
Name: "EntID",
Value: "7",
},
{
Name: "hr",
Value: "42",
},
];
try
{
var ganttLookup = SFU.getLookupSchemaAndData(
"entityparam",
parameterCollection,
true
);
if (
ganttLookup.DisplayColumn === "" &&
ganttLookup.ValueColumn === "" &&
ganttLookup.Data.length === 0
)
{
throw new Error("gantt lookup not found !");
}
var allData =
{
globalSetting:
{
barThickness: 50,
timePeriod: 0,
duration: 42,
timeRangeStartTime: "2022-09-01 00:00:00",
timeRangeEndTime: "2022-09-01 11:00:00",
widgetTitle: "PSR_Entity_001",
showDetailPane: true,
showTimeRange: true,
eventLabelPosition: 0,
enableTimerRefresh: true,
timerRefreshRate: 30,
enableAction1: true,
action1Title: "Split",
enableAction2: true,
action2Title: "Merge",
enableAction3: true,
action3Title: "Edit",
columnNameMapping:
{
eventState: "state_desc",
eventStartTimeutc: "event_time_utc",
eventEndTimeutc: "event_end_time_utc",
eventName: "reas_desc",
eventColor: "state_color",
},
},
datasets:
[
{
barThickness: 80,
columnNameMapping:
{
eventState: "state_desc",
eventStartTimeutc: "event_time_utc",
eventEndTimeutc: "event_end_time_utc",
eventName: "reas_desc",
eventColor: "state_color",
},
dataSegments: ganttLookup.Data,
},
],
};
control.findByXmlNode("Widget1").widgetProperties.data = JSON.stringify(allData);
}
catch (error)
{
SFU.showError("Gantt Lookup Fail !");
}
Example 3
If you have multiple Gantt Charts and using a Work Tasks lookup, you can use a similar script like the following with the On Initialize event to pass the lookup data into the widget.
// fetch and show 3 entities
try
{
var entities = [12, 13, 14];
var ganttLookup = [];
for (var i = 0; i < entities.length; i++)
{
var parameterCollection = [
{
Name: "1",
Value: entities[i],
},
{
Name: "2",
Value: 100,
},
];
// fetch different entities
ganttLookup.push(
SFU.getLookupSchemaAndData("789Api", parameterCollection, true)
);
if (
ganttLookup[i].DisplayColumn === "" &&
ganttLookup[i].ValueColumn === "" &&
ganttLookup[i].Data.length === 0
)
{
throw new Error("gantt lookup #" + i + " not found !");
}
} // end of for loops - entities 12, 13 and 14
var allData =
{
globalSetting:
{
widgetTitle: "Entities",
showBarLabel: true,
showTimeRange: true,
enableTimerRefresh: true,
timerRefreshRate: 30,
columnNameMapping:
{
eventState: "state_desc",
eventStartTimeutc: "event_time_utc",
eventEndTimeutc: "event_end_time_utc",
eventName: "reas_desc",
eventColor: "state_color",
},
},
datasets:
[
// bar 1
{
barLabel: "Entity 12",
barThickness: 80,
segmentLabelPosition: 1,
dataSegments: ganttLookup[0].Data,
},
// bar 2
{
barLabel: "Entity 13",
barThickness: 20,
segmentLabelPosition: 1,
dataSegments: ganttLookup[1].Data,
},
// bar 3
{
barLabel: "Entity 14",
barThickness: 70,
segmentLabelPosition: 1,
dataSegments: ganttLookup[2].Data,
},
],
};
control.findByXmlNode("Widget1").widgetProperties.data = JSON.stringify(allData);
}
catch (error)
{
SFU.showError("Gantt Lookup Fail !");
}