/usr/bin/pj_gantt is in pajeng 1.3.4-3build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | #!/usr/bin/Rscript
# This file is part of PajeNG
#
# PajeNG is free software: you can redistribute it and/or modify it
# under the terms of the GNU Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# PajeNG is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Public License for more details.
#
# You should have received a copy of the GNU Public License
# along with PajeNG. If not, see <http://www.gnu.org/licenses/>.
args = commandArgs(trailingOnly=TRUE)
if (length(args) < 1) {
stop("Usage: pj_gantt <FILE_states.csv> <state_type> [START_TIME] [END_TIME]", call.=FALSE)
}
#
# parse arguments
#
inputFilename = args[1];
stateType = args[2];
#
# Function to read states from a file
#
read_paje_trace <- function(file) {
df <- read.csv(file, header=FALSE, strip.white=TRUE)
names(df) <- c("Nature","ResourceId","Type","Start","End","Duration", "Depth", "Value")
df$Origin=file
m <- min(df$Start)
df$Start <- df$Start - m
df$End <- df$Start+df$Duration
df$Origin <- NULL
df$Nature <- NULL
df$Depth <- NULL
df
}
# read trace file
df <- read_paje_trace (inputFilename);
# make the trace selection
timeSelection = FALSE;
if (length(args) >= 3) {
timeSelection = TRUE;
startTime = as.double(args[3]);
}else{
startTime = 0;
}
if (length(args) >= 4) {
timeSelection = TRUE;
endTime = as.double(args[4]);
}else{
endTime = max(df$End);
}
if (timeSelection){
df <- df[df$Start >= startTime & df$End <= endTime,];
}
df <- df[df$Type == stateType,];
# get rid of durations == 0
df <- df[df$Duration != 0,];
# prepare name of output file
outputFile = paste (inputFilename, "-", stateType, "-", startTime, "-", endTime, ".pdf", sep="");
pdf(outputFile);
library(ggplot2);
p <- ggplot(df, aes(x=Start,xend=End, y=factor(ResourceId),yend=factor(ResourceId), color=Value)) + theme_bw() + geom_segment(size=4);
print(p);
dev.off();
print(outputFile);
|