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 4754 times

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

Posted: Thu Oct 31, 2024 2:12 am
by 17797791
Does the TLegendPaletteTool presented above exist in the javascript library?
I would like to inquire about how to implement the above example using Javascript.

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

Posted: Thu Oct 31, 2024 8:16 am
by yeray
Hello,

Oups sorry for the confusion! I'll take a look at the js library.

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

Posted: Thu Oct 31, 2024 8:44 am
by yeray
Hello,

I see you asked something very similar a few months ago.
https://www.steema.com/support/viewtopi ... 18&t=18141
Weren't you able to make it work?

The only difference I see is in the alignment of the legend. Am I missing anything else?

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

Posted: Sun Nov 03, 2024 11:46 pm
by 17797791
https://www.steema.com/support/viewtopi ... 18&t=18141

I would like to contact you because the legend does not display the way
I want even if I change the position of the legend to "bottom" in the source link above.

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

Posted: Mon Nov 04, 2024 9:39 am
by yeray
Hello,

You could try adding a second chart at the bottom and use it to draw the legend. Ie:
https://jsfiddle.net/norike82/7aj5p9of/
colorGridLegend.png
colorGridLegend.png (47.05 KiB) Viewed 2608 times

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

Posted: Mon Nov 04, 2024 11:16 pm
by 17797791
Yeray wrote:
Mon Nov 04, 2024 9:39 am
Hello,

You could try adding a second chart at the bottom and use it to draw the legend. Ie:
https://jsfiddle.net/norike82/7aj5p9of/

colorGridLegend.png
Thank you for suggesting a solution. :D