Skip to content

Commit a026b9b

Browse files
committed
Map text if no data reduction occurred
1 parent c00b5b8 commit a026b9b

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

R/trace_generation.R

+10-8
Original file line numberDiff line numberDiff line change
@@ -579,18 +579,20 @@ geom2trace <- list(
579579
# Convert days into milliseconds
580580
x <- as.numeric(x) * 24 * 60 * 60 * 1000
581581
}
582-
# if there is more than one y-value for a particular combination of
582+
# if there is more than one y-value for a particular combination of
583583
# x, PANEL, and group; then take the _max_ y.
584584
data$x <- x
585-
dat <- plyr::ddply(data, c("x", "PANEL", if("group"%in%names(data))"group"),
585+
dat <- plyr::ddply(data, c("x", "PANEL", if ("group" %in% names(data)) "group"),
586586
plyr::summarise, count = max(y))
587-
L <- list(x=dat$x,
588-
y=dat$count,
589-
type="bar",
590-
name=params$name,
591-
marker=list(color=toRGB(params$fill)))
587+
L <- list(x = dat$x,
588+
y = dat$count,
589+
type = "bar",
590+
# text only makes sense if no dimension reduction occurred
591+
text = if (nrow(dat) == nrow(data)) data$text else NULL,
592+
name = params$name,
593+
marker = list(color=toRGB(params$fill)))
592594
if (!is.null(params$colour)) {
593-
L$marker$line <- list(color=toRGB(params$colour))
595+
L$marker$line <- list(color = toRGB(params$colour))
594596
L$marker$line$width <- if (is.null(params$size)) 1 else params$size
595597
}
596598
if (!is.null(params$alpha)) L$opacity <- params$alpha

0 commit comments

Comments
 (0)