[chronojump] Fixed 77 on server graphs
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Fixed 77 on server graphs
- Date: Mon, 8 Mar 2010 06:46:59 +0000 (UTC)
commit c4efb6118bec7d4aebc176b68fed168723f6059d
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon Mar 8 14:46:26 2010 +0800
Fixed 77 on server graphs
chronojump_server/r-sqlite/evaluators.R | 20 ++++++++++++++++++++
.../r-sqlite/heights_by_jumps_boxplot.R | 7 +++----
chronojump_server/r-sqlite/persons.R | 5 ++---
.../r-sqlite/tv_by_level_sex_jumptype.R | 18 +++++++++---------
4 files changed, 34 insertions(+), 16 deletions(-)
---
diff --git a/chronojump_server/r-sqlite/evaluators.R b/chronojump_server/r-sqlite/evaluators.R
new file mode 100644
index 0000000..d08d7b3
--- /dev/null
+++ b/chronojump_server/r-sqlite/evaluators.R
@@ -0,0 +1,20 @@
+library(GDD)
+GDD(file="/var/www/web/server/images/evaluators.png", type="png", w=670, h=670)
+library(RSQLite)
+drv = dbDriver("SQLite")
+file = "/root/.local/share/Chronojump/database/chronojump_server.db"
+con = dbConnect(drv, file)
+
+jumps <- dbGetQuery(con, "SELECT COUNT(jump.uniqueID) AS conta, SEvaluator.name AS names FROM jump, SEvaluator, session WHERE jump.sessionID=session.uniqueID AND session.evaluatorID=Sevaluator.uniqueID GROUP BY SEvaluator.name ORDER BY SEvaluator.name;")
+
+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;")
+
+colors=c(topo.colors(8)[3],topo.colors(8)[6])
+o.j.d <- order(jumps$conta, decreasing=T)
+
+barplot(rbind(jumps$conta[o.j.d], persons$conta[o.j.d]), beside=T, legend=c("Jumps","Persons"), names=jumps$names[o.j.d], col=colors)
+
+title(main="Jumps and persons count by evaluator",
+ sub=paste(Sys.Date(),"(YYYY-MM-DD)"), cex.sub = 0.75, font.sub = 3, col.sub = "red")
+
+dev.off()
diff --git a/chronojump_server/r-sqlite/heights_by_jumps_boxplot.R b/chronojump_server/r-sqlite/heights_by_jumps_boxplot.R
index 1ad89fd..92c7171 100644
--- a/chronojump_server/r-sqlite/heights_by_jumps_boxplot.R
+++ b/chronojump_server/r-sqlite/heights_by_jumps_boxplot.R
@@ -1,12 +1,12 @@
library(GDD)
-GDD(file="/var/www/web/server/images/heights_by_jumps_boxplot.png",
+GDD(file="/var/www/web/server/images/heights_by_jumps_boxplot.png",
width = 670, height= 670, ps = 12, type="png")
library(RSQLite)
drv <- dbDriver("SQLite")
file = "/root/.local/share/Chronojump/database/chronojump_server.db"
con <- dbConnect(drv, file)
-jumps <- dbGetQuery(con, "select person.sex, jump.* from person, jump where person.uniqueID == jump.personID")
+jumps <- dbGetQuery(con, "SELECT person77.sex, jump.* FROM person77, jump WHERE person77.uniqueID == jump.personID")
jumpsM <- subset(jumps, jumps$sex=="M")
jumpsF <- subset(jumps, jumps$sex=="F")
@@ -18,7 +18,7 @@ text(1:ntypes, .4, paste("n=",format(bp$n),sep=""), xpd = TRUE, col = "grey20",
title(main="Heights by jumps in males")
ntypes <- length(levels(as.factor (jumpsF$type)))
-bp=boxplot(jumpsF$tv ~ jumpsF$type, las=2, col=cm.colors(ntypes))
+bp=boxplot(jumpsF$tv ~ jumpsF$type, las=2, col=topo.colors(ntypes))
text(1:ntypes, .4, paste("n=",format(bp$n),sep=""), xpd = TRUE, col = "grey20", cex=0.8)
title(main="Heights by jumps in females",
sub=paste(Sys.Date(),"(YYYY-MM-DD)"), cex.sub = 0.75, font.sub = 3, col.sub = "red")
@@ -27,4 +27,3 @@ par(mfrow=c(1,1))
dev.off()
-
diff --git a/chronojump_server/r-sqlite/persons.R b/chronojump_server/r-sqlite/persons.R
index ca06c4b..946af48 100644
--- a/chronojump_server/r-sqlite/persons.R
+++ b/chronojump_server/r-sqlite/persons.R
@@ -8,7 +8,7 @@ con = dbConnect(drv, file)
def.par <- par(no.readonly = TRUE) # save default, for resetting...
-persons <- dbGetQuery(con, "select sport.name as sport, speciallity.name as speciallity, country.name as country, person.sex as sex, person.practice as level from person, country, sport, speciallity where person.countryID = country.uniqueID and person.sportID == sport.uniqueID and person.speciallityID=speciallity.uniqueID")
+persons <- dbGetQuery(con, "SELECT sport.name AS sport, speciallity.name AS speciallity, country.name AS country, person77.sex AS sex, personSession77.practice AS level FROM person77, personSession77, country, sport, speciallity WHERE person77.uniqueID=personSession77.personID AND person77.countryID = country.uniqueID AND personSession77.sportID == sport.uniqueID AND personSession77.speciallityID=speciallity.uniqueID GROUP BY personID")
persons$sportF<-factor(persons$sport)
#persons$speciallityF<-factor(persons$speciallity)
@@ -27,7 +27,7 @@ dotchart(table(persons$sportF)[order (table(persons$sportF))], labels=levels(per
dotchart(table(persons$countryF)[order (table(persons$countryF))], labels=levels(persons$countryF)[order (table(persons$countryF))], main="Country")
-pie(table(persons$sexF), labels=levels(persons$sexF), main="Sex",
+pie(table(persons$sexF), labels=levels(persons$sexF), main="Sex",
col=rainbow(length(levels(persons$sexF))))
levels(persons$levelF)=c("Sedentary", "Regular practice", "Competition", "Elite") #undefined is impossible on server
@@ -44,4 +44,3 @@ title(main="Persons data in server",
dev.off()
-
diff --git a/chronojump_server/r-sqlite/tv_by_level_sex_jumptype.R b/chronojump_server/r-sqlite/tv_by_level_sex_jumptype.R
index a9071d0..e79f8c6 100644
--- a/chronojump_server/r-sqlite/tv_by_level_sex_jumptype.R
+++ b/chronojump_server/r-sqlite/tv_by_level_sex_jumptype.R
@@ -5,33 +5,33 @@ drv = dbDriver("SQLite")
file = "/root/.local/share/Chronojump/database/chronojump_server.db"
con = dbConnect(drv, file)
-jumps <- dbGetQuery(con, "select person.sex as sex, person.practice as level, jump.* from person, jump where level>=0 and simulated>=0 and person.uniqueID == jump.personID")
+jumps <- dbGetQuery(con, "SELECT person77.sex AS sex, personSession77.practice AS level, jump.* from person77, personSession77, jump WHERE person77.uniqueID == personSession77.personID AND level>=0 AND simulated>=0 AND person77.uniqueID == jump.personID")
jumps$sexF <- factor(jumps$sex, levels=c('M','F'), ordered=TRUE)
jumps$typeF <- factor(jumps$type)
library(car)
-jumps$sexNum <- recode(jumps$sexF, '"M" = .1; "F" = -.1; ',
+jumps$sexNum <- recode(jumps$sexF, '"M" = .1; "F" = -.1; ',
as.factor.result=FALSE)
-
+
library(lattice)
cols=c(topo.colors(4)[1], topo.colors(4)[2])
par(pch=19, col=cols, cex.sub=0.75, font.sub=3, col.sub="red")
- xyplot(tv ~ (level+sexNum) | typeF, groups=sexF,
- #simpleTheme don't work in R 2.7.1
+ xyplot(tv ~ (level+sexNum) | typeF, groups=sexF,
+ #simpleTheme don't work in R 2.7.1
#par.settings = simpleTheme(pch=19,col=cols),
- scales=list(x=list(tick.number=3, relation='same'),
+ scales=list(x=list(tick.number=3, relation='same'),
y=list(relation='same')),
xlab="level",
pch=19, col=cols,
auto.key=list(border=FALSE, text=c("Males", "Females"), col=cols, points = FALSE),
#title="TV by level, sex and jump type", sub="hola"),
- main="TV by level, sex and jump type",
+ main="TV by level, sex and jump type",
sub=paste(Sys.Date(),"(YYYY-MM-DD)"), cex.sub = 0.75, font.sub = 3, col.sub = "red",
- #key=list(title(main="TV by level, sex and jump type",
+ #key=list(title(main="TV by level, sex and jump type",
# sub=paste(Sys.Date(),"(YYYY-MM-DD)"), cex.sub = 0.75, font.sub = 3, col.sub = "red")),
data=jumps)
-
+
dev.off()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]