Page 1 of 1

Adding marks to specific x values on a bar chart

Posted: Mon Feb 02, 2009 4:00 pm
by 9231248
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

Posted: Mon Feb 02, 2009 4:19 pm
by narcis
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;

Posted: Mon Feb 02, 2009 4:50 pm
by 9231248
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