Page 1 of 1

lineseries and legend

Posted: Fri Nov 17, 2017 4:01 am
by 16579481
How should a lineseries with no markers be displayed in the legend? I get markers when they are visible in the chart. However I would like a short line with the same color as the line in the chart when no markers are displayed. Ideal would be to have both lines and markers shown in the legend if both are visible in the chart. Suggestions?

Jim

Re: lineseries and legend

Posted: Fri Nov 17, 2017 12:15 pm
by yeray
Hello Jim,

The legend shows line+pointer or only the line when applies for me here:
bds_2017-11-17_13-13-48.png
bds_2017-11-17_13-13-48.png (3.48 KiB) Viewed 3596 times
Am I misunderstanding anything?

Re: lineseries and legend

Posted: Fri Nov 17, 2017 4:47 pm
by 16579481
Your example is what I want. Is there some option I need to set?

Re: lineseries and legend

Posted: Mon Nov 20, 2017 9:31 am
by yeray
Hello,

I only created two TLineSeries, and made the Pointer one of them visible and smaller (to see its line better):

Code: Select all

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  Chart1.View3D:=False;

  for i:=0 to 1 do
    with Chart1.AddSeries(TLineSeries) as TLineSeries do
    begin
      if i=0 then
      begin
        Pointer.Visible:=True;
        Pointer.Size:=2;
      end;

      FillSampleValues;
    end;
end;
Project2_2017-11-27_08-26-58.png
Project2_2017-11-27_08-26-58.png (2.82 KiB) Viewed 3515 times
Another option is to make the legend symbol not squared and wider:

Code: Select all

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  Chart1.View3D:=False;

  for i:=0 to 1 do
    with Chart1.AddSeries(TLineSeries) as TLineSeries do
    begin
      if i=0 then
        Pointer.Visible:=True;

      FillSampleValues;
    end;

  Chart1.Legend.Symbol.Squared:=False;
  Chart1.Legend.Symbol.WidthUnits:=lcsPixels;
  Chart1.Legend.Symbol.Width:=25;
end;
Project2_2017-11-27_08-24-48.png
Project2_2017-11-27_08-24-48.png (3.9 KiB) Viewed 3517 times

Re: lineseries and legend

Posted: Wed Nov 22, 2017 4:29 pm
by 16579481
I must have some wrong settings. I now do get lines and the symbols in the legend. The symbols are the correct colors but the lines are all black.

Re: lineseries and legend

Posted: Thu Nov 23, 2017 7:36 am
by yeray
Hello,
JimR wrote:The symbols are the correct colors but the lines are all black.
Does it happen with the latest version (v2017.22) and the examples above?

Re: lineseries and legend

Posted: Fri Nov 24, 2017 5:02 am
by 16579481
Yes, that is the version I am using.

Re: lineseries and legend

Posted: Mon Nov 27, 2017 7:28 am
by yeray
Hello,
JimR wrote:Yes, that is the version I am using.
And do you get a different running the same code in the examples above?