# Alter chart configuration when dropping pens
# sample data for the Tag Pens property:
#"NAME","TAG_PATH","AGGREGATION_MODE","AXIS","SUBPLOT","ENABLED","COLOR","DASH_PATTERN","RENDER_STYLE","LINE_WEIGHT","SHAPE","FILL_SHAPE","LABELS","GROUP_NAME","DIGITAL","OVERRIDE_AUTOCOLOR","HIDDEN","USER_SELECTABLE","SORT_ORDER","USER_REMOVABLE"
#"HOA","[~]Motors/Motor 1/HOA","MinMax","HOA","2","true","color(85,255,85,255)","","1","1.0","0","true","false","","false","false","false","true",,"true"
# get old pen data and append new info
oldData = system.dataset.toPyDataSet(self.tagPens)
# get new info
for fullTagPath in paths:
# get names for everything in the tag path
lastSlashIndex = fullTagPath.rfind("/")
closeBracketIndex = fullTagPath.find("]")
tagName = fullTagPath[lastSlashIndex+1:]
tagPath = fullTagPath[closeBracketIndex+1:]
groupName = fullTagPath[closeBracketIndex+1:lastSlashIndex]
# find which tags are named "hoa" and put them in the HOA subplot.
if tagName.lower() == "hoa":
axis = "HOA"
subplot = 2
color = "color(255,85,85,255)" #red
digital = "true"
else:
axis = "Default Axis"
subplot = 1
color = "color(85,85,255,255)" #blue
digital = "false"
# append to the old pen data
newData = system.dataset.addRow(oldData, [tagName,tagPath,"MinMax",axis,subplot,"true",color,"","1","1.0","0","true","false",groupName,digital,"false","false","true","","true"])
# push new pens back to the tagPens property
self.tagPens = newData