@@ -28,14 +28,19 @@ function shouldPlotEquidistant() {
2828 return $ ( "#equidistant" ) . is ( ':checked' ) ;
2929}
3030
31+ function shouldPlotErrorBars ( ) {
32+ return $ ( "#show_error_bars" ) . is ( ':checked' ) ;
33+ }
34+
3135function getConfiguration ( ) {
3236 var config = {
3337 exe : readCheckbox ( "input[name='executable']:checked" ) ,
3438 base : $ ( "#baseline option:selected" ) . val ( ) ,
3539 ben : $ ( "input[name='benchmark']:checked" ) . val ( ) ,
3640 env : $ ( "input[name='environments']:checked" ) . val ( ) ,
3741 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"
3944 } ;
4045
4146 var branch = readCheckbox ( "input[name='branch']:checked" ) ;
@@ -64,17 +69,41 @@ function OnMarkerClickHandler(ev, gridpos, datapos, neighbor, plot) {
6469function renderPlot ( data ) {
6570 var plotdata = [ ] ,
6671 series = [ ] ,
72+ firstdates = [ ] ,
73+ lastdates = [ ] ,
6774 lastvalues = [ ] ; //hopefully the smallest values for determining significant digits.
6875 seriesindex = [ ] ;
76+ var errorSeries = 0 ;
6977 for ( var branch in data . branches ) {
7078 // NOTE: Currently, only the "default" branch is shown in the timeline
7179 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+ }
7294 // FIXME if (branch !== "default") { label += " - " + branch; }
7395 var label = $ ( "label[for*='executable" + exe_id + "']" ) . html ( ) ;
7496 series . push ( { "label" : label , "color" : getColor ( exe_id ) } ) ;
7597 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 ] ) ;
78107 }
79108 //determine significant digits
80109 var digits = 2 ;
@@ -115,7 +144,8 @@ function renderPlot(data) {
115144 labelRenderer : $ . jqplot . CanvasAxisLabelRenderer ,
116145 tickOptions :{ formatString :'%b %d' } ,
117146 pad : 1.01 ,
118- autoscale :true ,
147+ min : Math . min . apply ( Math , firstdates ) ,
148+ max : Math . max . apply ( Math , lastdates ) ,
119149 rendererOptions :{ sortMergedLabels :true } /* only relevant when
120150 $.jqplot.CategoryAxisRenderer is used */
121151 }
@@ -129,7 +159,7 @@ function renderPlot(data) {
129159 } ,
130160 cursor :{ show :true , zoom :true , showTooltip :false , clickReset :true }
131161 } ;
132- if ( series . length > 4 ) {
162+ if ( series . length > 4 + errorSeries ) {
133163 // Move legend outside plot area to unclutter
134164 var labels = [ ] ;
135165 for ( var l in series ) {
@@ -149,14 +179,23 @@ function renderPlot(data) {
149179
150180function renderMiniplot ( plotid , data ) {
151181 var plotdata = [ ] ,
152- series = [ ] ;
182+ series = [ ] ,
183+ firstdates = [ ] ,
184+ lastdates = [ ] ;
153185
154186 for ( var branch in data . branches ) {
155187 for ( var id in data . branches [ branch ] ) {
156188 series . push ( {
157189 "label" : $ ( "label[for*='executable" + id + "']" ) . html ( ) ,
158190 "color" : getColor ( id )
159191 } ) ;
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 ) ;
160199 plotdata . push ( data . branches [ branch ] [ id ] ) ;
161200 }
162201 }
@@ -181,7 +220,10 @@ function renderMiniplot(plotid, data) {
181220 renderer :$ . jqplot . DateAxisRenderer ,
182221 pad : 1.01 ,
183222 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 }
185227 }
186228 } ,
187229 highlighter : { show :false } ,
@@ -193,6 +235,7 @@ function renderMiniplot(plotid, data) {
193235function render ( data ) {
194236 $ ( "#revisions" ) . attr ( "disabled" , false ) ;
195237 $ ( "#equidistant" ) . attr ( "disabled" , false ) ;
238+ $ ( "#show_error_bars" ) . attr ( "disabled" , false ) ;
196239 $ ( "#plotgrid" ) . html ( "" ) ;
197240 if ( data . error !== "None" ) {
198241 var h = $ ( "#content" ) . height ( ) ; //get height for error message
@@ -208,6 +251,7 @@ function render(data) {
208251 //Render Grid of plots
209252 $ ( "#revisions" ) . attr ( "disabled" , true ) ;
210253 $ ( "#equidistant" ) . attr ( "disabled" , true ) ;
254+ $ ( "#show_error_bars" ) . attr ( "disabled" , true ) ;
211255 for ( var bench in data . timelines ) {
212256 var plotid = "plot_" + data . timelines [ bench ] . benchmark_id ;
213257 $ ( "#plotgrid" ) . append ( '<div id="' + plotid + '" class="miniplot"></div>' ) ;
@@ -254,6 +298,7 @@ function initializeSite(event) {
254298 $ ( "input[name='benchmark']" ) . change ( updateUrl ) ;
255299 $ ( "input[name='environments']" ) . change ( updateUrl ) ;
256300 $ ( "#equidistant" ) . change ( updateUrl ) ;
301+ $ ( "#show_error_bars" ) . change ( updateUrl ) ;
257302}
258303
259304function refreshSite ( event ) {
@@ -307,6 +352,7 @@ function setValuesOfInputFields(event) {
307352
308353 $ ( "#baselinecolor" ) . css ( "background-color" , baselineColor ) ;
309354 $ ( "#equidistant" ) . prop ( 'checked' , valueOrDefault ( event . parameters . equid , defaults . equidistant ) === "on" ) ;
355+ $ ( "#show_error_bars" ) . prop ( 'checked' , valueOrDefault ( event . parameters . error , defaults . error ) === "on" ) ;
310356}
311357
312358function init ( def ) {
0 commit comments