Free cookie consent management tool by TermsFeed Policy Generator

# Changeset 14159

Ignore:
Timestamp:
07/21/16 16:42:29 (7 years ago)
Message:

#2594: Slight improvement of scaling.

File:
1 edited

Unmodified
Added
Removed
• ## trunk/sources/HeuristicLab.Visualization.ChartControlsExtensions/3.3/ChartUtil.cs

 r14156 // if one of the interval ends is a multiple of 5 or 10, change the other interval end to be a multiple as well if (decimalRank > 0) { if (((aMin % 5).IsAlmost(0) || (aMin % 10).IsAlmost(0)) && !((aMax % 5).IsAlmost(0) || (aMax % 10).IsAlmost(0))) { aMax = Math.Min(aMax + 5 - aMax % 5, aMax + 10 - aMax % 10); } else if (((aMax % 5).IsAlmost(0) || (aMax % 10).IsAlmost(0)) && !((aMin % 5).IsAlmost(0) || (aMin % 10).IsAlmost(0))) { aMin = Math.Max(aMin - aMin % 5, aMin - aMin % 10); } if ((aMin.Mod(5).IsAlmost(0) || aMin.Mod(10).IsAlmost(0)) && Math.Abs(aMax) >= 5 && !(aMax.Mod(5).IsAlmost(0) || aMax.Mod(10).IsAlmost(0))) { aMax = Math.Min(aMax + 5 - aMax % 5, aMax + 10 - aMax % 10); } else if ((aMax.Mod(5).IsAlmost(0) || aMax.Mod(10).IsAlmost(0)) && Math.Abs(aMin) >= 5 && !(aMin.Mod(5).IsAlmost(0) || aMin.Mod(10).IsAlmost(0))) { aMin = Math.Max(aMin - aMin.Mod(5), aMin - aMin.Mod(10)); } var floor = (int)Math.Floor(value); var pow = (int)Math.Pow(10, decimalRank); var mod = floor % pow; if (mod < 0) mod += pow; var mod = Mod(floor, pow); return floor - mod; } var ceil = (int)Math.Ceiling(value); var pow = (int)Math.Pow(10, decimalRank); var mod = ceil % pow; if (mod < 0) mod += pow; var mod = Mod(ceil, pow); return ceil - mod + pow; } return Math.Abs(value - other) < eps; } private static double Mod(this double a, double b) { return a - b * Math.Floor(a / b); } } }
Note: See TracChangeset for help on using the changeset viewer.