Open PopUp with relative Position by Script in Perspective

Hello,

we have built a timeline with the status of an equipment with the XY chart in perspective. We would like to open a Popup next to the mouse courser when an element is selected. Sadly there is no on click event for a single element in the xy chart like in the table component (onRowClick). We now would performe this by a value change on the selection of the XY Chart. Basicly all works quite fine, execpt for the position of the PopUp.
The position of the Timeline is dynamic, so we also cant really use the position params for the scripting of opening a PopUp. Is there a way to hand over parameters for the relativ position for a PopUp like available in the onClickEvent?

Thank you very much!

In your onClick event, you can use event.clientX and event.clientY to track you mouse position when you clicked.

Based on those values, you can set the position of your popup when you use system.perspective.openPopup:

1 Like

with some adaption to the x coordinates based on the width of the viewport and popup to denie overflow this worked perfectly fine.
i also implimented a dirty sleep(0.1) to make shure the x y of the mouse is available before the popup opens, but this shouldnt be necessary or? the onClick event should basicly always be faster then the value change execution :confused:
Thanks very much and marry chrismas!

1 Like

You're welcome and merry Christmas :slight_smile:.

I don't think you need the sleep, but I'm not exactly sure.