diff --git a/release.notes b/release.notes index 1838e4a5d04..81ea2246b72 100644 --- a/release.notes +++ b/release.notes @@ -34,6 +34,11 @@ NEW: (#5042) Multi-VO mode of operation support *tests CHANGE: (#5046) don't use mail in the self generated certificates +[v7r2p6] + +*Core +FIX: (#5000) Display thousands separators in PrettyScalarFormatter again + [v7r2p5] FIX: fixes from v7r0p56, v7r1p39 diff --git a/src/DIRAC/Core/Utilities/Graphs/GraphUtilities.py b/src/DIRAC/Core/Utilities/Graphs/GraphUtilities.py index bde592ef680..7bd3d2089b8 100644 --- a/src/DIRAC/Core/Utilities/Graphs/GraphUtilities.py +++ b/src/DIRAC/Core/Utilities/Graphs/GraphUtilities.py @@ -20,11 +20,15 @@ import pytz import numpy +from matplotlib.pyplot import rcParams from matplotlib.ticker import ScalarFormatter from matplotlib.dates import AutoDateLocator, AutoDateFormatter, DateFormatter, RRuleLocator, \ rrulewrapper, HOURLY, MINUTELY, SECONDLY, YEARLY, MONTHLY, DAILY from dateutil.relativedelta import relativedelta +# This is a hack to workaround the use of float(ScalarFormatter.__call__(...)) +rcParams["axes.unicode_minus"] = False + def evalPrefs(*args, **kw): """ Interpret arguments as preferencies dictionaries or key-value pairs. The overriding order @@ -209,28 +213,17 @@ def comma_format(x_orig): class PrettyScalarFormatter(ScalarFormatter): + def __init__(self, *args, **kwargs): + super(PrettyScalarFormatter, self).__init__(*args, **kwargs) + self.set_powerlimits([-7, 9]) + self._useLocale = True - def _set_orderOfMagnitude(self, range): - # if scientific notation is to be used, find the appropriate exponent - # if using an numerical offset, find the exponent after applying the offset - locs = numpy.absolute(self.locs) + def __call__(self, x, pos=None): + val = super(PrettyScalarFormatter, self).__call__(x, pos=pos) if self.offset: - oom = math.floor(math.log10(range)) - else: - if locs[0] > locs[-1]: - val = locs[0] - else: - val = locs[-1] - if val == 0: - oom = 0 - else: - oom = math.floor(math.log10(val)) - if oom <= -7: - self.orderOfMagnitude = oom - elif oom >= 9: - self.orderOfMagnitude = oom + return val else: - self.orderOfMagnitude = 0 + return comma_format(val) class PrettyDateFormatter(AutoDateFormatter): diff --git a/tests/Integration/Monitoring/plots/ComponentMonitoringPlotter_plotPendingQueries.png b/tests/Integration/Monitoring/plots/ComponentMonitoringPlotter_plotPendingQueries.png index 2faee998685..674e2d66c09 100644 Binary files a/tests/Integration/Monitoring/plots/ComponentMonitoringPlotter_plotPendingQueries.png and b/tests/Integration/Monitoring/plots/ComponentMonitoringPlotter_plotPendingQueries.png differ