From 93fbce38ba033404b86236101e5491fa89e6abd1 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Mon, 8 Feb 2016 15:47:02 -0500 Subject: [PATCH] 8341: Do not round up Y axis to even numbers, just use max series value. Remove Y axis labels (so X axis matches other graphs from the same job), add grid lines. --- .../crunchstat_summary/chartjs.py | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tools/crunchstat-summary/crunchstat_summary/chartjs.py b/tools/crunchstat-summary/crunchstat_summary/chartjs.py index fb30041889..03e45e601d 100644 --- a/tools/crunchstat-summary/crunchstat_summary/chartjs.py +++ b/tools/crunchstat-summary/crunchstat_summary/chartjs.py @@ -2,6 +2,7 @@ from __future__ import print_function import cgi import json +import math import pkg_resources from crunchstat_summary import logger @@ -35,12 +36,25 @@ class ChartJS(object): } for s in self.summarizers] + def _axisY(self, tasks, stat): + ymax = 1 + for task in tasks.itervalues(): + for pt in task.series[stat]: + ymax = max(ymax, pt[1]) + ytick = math.exp((1+math.floor(math.log(ymax, 2)))*math.log(2))/4 + return { + 'gridColor': '#cccccc', + 'gridThickness': 1, + 'interval': ytick, + 'minimum': 0, + 'maximum': ymax, + 'valueFormatString': "''", + } + def charts(self, label, tasks): return [ { - 'axisY': { - 'minimum': 0, - }, + 'axisY': self._axisY(tasks=tasks, stat=stat), 'data': [ { 'type': 'line', -- 2.30.2