Bug+Fix for graph overflow with minimum and transparence

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Paessler
Newbie
Newbie
Posts: 2
Joined: Wed Mar 31, 2004 5:00 am

Bug+Fix for graph overflow with minimum and transparence

Post by Paessler » Mon Aug 07, 2006 2:35 pm

Problem:

When you set the minimum value of a x axis and have a areaseries with transparency the area is drawn over the y axis.

Cause:

The TeeBlendBitmaps function used for the transparency sets the pixelformat of the bitmap of the canvas of the chart.
Changing the pixelformat deletes the current clipping region which would prevent the overdrawing of the axis.

Solution:

Save and restore the clipping region before changing the pixelformat:

Code: Select all

region:hrgn;  //for var section

Region:=CreateRectRgn(0,0,0,0);
getcliprgn(bbitmap.canvas.handle,region);

BBitmap.PixelFormat:=TeePixelFormat;

selectcliprgn(bbitmap.canvas.handle,region);
deleteobject(region);

Hope this helps,
Jens

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

Post by Pep » Tue Aug 08, 2006 7:44 am

Hi Jens,

thanks for the report, but I'm not able to reproduce it using the following code (with the v7.08) :

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
// Area Series
Series1.Transparency:=50;
Chart1.Draw;
Chart1.Axes.Bottom.AutomaticMinimum:=false;
Chart1.Axes.Bottom.Minimum:=4;
end;
Could you please show me the code that you're using to reproduce it ?

Paessler
Newbie
Newbie
Posts: 2
Joined: Wed Mar 31, 2004 5:00 am

Post by Paessler » Tue Aug 08, 2006 9:24 am

The bug is only visible if the chart is created dynamically since it only shows in the very first display. After that the chart bitmap is already in the correct bitmap format and the clipping area is not deleted.

Try this:

Add a button to a empty form and enter this code on button click:

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
var s:tareaseries;
    iii:integer;
begin
  chart:=tchart.create(self);
  chart.parent:=self;
  chart.left:=100;
  chart.top:=100;
  s:=tareaseries.create(chart);
  s.AreaLinesPen.Visible:=false;
  for iii:=0 to 100 do
    s.AddXY(iii,iii);
  s.parentchart:=chart;
  s.Transparency:=50;
  Chart.LeftAxis.Automatic:=false;
  chart.LeftAxis.Maximum:=100;
  chart.leftaxis.Minimum:=50;
end;
This creates the bug here.

Jens

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

Post by Pep » Tue Aug 08, 2006 2:19 pm

Hi Jens,

yes, you're correct. Thanks for report, I've writed down to fix it for the next releases.

Post Reply