I don't believe I would do any of that in configureChart. The dataset, once saved in the designer shouldn't need to be recreated, but if it needed to be scripted at initialization for some reason, the easy chart's propertyChange event handler would be where I would put it. The code would look something like this:
# Run only once at initialization
# componentRunning only works in the designer if preview mode is on before the window is opened
if event.propertyName == 'componentRunning' and event.newValue:
# Get the tag pen headers
headers = list(system.dataset.getColumnHeaders(event.source.tagPens))
# Get the tag pen parameter information in some way and assemble it into a list of lists
data = [
["LIT0101","[default]Item1/Sensors/LIT0101/SensorStatus/value","MinMax","cm","1","true","color(255,85,85,255)","","1","1.0","0","true","false","","false","false","false","true",3,"true"],
["LIT0201","[default]Item1/Sensors/LIT0201/SensorStatus/value","MinMax","cm","1","true","color(85,85,255,255)","","1","1.0","0","true","false","","false","false","false","true",2,"true"],
["LIT0202","[default]Item1/Sensors/LIT0202/SensorStatus/value","MinMax","cm","1","true","color(85,255,85,255)","","1","1.0","0","true","false","","false","false","false","true",1,"true"]]
# Compile the data into a dataset and assign it to the tag pens property
event.source.tagPens = system.dataset.toDataSet(headers, data)
As for the dynamic start and end parameters, I would move this script out of configureChart and onto the parent container's propertyChange
event handler:
# Validate the events, so this script only runs when the start and end date properties change
if event.propertyName in ['startDT', 'endDT']:
# Get the current start and end dates
startDate = event.source.startDT
endDate = event.source.endDT
# Validate the start and end dates in some way before assigning them to the chart parameters
if endDate and startDate and endDate > startDate:
easyChart = event.source.parent.getComponent('Easy Chart')
easyChart.startDate = startDate
easyChart.endDate = endDate