Page 1 of 2

OnClickSeries with TLineSeries selects the wrong point

Posted: Wed Jul 07, 2010 4:26 pm
by 10048970
I am having a problem now with the TChart.OnClickSeries event handler. In my handler, I access the 'selected' point using the ValueIndex parameter, but sometimes it isn't the correct point. The X axis value appears to be correct, but the Y value can be off by a very large value.

I also tried using TChartSeries.GetCursorValueIndex instead of ValueIndex, but it did not correct the problem.

The 'y' value returned from TChartSeries.GetCursorValues(x,y) was correct.

I have three TLineSeries added to the chart. Two of them do not have any points.

Is it possible the OnClickSeries event is only considering the X axis? If yes, how do I enable the consideration of the Y axis?

Any other words of wisdom?

thxs,
dmo

Re: OnClickSeries with TLineSeries selects the wrong point

Posted: Thu Jul 08, 2010 3:56 pm
by yeray
Hi dmo,

I've seen that both the clicked method and the ClickSeries event return the index one position to the left to the correct point clicked.
I've reproduced it in v2010 so I've added it to the defect list to be fixed asap (TV52015018).
For example, if you click in the segment between pointindex 2 and 3, you get ValueIndex 1 while you should get 2.

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  Chart1.View3D:=false;

  for i:=0 to Chart1.SeriesCount-1 do
    Chart1[i].FillSampleValues(5);
end;

procedure TForm1.Chart1ClickSeries(Sender: TCustomChart;
  Series: TChartSeries; ValueIndex: Integer; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var clickedIndex: Integer;
begin
  Chart1.Title.Text.Text:='ValueIndex: ' + IntToStr(ValueIndex) + ', X: ' + FloatToStr(Series.XValue[ValueIndex]) + ', Y: ' + FloatToStr(Series.YValue[ValueIndex]);

  clickedIndex:=Series.Clicked(X,Y);
  if clickedIndex <> -1 then
    Chart1.Title.Text.Text:=Chart1.Title.Text.Text + 'ValueIndex: ' + IntToStr(clickedIndex) + ', X: ' + FloatToStr(Series.XValue[clickedIndex]) + ', Y: ' + FloatToStr(Series.YValue[clickedIndex]);
end;

Re: OnClickSeries with TLineSeries selects the wrong point

Posted: Sun Jul 11, 2010 7:08 pm
by 16556545
Hi!

Sorry to say, but the problem is certainly more than just an index off by one.

To test, I created a chart with several series. As in your example, I set the title according to onSeriesClick, but I also show the series.Name. In addition, I set the title when onClickBackground fires, to more easily see when onClickSeries fails to fire.

***Many*** clicks at or very near a point(ANY point) fail to fire the onClickSeries event. KEEP CLICKING, eventually onClickSeries fires, but it may return the wrong series or the wrong point.

ATTACHED is a Delphi 2010 project that illustrates the problem. I've included the built Project1.exe so you can try it without recompiling, if you wish.

I am using TeeChartPro v2010.00.00407, within Delphi 2010 version 14.0.3593.25826.

THANK YOU!!!!!!!

Kevin Killion

Re: OnClickSeries with TLineSeries selects the wrong point

Posted: Tue Jul 13, 2010 8:13 am
by yeray
Hi Kevin,

Changing the line in your code:

Code: Select all

clickedIndex := Series.Clicked(X, Y);
for this:

Code: Select all

clickedIndex := (Series.Clicked(X, Y) + 1);
It works fine except for the first segment, that always shows 'BACKGROUND', isn't it?

Re: OnClickSeries with TLineSeries selects the wrong point

Posted: Tue Jul 13, 2010 4:21 pm
by 10048970
Thank-you for the feedback.

I would like to use the corrected method when it becomes available.

How do I
1) learn when it's fixed?
2) get the corrected s/w?

We are currently using Delphi 2009 with TChart 8.04 (soon to be 8.07).

thanks again!
-dmo

Re: OnClickSeries with TLineSeries selects the wrong point

Posted: Wed Jul 14, 2010 9:48 am
by narcis
Hi dmo,

I recommend you to stay tuned to this forum or subscribe to our RSS news feed for new release announcements and what's fixed on them.

Re: OnClickSeries with TLineSeries selects the wrong point

Posted: Wed Jul 14, 2010 12:56 pm
by 10048970
Thank-you. I will continue to monitor this post.

Please confirm I will be able to realize the correction in the 2009 environment.

thxs,
dmo

Re: OnClickSeries with TLineSeries selects the wrong point

Posted: Wed Jul 14, 2010 1:16 pm
by narcis
Hi dmo,

Yes, I think this will be fixed for RAD Studio 2009 too when it's fixed. I'm sorry but, even we do it occasionally, we can not commit to notifying all bug fixes at the threads where they have been reported. Please be aware at new release announcements at the TeeChart VCL forum or subscribe to the RSS feed.

Thanks in advance.

Re: OnClickSeries with TLineSeries selects the wrong point

Posted: Mon Jul 19, 2010 11:35 am
by yeray
Hi dmo,

The clicked problem (TV52015018) has been already fixed and it will be available in the next maintenance release.

Re: OnClickSeries with TLineSeries selects the wrong point

Posted: Wed Jul 21, 2010 2:14 pm
by 10048970
Awesome!
Do you have any idea when the next maintenance release will be?

thxs,
dmo

Re: OnClickSeries with TLineSeries selects the wrong point

Posted: Wed Jul 21, 2010 2:18 pm
by narcis
Hi dmo,

It should be imminent. We are working on some installers issues right now.

Re: OnClickSeries with TLineSeries selects the wrong point

Posted: Mon Aug 09, 2010 6:39 pm
by 10048970
Was wondering if you had an update on the next release date
-dmo

Re: OnClickSeries with TLineSeries selects the wrong point

Posted: Tue Aug 10, 2010 8:35 am
by yeray
Hi dmo,

We found some problems when testing the installers we couldn't repair before vacation time. So I'm afraid the maintenance release will be delayed some weeks. :(
Excuse us for the inconvenience.

Re: OnClickSeries with TLineSeries selects the wrong point

Posted: Tue Aug 10, 2010 2:37 pm
by 10048970
Ah yes - the European summer vacations.
I'm jealous.

Re: OnClickSeries with TLineSeries selects the wrong point

Posted: Tue Sep 21, 2010 5:15 pm
by 10048970
New release date?
thxs,
dmo