@@ -28,14 +28,19 @@ function shouldPlotEquidistant() {
28
28
return $ ( "#equidistant" ) . is ( ':checked' ) ;
29
29
}
30
30
31
+ function shouldPlotErrorBars ( ) {
32
+ return $ ( "#show_error_bars" ) . is ( ':checked' ) ;
33
+ }
34
+
31
35
function getConfiguration ( ) {
32
36
var config = {
33
37
exe : readCheckbox ( "input[name='executable']:checked" ) ,
34
38
base : $ ( "#baseline option:selected" ) . val ( ) ,
35
39
ben : $ ( "input[name='benchmark']:checked" ) . val ( ) ,
36
40
env : $ ( "input[name='environments']:checked" ) . val ( ) ,
37
41
revs : $ ( "#revisions option:selected" ) . val ( ) ,
38
- equid : $ ( "#equidistant" ) . is ( ':checked' ) ? "on" : "off"
42
+ equid : $ ( "#equidistant" ) . is ( ':checked' ) ? "on" : "off" ,
43
+ error : $ ( "#show_error_bars" ) . is ( ':checked' ) ? "on" : "off"
39
44
} ;
40
45
41
46
var branch = readCheckbox ( "input[name='branch']:checked" ) ;
@@ -64,17 +69,41 @@ function OnMarkerClickHandler(ev, gridpos, datapos, neighbor, plot) {
64
69
function renderPlot ( data ) {
65
70
var plotdata = [ ] ,
66
71
series = [ ] ,
72
+ firstdates = [ ] ,
73
+ lastdates = [ ] ,
67
74
lastvalues = [ ] ; //hopefully the smallest values for determining significant digits.
68
75
seriesindex = [ ] ;
76
+ var errorSeries = 0 ;
69
77
for ( var branch in data . branches ) {
70
78
// NOTE: Currently, only the "default" branch is shown in the timeline
71
79
for ( var exe_id in data . branches [ branch ] ) {
80
+ if ( shouldPlotErrorBars ( ) ) {
81
+ marker = false ;
82
+ var error = new Array ( ) ;
83
+ for ( res in data [ "branches" ] [ branch ] [ exe_id ] ) {
84
+ var date = data [ "branches" ] [ branch ] [ exe_id ] [ res ] [ 0 ] ;
85
+ var value = data [ "branches" ] [ branch ] [ exe_id ] [ res ] [ 1 ] ;
86
+ var std_dev = data [ "branches" ] [ branch ] [ exe_id ] [ res ] [ 2 ] ;
87
+ error . push ( [ date , value - std_dev , value + std_dev , data [ "branches" ] [ branch ] [ exe_id ] [ res ] [ 3 ] ] ) ;
88
+ }
89
+ plotdata . push ( error ) ;
90
+ series . push ( { renderer :$ . jqplot . OHLCRenderer , rendererOptions :{ errorBar :true } , showLabel : false , showMarker : true ,
91
+ "label" : $ ( "label[for*='executable" + getColor ( exe_id ) + "']" ) . html ( ) + " error" , color : "#C0C0C0" } ) ;
92
+ errorSeries ++ ;
93
+ }
72
94
// FIXME if (branch !== "default") { label += " - " + branch; }
73
95
var label = $ ( "label[for*='executable" + exe_id + "']" ) . html ( ) ;
74
96
series . push ( { "label" : label , "color" : getColor ( exe_id ) } ) ;
75
97
seriesindex . push ( exe_id ) ;
76
- plotdata . push ( data . branches [ branch ] [ exe_id ] ) ;
77
- lastvalues . push ( data . branches [ branch ] [ exe_id ] [ 0 ] [ 1 ] ) ;
98
+ var exeData = data . branches [ branch ] [ exe_id ] ;
99
+ plotdata . push ( exeData ) ;
100
+ var startDate = new Date ( exeData [ exeData . length - 1 ] [ 0 ] )
101
+ var endDate = new Date ( exeData [ 0 ] [ 0 ] ) ;
102
+ startDate . setDate ( startDate . getDate ( ) - 1 ) ;
103
+ endDate . setDate ( endDate . getDate ( ) + 1 ) ;
104
+ firstdates . push ( startDate ) ;
105
+ lastdates . push ( endDate ) ;
106
+ lastvalues . push ( exeData [ 0 ] [ 1 ] ) ;
78
107
}
79
108
//determine significant digits
80
109
var digits = 2 ;
@@ -115,7 +144,8 @@ function renderPlot(data) {
115
144
labelRenderer : $ . jqplot . CanvasAxisLabelRenderer ,
116
145
tickOptions :{ formatString :'%b %d' } ,
117
146
pad : 1.01 ,
118
- autoscale :true ,
147
+ min : Math . min . apply ( Math , firstdates ) ,
148
+ max : Math . max . apply ( Math , lastdates ) ,
119
149
rendererOptions :{ sortMergedLabels :true } /* only relevant when
120
150
$.jqplot.CategoryAxisRenderer is used */
121
151
}
@@ -129,7 +159,7 @@ function renderPlot(data) {
129
159
} ,
130
160
cursor :{ show :true , zoom :true , showTooltip :false , clickReset :true }
131
161
} ;
132
- if ( series . length > 4 ) {
162
+ if ( series . length > 4 + errorSeries ) {
133
163
// Move legend outside plot area to unclutter
134
164
var labels = [ ] ;
135
165
for ( var l in series ) {
@@ -149,14 +179,23 @@ function renderPlot(data) {
149
179
150
180
function renderMiniplot ( plotid , data ) {
151
181
var plotdata = [ ] ,
152
- series = [ ] ;
182
+ series = [ ] ,
183
+ firstdates = [ ] ,
184
+ lastdates = [ ] ;
153
185
154
186
for ( var branch in data . branches ) {
155
187
for ( var id in data . branches [ branch ] ) {
156
188
series . push ( {
157
189
"label" : $ ( "label[for*='executable" + id + "']" ) . html ( ) ,
158
190
"color" : getColor ( id )
159
191
} ) ;
192
+ var exeData = data . branches [ branch ] [ id ] ;
193
+ var startDate = new Date ( exeData [ exeData . length - 1 ] [ 0 ] )
194
+ var endDate = new Date ( exeData [ 0 ] [ 0 ] ) ;
195
+ startDate . setDate ( startDate . getDate ( ) - 1 ) ;
196
+ endDate . setDate ( endDate . getDate ( ) + 1 ) ;
197
+ firstdates . push ( startDate ) ;
198
+ lastdates . push ( endDate ) ;
160
199
plotdata . push ( data . branches [ branch ] [ id ] ) ;
161
200
}
162
201
}
@@ -181,7 +220,10 @@ function renderMiniplot(plotid, data) {
181
220
renderer :$ . jqplot . DateAxisRenderer ,
182
221
pad : 1.01 ,
183
222
autoscale :true ,
184
- showTicks : false
223
+ showTicks : false ,
224
+ min : Math . min . apply ( Math , firstdates ) ,
225
+ max : Math . max . apply ( Math , lastdates ) ,
226
+ rendererOptions :{ sortMergedLabels :true }
185
227
}
186
228
} ,
187
229
highlighter : { show :false } ,
@@ -193,6 +235,7 @@ function renderMiniplot(plotid, data) {
193
235
function render ( data ) {
194
236
$ ( "#revisions" ) . attr ( "disabled" , false ) ;
195
237
$ ( "#equidistant" ) . attr ( "disabled" , false ) ;
238
+ $ ( "#show_error_bars" ) . attr ( "disabled" , false ) ;
196
239
$ ( "#plotgrid" ) . html ( "" ) ;
197
240
if ( data . error !== "None" ) {
198
241
var h = $ ( "#content" ) . height ( ) ; //get height for error message
@@ -208,6 +251,7 @@ function render(data) {
208
251
//Render Grid of plots
209
252
$ ( "#revisions" ) . attr ( "disabled" , true ) ;
210
253
$ ( "#equidistant" ) . attr ( "disabled" , true ) ;
254
+ $ ( "#show_error_bars" ) . attr ( "disabled" , true ) ;
211
255
for ( var bench in data . timelines ) {
212
256
var plotid = "plot_" + data . timelines [ bench ] . benchmark_id ;
213
257
$ ( "#plotgrid" ) . append ( '<div id="' + plotid + '" class="miniplot"></div>' ) ;
@@ -254,6 +298,7 @@ function initializeSite(event) {
254
298
$ ( "input[name='benchmark']" ) . change ( updateUrl ) ;
255
299
$ ( "input[name='environments']" ) . change ( updateUrl ) ;
256
300
$ ( "#equidistant" ) . change ( updateUrl ) ;
301
+ $ ( "#show_error_bars" ) . change ( updateUrl ) ;
257
302
}
258
303
259
304
function refreshSite ( event ) {
@@ -307,6 +352,7 @@ function setValuesOfInputFields(event) {
307
352
308
353
$ ( "#baselinecolor" ) . css ( "background-color" , baselineColor ) ;
309
354
$ ( "#equidistant" ) . prop ( 'checked' , valueOrDefault ( event . parameters . equid , defaults . equidistant ) === "on" ) ;
355
+ $ ( "#show_error_bars" ) . prop ( 'checked' , valueOrDefault ( event . parameters . error , defaults . error ) === "on" ) ;
310
356
}
311
357
312
358
function init ( def ) {
0 commit comments