Charts, Images and Display Settings
-
- Newbie
- Posts: 28
- Joined: Tue Dec 05, 2017 12:00 am
Charts, Images and Display Settings
I create images from TCharts to put in my reports (using Digital Metaphors TppReport). Everything is fine when Display/Scale and Input/Change the size of text, apps and other items is at 100%, but when that number changes, all bets are off: fonts appear incorrectly, and the reports simply do not work. It is frustrating.
I have narrowed part of it down to creating imags from TChart (there are some things happening that I haven't quite figured out).
Take a look at the attached demo: when the setting is 100%:
the caption on the chart caption is the correct size (compare it against the size of the TLabel just above it, which is the same font and text):
but when I change it to 200%, the image is rendered without the correct font size:
The report needs the fonts rendered the font size for printing, not for the display settings.
Demo is attached.
Any suggestions on how to get this to work correctly?
Ed Dressel
I have narrowed part of it down to creating imags from TChart (there are some things happening that I haven't quite figured out).
Take a look at the attached demo: when the setting is 100%:
the caption on the chart caption is the correct size (compare it against the size of the TLabel just above it, which is the same font and text):
but when I change it to 200%, the image is rendered without the correct font size:
The report needs the fonts rendered the font size for printing, not for the display settings.
Demo is attached.
Any suggestions on how to get this to work correctly?
Ed Dressel
- Attachments
-
- Image Size.zip
- (7.81 KiB) Downloaded 1262 times
-
- Newbie
- Posts: 28
- Joined: Tue Dec 05, 2017 12:00 am
Re: Charts, Images and Display Settings
It is quiet, but by far, this is the biggest problem and support issue with our software. Any suggestions on this? Does Steema recognize it as a bug or is there something I can work on?
Re: Charts, Images and Display Settings
Hello,
It looks similar or related to the ticket #1447. I'll take a look at your project and I'll tell you something asap.
It looks similar or related to the ticket #1447. I'll take a look at your project and I'll tell you something asap.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Charts, Images and Display Settings
Hello,
What TeeChart version are you using?
Fin below my results with TeeChart v2018.24 setting the scale to 150% (I can't set it to 200%).
First I've ran the application and changed the scale "on the fly": This is what I get if I close and reopen the application: And this is what I get when I open the application after rebooting at 150%:
What TeeChart version are you using?
Fin below my results with TeeChart v2018.24 setting the scale to 150% (I can't set it to 200%).
First I've ran the application and changed the scale "on the fly": This is what I get if I close and reopen the application: And this is what I get when I open the application after rebooting at 150%:
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 28
- Joined: Tue Dec 05, 2017 12:00 am
Re: Charts, Images and Display Settings
> What TeeChart version are you using?
v 2018.24
I did some testing on different computers in the office and am getting differerent results--and non predictable results. My customers are seeing lots of problems with this.
(The high DPI issues are another issue, which, on some computers, create an image that is ~20% of what it should be).
Any suggestions on how to move this forward?
Ed Dressel
v 2018.24
I did some testing on different computers in the office and am getting differerent results--and non predictable results. My customers are seeing lots of problems with this.
(The high DPI issues are another issue, which, on some computers, create an image that is ~20% of what it should be).
Any suggestions on how to move this forward?
Ed Dressel
Re: Charts, Images and Display Settings
Hello,
We'll check your project in different machines here and compare the results.
We'll check your project in different machines here and compare the results.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Charts, Images and Display Settings
Hello Ed,
I've taken the FontHeightAtDpi function from this guide and added it to TCustomTeePanel.ChangeScale function in TeeProcs.pas to calculate the FontZoom. Could you please check if it gives a better result for you with it?
I've taken the FontHeightAtDpi function from this guide and added it to TCustomTeePanel.ChangeScale function in TeeProcs.pas to calculate the FontZoom. Could you please check if it gives a better result for you with it?
Code: Select all
{$IFNDEF FMX}
procedure TCustomTeePanel.ChangeScale(M, D: Integer);
function FontHeightAtDpi(aDPI, aFontSize: integer): integer;
var tmpCanvas: TCanvas;
begin
tmpCanvas := TCanvas.Create;
try
tmpCanvas.Handle := GetDC(0);
tmpCanvas.Font.Assign(self.Font);
tmpCanvas.Font.PixelsPerInch := aDPI;
tmpCanvas.Font.Size := aFontSize;
result := tmpCanvas.TextHeight('0');
finally
tmpCanvas.free;
end;
end;
var intFontHeightAt96Dpi, intFontHeightCurrent: Integer;
begin
inherited;
if M <> D then
begin
intFontHeightAt96Dpi:=FontHeightAtDpi(96, Canvas.Font.Size);
intFontHeightCurrent:=FontHeightAtDpi(Screen.PixelsPerInch, Canvas.Font.Size);
Canvas.FontZoom:=intFontHeightAt96Dpi/intFontHeightCurrent*100*M/D;
FView3DOptions.FontZoom:=Round(Canvas.FontZoom);
end;
end;
{$ENDIF}
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 28
- Joined: Tue Dec 05, 2017 12:00 am
Re: Charts, Images and Display Settings
Thank you for this code! This seems to work (there are a lot of computers that it needs to be tested on, so I am a bit slow to get too excited)…
**except** when I don't want display setting scaling. This is when I go to print--I create images of the chart for a report, and the fonts and chart get all messed up.
For reports, I use a TChart.TeeCreateMetafile or TChart.TeeCreateBitmap() methods. Is there any way to create an image of a TChart and ignore display settings, so that it prints in a report correctly?
The attached demo is a revision of the early one. If you define "Reporting" at the top defined, it will use Report Builder to create a image in a report, and the font at the top of the report should match the caption of the font (size et al) of the chart.
Ed Dressel
**except** when I don't want display setting scaling. This is when I go to print--I create images of the chart for a report, and the fonts and chart get all messed up.
For reports, I use a TChart.TeeCreateMetafile or TChart.TeeCreateBitmap() methods. Is there any way to create an image of a TChart and ignore display settings, so that it prints in a report correctly?
The attached demo is a revision of the early one. If you define "Reporting" at the top defined, it will use Report Builder to create a image in a report, and the font at the top of the report should match the caption of the font (size et al) of the chart.
Ed Dressel
- Attachments
-
- Image Size.zip
- (8.26 KiB) Downloaded 1201 times
Re: Charts, Images and Display Settings
Hello,
To eliminate variables, can the same behaviour be reproduced without Report Builder?
To eliminate variables, can the same behaviour be reproduced without Report Builder?
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 28
- Joined: Tue Dec 05, 2017 12:00 am
Re: Charts, Images and Display Settings
**Finally after years of living wit this bug** I figured out how to recreate the problem without printing, but it was not easy (several hours, including another programmer, just today).
With the attached demo (same as before-but it does have printing features, but won't need that):
1) In the IDE turn off generating a manifest (in Tokyo/Seattle, goo to Project/Options/Application and set Manifest File to "(None)"; similar in Seattle). (Having the auto-generate manifest makes my application unworkable).
2) Build and run the app and view the "Generated Image" tab, which should be showing a bitmap.
3) Now change it from a bitmap to a Metafile. The image is 1/4 the size when viewing 200%.
The image height and width are both the percentage larger as defined by the Display Settings--even though the image is not larger (which, being a metafile, it should not have to be).
Please confirm that you can reproduce this.
Ed Dressel
With the attached demo (same as before-but it does have printing features, but won't need that):
1) In the IDE turn off generating a manifest (in Tokyo/Seattle, goo to Project/Options/Application and set Manifest File to "(None)"; similar in Seattle). (Having the auto-generate manifest makes my application unworkable).
2) Build and run the app and view the "Generated Image" tab, which should be showing a bitmap.
3) Now change it from a bitmap to a Metafile. The image is 1/4 the size when viewing 200%.
The image height and width are both the percentage larger as defined by the Display Settings--even though the image is not larger (which, being a metafile, it should not have to be).
Please confirm that you can reproduce this.
Ed Dressel
- Attachments
-
- Image Size.zip
- (50.93 KiB) Downloaded 1303 times
-
- Newbie
- Posts: 28
- Joined: Tue Dec 05, 2017 12:00 am
Re: Charts, Images and Display Settings
I posted this a few days ago and haven't heard anything back. Can you confirm that you can reproduce it? It is a critical issue for my customers.
Re: Charts, Images and Display Settings
Hello,
Indeed I reproduced it, but I'm not sure we'll be able to support scales different to 100% without enabling the Manifest. Note the On[Before/After]MonitorDpiChanged events don't fire and Monitor.PixelsPerInch always returns 96.
Indeed I reproduced it, but I'm not sure we'll be able to support scales different to 100% without enabling the Manifest. Note the On[Before/After]MonitorDpiChanged events don't fire and Monitor.PixelsPerInch always returns 96.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 28
- Joined: Tue Dec 05, 2017 12:00 am
Re: Charts, Images and Display Settings
Thank you for responding.
Turning on manifests about ruins the GUI in my application.
Also note that a BMP works fine here, it is only the WMF that doesn't work. If it would just create the same WMF as before--it seems it must be reading scaling in one place and not in another.
You stated:
I don't understand what you mean by "scales different to 100%". Also, "I'm not sure"--are you looking into this?
Ed Dressel
Turning on manifests about ruins the GUI in my application.
Also note that a BMP works fine here, it is only the WMF that doesn't work. If it would just create the same WMF as before--it seems it must be reading scaling in one place and not in another.
You stated:
..but I'm not sure we'll be able to support scales different to 100% without enabling the Manifest.
I don't understand what you mean by "scales different to 100%". Also, "I'm not sure"--are you looking into this?
Ed Dressel
-
- Newbie
- Posts: 28
- Joined: Tue Dec 05, 2017 12:00 am
Re: Charts, Images and Display Settings
Any comments?
-
- Newbie
- Posts: 28
- Joined: Tue Dec 05, 2017 12:00 am
Re: Charts, Images and Display Settings
But why would the TMetafile image be messed up at all if the system doesn't know about the changes? If it would just create the image that it does for 96 PPI, I would be elated.Yeray wrote:Indeed I reproduced it, but I'm not sure we'll be able to support scales different to 100% without enabling the Manifest. Note the On[Before/After]MonitorDpiChanged events don't fire and Monitor.PixelsPerInch always returns 96.
We have our own custom chart program and the creation of a metafile works just fine. This really is the biggest issue in my product.
Ed Dressel