@@ -24,18 +24,34 @@ function getColor(exe_id) {
2424 . data ( 'color' ) ;
2525}
2626
27+ function scaleColorAlpha ( color , scale ) {
28+ var c = $ . jqplot . getColorComponents ( color ) ;
29+ c [ 3 ] = c [ 3 ] * scale ;
30+ return 'rgba(' + c [ 0 ] + ', ' + c [ 1 ] + ', ' + c [ 2 ] + ', ' + c [ 3 ] + ')' ;
31+ }
32+
2733function shouldPlotEquidistant ( ) {
2834 return $ ( "#equidistant" ) . is ( ':checked' ) ;
2935}
3036
37+ function shouldPlotQuartiles ( ) {
38+ return $ ( "#show_quartile_bands" ) . is ( ':checked' ) ;
39+ }
40+
41+ function shouldPlotExtrema ( ) {
42+ return $ ( "#show_extrema_bands" ) . is ( ':checked' ) ;
43+ }
44+
3145function getConfiguration ( ) {
3246 var config = {
3347 exe : readCheckbox ( "input[name='executable']:checked" ) ,
3448 base : $ ( "#baseline option:selected" ) . val ( ) ,
3549 ben : $ ( "input[name='benchmark']:checked" ) . val ( ) ,
3650 env : $ ( "input[name='environments']:checked" ) . val ( ) ,
3751 revs : $ ( "#revisions option:selected" ) . val ( ) ,
38- equid : $ ( "#equidistant" ) . is ( ':checked' ) ? "on" : "off"
52+ equid : $ ( "#equidistant" ) . is ( ':checked' ) ? "on" : "off" ,
53+ quarts : $ ( "#show_quartile_bands" ) . is ( ':checked' ) ? "on" : "off" ,
54+ extr : $ ( "#show_extrema_bands" ) . is ( ':checked' ) ? "on" : "off"
3955 } ;
4056
4157 var branch = readCheckbox ( "input[name='branch']:checked" ) ;
@@ -53,25 +69,89 @@ function permalinkToChanges(commitid, executableid, environment) {
5369function OnMarkerClickHandler ( ev , gridpos , datapos , neighbor , plot ) {
5470 if ( $ ( "input[name='benchmark']:checked" ) . val ( ) === "grid" ) { return false ; }
5571 if ( neighbor ) {
56- var commitid = neighbor . data [ 3 ] ;
72+ var commitid = neighbor . data [ neighbor . data . length - 2 ] ;
5773 // Get executable ID from the seriesindex array
5874 var executableid = seriesindex [ neighbor . seriesIndex ] ;
5975 var environment = $ ( "input[name='environments']:checked" ) . val ( ) ;
6076 permalinkToChanges ( commitid , executableid , environment ) ;
6177 }
6278}
6379
80+ function getHighlighterConfig ( median ) {
81+ if ( median ) {
82+ return {
83+ show : true ,
84+ tooltipLocation : 'nw' ,
85+ yvalues : 7 ,
86+ formatString :'<table class="jqplot-highlighter"> <tr><td>date:</td><td>%s</td></tr> <tr><td>median:</td><td>%s</td></tr> <tr><td>max:</td><td>%s</td></tr> <tr><td>Q3:</td><td>%s</td></tr> <tr><td>Q1:</td><td>%s</td></tr> <tr><td>min:</td><td>%s</td></tr> <tr><td>commit:</td><td>%s</td></tr></table>'
87+ } ;
88+ } else {
89+ return {
90+ show : true ,
91+ tooltipLocation : 'nw' ,
92+ yvalues : 4 ,
93+ formatString :'<table class="jqplot-highlighter"> <tr><td>date:</td><td>%s</td></tr> <tr><td>result:</td><td>%s</td></tr> <tr><td>std dev:</td><td>%s</td></tr> <tr><td>commit:</td><td>%s</td></tr></table>'
94+ } ;
95+ }
96+ }
97+
6498function renderPlot ( data ) {
6599 var plotdata = [ ] ,
66100 series = [ ] ,
67101 lastvalues = [ ] ; //hopefully the smallest values for determining significant digits.
68102 seriesindex = [ ] ;
103+ var hiddenSeries = 0 ;
104+ var median = data [ 'data_type' ] === 'M' ;
69105 for ( var branch in data . branches ) {
70106 // NOTE: Currently, only the "default" branch is shown in the timeline
71107 for ( var exe_id in data . branches [ branch ] ) {
72108 // FIXME if (branch !== "default") { label += " - " + branch; }
73109 var label = $ ( "label[for*='executable" + exe_id + "']" ) . html ( ) ;
74- series . push ( { "label" : label , "color" : getColor ( exe_id ) } ) ;
110+ var seriesConfig = {
111+ label : label ,
112+ color : getColor ( exe_id )
113+ } ;
114+ if ( median ) {
115+ $ ( "span.options.median" ) . css ( "display" , "inline" ) ;
116+ var mins = new Array ( ) ;
117+ var maxes = new Array ( ) ;
118+ var q1s = new Array ( ) ;
119+ var q3s = new Array ( ) ;
120+ for ( res in data [ "branches" ] [ branch ] [ exe_id ] ) {
121+ var date = data [ "branches" ] [ branch ] [ exe_id ] [ res ] [ 0 ] ;
122+ var value = data [ "branches" ] [ branch ] [ exe_id ] [ res ] [ 1 ] ;
123+ var max = data [ "branches" ] [ branch ] [ exe_id ] [ res ] [ 2 ] ;
124+ var q3 = data [ "branches" ] [ branch ] [ exe_id ] [ res ] [ 3 ] ;
125+ var q1 = data [ "branches" ] [ branch ] [ exe_id ] [ res ] [ 4 ] ;
126+ var min = data [ "branches" ] [ branch ] [ exe_id ] [ res ] [ 5 ] ;
127+ if ( min !== "" )
128+ mins . push ( [ date , min ] ) ;
129+ if ( max !== "" )
130+ maxes . push ( [ date , max ] ) ;
131+ if ( q1 !== "" )
132+ q1s . push ( [ date , q1 ] ) ;
133+ if ( q3 !== "" )
134+ q3s . push ( [ date , q3 ] ) ;
135+ }
136+ var extrema = new Array ( mins , maxes ) ;
137+ var quartiles = new Array ( q1s , q3s ) ;
138+ if ( shouldPlotQuartiles ( ) ) {
139+ seriesConfig [ 'rendererOptions' ] = { bandData : quartiles } ;
140+ } else if ( shouldPlotExtrema ( ) ) {
141+ seriesConfig [ 'rendererOptions' ] = { bandData : extrema } ;
142+ }
143+ if ( shouldPlotQuartiles ( ) && shouldPlotExtrema ( ) ) {
144+ series . push ( {
145+ showLabel : false ,
146+ showMarker : false ,
147+ color : scaleColorAlpha ( getColor ( exe_id ) , 0.6 ) ,
148+ rendererOptions : { bandData : extrema }
149+ } ) ;
150+ plotdata . push ( data . branches [ branch ] [ exe_id ] ) ;
151+ hiddenSeries ++ ;
152+ }
153+ }
154+ series . push ( seriesConfig ) ;
75155 seriesindex . push ( exe_id ) ;
76156 plotdata . push ( data . branches [ branch ] [ exe_id ] ) ;
77157 lastvalues . push ( data . branches [ branch ] [ exe_id ] [ 0 ] [ 1 ] ) ;
@@ -121,15 +201,10 @@ function renderPlot(data) {
121201 }
122202 } ,
123203 legend : { show : true , location : 'nw' } ,
124- highlighter : {
125- show : true ,
126- tooltipLocation : 'nw' ,
127- yvalues : 4 ,
128- formatString :'<table class="jqplot-highlighter"> <tr><td>date:</td><td>%s</td></tr> <tr><td>result:</td><td>%s</td></tr> <tr><td>std dev:</td><td>%s</td></tr> <tr><td>commit:</td><td>%s</td></tr></table>'
129- } ,
204+ highlighter : getHighlighterConfig ( median ) ,
130205 cursor :{ show :true , zoom :true , showTooltip :false , clickReset :true }
131206 } ;
132- if ( series . length > 4 ) {
207+ if ( series . length > 4 + hiddenSeries ) {
133208 // Move legend outside plot area to unclutter
134209 var labels = [ ] ;
135210 for ( var l in series ) {
@@ -193,6 +268,7 @@ function renderMiniplot(plotid, data) {
193268function render ( data ) {
194269 $ ( "#revisions" ) . attr ( "disabled" , false ) ;
195270 $ ( "#equidistant" ) . attr ( "disabled" , false ) ;
271+ $ ( "span.options.median" ) . css ( "display" , "none" ) ;
196272 $ ( "#plotgrid" ) . html ( "" ) ;
197273 if ( data . error !== "None" ) {
198274 var h = $ ( "#content" ) . height ( ) ; //get height for error message
@@ -254,6 +330,8 @@ function initializeSite(event) {
254330 $ ( "input[name='benchmark']" ) . change ( updateUrl ) ;
255331 $ ( "input[name='environments']" ) . change ( updateUrl ) ;
256332 $ ( "#equidistant" ) . change ( updateUrl ) ;
333+ $ ( "#show_quartile_bands" ) . change ( updateUrl ) ;
334+ $ ( "#show_extrema_bands" ) . change ( updateUrl ) ;
257335}
258336
259337function refreshSite ( event ) {
@@ -307,6 +385,8 @@ function setValuesOfInputFields(event) {
307385
308386 $ ( "#baselinecolor" ) . css ( "background-color" , baselineColor ) ;
309387 $ ( "#equidistant" ) . prop ( 'checked' , valueOrDefault ( event . parameters . equid , defaults . equidistant ) === "on" ) ;
388+ $ ( "#show_quartile_bands" ) . prop ( 'checked' , valueOrDefault ( event . parameters . quarts , defaults . quartiles ) === "on" ) ;
389+ $ ( "#show_extrema_bands" ) . prop ( 'checked' , valueOrDefault ( event . parameters . extr , defaults . extrema ) === "on" ) ;
310390}
311391
312392function init ( def ) {
0 commit comments