Page 1 of 1

OnClickSeries in TGanttSeries

Posted: Sun Jan 01, 2012 7:38 pm
by 16459037
Hi,

I'm using a OnClickSeries on a GanttSeries.

How do I obtain the MarkText when I click on a TGantt series?

I have tried the following but it doesn't work:

Code: Select all

procedure TForm1.Chart14ClickSeries(Sender: TCustomChart; Series: TChartSeries;
  ValueIndex: Integer; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
GanttSeries : TGanttSeries;

begin

  if Series is TGanttSeries then
    begin
      GanttSeries := Series as TGanttSeries;
      showmessage(GanttSeries.Marks.Item[valueindex].Text[0]);
  end;


Re: OnClickSeries in TGanttSeries

Posted: Wed Jan 04, 2012 9:17 am
by yeray
Hi Friis,

If in the Marks you are showing the Labels, you can simply show the Labels in the click event:

Code: Select all

ShowMessage(GanttSeries.Labels[ValueIndex]);
If you are using a different Marks Style, you'll have to format your string manually, but knowing the ValueIndex of the point, it shouldn't be difficult. Anyway, if you find any problem with it, don't hesitate to let us know.