Page 1 of 1

I would like to inquire about how to apply a legend to a ColorGrid chart.

Posted: Mon Oct 28, 2024 4:43 am
by 17797791
I would like to inquire about how to apply a legend to a ColorGrid chart as shown in the attached image.
thank you.

Re: I would like to inquire about how to apply a legend to a ColorGrid chart.

Posted: Mon Oct 28, 2024 9:23 am
by yeray
Hello,

Have you tried the TLegendPaletteTool?
Here a simple example:

Code: Select all

uses Chart, TeeSurfa, TeeLegendPalette;

var Chart1: TChart;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1:=TChart.Create(Self);

  with Chart1 do
  begin
    Parent:=Self;
    Align:=alClient;
    Color:=clWhite;
    Gradient.Visible:=False;
    Walls.Back.Color:=clWhite;
    Walls.Back.Gradient.Visible:=False;
    Legend.Hide;
    View3D:=False;
    MarginBottom:=10;

    AddSeries(TColorGridSeries).FillSampleValues;

    Draw;

    with TLegendPaletteTool(Tools.Add(TLegendPaletteTool)) do
    begin
      Series:=Chart1[0];
      Vertical:=False;
      Width:=Chart1.Width;
      Height:=40;
      Top:=Chart1.Axes.Bottom.PosAxis+25;
      Axis:=laDefault;
    end;
  end;
end;
horiz_legendpalette.png
horiz_legendpalette.png (16.09 KiB) Viewed 203 times