Chart transparency

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Jim Green
Newbie
Newbie
Posts: 43
Joined: Thu Aug 03, 2006 12:00 am

Chart transparency

Post by Jim Green » Tue Jun 19, 2012 8:13 pm

Hello, I have both Pro 7.08 (in Delphi 2006) and Standard 2010.01.20814 (in Delphi XE). I am looking to get a white interior (the area within the axes) and transparent outside of this to the edges of the chart. The white interior is fine (BackWall.Color=clWhite and Transparent=False) but I don't see any option for the outer transparency. I've tried Chart.Color=clNone but this just results in white.

(Note: I am trying to duplicate the appearance of an Excel chart. This is done quite easily with ChartArea.Fill=NoFill and PlotArea.Fill=Solid.)

Is this possible? Do I need to get the current version (2012)?

TIA, Jim

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Chart transparency

Post by Sandra » Fri Jun 22, 2012 2:00 pm

Hello Jim,

I have made a simple code that I can help to achieve as you want:

Code: Select all

Uses Series;
procedure TForm3.FormCreate(Sender: TObject);
var Series1:TLineSeries;
begin
  Chart1.Walls.Left.Visible := false;
  Chart1.Walls.Bottom.Visible:=false;
  Chart1.Walls.Back.Color:= clWhite;
  Chart1.Walls.Back.Visible:=false;
  Chart1.Gradient.Visible:=false;
  Chart1.Color := clWhite;
  Series1 := TLineSeries.Create(self);
  Chart1.AddSeries(Series1);

end;
Can you tell us if next code works as you expecte?
Thanks,
Best Regards,
Sandra Pazos / 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

Jim Green
Newbie
Newbie
Posts: 43
Joined: Thu Aug 03, 2006 12:00 am

Re: Chart transparency

Post by Jim Green » Fri Jun 22, 2012 2:24 pm

Sandra, thanks for the reply. Sorry, no, this produces a completely white chart (using Standard 2010.01.20814) I don't see anything in the code below that indicates transparency for the outer area. (I DO see a Transparent property for the BackWall that does let the Chart1.Color show through.) Note that I'm only doing a 2D chart, so the walls other than Back are N/A.

Surely there must be a way to do this. Like "Chart1.Transparent := True;"? Or "Chart1.ParentBackground := True;"? (like TPanel)

Jim

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Chart transparency

Post by Sandra » Tue Jun 26, 2012 4:00 pm

Hello Jim,

Ok. I suggest you taking a look in this thread where Narcís explains as you achieve the panel to be transparent.

Thanks,
Best Regards,
Sandra Pazos / 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

Jim Green
Newbie
Newbie
Posts: 43
Joined: Thu Aug 03, 2006 12:00 am

Re: Chart transparency

Post by Jim Green » Tue Jun 26, 2012 6:30 pm

The link you gave is to a thread title "Anchors not published" (?)

However, if you're referring to this:

if not Assigned(Back) then
begin
Back:=TBitmap.Create;
Back.Width:=Chart1.Width;
Back.Height:=Chart1.Height;

Back.Canvas.CopyRect(Chart1.ClientRect,Canvas,Chart1.BoundsRect);
end;

if Chart1.Color=clNone then
Chart1.Canvas.Draw(0,0,Back);

Then yes, it does work (with alterations for when the parent is a TPanel, not a Form).

Still, I'm very surprised this is not a built-in option!

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Chart transparency

Post by Sandra » Wed Jun 27, 2012 7:48 am

Hello Jim,

Sorry I have been wrong with link. The correct thread is this.
Still, I'm very surprised this is not a built-in option!
if you take a look in the link you will find the problem is caused for the panel as explained Narcís

Thanks,
Best Regards,
Sandra Pazos / 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

Post Reply