@@ -34,6 +34,10 @@ function shouldPlotEquidistant() {
34
34
return $ ( "#equidistant" ) . is ( ':checked' ) ;
35
35
}
36
36
37
+ function shouldPlotErrorBars ( ) {
38
+ return $ ( "#show_error_bars" ) . is ( ':checked' ) ;
39
+ }
40
+
37
41
function shouldPlotQuartiles ( ) {
38
42
return $ ( "#show_quartile_bands" ) . is ( ':checked' ) ;
39
43
}
@@ -50,6 +54,7 @@ function getConfiguration() {
50
54
env : $ ( "input[name='environments']:checked" ) . val ( ) ,
51
55
revs : $ ( "#revisions option:selected" ) . val ( ) ,
52
56
equid : $ ( "#equidistant" ) . is ( ':checked' ) ? "on" : "off" ,
57
+ error : $ ( "#show_error_bars" ) . is ( ':checked' ) ? "on" : "off" ,
53
58
quarts : $ ( "#show_quartile_bands" ) . is ( ':checked' ) ? "on" : "off" ,
54
59
extr : $ ( "#show_extrema_bands" ) . is ( ':checked' ) ? "on" : "off"
55
60
} ;
@@ -98,13 +103,34 @@ function getHighlighterConfig(median) {
98
103
function renderPlot ( data ) {
99
104
var plotdata = [ ] ,
100
105
series = [ ] ,
106
+ firstdates = [ ] ,
107
+ lastdates = [ ] ,
101
108
lastvalues = [ ] ; //hopefully the smallest values for determining significant digits.
102
109
seriesindex = [ ] ;
110
+ var errorSeries = 0 ;
103
111
var hiddenSeries = 0 ;
112
+ var mean = data [ 'data_type' ] === 'U' ;
104
113
var median = data [ 'data_type' ] === 'M' ;
105
114
for ( var branch in data . branches ) {
106
115
// NOTE: Currently, only the "default" branch is shown in the timeline
107
116
for ( var exe_id in data . branches [ branch ] ) {
117
+ if ( mean ) {
118
+ $ ( "span.options.mean" ) . css ( "display" , "inline" ) ;
119
+ if ( shouldPlotErrorBars ( ) ) {
120
+ marker = false ;
121
+ var error = new Array ( ) ;
122
+ for ( res in data [ "branches" ] [ branch ] [ exe_id ] ) {
123
+ var date = data [ "branches" ] [ branch ] [ exe_id ] [ res ] [ 0 ] ;
124
+ var value = data [ "branches" ] [ branch ] [ exe_id ] [ res ] [ 1 ] ;
125
+ var std_dev = data [ "branches" ] [ branch ] [ exe_id ] [ res ] [ 2 ] ;
126
+ error . push ( [ date , value - std_dev , value + std_dev , data [ "branches" ] [ branch ] [ exe_id ] [ res ] [ 3 ] ] ) ;
127
+ }
128
+ plotdata . push ( error ) ;
129
+ series . push ( { renderer :$ . jqplot . OHLCRenderer , rendererOptions :{ errorBar :true } , showLabel : false , showMarker : true ,
130
+ "label" : $ ( "label[for*='executable" + getColor ( exe_id ) + "']" ) . html ( ) + " error" , color : "#C0C0C0" } ) ;
131
+ errorSeries ++ ;
132
+ }
133
+ }
108
134
// FIXME if (branch !== "default") { label += " - " + branch; }
109
135
var label = $ ( "label[for*='executable" + exe_id + "']" ) . html ( ) ;
110
136
var seriesConfig = {
@@ -153,8 +179,15 @@ function renderPlot(data) {
153
179
}
154
180
series . push ( seriesConfig ) ;
155
181
seriesindex . push ( exe_id ) ;
156
- plotdata . push ( data . branches [ branch ] [ exe_id ] ) ;
157
- lastvalues . push ( data . branches [ branch ] [ exe_id ] [ 0 ] [ 1 ] ) ;
182
+ var exeData = data . branches [ branch ] [ exe_id ] ;
183
+ plotdata . push ( exeData ) ;
184
+ var startDate = new Date ( exeData [ exeData . length - 1 ] [ 0 ] )
185
+ var endDate = new Date ( exeData [ 0 ] [ 0 ] ) ;
186
+ startDate . setDate ( startDate . getDate ( ) - 1 ) ;
187
+ endDate . setDate ( endDate . getDate ( ) + 1 ) ;
188
+ firstdates . push ( startDate ) ;
189
+ lastdates . push ( endDate ) ;
190
+ lastvalues . push ( exeData [ 0 ] [ 1 ] ) ;
158
191
}
159
192
//determine significant digits
160
193
var digits = 2 ;
@@ -202,7 +235,8 @@ function renderPlot(data) {
202
235
labelRenderer : $ . jqplot . CanvasAxisLabelRenderer ,
203
236
tickOptions : { formatString :'%b %d' } ,
204
237
pad : 1.01 ,
205
- autoscale : true ,
238
+ min : Math . min . apply ( Math , firstdates ) ,
239
+ max : Math . max . apply ( Math , lastdates ) ,
206
240
rendererOptions : { sortMergedLabels :true } /* only relevant when
207
241
$.jqplot.CategoryAxisRenderer is used */
208
242
}
@@ -211,7 +245,7 @@ function renderPlot(data) {
211
245
highlighter : getHighlighterConfig ( median ) ,
212
246
cursor : { show :true , zoom :true , showTooltip :false , clickReset :true }
213
247
} ;
214
- if ( series . length > 4 + hiddenSeries ) {
248
+ if ( series . length > 4 + errorSeries + hiddenSeries ) {
215
249
// Move legend outside plot area to unclutter
216
250
var labels = [ ] ;
217
251
for ( var l in series ) {
@@ -231,14 +265,23 @@ function renderPlot(data) {
231
265
232
266
function renderMiniplot ( plotid , data ) {
233
267
var plotdata = [ ] ,
234
- series = [ ] ;
268
+ series = [ ] ,
269
+ firstdates = [ ] ,
270
+ lastdates = [ ] ;
235
271
236
272
for ( var branch in data . branches ) {
237
273
for ( var id in data . branches [ branch ] ) {
238
274
series . push ( {
239
275
"label" : $ ( "label[for*='executable" + id + "']" ) . html ( ) ,
240
276
"color" : getColor ( id )
241
277
} ) ;
278
+ var exeData = data . branches [ branch ] [ id ] ;
279
+ var startDate = new Date ( exeData [ exeData . length - 1 ] [ 0 ] )
280
+ var endDate = new Date ( exeData [ 0 ] [ 0 ] ) ;
281
+ startDate . setDate ( startDate . getDate ( ) - 1 ) ;
282
+ endDate . setDate ( endDate . getDate ( ) + 1 ) ;
283
+ firstdates . push ( startDate ) ;
284
+ lastdates . push ( endDate ) ;
242
285
plotdata . push ( data . branches [ branch ] [ id ] ) ;
243
286
}
244
287
}
@@ -268,7 +311,10 @@ function renderMiniplot(plotid, data) {
268
311
renderer :$ . jqplot . DateAxisRenderer ,
269
312
pad : 1.01 ,
270
313
autoscale :true ,
271
- showTicks : false
314
+ showTicks : false ,
315
+ min : Math . min . apply ( Math , firstdates ) ,
316
+ max : Math . max . apply ( Math , lastdates ) ,
317
+ rendererOptions : { sortMergedLabels :true }
272
318
}
273
319
} ,
274
320
highlighter : { show :false } ,
@@ -280,6 +326,7 @@ function renderMiniplot(plotid, data) {
280
326
function render ( data ) {
281
327
$ ( "#revisions" ) . attr ( "disabled" , false ) ;
282
328
$ ( "#equidistant" ) . attr ( "disabled" , false ) ;
329
+ $ ( "span.options.mean" ) . css ( "display" , "none" ) ;
283
330
$ ( "span.options.median" ) . css ( "display" , "none" ) ;
284
331
$ ( "#plotgrid" ) . html ( "" ) ;
285
332
if ( data . error !== "None" ) {
@@ -342,6 +389,7 @@ function initializeSite(event) {
342
389
$ ( "input[name='benchmark']" ) . change ( updateUrl ) ;
343
390
$ ( "input[name='environments']" ) . change ( updateUrl ) ;
344
391
$ ( "#equidistant" ) . change ( updateUrl ) ;
392
+ $ ( "#show_error_bars" ) . change ( updateUrl ) ;
345
393
$ ( "#show_quartile_bands" ) . change ( updateUrl ) ;
346
394
$ ( "#show_extrema_bands" ) . change ( updateUrl ) ;
347
395
}
@@ -397,6 +445,7 @@ function setValuesOfInputFields(event) {
397
445
398
446
$ ( "#baselinecolor" ) . css ( "background-color" , baselineColor ) ;
399
447
$ ( "#equidistant" ) . prop ( 'checked' , valueOrDefault ( event . parameters . equid , defaults . equidistant ) === "on" ) ;
448
+ $ ( "#show_error_bars" ) . prop ( 'checked' , valueOrDefault ( event . parameters . error , defaults . error ) === "on" ) ;
400
449
$ ( "#show_quartile_bands" ) . prop ( 'checked' , valueOrDefault ( event . parameters . quarts , defaults . quartiles ) === "on" ) ;
401
450
$ ( "#show_extrema_bands" ) . prop ( 'checked' , valueOrDefault ( event . parameters . extr , defaults . extrema ) === "on" ) ;
402
451
}
0 commit comments