Page 1 of 1

Legend in Tchart

Posted: Wed Jul 06, 2016 7:59 am
by 16476632
I would like to split a legend list in sevral apparent groups in order to have an easier overview
I would imagine either to add dividing line(s) ONLY at specific(s) location(s) and/or to change et vertical spacing only those positionns
Is it possible?
if Yes, how may I realize this/those local speration(s): I only found dividing line On/Off or Vertical Spacing value who are applied inbetween all the legend items.
if No, what could you suggest me to archive an equivatant result?
Thank you in advance for your answer.

Re: Legend in Tchart

Posted: Wed Jul 06, 2016 3:29 pm
by yeray
Hello,

Have you seen the TExtraLegendTool?

Code: Select all

uses Series, TeeExtraLegendTool;

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

  Chart1.Legend.LegendStyle:=lsValues;

  with Chart1.Tools.Add(TExtraLegendTool) as TExtraLegendTool do
  begin
    Series:=Chart1[1];

    Chart1.Draw;

    with Legend do
    begin
      CustomPosition:=True;
      Left:=Chart1.Legend.Left;
      Top:=Chart1.Legend.ShapeBounds.Bottom+10;
    end;
  end;
end;