Page 1 of 1

[BUG] OnSeriesClick called with the wrong Series

Posted: Tue Jan 22, 2008 2:09 pm
by 9343260
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

Posted: Tue Jan 22, 2008 3:44 pm
by narcis
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;

Posted: Tue Jan 22, 2008 3:54 pm
by 9343260
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.

Posted: Wed Jan 23, 2008 12:00 pm
by narcis
Hi bertrod,

I find series pen not visible useful in 3D charts where the brush is visible and makes sense hiding the pen.