Page 1 of 1

Bug+Fix for graph overflow with minimum and transparence

Posted: Mon Aug 07, 2006 2:35 pm
by 9336954
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

Posted: Tue Aug 08, 2006 7:44 am
by Pep
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 ?

Posted: Tue Aug 08, 2006 9:24 am
by 9336954
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

Posted: Tue Aug 08, 2006 2:19 pm
by Pep
Hi Jens,

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