Page 1 of 1

ContextMenu not displayed sometimes

Posted: Fri May 13, 2022 7:25 am
by MirroZV
Hello,
We use chart, where we have some points, and when user clicks on some point, the contextmenu is shown. But on some laptops, the contextmenu is not shown. Can it be related to graphic card/dpi/screenresolution? In logs, there is nothing specific.

Thank you

Re: ContextMenu not displayed sometimes

Posted: Fri May 13, 2022 9:52 am
by ArctionKestutis
It may depend how you implemented-context menu. In general it is about MouseUp event. If event is handled by some other objects, then menu will not be shown.
Without details of implementation, I would say graphic card/dpi/screenresolution is unlikely reason for missed event. Make sure that you click on same position. Subscribe to 'preview' event (e..g _chart.PreviewMouseUp) and log whatever you have one, and at which coordinates.

Re: ContextMenu not displayed sometimes

Posted: Mon May 16, 2022 5:21 am
by MirroZV
Not sure, if it can be implemented somehow incorrectly, because it works on other machines. It appears only some laptops.

Re: ContextMenu not displayed sometimes

Posted: Tue May 17, 2022 8:02 am
by MirroZV
On this graph the resolution is 2560x1440 and Scale is 100%. Context menu is correctly shown, when I click on the dot.
graf1.png
graf1.png (19.34 KiB) Viewed 5710 times
On this graph the resolution is 1920x1080 and Scale is 125%. Context menu is not shown correctly. The context menu we can see is the menu, when I click anywhere in the graph except dots. But with this settings, context menu for dots is not displayed, but the general one.
graf2.png
graf2.png (28.7 KiB) Viewed 5710 times

Re: ContextMenu not displayed sometimes

Posted: Wed May 18, 2022 9:13 am
by ArctionKestutis
That could be explained, if you mixed units (PX versus DIP, or screen-pixel versus device-independent pixel).
When scale/zooming-factor for windows is not 100% and WPF chart is used, the value is different for each unit. LightningChart methods usually have flag (or written in description) which unit it expect.
For example,
FreeformPointLineSeries[j].SolveNearestDataPointByCoord() method expect DIPs,
XAxis.ValuesToCoords(double[] xValues, bool UseDIP = true) method's conversion depend on boolean flag.

Most of LightningChart properties (if value in pixels) will be in PX. Otherwise the description specifies.

Please check which units you are using and check what Chart is expecting.
If need use DpiHelper class to convert between PX and DIP (e.g. DpiHelper.PxToDip()).