Printing Problem

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
dbrillon
Newbie
Newbie
Posts: 4
Joined: Thu Nov 20, 2003 5:00 am
Contact:

Printing Problem

Post by dbrillon » Fri Aug 11, 2006 8:11 pm

The printing in TChart is very strange. The printout will be different depending on the size of the window containing the graph. This is not a normal behavior. I would like the printout to be exactly the same each time I print my graph (font size, border, line width,...). Is there a way to achieve that?

Regards,

D Brillon

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

Post by Pep » Sat Aug 12, 2006 9:48 am

Hi Brillon,

yes, please take a look at this link on our FAQ.

dbrillon
Newbie
Newbie
Posts: 4
Joined: Thu Nov 20, 2003 5:00 am
Contact:

Post by dbrillon » Sat Aug 12, 2006 2:53 pm

Hello Pep

I already tried that and it doest not work as I would expect. The size of the graph wil be ok but the fonts would not have a fixed size and the line width will change depending on the size of the graph windows. I want the behavior of the printout to be the same as the behaviour of the graph windows. If I change the size of the graph window, the fonts, the lines width, etc... does not changed.

Thanks

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

Post by Pep » Mon Aug 14, 2006 9:59 am

Hi Brillon,

perhaps the problem is you're using Canvas.Font.Size to set font "size" ?, when printing, you should always use Font.Height instead of Font.Size.

Something like this should work:

Chart1.Canvas.Font.Height = -13; // note the - sign!
Chart1.Canvas.TextOut(100,100,'Hello World');

dbrillon
Newbie
Newbie
Posts: 4
Joined: Thu Nov 20, 2003 5:00 am
Contact:

Post by dbrillon » Mon Aug 14, 2006 1:20 pm

Josep,

I don't think that's the problem because all aspect of the graph are changed. The line width the cursor, etc. Take a look at the result of printing the same graph first with a large window and secondly with a small window. (The results are generated using Printer.Canvas.StretchDraw as described in the FAQ )

Large window:
Image


small window:
Image

When the user want to print a graph from my application they want to have the same printout whatever the size of the window on the screen is.

I would like the print routine to do the same thing the draw window does but on the printer canvas.

Thanks,

David Brillon

Hi Octane
Newbie
Newbie
Posts: 11
Joined: Tue Aug 29, 2006 12:00 am

Printing

Post by Hi Octane » Thu Oct 12, 2006 2:56 pm

I ran into this same issue. I resolved it by creating a 'Resize' function.
I basically Resize everything to allow the user to see the graph zoomed in or out, and when printing I pass Zoom = 100;
Here's some of the code lines:
Graph1.Font.Height := -Round(Int(8 * Zoom / 100));
Graph1.LeftAxis.LabelsFont.Height := -Round(Int(8 * Zoom / 100));
Graph1.BottomAxis.LabelsFont.Height := -Round(Int(8 * Zoom / 100));
Graph1.Legend.Font.Height := -Round(Int(8 * Zoom / 100));
Graph1.Title.Font.Height := -Round(Int(8 * Zoom / 100));
Graph1.Foot.Font.Height := -Round(Int(8 * Zoom / 100));

for X := 0 to Graph1.SeriesCount - 1 do
begin
//Graph1.Series[X].Marks.Font.Size := Round(Int(8 * Zoom / 100));
Graph1.Series[X].Marks.Font.Height := -Round(Int(8 * Zoom / 100));
if (GraphObject.View.BarMulti in [2, 3]) then
Graph1.Series[X].Marks.ArrowLength := -Round(Int(17 * Zoom /100))
else
Graph1.Series[X].Marks.ArrowLength := Round(Int(10 * Zoom /100));
if (Graph1.Series[X] is TPieSeries) then
begin
with Graph1.Series[X] as TPieSeries do
begin
if (not Circled) then
begin
if (GraphObject.View.PieXRadius > 0) then
CustomXRadius := Round(GraphObject.View.PieXRadius *
Zoom / 100);
if (GraphObject.View.PieYRadius > 0) then
CustomYRadius := Round(GraphObject.View.PieYRadius *
Zoom / 100);
end;
end;
end;
if (Graph1.Series[X] is TGaugeSeries) then
begin
with Graph1.Series[X] as TGaugeSeries do
begin
CustomXRadius := Round(134 * Zoom / 100);
CustomYRadius := Round(126 * Zoom / 100);
end;
end;
for Y := 0 to Graph1.Series[X].YValues.Count - 1 do
//Graph1.Series[X].Marks.Item[Y].Font.Size := Round(Int(8 *
Zoom / 100));
Graph1.Series[X].Marks.Item[Y].Font.Height := -Round(Int(8 *
Zoom / 100));
end;

Post Reply