- I’m trying to create a chart that shows both energy consumption and production using grouped bars, along with a trendline for energy over time—similar to the attached one. Is it possible to build something like this in Ignition, especially in Perspective?"
You can do that with an XY Chart. Set render: column
and stacked: true
for the bars:
You have to calculate your own trend lines. I use a Python script to generate a linear regression for a given list of values:
def linearRegressionOf(numList, allowNegativeValues=False):
x = []
y = []
for i in range(len(numList)):
x.append(i)
y.append(numList[i])
try:
slope, yInt, rr = Math.linreg(x, y)
except:
slope, yInt, rr = [0, 0, 0]
lr = []
for i in range(len(numList)):
val = slope * i + yInt
if val < 0 and not allowNegativeValues:
val = 0
lr.append(val)
return lr
What exactly is the chart supposed to tell the reader? You're stacking cases on kWh! Surely a chart of energy per case produced would be more useful?
Tip: "KWh" is a kelvin-watt-hour. It should be "kWh".