Chart background text

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
mfehr
Newbie
Newbie
Posts: 5
Joined: Wed Mar 30, 2011 12:00 am

Chart background text

Post by mfehr » Wed Oct 05, 2011 12:30 pm

Probably a simple question:

Is there an easy wey to write a background text behind the Chart grid?

I could not find this in the help..

Many thanks for any help!

MF

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

Re: Chart background text

Post by Yeray » Thu Oct 06, 2011 8:16 am

Hello,

Yes, you could draw your text at OnBeforeDrawAxes event. For example:

Code: Select all

uses Series;

procedure TForm1.Chart1BeforeDrawAxes(Sender: TObject);
begin
  with Chart1.Canvas do
  begin
    Font.Size:=50;
    Brush.Style:=bsClear;
    TextOut(50,50,'My text');
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D:=false;
  Chart1.Legend.Visible:=false;

  Chart1.AddSeries(TLineSeries).FillSampleValues();

  Chart1.Axes.Left.Grid.Width:=5;
  Chart1.Axes.Left.Grid.Style:=psSolid;
  Chart1.Axes.Left.Grid.Color:=clRed;
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

Post Reply