Displaying forecasted data value on time series chart

In perspective we have a Time Series chart displaying historical tag data:


Its show 10 days, then does a forecasted 24hrs. how can I show what the forecasted value would be?
Here is how we are transforming the data on the chart to show forecasting:

def transform(self, value, quality, timestamp):
	from java.util import Date
	from java.sql import Timestamp
	
	headers = system.dataset.getColumnHeaders(value)
	value = list(system.dataset.toPyDataSet(value))
	finalTime = system.date.parse(value[-1][0])
	initTime = system.date.parse(value[-338][0])
	init = value[-338][1]
	final = value[-1][1]
	rate = (final-init)/(1.0*system.date.hoursBetween(initTime, finalTime))
	newTime = Timestamp(system.date.addDays(finalTime, 1).getTime())
	new = long(final + (rate * 24))
	value.append([newTime, new])
	return system.dataset.toDataSet(headers, value)

And what's the problem? Does it not work? What on the chart is incorrect?

1 Like