Perspective Power Chart invalid rangeEndDate

When using the Power Chart in historical mode and I choose a rangeEndDate in the future (for which there is no tag history), and then press apply, the selected range changes but the chart does not update. This is because it is throwing a wrapper error on the historical tag read. How do prevent the user from selecting a future date or intercept their errant entry and set it to now()? I tried a property change script to intercept the bad choice but that doesn’t take effect until too late (i.e. after the error)

This was solved by adding the following onChange script on props/config/endDate in historical mode:

if currentValue.value > system.date.now():
	self.props.config.endDate = system.date.now()

rangeEndDate is used to control only pan & zoom time, whereas endDate controls the selected time range of the chart. The change script was not firing because we had a check for if the chart was in historical mode, which it wasn’t until after the user had already selected a time.

1 Like