Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 1 | # Copyright 2017 Open Networking Foundation (ONF) |
| 2 | # |
| 3 | # Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>, |
| 4 | # the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>, |
| 5 | # or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg> |
| 6 | # |
| 7 | # TestON is free software: you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License as published by |
| 9 | # the Free Software Foundation, either version 2 of the License, or |
| 10 | # (at your option) any later version. |
| 11 | # |
| 12 | # TestON is distributed in the hope that it will be useful, |
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | # GNU General Public License for more details. |
| 16 | # |
| 17 | # You should have received a copy of the GNU General Public License |
| 18 | # along with TestON. If not, see <http://www.gnu.org/licenses/>. |
| 19 | # |
| 20 | # If you have any questions, or if you don't understand R, |
Jeremy Ronquillo | b626884 | 2017-10-03 13:02:58 -0700 | [diff] [blame] | 21 | # please contact Jeremy Ronquillo: j_ronquillo@u.pacific.edu |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 22 | |
| 23 | # ********************************************************** |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 24 | # STEP 1: Data management. |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 25 | # ********************************************************** |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 26 | database_host = 1 |
| 27 | database_port = 2 |
| 28 | database_u_id = 3 |
| 29 | database_pw = 4 |
| 30 | test_name = 5 |
| 31 | branch_name = 6 |
| 32 | old_flow = 7 |
| 33 | save_directory = 8 |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 34 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 35 | print( "**********************************************************" ) |
| 36 | print( "STEP 1: Data management." ) |
| 37 | print( "**********************************************************" ) |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 38 | |
Jeremy Ronquillo | b626884 | 2017-10-03 13:02:58 -0700 | [diff] [blame] | 39 | # Command line arguments are read. |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 40 | print( "Reading commmand-line args." ) |
| 41 | args <- commandArgs( trailingOnly=TRUE ) |
| 42 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 43 | # ---------------- |
| 44 | # Import Libraries |
| 45 | # ---------------- |
| 46 | |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 47 | print( "Importing libraries." ) |
| 48 | library( ggplot2 ) |
| 49 | library( reshape2 ) |
| 50 | library( RPostgreSQL ) # For databases |
| 51 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 52 | # ------------------- |
| 53 | # Check CLI Arguments |
| 54 | # ------------------- |
| 55 | |
| 56 | print( "Verifying CLI args." ) |
| 57 | |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 58 | if ( is.na( args[ save_directory ] ) ){ |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 59 | |
| 60 | print( paste( "Usage: Rscript SCPFbatchFlowResp", |
| 61 | "<database-host>", |
| 62 | "<database-port>", |
| 63 | "<database-user-id>", |
| 64 | "<database-password>", |
| 65 | "<test-name>", |
| 66 | "<branch-name>", |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 67 | "<using-old-flow>", |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 68 | "<directory-to-save-graphs>", |
| 69 | sep=" " ) ) |
| 70 | |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 71 | q() # basically exit(), but in R |
| 72 | } |
| 73 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 74 | # ----------------- |
| 75 | # Create File Names |
| 76 | # ----------------- |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 77 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 78 | print( "Creating filenames and title of graph." ) |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 79 | |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 80 | postOutputFile <- paste( args[ save_directory ], |
| 81 | args[ test_name ], |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 82 | "_", |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 83 | args[ branch_name ], |
| 84 | if( args[ old_flow ] == "y" ) "_OldFlow" else "", |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 85 | "_PostGraph.jpg", |
| 86 | sep="" ) |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 87 | |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 88 | delOutputFile <- paste( args[ save_directory ], |
| 89 | args[ test_name ], |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 90 | "_", |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 91 | args[ branch_name ], |
| 92 | if( args[ old_flow ] == "y" ) "_OldFlow" else "", |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 93 | "_DelGraph.jpg", |
| 94 | sep="" ) |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 95 | |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 96 | postChartTitle <- paste( "Single Bench Flow Latency - Post\n", |
| 97 | "Last 3 Builds", |
| 98 | if( args[ old_flow ] == "y" ) " With Old Flow" else "", |
| 99 | sep = "" ) |
| 100 | delChartTitle <- paste( "Single Bench Flow Latency - Del\n", |
| 101 | "Last 3 Builds", |
| 102 | if( args[ old_flow ] == "y" ) " With Old Flow" else "", |
| 103 | sep = "" ) |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 104 | |
| 105 | # ------------------ |
| 106 | # SQL Initialization |
| 107 | # ------------------ |
| 108 | |
| 109 | print( "Initializing SQL" ) |
| 110 | |
| 111 | con <- dbConnect( dbDriver( "PostgreSQL" ), |
| 112 | dbname = "onostest", |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 113 | host = args[ database_host ], |
| 114 | port = strtoi( args[ database_port ] ), |
| 115 | user = args[ database_u_id ], |
| 116 | password = args[ database_pw ] ) |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 117 | |
| 118 | # --------------------------- |
| 119 | # Batch Flow Resp SQL Command |
| 120 | # --------------------------- |
| 121 | |
| 122 | print( "Generating Batch Flow Resp SQL Command" ) |
| 123 | |
| 124 | command <- paste( "SELECT * FROM batch_flow_tests WHERE branch='", |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 125 | args[ branch_name ], |
| 126 | "' AND " , |
| 127 | ( if( args[ old_flow ] == 'y' ) "" else "NOT " ) , |
| 128 | "is_old_flow", |
| 129 | " ORDER BY date DESC LIMIT 3", |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 130 | sep="" ) |
| 131 | |
| 132 | print( "Sending SQL command:" ) |
| 133 | print( command ) |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 134 | |
| 135 | fileData <- dbGetQuery( con, command ) |
| 136 | |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 137 | |
| 138 | # ********************************************************** |
| 139 | # STEP 2: Organize data. |
| 140 | # ********************************************************** |
| 141 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 142 | print( "**********************************************************" ) |
| 143 | print( "STEP 2: Organize Data." ) |
| 144 | print( "**********************************************************" ) |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 145 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 146 | # ----------------- |
| 147 | # Post Data Sorting |
| 148 | # ----------------- |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 149 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 150 | print( "Sorting data for Post." ) |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 151 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 152 | postAvgs <- c( fileData[ 'posttoconfrm' ], |
| 153 | fileData[ 'elapsepost' ] ) |
| 154 | |
| 155 | # ------------------------- |
| 156 | # Post Construct Data Frame |
| 157 | # ------------------------- |
| 158 | |
| 159 | postDataFrame <- melt( postAvgs ) |
| 160 | postDataFrame$scale <- fileData$scale |
| 161 | postDataFrame$date <- fileData$date |
| 162 | postDataFrame$iterative <- rev( seq( 1, nrow( fileData ), by = 1 ) ) |
| 163 | |
| 164 | colnames( postDataFrame ) <- c( "ms", |
| 165 | "type", |
| 166 | "scale", |
| 167 | "date", |
| 168 | "iterative" ) |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 169 | |
| 170 | # Format data frame so that the data is in the same order as it appeared in the file. |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 171 | postDataFrame$type <- as.character( postDataFrame$type ) |
| 172 | postDataFrame$type <- factor( postDataFrame$type, |
| 173 | levels = unique( postDataFrame$type ) ) |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 174 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 175 | postDataFrame <- na.omit( postDataFrame ) # Omit any data that doesn't exist |
Jeremy Ronquillo | 2d2649d | 2017-09-14 12:53:06 -0700 | [diff] [blame] | 176 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 177 | print( "Post Data Frame Results:" ) |
| 178 | print( postDataFrame ) |
| 179 | |
| 180 | # ---------------- |
| 181 | # Del Data Sorting |
| 182 | # ---------------- |
| 183 | |
| 184 | print( "Sorting data for Del." ) |
| 185 | avgs <- c( fileData[ 'deltoconfrm' ], |
| 186 | fileData[ 'elapsedel' ] ) |
| 187 | |
| 188 | # ------------------------ |
| 189 | # Del Construct Data Frame |
| 190 | # ------------------------ |
| 191 | |
| 192 | delDataFrame <- melt( avgs ) |
| 193 | delDataFrame$scale <- fileData$scale |
| 194 | delDataFrame$date <- fileData$date |
| 195 | delDataFrame$iterative <- rev( seq( 1, nrow( fileData ), by = 1 ) ) |
| 196 | |
| 197 | colnames( delDataFrame ) <- c( "ms", |
| 198 | "type", |
| 199 | "scale", |
| 200 | "date", |
| 201 | "iterative" ) |
| 202 | |
| 203 | # Format data frame so that the data is in the same order as it appeared in the file. |
| 204 | delDataFrame$type <- as.character( delDataFrame$type ) |
| 205 | delDataFrame$type <- factor( delDataFrame$type, |
| 206 | levels = unique( delDataFrame$type ) ) |
| 207 | |
| 208 | delDataFrame <- na.omit( delDataFrame ) # Omit any data that doesn't exist |
| 209 | |
| 210 | print( "Del Data Frame Results:" ) |
| 211 | print( delDataFrame ) |
Jeremy Ronquillo | 2d2649d | 2017-09-14 12:53:06 -0700 | [diff] [blame] | 212 | |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 213 | # ********************************************************** |
| 214 | # STEP 3: Generate graphs. |
| 215 | # ********************************************************** |
| 216 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 217 | print( "**********************************************************" ) |
| 218 | print( "STEP 3: Generate Graph." ) |
| 219 | print( "**********************************************************" ) |
| 220 | |
| 221 | # ------------------------------------------ |
| 222 | # Initializing variables used in both graphs |
| 223 | # ------------------------------------------ |
| 224 | |
| 225 | print( "Initializing variables used in both graphs." ) |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 226 | |
Jeremy Ronquillo | 0e27b91 | 2017-10-21 14:34:24 -0700 | [diff] [blame] | 227 | theme_set( theme_grey( base_size = 22 ) ) # set the default text size of the graph. |
Jeremy Ronquillo | b626884 | 2017-10-03 13:02:58 -0700 | [diff] [blame] | 228 | xLabel <- xlab( "Build Date" ) |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 229 | yLabel <- ylab( "Latency (ms)" ) |
| 230 | fillLabel <- labs( fill="Type" ) |
Jeremy Ronquillo | 0e27b91 | 2017-10-21 14:34:24 -0700 | [diff] [blame] | 231 | colors <- scale_fill_manual( values=c( "#F77670", "#619DFA" ) ) |
| 232 | wrapLegend <- guides( fill=guide_legend( nrow=1, byrow=TRUE ) ) |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 233 | barWidth <- 0.3 |
| 234 | imageWidth <- 15 |
| 235 | imageHeight <- 10 |
| 236 | imageDPI <- 200 |
| 237 | |
| 238 | theme <- theme( plot.title = element_text( hjust = 0.5, size = 32, face = 'bold' ), |
| 239 | legend.position = "bottom", |
| 240 | legend.text = element_text( size = 22 ), |
| 241 | legend.title = element_blank(), |
| 242 | legend.key.size = unit( 1.5, 'lines' ) ) |
| 243 | |
| 244 | barGraphFormat <- geom_bar( stat = "identity", |
| 245 | width = barWidth ) |
| 246 | |
| 247 | # ----------------------- |
| 248 | # Post Generate Main Plot |
| 249 | # ----------------------- |
| 250 | |
| 251 | print( "Creating main plot for Post graph." ) |
| 252 | |
| 253 | mainPlot <- ggplot( data = postDataFrame, aes( x = iterative, |
| 254 | y = ms, |
| 255 | fill = type ) ) |
| 256 | |
| 257 | # ----------------------------------- |
| 258 | # Post Fundamental Variables Assigned |
| 259 | # ----------------------------------- |
| 260 | |
| 261 | print( "Generating fundamental graph data for Post graph." ) |
| 262 | |
| 263 | xScaleConfig <- scale_x_continuous( breaks = postDataFrame$iterative, |
| 264 | label = postDataFrame$date ) |
| 265 | title <- ggtitle( postChartTitle ) |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 266 | |
| 267 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 268 | fundamentalGraphData <- mainPlot + |
| 269 | xScaleConfig + |
| 270 | xLabel + |
| 271 | yLabel + |
| 272 | fillLabel + |
| 273 | theme + |
| 274 | wrapLegend + |
| 275 | colors + |
| 276 | title |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 277 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 278 | # -------------------------------- |
| 279 | # Post Generating Bar Graph Format |
| 280 | # -------------------------------- |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 281 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 282 | print( "Generating bar graph for Post graph." ) |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 283 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 284 | sum <- fileData[ 'posttoconfrm' ] + |
| 285 | fileData[ 'elapsepost' ] |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 286 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 287 | values <- geom_text( aes( x = postDataFrame$iterative, |
| 288 | y = sum + 0.03 * max( sum ), |
| 289 | label = format( sum, |
| 290 | digits = 3, |
| 291 | big.mark = ",", |
| 292 | scientific = FALSE ) ), |
| 293 | size = 7.0, |
| 294 | fontface = "bold" ) |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 295 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 296 | result <- fundamentalGraphData + |
| 297 | barGraphFormat + |
| 298 | values |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 299 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 300 | # ---------------------------- |
| 301 | # Post Exporting Graph to File |
| 302 | # ---------------------------- |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 303 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 304 | print( paste( "Saving Post bar chart to", postOutputFile ) ) |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 305 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 306 | ggsave( postOutputFile, |
| 307 | width = imageWidth, |
| 308 | height = imageHeight, |
| 309 | dpi = imageDPI ) |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 310 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 311 | print( paste( "[SUCCESS] Successfully wrote stacked bar chart out to", postOutputFile ) ) |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 312 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 313 | # ---------------------- |
| 314 | # Del Generate Main Plot |
| 315 | # ---------------------- |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 316 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 317 | print( "Creating main plot for Del graph." ) |
Jeremy Ronquillo | 2d2649d | 2017-09-14 12:53:06 -0700 | [diff] [blame] | 318 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 319 | mainPlot <- ggplot( data = delDataFrame, aes( x = iterative, |
| 320 | y = ms, |
| 321 | fill = type ) ) |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 322 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 323 | # ---------------------------------- |
| 324 | # Del Fundamental Variables Assigned |
| 325 | # ---------------------------------- |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 326 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 327 | print( "Generating fundamental graph data for Del graph." ) |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 328 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 329 | xScaleConfig <- scale_x_continuous( breaks = delDataFrame$iterative, |
| 330 | label = delDataFrame$date ) |
| 331 | title <- ggtitle( delChartTitle ) |
Jeremy Ronquillo | 2d2649d | 2017-09-14 12:53:06 -0700 | [diff] [blame] | 332 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 333 | fundamentalGraphData <- mainPlot + |
| 334 | xScaleConfig + |
| 335 | xLabel + |
| 336 | yLabel + |
| 337 | fillLabel + |
| 338 | theme + |
| 339 | wrapLegend + |
| 340 | colors + |
| 341 | title |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 342 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 343 | # ------------------------------- |
| 344 | # Del Generating Bar Graph Format |
| 345 | # ------------------------------- |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 346 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 347 | print( "Generating bar graph for Del graph." ) |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 348 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 349 | sum <- fileData[ 'deltoconfrm' ] + |
| 350 | fileData[ 'elapsedel' ] |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 351 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 352 | values <- geom_text( aes( x = delDataFrame$iterative, |
| 353 | y = sum + 0.03 * max( sum ), |
| 354 | label = format( sum, |
| 355 | digits = 3, |
| 356 | big.mark = ",", |
| 357 | scientific = FALSE ) ), |
| 358 | size = 7.0, |
| 359 | fontface = "bold" ) |
Jeremy Ronquillo | 6df8781 | 2017-08-28 16:17:36 +0000 | [diff] [blame] | 360 | |
Jeremy Ronquillo | 7673f80 | 2017-10-30 09:42:44 -0700 | [diff] [blame] | 361 | result <- fundamentalGraphData + |
| 362 | barGraphFormat + |
| 363 | title + |
| 364 | values |
| 365 | |
| 366 | # --------------------------- |
| 367 | # Del Exporting Graph to File |
| 368 | # --------------------------- |
| 369 | |
| 370 | print( paste( "Saving Del bar chart to", delOutputFile ) ) |
| 371 | |
| 372 | ggsave( delOutputFile, |
| 373 | width = imageWidth, |
| 374 | height = imageHeight, |
| 375 | dpi = imageDPI ) |
| 376 | |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 377 | print( paste( "[SUCCESS] Successfully wrote stacked bar chart out to", delOutputFile ) ) |