|
14 | 14 | <script type="text/javascript" src="{{ STATIC_URL }}js/jqplot/jqplot.canvasAxisLabelRenderer.min.js"></script> |
15 | 15 |
|
16 | 16 | <script type="text/javascript"> |
17 | | - var baselineColor = "#d8b83f"; |
18 | | - var seriesColors = ["#4bb2c5", "#EAA228", "#c5b47f", "#579575", "#839557", "#958c12", "#953579", "#4b5de4", "#ff5800", "#0085cc"]; |
19 | 17 | var seriesindex = new Array(); |
| 18 | + var baselineColor = "#d8b83f"; |
| 19 | + var seriesColors = ["#4bb2c5", "#EAA228", "#579575", "#953579", "#839557", "#ff5800", "#958c12", "#4b5de4", "#0085cc"]; |
| 20 | + |
| 21 | + function setExeColors() { |
| 22 | + // Set color data attribute for all executables |
| 23 | + $("#executable > div.boxbody > ul > ul > li > input").each(function(index) { |
| 24 | + var color_id = index; |
| 25 | + while (color_id > seriesColors.length) { color_id -= seriesColors.length; } |
| 26 | + $(this).data('color', seriesColors[color_id]); |
| 27 | + }); |
| 28 | + } |
| 29 | + |
| 30 | + function getColor(exe_id) { |
| 31 | + return $("#executable > div.boxbody") |
| 32 | + .find("input[value='"+exe_id+"']") |
| 33 | + .data('color'); |
| 34 | + } |
20 | 35 |
|
21 | 36 | function shouldPlotEquidistant() { |
22 | | - return $("#equidistant").is(':checked'); |
| 37 | + return $("#equidistant").is(':checked'); |
23 | 38 | } |
24 | 39 |
|
25 | 40 | function getConfiguration() { |
26 | 41 | var config = new Object(); |
27 | | - |
28 | 42 | config["exe"] = readCheckbox("input[name='executable']:checked"); |
29 | 43 | config["base"] = $("#baseline option:selected").val(); |
30 | 44 | config["ben"] = $("input[name='benchmark']:checked").val(); |
31 | 45 | config["env"] = $("input[name='environments']:checked").val(); |
32 | 46 | config["revs"] = $("#revisions option:selected").val(); |
33 | | - |
| 47 | + |
34 | 48 | var branch = readCheckbox("input[name='branch']:checked"); |
35 | 49 | if (branch) |
36 | 50 | config["bran"] = branch; |
37 | | - |
38 | 51 | config["equid"] = $("#equidistant").is(':checked') ? "on" : "off"; |
39 | 52 | return config; |
40 | 53 | } |
|
47 | 60 | if($("input[name='benchmark']:checked").val() == "grid") { return false; } |
48 | 61 | if (neighbor) { |
49 | 62 | var commitid = neighbor.data[3]; |
| 63 | + // Get executable ID from the seriesindex array |
50 | 64 | var executableid = seriesindex[neighbor.seriesIndex]; |
51 | 65 | var environment = $("input[name='environments']:checked").val(); |
52 | 66 | permalinkToChanges(commitid, executableid, environment); |
|
57 | 71 | var plotdata = new Array(); |
58 | 72 | var series = new Array(); |
59 | 73 | var lastvalues = new Array();//hopefully the smallest values for determining significant digits. |
| 74 | + seriesindex = new Array(); |
60 | 75 | for (branch in data["branches"]) { |
61 | 76 | // NOTE: Currently, only the "default" branch is shown in the timeline |
62 | | - seriesindex = new Array(); |
63 | 77 | for (exe_id in data["branches"][branch]) { |
64 | | - var color_id = $("#executable > div.boxbody").find("input[value='"+exe_id+"']").attr('id').slice(10); |
65 | | - while (color_id > seriesColors.length) { color_id -= seriesColors.length; } |
66 | | - var label = $("label[for*='executable" + color_id + "']").html(); |
67 | 78 | if (branch != "default") { label += " - " + branch; } |
68 | | - series.push({"label": label, "color": seriesColors[color_id-1]}); |
| 79 | + var label = $("label[for*='executable" + exe_id + "']").html(); |
| 80 | + series.push({"label": label, "color": getColor(exe_id)}); |
69 | 81 | seriesindex.push(exe_id); |
70 | 82 | plotdata.push(data["branches"][branch][exe_id]); |
71 | 83 | lastvalues.push(data["branches"][branch][exe_id][0][1]); |
|
158 | 170 | function renderMiniplot(plotid, data) { |
159 | 171 | var plotdata = new Array(); |
160 | 172 | for (branch in data['branches']) { |
161 | | - var series = new Array(); |
162 | | - for (id in data['branches'][branch]) { |
163 | | - var colorid = $("#executable > div.boxbody").find("input[value='"+id+"']").attr('id').slice(10); |
164 | | - while (colorid > seriesColors.length) { colorid -= seriesColors.length;} |
165 | | - series.push({ |
166 | | - "label": $("label[for*='executable" + colorid + "']").html(), |
167 | | - "color": seriesColors[colorid-1] |
168 | | - }); |
169 | | - plotdata.push(data['branches'][branch][id]); |
170 | | - } |
| 173 | + var series = new Array(); |
| 174 | + for (id in data['branches'][branch]) { |
| 175 | + series.push({ |
| 176 | + "label": $("label[for*='executable" + id + "']").html(), |
| 177 | + "color": getColor(id) |
| 178 | + }); |
| 179 | + plotdata.push(data['branches'][branch][id]); |
| 180 | + } |
171 | 181 | } |
172 | 182 | if (data["baseline"] != "None") { |
173 | 183 | series.push({ |
|
306 | 316 |
|
307 | 317 | //Add color legend to executable list |
308 | 318 | $("#executable div.boxbody > ul > ul > li > input").each(function() { |
309 | | - var colorid = $(this).attr("id").slice(10); |
310 | | - $(this).parent().find("div.seriescolor").css("background-color", seriesColors[colorid-1]); |
| 319 | + $(this).parent() |
| 320 | + .find("div.seriescolor") |
| 321 | + .css("background-color", getColor($(this).attr("id").slice(10))); |
311 | 322 | }); |
312 | 323 | $("#baselinecolor").css("background-color", baselineColor); |
313 | 324 | $("#equidistant").attr('checked', valueOrDefault(event.parameters['equid'], '{{ defaultequid }}') == "on"); |
|
356 | 367 | refreshContent(); |
357 | 368 | return false; |
358 | 369 | }); |
| 370 | + setExeColors(); |
359 | 371 | }); |
360 | 372 | </script> |
361 | 373 | {% endblock %} |
|
0 commit comments