Page 1 of 1
XE11Delphi + TeeChart + High DPI
Posted: Mon Dec 20, 2021 8:55 pm
by 10553945
I like to use TeeChart together with high DPI awareness.
I've found no document about it, also the help is not helpful.
So how to set up Teechart in a XE11 IDE environment correctly to get a correct display for different monitors and different user Windows scalings? Which actions are done automatically, which actions have to be done by programming.
Examples: font sizes, e.g. of legend, thickness of lines and all other stuff.
Is TeeChart aware about DPI settings?
BR
Uli
Re: XE11Delphi + TeeChart + High DPI
Posted: Wed Dec 22, 2021 8:54 am
by yeray
Hello,
Yes, TeeChart should be DPI aware. Find
here a discussion and a test project about the subject.
Re: XE11Delphi + TeeChart + High DPI
Posted: Tue Jan 18, 2022 11:49 am
by 10553945
Hello Yeray,
please let me come back to the high DPI question.
Here is the DisplaySize example with a checkbox in the legend. The snapshot is taken from a 300% scaling on a high DPI monitor.
- DisplaySize.png (102.49 KiB) Viewed 15933 times
As you can see the checkbox is far from usable. Also the icons in the bar get unreadable. The images do not properly scale.
In a setup with 2 screens with different resolutions the program should be aware about the change of scaling and/or resolution (shift of GUI between monitors). Therefore the program or here better chart must get information about a change.
Possible you do this by the ChangeScale procedure as mentioned in
https://www.steema.com/support/viewtopi ... 188#p78188
But by the DisplaySize example the setting of the font sizes is just by a button click and not an automatic reaction on a screen scaling.
And as the example shows the checkboxes are not touched in any way.
Any idea for a solution?
Best wishes
Uli
Re: XE11Delphi + TeeChart + High DPI
Posted: Thu Jan 20, 2022 11:55 am
by 10553945
Hello Yeray,
do you have any answer for my DPI problem (legend checkboxes)?
Best wishes
Uli
Re: XE11Delphi + TeeChart + High DPI
Posted: Thu Jan 20, 2022 11:59 am
by yeray
Hello Uli,
The "Set all fonts" button in the DisplaySize example was an attempt to find a workaround when I wasn't able to find a proper ChangeScale
implementation. However, that last code should work fine when moving a chart between screens with different scales.
I'll revise the legend checkbox and the commander icons. Doesn't the rest of the chart adapt correctly to the scale changes for you with that ChangeScale
implementation?
Re: XE11Delphi + TeeChart + High DPI
Posted: Thu Jan 20, 2022 12:41 pm
by 10553945
A simple line series with pen width = 1 gets very thin on a high DPI monitor. So actually I try to help myself by Pen.Width := nominal_pen_width * Screen.PixelsPerInch / 96 as a quick turnaround.
But again it shows that TeeChart is not consistent regarding High DPI.
As I only see my application I cannot tell you about all the obstacles. So you may need to check the library more deeply.
I expect from time to time to stumble across a next problem
Best wishes
Uli
Re: XE11Delphi + TeeChart + High DPI
Posted: Thu Jan 20, 2022 5:42 pm
by yeray
Hello Uli,
Yeray wrote: ↑Thu Jan 20, 2022 11:59 am
I'll revise the legend checkbox and the commander icons.
I've already corrected the legend checkboxes at
#2501.
ulibru wrote: ↑Thu Jan 20, 2022 12:41 pm
A simple line series with pen width = 1 gets very thin on a high DPI monitor. So actually I try to help myself by Pen.Width := nominal_pen_width * Screen.PixelsPerInch / 96 as a quick turnaround.
It doesn't look bad for me at 150%:
- VirtualBoxVM_2022-01-20_18-30-33.png (44.05 KiB) Viewed 15908 times
But you could try to override the
ChangeScale
method and change the series pen width there.
ulibru wrote: ↑Thu Jan 20, 2022 12:41 pm
But again it shows that TeeChart is not consistent regarding High DPI.
As I only see my application I cannot tell you about all the obstacles. So you may need to check the library more deeply.
I expect from time to time to stumble across a next problem
Yes, I'm afraid we haven't tested all the possibilities and there are chances that we are missing something.
Re: XE11Delphi + TeeChart + High DPI
Posted: Fri Jan 21, 2022 1:28 pm
by 10553945
Hello Yeray,
1.
great to read about the fix but where do I get it?
2.
How to override ChangeScale? I'm reluctant to change library source codes as with a next library update the problems start ... (is the update a solution or not, do I need to change my own code ... ?)
Best wishes
Uli
Re: XE11Delphi + TeeChart + High DPI
Posted: Fri Jan 21, 2022 1:31 pm
by 10553945
Addendum: take a look at a a line of pen width = 1 on a monitor with resolution 3840 * 2160
Re: XE11Delphi + TeeChart + High DPI
Posted: Wed Jan 26, 2022 8:13 pm
by yeray
Hello,
We're in contact with Uli by mail, but I'd like to reply here in case other customers find this.
ulibru wrote: ↑Fri Jan 21, 2022 1:28 pm
great to read about the fix but where do I get it?
The fix is included in TeeChart v2022.34 published yesterday.
ulibru wrote: ↑Fri Jan 21, 2022 1:28 pm
How to override ChangeScale? I'm reluctant to change library source codes as with a next library update the problems start ... (is the update a solution or not, do I need to change my own code ... ?)
See
TControl.ChangeScale
at docwiki. Sice TForm inherits TControl, you can override it and change whatever you want there. Ie:
Code: Select all
type
TForm1 = class(TForm)
//...
private
procedure ChangeScale(M, D: Integer{$IFDEF D24}; isDpiChange: Boolean{$ENDIF}); override;
//...
procedure TForm1.ChangeScale(M, D: Integer{$IFDEF D24}; isDpiChange: Boolean{$ENDIF});
var i: Integer;
begin
inherited;
if not (csLoading in Self.ComponentState) and (M <> D) then
begin
for i:=0 to Chart1.SeriesCount-1 do
Chart1[i].Pen.Width:=MulDiv(Chart1[i].Pen.Width, M, D);
end;
end;
ulibru wrote: ↑Fri Jan 21, 2022 1:31 pm
Addendum: take a look at a a line of pen width = 1 on a monitor with resolution 3840 * 2160
I have a fix proposal on the works.