iSEE / iSEE

Compare c9a4b48 ... +0 ... e3a3ffa

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.


@@ -35,6 +35,7 @@
Loading
35 35
#' Defaults to 100.}
36 36
#' \item{\code{RowTable.select.details}}{A function that takes a string containing the name of a feature (i.e., the current selection in the \linkS4class{RowTable}) and returns a HTML element with more details.} 
37 37
#' \item{\code{ColumnTable.select.details}}{A function that takes a string containing the name of a sample (i.e., the current selection in the \linkS4class{ColumnTable}) and returns a HTML element with more details.}
38 +
#' \item{\code{tooltip.signif}}{Number of \emph{significant} digits to display in the tooltip. Defaults to 6.}
38 39
#' }
39 40
#'
40 41
#' The registered options are stored in the SummarizedExperiment to ensure that we can recover the application state with the combination of the SummarizedExperiment and list of Panel settings.

@@ -0,0 +1,50 @@
Loading
1 +
#' Generate Text in Tooltip
2 +
#'
3 +
#' @param name Identifier of the data point.
4 +
#' Typically, from the \code{rownames} or \code{colnames}.
5 +
#' @param fields Named list of fields to include in the tooltip text.
6 +
#' See \emph{Details}.
7 +
#' @param value Scalar representing one value in \code{fields}.
8 +
#' 
9 +
#' @details 
10 +
#' Every item in the argument \code{fields} is added as a separate line in the tooltip.
11 +
#' The line is formatted as \dQuote{\bold{name:} value}.
12 +
#'
13 +
#' @return 
14 +
#' \code{.generate_tooltip_html} returns an \code{\link{HTML}} element
15 +
#' that will be displayed in the tooltip.
16 +
#' 
17 +
#' \code{.process_tooltip_field} converts individual fields to a character
18 +
#' representation suitable for display. For instance, this may include trimming
19 +
#' double-precision scalars to a set number of significant digits.
20 +
#'
21 +
#' @author Kevin Rue-Albrecht
22 +
#'
23 +
#' @rdname INTERNAL_generate_tooltip_html
24 +
.generate_tooltip_html <- function(name, fields) {
25 +
    fields <- sapply(fields, function(x) .process_tooltip_field(x), USE.NAMES = TRUE)
26 +
    HTML(
27 +
        paste0(c(
28 +
            sprintf("<strong>%s</strong>", name),
29 +
            sprintf("%s: <i>%s</i>", names(fields), fields)
30 +
            ), collapse = "<br />")
31 +
        )
32 +
}
33 +
34 +
#' @rdname INTERNAL_generate_tooltip_html
35 +
.process_tooltip_field <- function(value) {
36 +
    original <- value
37 +
    if (is.double(value)) {
38 +
        value <- signif(value, digits = getAppOption("tooltip.signif", default = 6))
39 +
        value <- ifelse(
40 +
            identical(value, original),
41 +
            as.character(value),
42 +
            paste0(as.character(value), "(...)")
43 +
            )
44 +
    } else if (is.factor(value)) {
45 +
        value <- as.character(value)
46 +
    } else {
47 +
        value <- as.character(value)
48 +
    }
49 +
    value
50 +
}

@@ -600,15 +600,9 @@
Loading
600 600
601 601
setMethod(".getTooltipUI", "RowDotPlot", function(x, se, name) {
602 602
    if (length(x[[.tooltipRowData]]) > 0) {
603 -
        # as.data.frame sometimes needed to fix names of items in vector
604 -
        info <- as.data.frame(rowData(se)[name, x[[.tooltipRowData]], drop=FALSE])
605 -
        info <- sapply(info, function(x) as.character(x))
606 -
        ui <- HTML(
607 -
            paste0(c(
608 -
                sprintf("<strong>%s</strong>", name),
609 -
                sprintf("%s: %s", names(info), info)
610 -
                ), collapse = "<br />")
611 -
            )
603 +
        # as.data.frame sometimes needed before as.list to fix names of items in vector
604 +
        info <- as.list(as.data.frame(rowData(se)[name, x[[.tooltipRowData]], drop=FALSE]))
605 +
        ui <- .generate_tooltip_html(name, info)
612 606
        ui
613 607
    } else {
614 608
        name

@@ -603,15 +603,9 @@
Loading
603 603
604 604
setMethod(".getTooltipUI", "ColumnDotPlot", function(x, se, name) {
605 605
    if (length(x[[.tooltipColData]]) > 0) {
606 -
        # as.data.frame sometimes needed to fix names of items in vector
607 -
        info <- as.data.frame(colData(se)[name, x[[.tooltipColData]], drop=FALSE])
608 -
        info <- sapply(info, function(x) as.character(x))
609 -
        ui <- HTML(
610 -
            paste0(c(
611 -
                sprintf("<strong>%s</strong>", name),
612 -
                sprintf("%s: %s", names(info), info)
613 -
                ), collapse = "<br />")
614 -
            )
606 +
        # as.data.frame sometimes needed before as.list to fix names of items in vector
607 +
        info <- as.list(as.data.frame(colData(se)[name, x[[.tooltipColData]], drop=FALSE]))
608 +
        ui <- .generate_tooltip_html(name, info)
615 609
        ui
616 610
    } else {
617 611
        name

Learn more Showing 1 files with coverage changes found.

New file R/utils_tooltip.R
New
Loading file...
Files Coverage
R 0.01% 89.56%
Project Totals (70 files) 89.56%
Loading