Page 1 of 1
Series highlighting with hidden legends
Posted: Fri Feb 10, 2017 8:06 am
by 16578641
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 (201.55 KiB) Viewed 9838 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 (185.63 KiB) Viewed 9837 times
Can you suggest a way to synchronise the hover/highlight function with the legend.
I look forward to hearing from you. Regards Errol
Re: Series highlighting with hidden legends
Posted: Fri Feb 10, 2017 12:01 pm
by yeray
Hello,
Could you please arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
Re: Series highlighting with hidden legends
Posted: Sun Feb 12, 2017 7:52 pm
by 16578641
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.
Re: Series highlighting with hidden legends
Posted: Tue Feb 14, 2017 8:09 am
by yeray
Hello,
Errol wrote:the series are not highlighted when I hover over the legend
I'm not sure it has ever occurred automatically.
Re: Series highlighting with hidden legends
Posted: Tue Feb 28, 2017 4:02 am
by 16578641
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.
Re: Series highlighting with hidden legends
Posted: Tue Feb 28, 2017 8:55 am
by yeray
Hi,
I'm glad to hear you found how to make it work as you wished!