Page 1 of 1

Serious Bug in TAreaSeries OnClick event

Posted: Thu Nov 17, 2011 8:30 pm
by 9342063
I am using Delphi XE and a chart containing an AreaSeries. The OnClick event has a serious bug which was reported many years ago and was apparently fixed.

The OnClick event has an arguement, ValueIndex, to provide the index of the series value clicked. BUT, the value provided is wrong. My original application was developed in Delphi 7 and 2007. How did this bug reappear in Delphi XE ?

Any help/advice gratefully accepted ...

Re: Serious Bug in TAreaSeries OnClick event

Posted: Fri Nov 18, 2011 4:32 pm
by yeray
Hello Andre,

Could you please describe the problem with some more detail? I'm trying to reproduce the problem here with the following example and it seems to work fine for me here:

Code: Select all

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
begin
//  Chart1.View3D:=false;

  with Chart1.AddSeries(TAreaSeries) as TAreaSeries do
  begin
    FillSampleValues();
    OnClick:=Series1Click;
  end;
end;

procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  Chart1.Title.Text.Text:='ValueIndex under the mouse: ' + IntToStr(Chart1[0].Clicked(X,Y));  //Clicked function is actually called in series OnClick event
end;

procedure TForm1.Series1Click(Sender: TChartSeries; ValueIndex: Integer;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  Caption:='ValueIndex Clicked: ' + IntToStr(ValueIndex);
end;

Re: Serious Bug in TAreaSeries OnClick event

Posted: Mon Nov 21, 2011 6:24 pm
by 9342063
Hi Yeray

Thanks for your reply. I implemented your code and it also reports the incorrect ValueIndex.

The resultant AreaSeries shows about 24 points on the X axis and the OnClick event usually indicates ValueIndex to be 24, sometimes 20.

I did find an old post reporting this problem but it was apparently fixed in Delphi 2010. Very odd that it is working at your end and not mine. I am using Delphi XE on Windows 7.

Thanks
Andre.

Re: Serious Bug in TAreaSeries OnClick event

Posted: Tue Nov 22, 2011 10:33 am
by narcis
Hi Andre,

This also works fine for me here using Delphi XE in Windows 7 and TeeChart Pro 2011.04.41118, which we published yesterday, with the attached project. Could you please check if this version solves the problem at your end?

Thanks in advance.