[chronojump] Added timeline on evaluators server graph



commit 6114c15944941f5a0083224903dd4615d5596fda
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Aug 29 23:00:47 2011 +0200

    Added timeline on evaluators server graph

 chronojump_server/r-sqlite/evaluators.R |   42 +++++++++++++++++++++++++------
 1 files changed, 34 insertions(+), 8 deletions(-)
---
diff --git a/chronojump_server/r-sqlite/evaluators.R b/chronojump_server/r-sqlite/evaluators.R
index 1ae41a7..e5bcce5 100644
--- a/chronojump_server/r-sqlite/evaluators.R
+++ b/chronojump_server/r-sqlite/evaluators.R
@@ -1,8 +1,14 @@
-library(GDD)
-GDD(file="/var/www/web/server/images/evaluators.png", type="png", w=670, h=670)
+#server
+#library(GDD)
+#GDD(file="/var/www/web/server/images/evaluators.png", type="png", w=670, h=670)
+#file = "/root/.local/share/Chronojump/database/chronojump_server.db"
+
+#local
+pdf(file="evaluators.pdf", width=7, height=7)
+file = "/home/xavier/.local/share/Chronojump/database/chronojump_server_2011-07-26.db"
+
 library(RSQLite)
 drv = dbDriver("SQLite")
-file = "/root/.local/share/Chronojump/database/chronojump_server.db"
 con = dbConnect(drv, file)
 
 persons <- dbGetQuery(con, "SELECT COUNT(DISTINCT(person77.uniqueID)) AS conta, SEvaluator.name AS names FROM person77, SEvaluator, session, personSession77 WHERE person77.uniqueID=personSession77.personID AND session.uniqueID=personSession77.sessionID AND session.evaluatorID=Sevaluator.uniqueID GROUP BY SEvaluator.name ORDER BY SEvaluator.name DESC;")
@@ -21,8 +27,6 @@ pulses <- dbGetQuery(con, "SELECT COUNT(pulse.uniqueID) AS conta, SEvaluator.nam
 
 #multichronopic <- dbGetQuery(con, "SELECT COUNT(multichronopic.uniqueID) AS conta, SEvaluator.name AS names FROM multichronopic, SEvaluator, session WHERE multichronopic.sessionID=session.uniqueID AND session.evaluatorID=Sevaluator.uniqueID GROUP BY SEvaluator.name ORDER BY SEvaluator.name;")
 
-par(oma=c(1,7,1,1))
-
 #a <- merge(persons, jumps, by="names", all.x=T)
 #colnames(a)=c("names", "persons", "jumps")
 #a <- merge(a, jumpsRj, by="names", all.x=T)
@@ -83,11 +87,33 @@ rownames(b)=a$names
 #graph
 cex=.8
 #change colors to 8 when add runs and multichronopic
-colors=6
-barplot(t(b), horiz=T, las=2, col=topo.colors(colors), cex.names=cex)
-legend("bottomright", colnames(b), pch=15, col=topo.colors(colors))
+colors=topo.colors(6)
+
+par(mar=c(5,4,5.5,2), oma=c(1,7,1,1))
+
+barplot(t(b), horiz=T, las=2, col=colors, cex.names=cex,axes=F)
+axis(3, cex.axis=.8)
+legend("right", colnames(b), pch=15, col=colors, cex=.8)
 
 title(main="Data uploaded by evaluator",
   sub=paste(Sys.Date(),"(YYYY-MM-DD)"), cex.sub = 0.75, font.sub = 3, col.sub = "red")
 
+par(new=TRUE)
+par(mar=c(5.2,12,20,2))
+
+persons <- dbGetQuery(con, "SELECT session.uploadedDate AS date, count(personSession77.uniqueID) AS conta FROM session,personSession77 WHERE personSession77.sessionID == session.UniqueID AND session.uploadedDate != '2007-07-30' GROUP BY date;")
+jumps <- dbGetQuery(con, "SELECT session.uploadedDate AS date, count(jump.uniqueID) AS conta FROM session,jump WHERE jump.sessionID == session.UniqueID AND session.uploadedDate != '2007-07-30' GROUP BY date;")
+jumpsRj <- dbGetQuery(con, "SELECT session.uploadedDate AS date, count(jumpRj.uniqueID) AS conta FROM session,jumpRj WHERE jumpRj.sessionID == session.UniqueID AND session.uploadedDate != '2007-07-30' GROUP BY date;")
+dates = c(as.Date(persons$date),as.Date(jumps$date),as.Date(jumpsRj$date))
+minx=min(dates)
+maxx=max(dates)
+maxy=max(c(sum(persons$conta),sum(jumps$conta),sum(jumpsRj$conta)))
+
+plot(as.Date(persons$date), cumsum(persons$conta), type='s', lwd=2, col=colors[1], xlim=c(minx,maxx), ylim=c(0,maxy), ylab="", cex.axis=.8, las=T)
+abline(v=seq(as.Date("2009/1/1"), as.Date("2020/1/1"), by="3 months"),lty=3)
+par(new=TRUE)
+plot(as.Date(jumps$date), cumsum(jumps$conta), type='s', lwd=2, col=colors[2], xlim=c(minx,maxx), ylim=c(0,maxy), ylab="", axes=F)
+par(new=TRUE)
+plot(as.Date(jumpsRj$date), cumsum(jumpsRj$conta), type='s', lwd=2, col=colors[3], xlim=c(minx,maxx), ylim=c(0,maxy), ylab="", axes=F)
+
 dev.off()



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