getting proper resolution graphics

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
David Novo
Newbie
Newbie
Posts: 71
Joined: Fri Jul 02, 2004 4:00 am
Location: Culver City
Contact:

getting proper resolution graphics

Post by David Novo » Sun Dec 11, 2005 4:51 am

Hello,

I have a bit of a tricky problem ( I think).

Lets say I have a plot where the x- and y-axes are 100 pixels long. I am also graphing data that possibly goes from 0..99. That means, that each data point should be one pixel, since there is 100 pixels, and 100 possible data values.

Everything is good so far.

Now lets say, that I have an option to have a multiplier for my dot sizes, and the user picks 0.5. Well, that would mean my dots should be 0.5 pixels wide onscreen. Well, they cannot be, so I draw them as 1 pixel wide.

However, for a printer, where I have higher resolution, I have the resolution to show the different between a 0.5x dot and a regular dot. So, I tried to do TeeCreateMetafile(true,rect(0,0,200,200)) to create a metafile that would be larger. The problem is that while the plot was larger, the fonts stayed the same size, so the fonts looked smaller in the metafile than in the plot on screen.

I need to know how I can draw the chart to a larger metafile when needed, so I can see the difference between the "0.5 pixel" and "1 pixel" plots when printed. I cannot simply print the plot using the print method, since we have to manipulate the metafile in various ways first.

I notice that the printPartial method takes in a plain tcanvas. Can I use this to print to a metafile canvas, and set the printresolution parameter appropriately to have the font sizes adjusted.... I am not quite sure how to set the printresolution in this case, since the instructions are a little vague.

Thanks for your help

David Novo
Newbie
Newbie
Posts: 71
Joined: Fri Jul 02, 2004 4:00 am
Location: Culver City
Contact:

Post by David Novo » Fri Dec 16, 2005 4:25 am

I have investigated the issue a bit further, and am still a bit confused.

I created a TChart that is 100x100. I did a printPartialCanvas with the output rect as (0,0,100,100). Everything worked great, except the background did not print. Is there any way to get the background to print when doing printPartialCanvas?

Here is the crux of the issue. I dynamically calculate my dot size to be Chartrect.width / 200. Onscreen, with a 100 pixel wide chart, that would result in a 0.5 pixel wide dot. That is not possible, so I have to round up to 1 pixel.

However, on the printer, my 100 pixel wide chart is equivalent to a 500 pixel wide chart (because the printer is higher resolution). So, what I tried is to make a 500x500 metafile and print to it using chart1.printPartialCanvas(metafileCanvas,rect(0,0,500,500))

However, when it got to the part where I calculate the dot size, the chartrect.width was still 100, so my dot size was calculated as 1. Of course, on the metafile it came out as 5 pixels, so it was scaled propertly. However, I wanted to be able for it to come out to 2.5 pixels (rounded to 3).

How can I do this, i.e. take advantage of the higher resolution of my printer to make smaller dots on the printer?

David Novo
Newbie
Newbie
Posts: 71
Joined: Fri Jul 02, 2004 4:00 am
Location: Culver City
Contact:

Post by David Novo » Fri Dec 16, 2005 6:16 am

I think I realize what the problem is.....

Lets stay my chart is 100 x 100 pixels

I realize that if I do
chart.printerResolution:=-(100;
chart1.drawPartialCanvas(metafileCanvas, rect(0,0,200,200))

its the same as
TeeCreateMetafile(true,rect(0,0,200,200));

What I basically need is to have a printerResolution of 0 for everything but the dots on the plot, and for the dots on the plot have a printer resolution of -100. That way, all the fonts and lines will come out the same as onscreen, but I will have higher resolution for the dots.

Is this possible to do?

Pep
Site Admin
Site Admin
Posts: 3274
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Sun Dec 18, 2005 10:29 am

Hi David,

this cannot be done, as I know. You only can do this giving all the TChart canvas, you cannot apply one printer resolution for the fonts, texts, etc.. and another for the data.

David Novo
Newbie
Newbie
Posts: 71
Joined: Fri Jul 02, 2004 4:00 am
Location: Culver City
Contact:

Post by David Novo » Sun Dec 18, 2005 7:27 pm

i have figured out a way to do it partially.

If the plot is 100x100 I can do the following:

chart1.view3doptions.fontzoom:=200;
teecreatemetafile(true,rect(0,0,200,200))

This creates the correct size metafile, with high res for the dot and the fonts come out to be the relatively correct size. The only issue is that the lines are too thin. Is there some properlty like fontZoom except for line widths. That way everything should work out just fine....

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Dec 19, 2005 10:15 am

Hi David,

As far as I know this can't be done.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply