Small bitmaps after printing a QuickRep chart

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
jindrich.muzik
Newbie
Newbie
Posts: 5
Joined: Fri May 20, 2005 4:00 am

Small bitmaps after printing a QuickRep chart

Post by jindrich.muzik » Wed Jul 07, 2010 11:16 am

Hello.
My HorizareaSeries is filled with bitmaps 32x32. When I display a chart in
quickreport by command QuickRep1.Preview everything looks normal - that means chart is
filled with hundreds of visible bitmaps. When I print the chart(send it to
printer or into pdf) chart is filled with thousands of small almost
invisible bitmaps. Why preview is different from printing? Why bitmaps are
too small after printing the chart? How to make them larger as preview
shows?Yours sincerely Jindřich Mužík

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

Re: Small bitmaps after printing a QuickRep chart

Post by Narcís » Wed Jul 07, 2010 2:02 pm

Hi Jindřich,

In that case I recommend you to read the printing better article I posted here.

You may also be interested in the StretchDraw example I posted here:

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

If this doesn't help don't hesitate to let us know.
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

jindrich.muzik
Newbie
Newbie
Posts: 5
Joined: Fri May 20, 2005 4:00 am

Re: Small bitmaps after printing a QuickRep chart

Post by jindrich.muzik » Wed Jul 07, 2010 7:09 pm

Hi Narcis.
There is a checkbox named "smooth" in TeeChart print preview dialog box which gets better print result when it is checked. Please which code or property does represent it? After checking it printed bitmaps are similar as bitmaps in preview. Best regards. J.Muzik
Attachments
Chart.JPG
TeeChart print preview dialog box
Chart.JPG (38.36 KiB) Viewed 6266 times

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

Re: Small bitmaps after printing a QuickRep chart

Post by Narcís » Thu Jul 08, 2010 7:56 am

Hi Jindřich,

To reproduce smooth checkbox behavior you should use StretchDraw as I posted here.
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

jindrich.muzik
Newbie
Newbie
Posts: 5
Joined: Fri May 20, 2005 4:00 am

Re: Small bitmaps after printing a QuickRep chart

Post by jindrich.muzik » Thu Jul 08, 2010 7:05 pm

Hi Narcis.
It seems "smooth metod" solves my problem with printing HorizArea series in proper size. But there is another problem: printing large area of chart takes long time. Is reason *.bmp file format I loaded into the chart? I loaded the patern into chart by command: Series1.AreaChartBrush.Image.LoadFromFile('someth.bmp'). Also I tried to load wmf patern into chart by command: Series1.AreaChartBrush.Image.LoadFromFile('someth.wmf') to enhance speed for repainting but no pattern were loaded into chart(I mean chart area was empty or transparent). What am I doing wrong? Best regards. Jindra

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

Re: Small bitmaps after printing a QuickRep chart

Post by Yeray » Thu Jul 15, 2010 12:52 pm

Hi Jindra,

Custom drawing techniques could give you a better performance here too.
Here you have an example. Note that the with CustomDrawing to true, scrolling the chart is faster than with CustomDrawing to false:

Code: Select all

uses TeCanvas, Series;

var Series1: TAreaSeries;
    CustomDrawing: Boolean;

procedure TForm1.FormCreate(Sender: TObject);
begin
  CustomDrawing:=False;
  Chart1.AddSeries(TBarSeries);
  Chart1[0].FillSampleValues();
  Chart1[0].ColorEachPoint:=true;
  Chart1.Walls.Back.Gradient.StartColor:=clRed;
  Chart1.SaveToBitmapFile('C:\tmp\test.bmp');

  Chart1.ClearChart;
  Chart1.Walls.Back.Gradient.StartColor:=RGB(234,234,234);
  Series1:=Chart1.AddSeries(TAreaSeries) as TAreaSeries;
  Series1.FillSampleValues();

  //change it
  CustomDrawing:=True;

  if not CustomDrawing then
    Series1.AreaChartBrush.Image.LoadFromFile('C:\tmp\test.bmp');
end;

procedure TForm1.Chart1AfterDraw(Sender: TObject);
var i: Integer;
    tmpBitmap: TBitmap;
begin
  if (CustomDrawing) then
  begin
    tmpBitmap:=TBitmap.Create;
    tmpBitmap.LoadFromFile('C:\tmp\test.bmp');
    Chart1.Canvas.Brush.Bitmap:=tmpBitmap;

    for i:=1 to Series1.Count-1 do
      Chart1.Canvas.Polygon3D([Point3D(Series1.CalcXPos(i-1), Series1.CalcYPos(i-1), 0),
                              Point3D(Series1.CalcXPos(i), Series1.CalcYPos(i), 0),
                              Point3D(Series1.CalcXPos(i), Chart1.Axes.Left.CalcYPosValue(Chart1.Axes.Left.Minimum), 0),
                              Point3D(Series1.CalcXPos(i), Chart1.Axes.Left.CalcYPosValue(Chart1.Axes.Left.Minimum), 0),
                              Point3D(Series1.CalcXPos(i-1), Chart1.Axes.Left.CalcYPosValue(Chart1.Axes.Left.Minimum), 0)]);
    tmpBitmap.Free;
  end;
end;
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

jindrich.muzik
Newbie
Newbie
Posts: 5
Joined: Fri May 20, 2005 4:00 am

Re: Small bitmaps after printing a QuickRep chart

Post by jindrich.muzik » Sat Aug 28, 2010 8:06 pm

Hello,
I filled a chart with a pattern:
MyHorizAreaSeries.AreaChartBrush.Image.LoadFromFile('MyBmp');
Please is there any metod how to stretch the pattern only?
A metod like: MyHorizAreaSeries.AreaChartBrush.Image.ZoomOut() or MyHorizAreaSeries.AreaChartBrush.Image.Stretch() missing. Jindra

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

Re: Small bitmaps after printing a QuickRep chart

Post by Yeray » Mon Aug 30, 2010 2:48 pm

Hi Jindra,

You could modify your Image manually before loading into the Area brush:

Code: Select all

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
var Series1: TAreaSeries;
    tmp: TBitmap;
begin
  Series1:=Chart1.AddSeries(TAreaSeries) as TAreaSeries;
  Series1.FillSampleValues();
  tmp:=TBitmap.Create;
  tmp.LoadFromFile('C:\tmp\test.bmp');
  tmp.Width:=50;
  tmp.Height:=50;

  try
    Series1.AreaChartBrush.Image.Bitmap:=tmp;
  finally
    tmp.Free;
  end;
end;
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

jindrich.muzik
Newbie
Newbie
Posts: 5
Joined: Fri May 20, 2005 4:00 am

Re: Small bitmaps after printing a QuickRep chart

Post by jindrich.muzik » Wed Jun 08, 2011 7:30 am

Hi,
I had taken your advice and used your example bellow

uses Series;
procedure TForm1.FormCreate(Sender: TObject);
var Series1: TAreaSeries;
tmp: TBitmap;
begin
Series1:=Chart1.AddSeries(TAreaSeries) as TAreaSeries;
Series1.FillSampleValues();
tmp:=TBitmap.Create;
tmp.LoadFromFile('C:\tmp\test.bmp');
tmp.Width:=50;
tmp.Height:=50;
try
Series1.AreaChartBrush.Image.Bitmap:=tmp;
finally
tmp.Free;
end;
end;

I calculated tmp.width to see the bitmap in printed chart in proper size.
(In my case I found tmp.Width:=180 convenient). Everything worked fine
when the chart had just a few records - Series1.FillSampleValues(10). But if I filled a chart with thousands records - Series1.FillSampleValues(1000) to print the chart took unfortunatelly minutes. If I used tmp.Width=32 (small bitmap) the same chart with thousand records was printed quickly but bitmap pattern was small. How to solve the problem to print large bitmap quickly in proper size? Best regards. Jindra

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

Re: Small bitmaps after printing a QuickRep chart

Post by Yeray » Wed Jun 08, 2011 1:38 pm

Hello Jindra,

I've modified a little bit the code to test it. It seems you are right. the number of points in the series and the size of the bitmap seems to influence a lot here.
I've tested it with a virtual pdf printer (CutePfd Writter) for ecologic reasons but the result with a real printer should be similar.

Code: Select all

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
var Series1: TAreaSeries;
    tmp: TBitmap;
    relation: double;
begin
  Chart1.Legend.Visible:=false;

  Series1:=Chart1.AddSeries(TAreaSeries) as TAreaSeries;
  Series1.FillSampleValues(1000);
  Series1.AreaLinesPen.Visible:=false;
  tmp:=TBitmap.Create;
  tmp.LoadFromFile('C:\tmp\test.bmp');

  relation:=tmp.Width/tmp.Height;
  tmp.Width:=750;
  tmp.Height:=Round(tmp.Width/relation);

  Chart1.Title.Text.Text:=IntToStr(tmp.Width) + 'x' + IntToStr(tmp.Height);

  try
    Series1.AreaChartBrush.Image.Bitmap:=tmp;
  finally
    tmp.Free;
  end;
end;
My results:

- With 1000 points:
50x16 -> 7 sec
100x33 -> 8 sec
200x66 -> 9 sec
500x163 -> 35 sec
750x245 -> 58 sec

- With 10 points:
750x245 -> 4 sec

I've added it to the wish list to be investigated for further releases (TV52015606).
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

Post Reply