How do you programmatically toggle/bind Powerchart Options?

Hello all;

I am working on creating a dynamic power chart in perspective, so far I have been able to automatically fetch the available tags and construct the entire structure based on what tags are available; everything is working great, except for a few minor issues which I haven't been able to wrap my head around so thought I would ask some of the more experiences folks on here!

Issue#1:
How do I force the legend scroll arrow to show up when additional pens are being inserted? simply changing the size of the browsers actually triggers the arrow to show but adding my dynamic pens don't prompt it to do so; is there a component refresh I need to do while adding each pen somehow?

Issue#2:
When binding the mode property of the powerchart to a button; then toggling back and fourth between realtime and historical, realtime mode doesn't scroll anymore; (this is only true if I am zoomed in while in historical mode) - I even tried to reset the zoom to 1 with no luck (which I then noticed that it's READ-ONLY parameter chart.props.interaction.chartZoomLevel);

Thank you!

Update:

Issue #2 - Somewhat resolved, I ended up enabling freeRange which seems to do the trick, not ideally how I wanted it to work but it does work (now zooming out will switch to Historical automatically it is okay but not completely desired; and when switching back to real-time using the button, it zooms out automatically, negating the need to resetting the zoom)

Issue #1 still to go =)

Issue #1 workaround by toggling the visibility binding for the Pen Control Display when pens are more than 4 and less than 10, once the arrow is there, there's no need to refresh it.

Bound:

PowerChart.props.visability.showPenControlDisplay

To:

self.custom.showPenControlDisplayToggle.

And the below changescript on the selected pens.

> 	from java.lang import Thread
> 	
> 	# Retrieve the pens array
> 	pens = self.getChild("Main").getChild("Middle").getChild("PowerChart").props.pens
> 	
> 	# Check if the number of pens is more than 4 and less than 10
> 	if 4 < len(pens) < 10:   
> 	    self.custom.showPenControlDisplayToggle = False
> 
> 	    Thread.sleep(10)
> 	    
> 	    self.custom.showPenControlDisplayToggle = True

Perhaps there is a better way to do this, but this seems to work ok for now