I would like some help with scripting the series, trends and axes. I use a script to generate an array of positions, which is used in a transform to generate the series, as well as the trends.
The current end result is an empty time series chart with three axes.
Here is my project script:
def buildZonePositions02(zone):
"""
Returns a list of dicts describing all valid positions for one zone.
"""
zone = int(zone)
if zone == 11:
return []
# Zones with 4 positions
posCount = 4 if zone in (6, 7, 8) else 3
positions = []
zoneName = "PS %02d" % zone
zoneStr = "%02d" % zone
for p in range(1, posCount + 1):
# Exclusion: PS 05-3
if zone == 5 and p == 3:
continue
posLabel = "%s-%d" % (zoneName, p)
psBase = (
"[default]Folder/Power Supplies/"
"%s/Display/" % posLabel
)
positions.append({
"zone": zone,
"position": p,
"label": posLabel,
"kw": psBase + "KW",
"amps": psBase + "Amps",
"volts": psBase + "Volts"
})
return positions
This is the transform that calls the script, binding on self.custom.positions
positions = Coater.Power_Supply_Trending.buildZonePositions02(self.custom.zone)
return positions
Series transform:
# self.custom.series binding on self.custom.positions:
series = []
colors = ["#4CAF50", "#2196F3", "#FF9800", "#9C27B0"]
for i, pos in enumerate(value):
color = colors[i % len(colors)]
series.append({
"name": pos["label"] + " KW",
"data": pos["kw"]#
})
return series
Trend transform:
# self.custom.trends binding on self.custom.positions:
trends = []
for i, pos in enumerate(value):
# print(i, pos)
trends.append({
'visible': True,
'type':'line',
'series':'kw',
'interpolation':'curveLinear',
'axis':'Power',
'columns':{
'key':pos['label'] + ' KW',
'color':'#00FF00'
}
})
return trends
Axes configuration:
# Current axes configuration, self.custom.axes:
[
{
"name": "Power",
"min": 0,
"max": 100,
"alignment": "right",
"width": 30,
"label": {
"visible": true,
"text": "",
"offset": 0,
"font": {
"color": "",
"size": 10
},
"style": {
"classes": ""
}
},
"tick": {
"color": "",
"count": "Auto",
"label": {
"format": "Auto",
"font": {
"color": "",
"size": 10
},
"style": {
"classes": ""
}
},
"style": {
"classes": ""
}
},
"grid": {
"visible": false,
"color": "",
"opacity": 0.9,
"dashArray": 0,
"style": {
"classes": ""
}
},
"style": {
"classes": ""
}
}
]
So the custom props look like this:
Chart's props.series[0]:
{
"name": "PS 03-1 KW",
"data": {
"path": "[default]/Folder/PS 03-1/Display/KW",
"source": "tag"
}
}
trends[0]:
{
"visible": true,
"type": "line",
"series": "PS 03-1 KW",
"interpolation": "curveLinear",
"axis": "Power",
"columns": [
{
"key": "PS 03-1 KW",
"color": "#00FF00"
}
],
"baselines": []
}
But the chart looks like this:
What am I missing to get the tag's historical data to display?
And, why are there three axes?
Thank you!

