[chronojump] encoder cross variables with units



commit 59759b76039c60c4cd5edbc8336eaa4910f4a6ae
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Apr 1 14:57:46 2013 +0200

    encoder cross variables with units

 encoder/graph.R |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index b3320a6..9bc033e 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -832,6 +832,19 @@ findPosInPaf <- function(var, option) {
        return(pos)
 }
 
+addUnits <- function (var) {
+       if(var == "Speed")
+               return ("Speed (m/s)")
+       else if(var == "Power")
+               return ("Power (W)")
+       else if(var == "Load") #or Mass
+               return ("Load (Kg)")
+       else if(var == "Force")
+               return ("Force (N)")
+
+       return(var)
+}
+
 #option: mean or max
 paintCrossVariables <- function (paf, varX, varY, option, isAlone, title, singleFile, Eccon, seriesName) {
        x = (paf[,findPosInPaf(varX, option)])
@@ -843,6 +856,9 @@ paintCrossVariables <- function (paf, varX, varY, option, isAlone, title, single
        colBalls = NULL
        bgBalls = NULL
 
+       varX = addUnits(varX)
+       varY = addUnits(varY)
+
        #if only one series
        if(length(unique(seriesName)) == 1) {
                myNums = rownames(paf)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]