Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
Package: rhtmlHeatmap
Type: Package
Title: An improved heatmap package based on d3heatmap
Version: 1.0.3
Version: 1.0.4
Author: Displayr <opensource@displayr.com>
Maintainer: Displayr <opensource@displayr.com>
Description: An improved heatmap package based on d3heatmap.
License: GPL-3 + file LICENSE
Encoding: UTF-8
LazyData: TRUE
Imports:
png,
base64enc,
dendextend,
htmlwidgets,
grDevices,
scales,
stats
Remotes:
Displayr/htmlwidgets
RoxygenNote: 7.1.1
RoxygenNote: 7.3.3
20 changes: 10 additions & 10 deletions R/rhtmlHeatmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ NULL
#' @param distfun function used to compute the distance (dissimilarity) between both rows and columns. Defaults to dist.
#' @param hclustfun function used to compute the hierarchical clustering when Rowv or Colv are not dendrograms. Defaults to hclust.
#' @param dendrogram character string indicating whether to draw 'none', 'row', 'column' or 'both' dendrograms. Defaults to 'both'. However, if Rowv (or Colv) is FALSE or NULL and dendrogram is 'both', then a warning is issued and Rowv (or Colv) arguments are honoured.
#' @param reorderfun function(d, w) of dendrogram and weights for reordering the row and column dendrograms. The default uses stats{reorder.dendrogram}
#' @param reorderfun function(d, w) of dendrogram and weights for reordering the row and column dendrograms. The default uses \code{\link[stats]{reorder.dendrogram}}
#'
#' @param k_row an integer scalar with the desired number of groups by which to color the dendrogram's branches in the rows (uses \link[dendextend]{color_branches})
#' @param k_col an integer scalar with the desired number of groups by which to color the dendrogram's branches in the columns (uses \link[dendextend]{color_branches})
Expand Down Expand Up @@ -104,11 +104,11 @@ NULL
#' @param footer_font_family character. Font family of the chart footer_font_family, defaults to "sans-serif".
#' @param footer_font_color An RGB character to set the color of the chart footer_font_color. Defaults to "#000000".
#'
#' @param column_label_orientation. Enum ['horizontal', 'vertical', 'diagonal']. Defaults to 'diagonal'.
#' @param column_label_max_height. Max height used by column labels (xaxis and column subtitles). Specified as proportion of total height. Defaults to 0.25.
#' @param row_label_max_width. Max width used by row labels (yaxis and column labels). Specified as proportion of total height. Defaults to 0.25.
#' @param heatmap_max_height. Max height used by heatmap grid. Specified as proportion of total height. Defaults to 1.
#' @param heatmap_max_width. Max width used by heatmap grid. Specified as proportion of total width. Defaults to 1.
#' @param column_label_orientation Enum ['horizontal', 'vertical', 'diagonal']. Defaults to 'diagonal'.
#' @param column_label_max_height Max height used by column labels (xaxis and column subtitles). Specified as proportion of total height. Defaults to 0.25.
#' @param row_label_max_width Max width used by row labels (yaxis and column labels). Specified as proportion of total height. Defaults to 0.25.
#' @param heatmap_max_height Max height used by heatmap grid. Specified as proportion of total height. Defaults to 1.
#' @param heatmap_max_width Max width used by heatmap grid. Specified as proportion of total width. Defaults to 1.
#'
#' @param xaxis_hidden Boolean variable to hide x axis. Defaults to FALSE.
#' @param xaxis_location Location of the x axis, c("bottom", "top"). Defaults to "bottom". "top" only works when dendrogram is "none".
Expand Down Expand Up @@ -169,17 +169,17 @@ NULL
#'
#' @export
#' @source
#' The interface was designed based on \link{heatmap} and \link[gplots]{heatmap.2}
#' The interface was designed based on \link{heatmap} and \code{gplots::heatmap.2}
#'
#' @seealso
#' \link{heatmap}, \link[gplots]{heatmap.2}
#' \link{heatmap}, \code{gplots::heatmap.2}
#'
#' @examples
#' library(rhtmlHeatmap)
#' Heatmap(mtcars, scale = "column", colors = "Blues")
#'
#' For more examples see the /examples/examples.R file
#' in the source package
#' # For more examples see the /examples/examples.R file
#' # in the source package
#'
#'
Heatmap <- function(x,
Expand Down
2 changes: 1 addition & 1 deletion inst/htmlwidgets/rhtmlHeatmap.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/htmlwidgets/rhtmlHeatmap.js.map

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions man/Heatmap.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 12 additions & 10 deletions theSrc/R/htmlwidget.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ NULL
#' @param distfun function used to compute the distance (dissimilarity) between both rows and columns. Defaults to dist.
#' @param hclustfun function used to compute the hierarchical clustering when Rowv or Colv are not dendrograms. Defaults to hclust.
#' @param dendrogram character string indicating whether to draw 'none', 'row', 'column' or 'both' dendrograms. Defaults to 'both'. However, if Rowv (or Colv) is FALSE or NULL and dendrogram is 'both', then a warning is issued and Rowv (or Colv) arguments are honoured.
#' @param reorderfun function(d, w) of dendrogram and weights for reordering the row and column dendrograms. The default uses stats{reorder.dendrogram}
#' @param reorderfun function(d, w) of dendrogram and weights for reordering the row and column dendrograms. The default uses \code{\link[stats]{reorder.dendrogram}}
#'
#' @param k_row an integer scalar with the desired number of groups by which to color the dendrogram's branches in the rows (uses \link[dendextend]{color_branches})
#' @param k_col an integer scalar with the desired number of groups by which to color the dendrogram's branches in the columns (uses \link[dendextend]{color_branches})
Expand Down Expand Up @@ -104,11 +104,11 @@ NULL
#' @param footer_font_family character. Font family of the chart footer_font_family, defaults to "sans-serif".
#' @param footer_font_color An RGB character to set the color of the chart footer_font_color. Defaults to "#000000".
#'
#' @param column_label_orientation. Enum ['horizontal', 'vertical', 'diagonal']. Defaults to 'diagonal'.
#' @param column_label_max_height. Max height used by column labels (xaxis and column subtitles). Specified as proportion of total height. Defaults to 0.25.
#' @param row_label_max_width. Max width used by row labels (yaxis and column labels). Specified as proportion of total height. Defaults to 0.25.
#' @param heatmap_max_height. Max height used by heatmap grid. Specified as proportion of total height. Defaults to 1.
#' @param heatmap_max_width. Max width used by heatmap grid. Specified as proportion of total width. Defaults to 1.
#' @param column_label_orientation Enum ['horizontal', 'vertical', 'diagonal']. Defaults to 'diagonal'.
#' @param column_label_max_height Max height used by column labels (xaxis and column subtitles). Specified as proportion of total height. Defaults to 0.25.
#' @param row_label_max_width Max width used by row labels (yaxis and column labels). Specified as proportion of total height. Defaults to 0.25.
#' @param heatmap_max_height Max height used by heatmap grid. Specified as proportion of total height. Defaults to 1.
#' @param heatmap_max_width Max width used by heatmap grid. Specified as proportion of total width. Defaults to 1.
#'
#' @param xaxis_hidden Boolean variable to hide x axis. Defaults to FALSE.
#' @param xaxis_location Location of the x axis, c("bottom", "top"). Defaults to "bottom". "top" only works when dendrogram is "none".
Expand Down Expand Up @@ -169,17 +169,17 @@ NULL
#'
#' @export
#' @source
#' The interface was designed based on \link{heatmap} and \link[gplots]{heatmap.2}
#' The interface was designed based on \link{heatmap} and \code{gplots::heatmap.2}
#'
#' @seealso
#' \link{heatmap}, \link[gplots]{heatmap.2}
#' \link{heatmap}, \code{gplots::heatmap.2}
#'
#' @examples
#' library(rhtmlHeatmap)
#' Heatmap(mtcars, scale = "column", colors = "Blues")
#'
#' For more examples see the /examples/examples.R file
#' in the source package
#' # For more examples see the /examples/examples.R file
#' # in the source package
#'
#'
Heatmap <- function(x,
Expand Down Expand Up @@ -318,6 +318,8 @@ Heatmap <- function(x,
...
) {

if (inherits(x, "QTable"))
x <- unclass(x)
## x is a matrix!
##====================
if(!is.matrix(x)) {
Expand Down
10 changes: 5 additions & 5 deletions theSrc/scripts/lib/components/colormap.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,19 +362,19 @@ function makeTipContentGenerator ({ values, rowNames, columnNames, numCols, extr
return (str + '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')
}

const commonStyleWithAlign = `text-align:right;font-size:${fontSize}px;font-family:${fontFamily};color:white`
const commonStyle = `font-size:${fontSize}px;font-family:${fontFamily};color:white`
const commonStyleWithAlign = `text-align:right;font-size:${fontSize}px;font-family:${htmlEscape(fontFamily)};color:white`
const commonStyle = `font-size:${fontSize}px;font-family:${htmlEscape(fontFamily)};color:white`

return (d, i) => {
var rowTitle = yaxisTitle || 'Row'
var colTitle = xaxisTitle || 'Column'
var rowTitle = htmlEscape(yaxisTitle || 'Row')
var colTitle = htmlEscape(xaxisTitle || 'Column')

let extraInfoHtml = ''
if (extraTooltipInfo) {
extraInfoHtml = _.map(extraTooltipInfo, (value, key) => {
return `
<tr>
<th style="${commonStyleWithAlign}">${key}</th>
<th style="${commonStyleWithAlign}">${htmlEscape(key)}</th>
<td style="${commonStyle}">${htmlEscape(value[d.row * numCols + d.col])}</td>
</tr>`
}).join('')
Expand Down
Loading