Print corrupted with subchart tool

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
sicorspa
Newbie
Newbie
Posts: 43
Joined: Tue Jan 13, 2009 12:00 am

Print corrupted with subchart tool

Post by sicorspa » Mon Feb 02, 2009 7:39 am

Hello all,
i have found a problem with the subchart tool in my chart.

I'm using standard bar chart, with a map subchart tool.

At video all works fine, the graphic result is very good (but i must tune it a bit), but if i print it the subchart is printed white and cover all the bar chart.
This is an example of the problem, using the TeeCommander at runtime

Image

Saving it to bitmap works perfectly, so no corruption in the image.

The only "particular" things on the map chart is that i'm using 75% trasparency, can be this?

Many thanks
Manuel

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Mon Feb 02, 2009 12:20 pm

Hi Manuel,

You're right, it seems that transparencies applied to series in a subchart aren't printed well. I've added it to the wish list to be fixed in future releases
(TV52013806).
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

sicorspa
Newbie
Newbie
Posts: 43
Joined: Tue Jan 13, 2009 12:00 am

Post by sicorspa » Mon Feb 02, 2009 12:22 pm

Many thanks.

For now i will use the export function and print the exported image. This works well.

Thanks
Manuel

sicorspa
Newbie
Newbie
Posts: 43
Joined: Tue Jan 13, 2009 12:00 am

Post by sicorspa » Thu Feb 05, 2009 4:19 pm

Playing a bit with the print option I found that if I check the SMOOTH proprerty in print group inside the TeeCommander the graph is printed well, without artifacts.

The problem is: where can I found the smooth option inside the print options??? I have searched a lot but can't find it..

Many thanks

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

Post by Narcís » Fri Feb 06, 2009 10:50 am

Hi sicorspa,

To reproduce similar behaviour to the Smooth checkbox you could try using StretchDraw as suggested on the thread below but using a bitmap instead of a metafile:

http://www.teechart.net/support/viewtopic.php?t=6852

An example of StretchDraw with a bitmap can be found here.

http://www.teechart.net/support/viewtopic.php?t=4767

Hope this helps!
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

sicorspa
Newbie
Newbie
Posts: 43
Joined: Tue Jan 13, 2009 12:00 am

Post by sicorspa » Fri Feb 06, 2009 3:21 pm

tried with the code in the links, but print is alway corrupted

the strange things is that using Chart1.TeeCreateBitmap create a corrupted bitmap, but using Chart1.SaveToBitmapFile() create a perfect bitmap.

Howether, there isn't any possibility to enable "Smooth" option in print tab before print?

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

Post by Pep » Mon Feb 09, 2009 12:37 pm

Hi Manuel,
Playing a bit with the print option I found that if I check the SMOOTH proprerty in print group inside the TeeCommander the graph is printed well, without artifacts.
Yes, you're correct, what the "Smooth" option does it to create a Bitmap internally instead of a Metafile.

To "check" this option automatically when the Previewer is called the following code should be used (adding first a ChartPreviewer component into the form) :

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
TeeCommander1.Previewer :=ChartPreviewer1;
ChartPreviewer1.Chart := Chart1;
ChartPreviewer1.Options :=  ChartPreviewer1.Options +  [ cpoAsBitmap ];
end;

sicorspa
Newbie
Newbie
Posts: 43
Joined: Tue Jan 13, 2009 12:00 am

Post by sicorspa » Mon Feb 09, 2009 1:26 pm

but it's possible to set it before the print method call, without using the teecommander??
because i don't wanto to let people manage the other options


however i have found another little bug

if i use ChartEditor component and disable all tabs except the print one and i call it, it opens with the only print tab, but under the print tab there is the chart tab form.
If I press the print tab then the chart tab form disappear and print tab is correctly shown

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

Post by Pep » Wed Feb 11, 2009 6:13 pm

Hi Manuel,

in that case, one way to do it would be usign similar code to :

Code: Select all

uses printers, TeCanvas;

procedure TForm1.Button1Click(Sender: TObject);
var tmpBitmap : TBitmap;
    tmpColor : Tcolor;
begin
  // hidding some aspects to print
  tmpColor := Chart1.color;
  Chart1.Color := clWhite;
  Chart1.BevelOuter := bvNone;
  Chart1.BevelInner := bvNone;

  Printer.BeginDoc;

  tmpBitmap:=chart1.TeeCreateBitmap(clWhite,TeeRect(0,0,Chart1.Width,Chart1.Height),pf32Bit);
  try
    Printer.Canvas.StretchDraw(Chart1.ChartPrintRect,tmpBitmap);
  finally
    tmpBitmap.Free;
  end;
  Printer.EndDoc;
  Chart1.Color := tmpColor;
end;
About the print tab, if you want just to show the Print tab why don't you use the ChartPreviewer Component (calling the Execute method) which will show the same form as the one into the ChartEditor ?

sicorspa
Newbie
Newbie
Posts: 43
Joined: Tue Jan 13, 2009 12:00 am

Post by sicorspa » Mon Feb 16, 2009 8:48 am

i have solved with your example!!!

many thanks

Manuel

Post Reply