Problem with XY Chart and script transform

Hi, I have a problem loading my chart on the perspective screen. I use the script to adjust what the XY chart shows depending on the situation. Script generates .json format for dataSources.

When I load the window as a refresh or switch from another tab everything looks ok but when I try to use navigate sript doesn't generate. What it depends on how it can be prevented?

View after navigate:
image

View after refresh:
image

Best Regards
MG

1 Like

Going to be difficult to troubleshoot a script transform without the script.

Please post it using the preformatted text </> option.

Code works fine but i dont know why script doesnt ganerate when i use navigate window in perspective. when I do a refresh everything works fine.

def transform(self, value, quality, timestamp):

	#Color palete
	ColorHEX =[	"#9AFEFF", #0
				"#4EE2EC", #1
				"#81D8D0", #2
				"#7BCCB5", #3
				"#48D1CC", #4
				"#43BFC7", #5
				"#3B9C9C", #6
				"#008080", #7
				"#438D80", #8
				"#50C878"] #9
	
	IndexFor = len(value.keys())
	ListDictionary = []
	TempValue = value
	
	if IndexFor <= 10:
		for i in range(IndexFor):
			SubDictionary = {}
			SubDictionary["Color"] = ColorHEX[i]
			Temp = str(i+1)
			SubDictionary["nr"] = "Inv. " + Temp
			Temp = "Power_Inverter_" + str(i+1)
			SubDictionary["value"] = round(value[Temp], 2)
			ListDictionary.append(SubDictionary)
			
		dictionaries={"ActivePower": ListDictionary}
	
	return dictionaries

Where does the value come from ?

How are you using system.perspective.navigate() (i.e. are you navigating to a Page, URL, or View)

I think binding update problems with XY Chart have been fixed in 8.1.22.
See the changelog.

4429: XY Chart Expression Tag History binding with dynamic path causes Component Error
Fixed an issue with the XY Chart where the chart would not load when using a dynamic expression tag history bindings and switching views.

This had been a big puzzle for me and as a workaround I was refreshing the page on load. The upgrade fixed it.

It's simply the readout of device values from the tag provider.
Everything works fine but if I use navigate window script does not start. If I use refresh script it executes correctly.

So you recomend upgrade?
image

Well that script is not complete and might run into a runtime error: it returns dictionnaries which is declared in an if statement. If the if is not entered, dictionnaries will not exist and can't be returned.

What should happen if IndexFor is above 10 ?

Try it on a test server / PC and see if it solves the problem.