Page 1 of 1

Small bitmaps after printing a QuickRep chart

Posted: Wed Jul 07, 2010 11:16 am
by 9236961
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

Re: Small bitmaps after printing a QuickRep chart

Posted: Wed Jul 07, 2010 2:02 pm
by narcis
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.

Re: Small bitmaps after printing a QuickRep chart

Posted: Wed Jul 07, 2010 7:09 pm
by 9236961
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

Re: Small bitmaps after printing a QuickRep chart

Posted: Thu Jul 08, 2010 7:56 am
by narcis
Hi Jindřich,

To reproduce smooth checkbox behavior you should use StretchDraw as I posted here.

Re: Small bitmaps after printing a QuickRep chart

Posted: Thu Jul 08, 2010 7:05 pm
by 9236961
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

Re: Small bitmaps after printing a QuickRep chart

Posted: Thu Jul 15, 2010 12:52 pm
by yeray
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;

Re: Small bitmaps after printing a QuickRep chart

Posted: Sat Aug 28, 2010 8:06 pm
by 9236961
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

Re: Small bitmaps after printing a QuickRep chart

Posted: Mon Aug 30, 2010 2:48 pm
by yeray
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;

Re: Small bitmaps after printing a QuickRep chart

Posted: Wed Jun 08, 2011 7:30 am
by 9236961
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

Re: Small bitmaps after printing a QuickRep chart

Posted: Wed Jun 08, 2011 1:38 pm
by yeray
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).