Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Round axis labels by Magnitude or BarUnit #942

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

taoyouh
Copy link

@taoyouh taoyouh commented Apr 10, 2019

Summary

  • Separator postioning logic is changed in function LiveCharts.AxisCore.PrepareChart() of project Core40:

    • The bottom separator are always positioned first;
    • The position of bottom-most separator is caculated by rounding instead of truncation;
    • The positions of not only the bottom-most but every separator will be rounded to m (which equals to Unit or BarUnit, or Magnitude if not set);

Solves

  • Solves issue Axis label rounding issues #918 :

    • When using truncation, values like 1.9405 (which can't be accurately represented in binary floating-point numbers) will be truncated to 1.94049, but 1.9405 is the real value people wanted.
  • Solves bugs if separators comes from negative number to positive number:

    • If the data ranges from -0.15 to 0.15, the separator in the middle is placed at about 1.388E-17 but not 0. This is because -0.15+0.05+0.05+0.05 equals 1.388E-17 in binary floating-point calculations. Rounding the values should solve the problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant