Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
  • Lazarus Lazarus
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 2,102
    • Issues 2,102
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 9
    • Merge requests 9
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • FPC
  • LazarusLazarus
  • LazarusLazarus
  • Issues
  • #34898
Closed
Open
Issue created Jan 18, 2019 by FPC Admin account@fpc_adminOwner

TAChart: improper calculations in TChart.YImageToGraph

Original Reporter info from Mantis: Marcin Wiazowski
  • Reporter name:

Description:

Problem described here is related to #34819 (closed), but has been described separately here, to avoid mess in the original report.

In TAGraph.pas, there are two functions declared:

function TChart.XImageToGraph(AX: Integer): Double;
begin
  if AX >= MAX_COORD then
    Result := Infinity * SgnInt(FScale.X)
  else if AX <= -MAX_COORD then
    Result := -Infinity * SgnInt(FScale.X)
  else
    Result := (AX - FOffset.X) / FScale.X;
end;

function TChart.YImageToGraph(AY: Integer): Double;
begin
  if AY >= MAX_COORD then
    Result := Infinity * SgnInt(FScale.Y)
  else if AY <= -MAX_COORD then
    Result := +Infinity * SgnInt(FScale.Y)
  else
    Result := (AY - FOffset.Y) / FScale.Y;
end;

The idea is:
- for very large, positive values, return +INF,
- for very large, negative values, return -INF,
- in other cases perfrom the calculations.

There is a mistake in TChart.YImageToGraph: "+Infinity" should be changed to "-Infinity".

Regards

Mantis conversion info:

  • Mantis ID: 34898
  • Build: 60103
  • Version: 2.1 (SVN)
  • Fixed in revision: 60104 (#974e1fea), 60105 (#033dcb2d)
  • Target version: 2.0
Assignee
Assign to
Time tracking