Steema Issues Database

Note: 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.



Bug 2074

Summary: line series tool NearestPoint never fired on a zero YValue point
Product: .NET TeeChart Reporter: truthtracer
Component: ToolsAssignee: Steema Issue Manager <issuemanager>
Status: RESOLVED NOTABUG    
Severity: major CC: chris
Priority: ---    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Chart Series: FastLine Delphi / C++ Builder RAD IDE Version:
Attachments: sample project

Description truthtracer 2018-08-15 04:25:28 EDT
Created attachment 844 [details]
sample project

tchart version 2018.05.04

1. create a tchart control, add tool NearestPoint and a fast line series
2. series.FillSampleValues(10), then set some points YValue to 0

set marks visible to see clearly, the NearestPoint tool never fired on these YValue = 0 points

plz see the attachment project
Comment 1 christopher ireland 2018-08-17 04:40:06 EDT
Internally TeeChart uses the Rectangle.Contains method ( https://docs.microsoft.com/en-us/dotnet/api/system.drawing.rectangle.contains?view=netframework-4.7.2 ) to determine whether to include a series point into the nearestpoint calculation or not. However, this method returns false when the point is touching the rectangle boundary. To counteract this we can increase the size of the rectangle, e.g. 

series.FillSampleValues(10);
series.YValues[2] = 0;
series.YValues[4] = 1;

tChart1.Axes.Left.MinimumOffset = 1; //<- offset one pixel

The nearesttool now detects the point at 0 (zero).
Comment 2 truthtracer 2018-08-19 23:08:38 EDT
tChart1.Axes.Left.MinimumOffset = 1

Works.

Thanks very much !