Home > Blockchain >  Style individual Labels on Gantt-Rows in a VCL TeeChart
Style individual Labels on Gantt-Rows in a VCL TeeChart

Time:11-26

I am using TeeChart (Build 2020.30.200525) in a Delphi XE3 VCL-Application.

In that application I am setting up a Gantt series and I would like to style an individual row label on the left axis to set it apart from the others.

Something like changing the color or font-style of the label or highlighting it by using a background.

How could I achieve this?

I have found the OnGetAxisLabel event which I ca use to change the text of the labels.

And I have also tried Axes.Left.Items, but that only has a single element even after I have added several Values to the Gantt-Series.

CodePudding user response:

You need to force a chart repaint to populate the axis items. Ie:

uses VclTee.GanttCh;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.AddSeries(TGanttSeries).FillSampleValues;

  Chart1.Draw; // Force a repaint to populate Axis Items

  Chart1.Axes.Left.Items.Automatic:=False;
  Chart1.Axes.Left.Items[2].Format.Font.Color:=clRed;
end;
  • Related