Perspective XY Chart onClick Scripting

Hello all. I am trying to write a script on an XY chart in perspective to display text in the label underneath it based on the bar and/or section of the bar clicked on.

I tried linking to the tooltip text as seen in the picture but that just gave me the tooltip formatting. What i am wondering is if the string formatting variables ({valueY},{CatergoryX} etc.) are reachable in the onClick event? “self” is a passed in parameter but i am not sure how to get to those values. Thanks in advance.

Hey Phil_B, did you manage to do what you wanted ?
I’d be interested in such a functionality.

No i havent but i pivoted away from that for the time being. i will try again someday though

OK thanks, it’s driving my crazy but I hope to find a solution soon enough.

One thought we had but didnt get a chance to try is to make a flex repeater under the chart and when we populate the chart data also make instances of a view in the flex repeater that are buttons which contain custom properties of the data for the bar on the chart right above it. and then on click you can do what ever you want.

That could be a lead.
I’m trying to replicate this functionality :
https://www.amcharts.com/docs/v4/tutorials/zoom-to-month-by-clicking-on-a-dateaxis-label/

when i was last looking into this (which was a while ago) i was finding something called “Listeners” in the amCharts which is what would be used to fire an event and from what i could see, that functionality wasnt in yet.

Yeah at the moment there isnt any “onActionPerformed” events on the XY Chart, Pie Chart, and a few others that could definitely use it for exactly what you guys have talked about here.

I made an ideas post about it a while back that you could update if you want
https://ideas.inductiveautomation.com/ignition-features-and-ideas/p/xy-chart-and-pie-chart-onactionperformed

Hi @Phil_B , any luck on this?

I manage to get this functionality. Like Phil_B suggested I used a flex repeater that are buttons which contain custom properties of the data for the bar on the chart right above it.

image

I havent revisited this lately. sorry

Hi all.
Maybe my solution will help you.
Based on the selected bar I open a popup and pass selected data as a parameter to the popup.

  1. Enable selection on XY chart.

  1. Click on a bar to get the data

  1. Using OnClick even for XY Chart access the data. ( it is important to use Try - Except, otherwise Ignition crashes)

Hope this helps

2 Likes

@michal.such what is the Ignition version you are using? I tried same with 8.1.7 but i dont have the selection property. So i guess its only available in newer versions.

EDIT: nvm. i see its available with 8.1.10

@KonfektionE you are right, the selection property was released in 8.1.10 and that is the version I am running.

1 Like