[BUG] OnSeriesClick called with the wrong Series

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
bertrod
Advanced
Posts: 151
Joined: Wed Sep 07, 2005 4:00 am

[BUG] OnSeriesClick called with the wrong Series

Post by bertrod » Tue Jan 22, 2008 2:09 pm

Hello,

I noticed a bug which occurs also in TeeChartOffice. I'm using TeeChart Pro 8.0.1.10787

Description : When 2 series are exactly at the same position, and one series is not visible, clicking on the Series sometimes calls OnSeriesClicked with the invisible Series.

How to do the bug in TeeChartOffice :
- create 2 FastLineSeries with the same points (Series1 and Series2)
- uncheck Series2 (set series.pen.visible to false)
- right-click on the Series1 which is still visible, change the color and you'll notice it's the Series2 which gets the new color

My opinion : I didn't check the source code of TChart, but I guess a test is missing when searching the series which is clicked.

Regards

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Jan 22, 2008 3:44 pm

Hi bertrod,

This doesn't seem a bug to me. You can reproduce what you report using the code snippet below. However, it works fine commenting in the line that makes the pen not visible and comment out the line that makes the series not visible. Making a series' pen not visible is not the way to hide a series.

Code: Select all

procedure TForm1.Series1Click(Sender: TChartSeries; ValueIndex: Integer;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  Chart1.Title.Text.Add('Series1Clicked');
end;

procedure TForm1.Series2Click(Sender: TChartSeries; ValueIndex: Integer;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  Chart1.Title.Text.Add('Series2Clicked');
end;

procedure TForm1.FormCreate(Sender: TObject);
var SecondSeries: TChartSeries;
begin
  Series1.FillSampleValues();
  SecondSeries:=CloneChartSeries(Series1);

  Series1.OnClick:=Series1Click;
  SecondSeries.OnClick:=Series2Click;

  Chart1.Legend.CheckBoxes:=true;

  (SecondSeries as TLineSeries).LinePen.Visible:=false;
  //SecondSeries.Visible:=false;
end;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

bertrod
Advanced
Posts: 151
Joined: Wed Sep 07, 2005 4:00 am

Post by bertrod » Tue Jan 22, 2008 3:54 pm

narcis wrote:Making a series' pen not visible is not the way to hide a series.
Ok, then what is pen.visible useful for ? I'm hiding series with pen.visible because I sometimes need to hide a serie, but not its axis.

I think it can be "considered as a bug", because this behaviour occurs only when you click on a visible series. So how would you explain that the Series2 is not clickable, but is called when clicking on another visible series which is exactly the same position ? Sounds a bit strange.

However, I could manage my problem by checking if pen.visible = false in the OnSeriesClicked; and if it is the case, I just search the chart for the first visible series at that position and it works fine.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Jan 23, 2008 12:00 pm

Hi bertrod,

I find series pen not visible useful in 3D charts where the brush is visible and makes sense hiding the pen.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply