Series highlighting with hidden legends

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Errol
Newbie
Newbie
Posts: 14
Joined: Fri Jul 08, 2016 12:00 am

Series highlighting with hidden legends

Post by Errol » Fri Feb 10, 2017 8:06 am

I am using TeeChart 2016.19. I am using TeeChart to plot data from a number of data sets on two independent axes. I wish to show the legend only once per dataset. I have attached two images. The first image, "ChartWithOneLegendPerSeries" shows 8 legend items, one per series. When I hover over the legend the correct series is highlighted.
ChartWithOneLegendPerSeries.jpg
ChartWithOneLegendPerSeries.jpg (201.55 KiB) Viewed 9848 times
The second image,"ChartWithOneLegendPerDataset" shows 4 legend items, corresponding to series 1, series 3, series 5 and series 7. However, when I now hover over the second legend item, the second series is highlighted, not the third series as I would expect (the legend suggests a red line with a cyan circle, but a blue line with a red square is highlighted). It appears that TeeChart does not count the series when the legend is hidden.
ChartWithOneLegendPerDataset.jpg
ChartWithOneLegendPerDataset.jpg (185.63 KiB) Viewed 9847 times
Can you suggest a way to synchronise the hover/highlight function with the legend.

I look forward to hearing from you. Regards Errol

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Series highlighting with hidden legends

Post by Yeray » Fri Feb 10, 2017 12:01 pm

Hello,

Could you please arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Errol
Newbie
Newbie
Posts: 14
Joined: Fri Jul 08, 2016 12:00 am

Re: Series highlighting with hidden legends

Post by Errol » Sun Feb 12, 2017 7:52 pm

Thanks. I m trying to prepare a simple example project but the series are not highlighted when I hover over the legend. I have attached the code I am using. Can you suggest what I might be doing wrong.

Code: Select all

unit LegendTestMain;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, TeeGDIPlus, ExtCtrls, TeeProcs, TeEngine, Chart, DBChart, Series,
  StdCtrls, DB;

type
  TForm1 = class(TForm)
    DBChart1: TDBChart;
    Button1: TButton;
    Button2: TButton;
    procedure LoadData(Sender: TObject);
    procedure ClearData(Sender: TObject);
    procedure FormCreate(Sender: TObject);

  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  DBChart1.AddSeries(TLineSeries).FillSampleValues();
end;

procedure TForm1.ClearData(Sender: TObject);
begin
  DBChart1.RemoveAllSeries;
end;

procedure TForm1.LoadData(Sender: TObject);

begin
  DBChart1.AddSeries(TLineSeries).FillSampleValues;
  DBChart1.AddSeries(TLineSeries).FillSampleValues;
end;

end.

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Series highlighting with hidden legends

Post by Yeray » Tue Feb 14, 2017 8:09 am

Hello,
Errol wrote:the series are not highlighted when I hover over the legend
I'm not sure it has ever occurred automatically.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Errol
Newbie
Newbie
Posts: 14
Joined: Fri Jul 08, 2016 12:00 am

Re: Series highlighting with hidden legends

Post by Errol » Tue Feb 28, 2017 4:02 am

I realised I was off track. I have now written code to hide data set identifiers if there are multiple series from a single data set, with auto-highlighting of all the series in the data set when you hover over each legend entry. A great feature, but quite complicated, especially given that each visible series on the chart is made up of 3 separate series - a normal line graph, used to write the legend but hidden from view in the chart, a fast line series, and a point series required to be able to reduce the number of points visible in dense data sets. Additionally, not all data sets have the same number of series, so there is some tricky counting required.

Thanks for your support.

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Series highlighting with hidden legends

Post by Yeray » Tue Feb 28, 2017 8:55 am

Hi,

I'm glad to hear you found how to make it work as you wished! :)
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply