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 2088 - Switching from a large maximum to a small maximum for an axis can result in an Range Check Error
Summary: Switching from a large maximum to a small maximum for an axis can result in a...
Status: UNCONFIRMED
Alias: None
Product: VCL TeeChart
Classification: Unclassified
Component: Tools (show other bugs)
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Steema Issue Manager
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-17 09:14 EDT by Thomas Mueller
Modified: 2018-09-17 09:14 EDT (History)
0 users

See Also:
Chart Series: ---
Delphi / C++ Builder RAD IDE Version:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Mueller 2018-09-17 09:14:18 EDT
Create a chart with one series that has at least one very large Y-Value (>100 Million)
Set LeftAxis scaling to Automatic.
Add a Cursor Tool

Add code to remove the above series and add one with small Y-Values (0<y<1).

You will get a RangeCheckError here:

Function TChartAxis.YPosValueCheck(Const Value:TChartValue):Integer;
var tmp : TAxisValue;
begin
  if IRangeZero then result:=ICenterPos
  else
  begin
    tmp:=(Value-IMinimum)*IAxisSizeRange;

    if IUseTeeMaxPixelPos then
    begin
      if FInverted then tmp:=IStartPos+tmp
                   else tmp:=IEndPos-tmp;

      if tmp> TeeMaxPixelPos then
        result:= TeeMaxPixelPos
      else
      if tmp<-TeeMaxPixelPos then
        result:=-TeeMaxPixelPos
      else
         result:=Round(tmp);
    end
    else
    if FInverted then result:=IStartPos+Round(tmp) // <== here
                 else result:=IEndPos-Round(tmp);  // <== or here
  end;
end;

That's because tmp becomes much larger than MaxInt.

This does not happen if IUseTeeMaxPixelPos is true (but there is no way to do that without subclassing TAxis). Or if Chart1.Axes.FastCalc is true (which calls  the method YPosValue instead of YPosValueCheck).