Possible LC bug. DistanceToAxis is not scaling with display scaling

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
mat-d
Posts: 19
Joined: Sat Jun 26, 2021 4:27 am

Possible LC bug. DistanceToAxis is not scaling with display scaling

Post by mat-d » Sat Apr 15, 2023 8:26 am

Hello

I believe I've found a lightning charts rendering bug in WPF.

To demonstrate the issue I've made a smal change to one of your projects to see if I can replicate a bug we have in our application, and was able to replicate the issue in ViewXY custom GDI+ Rendering Chart, in C# WPF .net framework 4.8


My change is to set label placement to manual
The pixel distances specified are not automatically scaling when the UI scale changes

Code: Select all

   private void CreateChart()
        {
            // Create a new chart.
            _chart = new LightningChart
            {
                ChartName = "ViewXY custom GDI+ rendering chart"
            };

            //begin change

            _chart.ViewXY.AxisLayout.YAxisTitleAutoPlacement = false;
            _chart.ViewXY.AxisLayout.XAxisTitleAutoPlacement = false;

            _chart.ViewXY.AxisLayout.AutoAdjustMargins = false;

            _chart.ViewXY.Margins = new System.Windows.Thickness(100, 100, 100, 100);

            _chart.ViewXY.XAxes[0].Title.DistanceToAxis = 50;
            _chart.ViewXY.YAxes[0].Title.DistanceToAxis = 50;

            // end change
this issue is affecting other label positioning settings too (such as the chart label offset)
scaling-position.png
scaling-position.png (47.26 KiB) Viewed 2999 times

thanks

Mat





EDIT:
full.png
full.png (692.03 KiB) Viewed 2996 times
here's the full chart at different scalings, the custom rendering position is erratic too,
but notice if I select the executable in file manager and set the properties :

compatibiilty > change hidpi settings > override hidpi scaling behaviour > system (enhanced) and run at 200% the text position is corrected but the custom rendering is different again.

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

Re: Possible LC bug. DistanceToAxis is not scaling with display scaling

Post by ArctionKestutis » Mon Apr 17, 2023 1:48 pm

Not sure what you think is incorrect?

There are view things your should aware.

* LightningChart uses 2 types of units, DPI (Dots Per Inch) and PX (screen pixels). Most of the properties (especially if description does not tell otherwise) are using PX units. For example, Title.DistanceToAxis property is in PX. Chart Margins (ViewXY.Margins) are rare exception - it is in DIPs.

* In WinForms LightningChart DPI=PX no matter what Windows-scaling is. For WPF/UWP LightningChart, only 100% will give DPI=PX. For higher scaling PX > DPI units. In application, you can use LightningChart's DpiHelper class to convert between units.

* You did not specify how you did testing of all those 100-200% scaling. You should be aware, that sometimes application does not react to Windows->Settings->Display->Scale change until you sign-out or restart Windows.

Hope this helps.

Post Reply