![]() | Steema Issues DatabaseNote: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;otherwise you can use StackOverflow. Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy. |
| Summary: | [TV52015566] The ClickedPoint function in TCustomSeries.Clicked funtion, in Series... | ||
|---|---|---|---|
| Product: | VCL TeeChart | Reporter: | yeray alonso <yeray> |
| Component: | Other Components | Assignee: | Steema Issue Manager <issuemanager> |
| Status: | CONFIRMED --- | ||
| Severity: | major | ||
| Priority: | Normal | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Chart Series: | --- | Delphi / C++ Builder RAD IDE Version: | |
The ClickedPoint function in TCustomSeries.Clicked funtion, in Series.pas has this condition: if CheckPointInLine or (FDrawArea and PointInArea(Index)) then So when the mouse is in the area region, it is considered as if the mouse were over the line segment and the predecessor point is returned (or successor if axis.inverted). It would be interesting to have the option to always return the nearest point, even when the mouse pointer is over the area region. So we would have: if CheckPointInLine or (FDrawArea and (not FNewProperty) and PointInArea(Index)) then FNewProperty could be called FAbsoluteNearest and be false by default, for example. But other series may be also considered, like TBarSeries. In the TBarSeries, the TCustomBarSeries.Clicked function should check it too, for example like this: if not FNewProperty then for t:=FirstValueIndex to Min(LastValueIndex,Count-1) do Forums link: http://www.teechart.net/support/viewtopic.php?f=3&t=12332&view=unread#unread Testing code: uses Series, TeeTools; var Chart1: TChart; procedure TForm1.FormCreate(Sender: TObject); begin Chart1:=TChart.Create(Self); Chart1.Parent:=Self; Chart1.Align:=alClient; Chart1.View3D:=false; // Chart1.AddSeries(TPointSeries).FillSampleValues(10); // Chart1.AddSeries(TLineSeries).FillSampleValues(10); // Chart1.AddSeries(TAreaSeries).FillSampleValues(10); // Chart1.AddSeries(THorizAreaSeries).FillSampleValues(10); // Chart1.AddSeries(TBarSeries).FillSampleValues(10); // Chart1.AddSeries(THorizBarSeries).FillSampleValues(10); // Chart1.Axes.Left.Inverted:=true; // Chart1.Axes.Bottom.Inverted:=true; with (Chart1.Tools.Add(TNearestTool) as TNearestTool) do begin Series:=Chart1[0]; Pen.Color:=clRed; end; Chart1.OnMouseMove:=Chart1MouseMove; end; procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); var tmpIndex: Integer; begin with (Chart1.Tools[0] as TNearestTool) do begin Caption:='Series clicked: ' + IntToStr(Chart1[0].Clicked(X,Y)) + ', Nearest point: ' + IntToStr(Point); end; end; [created:2011-05-16T16:38:00.000+01:00 reported by:yeray@steema.com reported in version:2011.03.30407 (TeeChart VCL)]