ContextMenu not displayed sometimes

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
MirroZV
Posts: 45
Joined: Wed May 13, 2020 10:41 am

ContextMenu not displayed sometimes

Post by MirroZV » Fri May 13, 2022 7:25 am

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

ArctionKestutis
Posts: 552
Joined: Mon Mar 14, 2016 9:22 am

Re: ContextMenu not displayed sometimes

Post by ArctionKestutis » Fri May 13, 2022 9:52 am

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.

MirroZV
Posts: 45
Joined: Wed May 13, 2020 10:41 am

Re: ContextMenu not displayed sometimes

Post by MirroZV » Mon May 16, 2022 5:21 am

Not sure, if it can be implemented somehow incorrectly, because it works on other machines. It appears only some laptops.

MirroZV
Posts: 45
Joined: Wed May 13, 2020 10:41 am

Re: ContextMenu not displayed sometimes

Post by MirroZV » Tue May 17, 2022 8:02 am

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 5445 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 5445 times

ArctionKestutis
Posts: 552
Joined: Mon Mar 14, 2016 9:22 am

Re: ContextMenu not displayed sometimes

Post by ArctionKestutis » Wed May 18, 2022 9:13 am

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()).

Post Reply