[LNT] r208134 - Update baseline's color selection

Chris Matthews cmatthews5 at apple.com
Tue May 6 14:30:16 PDT 2014


Author: cmatthews
Date: Tue May  6 16:30:16 2014
New Revision: 208134

URL: http://llvm.org/viewvc/llvm-project?rev=208134&view=rev
Log:
Update baseline's color selection

When there are many baselines on a LNT graph, they become hard to distinguish. This changes baselines to have a spread of colors, so they can be easily visually separated.

Modified:
    lnt/trunk/lnt/server/ui/views.py

Modified: lnt/trunk/lnt/server/ui/views.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/views.py?rev=208134&r1=208133&r2=208134&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/views.py (original)
+++ lnt/trunk/lnt/server/ui/views.py Tue May  6 16:30:16 2014
@@ -558,8 +558,9 @@ def v4_graph():
         # Aggregate by revision.
         data = util.multidict((rev, (val, date)) for val,rev,date in q).items()
         data.sort(key=lambda sample: convert_revision(sample[0]))
-
+        color_offset = 1
         # Get baselines for this line
+        num_baselines = len(baseline_parameters)
         for baseline, baseline_title in baseline_parameters:
             q_baseline = ts.query(field.column, ts.Order.llvm_project_revision, ts.Run.start_time, ts.Machine.name).\
                          join(ts.Run).join(ts.Order).join(ts.Machine).\
@@ -571,8 +572,10 @@ def v4_graph():
             for sample in q_baseline:
                 samples.append(sample[0])
             mean = sum(samples)/len(samples)
-            # Darken the baseline color distinguish from real line.
-            dark_col = list(util.makeDarkerColor(float(i) / num_plots))
+            # Darken the baseline color distinguish from non-baselines.
+            # Make a color spread that is wide enough for all baselines x plots.
+            my_color = (float(i) * num_baselines + color_offset) / (num_plots * num_baselines)
+            dark_col = list(util.makeDarkerColor(my_color))
             str_dark_col =  util.toColorString(dark_col)
             baseline_plots.append({'color': str_dark_col,
                                    'lineWidth': 2,
@@ -580,6 +583,7 @@ def v4_graph():
                                    'name': q_baseline[0].llvm_project_revision})
             baseline_name = "Baseline {} on {}".format(baseline_title,  q_baseline[0].name)
             legend.append((BaselineLegendItem(baseline_name, baseline.id), test.name, field.name, dark_col))
+            color_offset += 1
         # Compute the graph points.
         errorbar_data = []
         points_data = []





More information about the llvm-commits mailing list