Adding marks to specific x values on a bar chart

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

Adding marks to specific x values on a bar chart

Post by STC » Mon Feb 02, 2009 4:00 pm

Hello

I have a bar chart that displays the cost of invoices on a month by month basis

Some of these invoices are estimated and so when I add them to the chart using addXY I specify a different colour (red)

However, my user also wants a mark simply "E" above each bar that represents an estimated invoice

How do I do this? The impression I get about marks is that they either get displayed for all bars or none?

I am using VCL v7.07

Cheers

Paul

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Feb 02, 2009 4:19 pm

Hi Paul,

A trick to easily achieve that is setting an empty string as the mark text for those marks you don't want to display and they will be not displayed, for example:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.AddXY(0, random, '');
  Series1.AddXY(1, random, 'E');
  Series1.AddXY(2, random, 'E');
  Series1.AddXY(3, random, '');
  Series1.AddXY(4, random, '');
  Series1.AddXY(5, random, '');
end;

procedure TForm1.Series1GetMarkText(Sender: TChartSeries;
  ValueIndex: Integer; var MarkText: String);
begin
  if (MarkText<>'E') then MarkText:='';
end;
Best Regards,
Narcís Calvet / 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

STC
Newbie
Newbie
Posts: 23
Joined: Wed Mar 10, 2004 5:00 am

Post by STC » Mon Feb 02, 2009 4:50 pm

Hi Narcís

I am already using the parameter in addXY for the name of the month

Although I will try using the GetMarkText event that may work. My chart is contained within a report builder report but hopefully that wont be a problem

Paul

Post Reply