Page 1 of 1

Print corrupted with subchart tool

Posted: Mon Feb 02, 2009 7:39 am
by 10051462
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

Posted: Mon Feb 02, 2009 12:20 pm
by yeray
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).

Posted: Mon Feb 02, 2009 12:22 pm
by 10051462
Many thanks.

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

Thanks
Manuel

Posted: Thu Feb 05, 2009 4:19 pm
by 10051462
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

Posted: Fri Feb 06, 2009 10:50 am
by narcis
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!

Posted: Fri Feb 06, 2009 3:21 pm
by 10051462
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?

Posted: Mon Feb 09, 2009 12:37 pm
by Pep
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;

Posted: Mon Feb 09, 2009 1:26 pm
by 10051462
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

Posted: Wed Feb 11, 2009 6:13 pm
by Pep
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 ?

Posted: Mon Feb 16, 2009 8:48 am
by 10051462
i have solved with your example!!!

many thanks

Manuel