diff --git a/.Rbuildignore b/.Rbuildignore index 5fe7ea64..dd201b40 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,3 +1,4 @@ +^CRAN-RELEASE$ ^.*\.Rproj$ ^\.Rproj\.user$ ^\.travis.yml$ diff --git a/.gitignore b/.gitignore index 36d8b6ff..0f63496f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ .Ruserdata **/.DS_Store vignettes/*.html +**/Rplots.pdf diff --git a/DESCRIPTION b/DESCRIPTION old mode 100644 new mode 100755 index 5f4e09ce..0569f474 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: canvasXpress -Version: 1.20.5 +Version: 1.21.6 Title: Visualization Package for CanvasXpress in R Description: Enables creation of visualizations using the CanvasXpress framework in R. CanvasXpress is a standalone JavaScript library for reproducible research @@ -9,6 +9,7 @@ Description: Enables creation of visualizations using the CanvasXpress framework Type: Package License: GPL-3 Encoding: UTF-8 +Language: en-US Authors@R: c( person("Isaac", "Neuhaus", email = "imnphd@gmail.com", role = c("aut")), person("Connie", "Brett", email = "connie@aggregate-genius.com", role = c("aut", "cre"))) @@ -21,13 +22,15 @@ Depends: Imports: htmlwidgets (>= 0.8), httr -RoxygenNote: 6.0.1 +RoxygenNote: 6.1.1 Suggests: shiny (>= 0.13.2), knitr, rmarkdown, dplyr, testthat, + webshot, + png, limma, grDevices, covr, diff --git a/NEWS.md b/NEWS.md index cf63a8a8..08fa1004 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,9 @@ information on changes to the stand-alone JavaScript CanvasXpress library see th main website. --- +## v1.21.6 +* Updated CanvasXpress JavaScript and CSS libraries to v21.6 + ## v1.20.5 * Updated CanvasXpress JavaScript and CSS libraries to v20.5 * Tests updated and expanded to match new CX functionality @@ -18,9 +21,6 @@ information on changes to the stand-alone JavaScript CanvasXpress library see th ## v1.18.8 * Updated CanvasXpress JavaScript and CSS libraries to v18.8 -## v1.18.8 -* Updated CanvasXpress JavaScript and CSS libraries to v18.8 - ## v1.18.5 * Updated CanvasXpress JavaScript and CSS libraries to v18.5 diff --git a/R/canvasXpress.R b/R/canvasXpress.R old mode 100644 new mode 100755 diff --git a/R/internal_functionality.R b/R/internal_functionality.R old mode 100644 new mode 100755 diff --git a/canvasXpress.Rproj b/canvasXpress.Rproj index 19d6d689..fcef6073 100644 --- a/canvasXpress.Rproj +++ b/canvasXpress.Rproj @@ -13,6 +13,7 @@ RnwWeave: knitr LaTeX: pdfLaTeX AutoAppendNewline: Yes +StripTrailingWhitespace: Yes BuildType: Package PackageUseDevtools: Yes diff --git a/cran-comments.md b/cran-comments.md index b7030197..c63d03bf 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,19 +1,24 @@ ## Comments from Maintainer -Updated CanvasXpress JS libraries to 20.5 +Updated CanvasXpress JS libraries to 21.6 --- ## Test environments * ubuntu 16.04, R 3.3.3 -* ubuntu 16.04, R 3.4.3 +* ubuntu 16.04, R 3.4.4 * ubuntu 16.04, R 3.5.1 * ubuntu 14.04.5 (on travis-ci), R 3.4.4 -* ubuntu 14.04.5 (on travis-ci), R 3.5.0 +* ubuntu 14.04.5 (on travis-ci), R 3.5.1 -* win-builder (devel and release) +* win-builder (oldrelease, release, devel) + +* r-hub +* * Windows Server 2008 R2 SP1 +* * Ubuntu Linux 16.04 LTS +* * Fedora Linux --- diff --git a/inst/doc/additional_examples.R b/inst/doc/additional_examples.R deleted file mode 100644 index 8b137891..00000000 --- a/inst/doc/additional_examples.R +++ /dev/null @@ -1 +0,0 @@ - diff --git a/inst/doc/additional_examples.Rmd b/inst/doc/additional_examples.Rmd deleted file mode 100644 index e67ff7f6..00000000 --- a/inst/doc/additional_examples.Rmd +++ /dev/null @@ -1,237 +0,0 @@ ---- -title: "Additional Examples for canvasXpress in R " -author: "Connie Brett" -date: "`r Sys.Date()`" -output: - rmarkdown::html_vignette: - toc: TRUE - toc_depth: 4 -vignette: > - %\VignetteIndexEntry{Additional Examples for canvasXpress in R} - %\VignetteEngine{knitr::rmarkdown} - %\VignetteEncoding{UTF-8} ---- - -## Data from an R perspective - -The canvasXpress javaScript functionality in the browser generally expects data to be in a wide format and utilizes both column- and row-names to cross-reference and access the various slices of data needed to make the charts. The package will warn you if that data you provide doesn't match up, and it is likely that one of your structures is simply the wrong format or is missing the row or column names. - - -### Variables - -Variables are the rows of data and the variable names are drawn from the row names. It is helpful to keep in mind that there are a number of manipulations and functions in R that remove or reset rownames on various data structures. - - -### Samples - -Samples are the columns of data and the sample names are drawn from the column names. - - -### Annotations - -Annotations are considered to be *extra* information or characteristics. These data add to the information about samples or variables but are not a part of the main dataset. - - -### Item Indexing - -Some charts can be built in canvasXpress based on the index of the data instead of names. The JavaScript language uses 0-based indexing whereas the R language uses 1-based indexing. This means that to access the first item in a vectors column, row, etc in JavaScript the index would is 0, whereas the first item in that same structure in R would have an index of 1. - -This discrepancy in indexing means that when sending data indexes to canvasXpress from R it is crucial to adjust your R index (subtract 1) since the canvasXpress charts (even within RStudio) are *always* created from a JavaScript perspective. - - -### JSON Data (tips on matching R) - -The JSON format for the data is essentially a list of lists. From a data perspective the y list (compartment) is where the numerical data resides with three sub-lists - the names of the variables, the names of the samples, and the actual data. The x list contains the sample annotation data, and the z list contains the variable annotation data. - -When utilizing the canvasXpress functions from R the following mappings are made, which coveres the most common charts. There are additional named lists and properties that are mapped for specific chart types and covered with those chart examples below. - -> data -> y ->     *y.vars = row names* ->     *y.smps = column names* ->     *y.data = values* -> smpAnnot -> x -> varAnnot -> z - - -## Examples - -### Data Preparation - -Examples here use data manipulated with the tidyverse related packages (dplyr, tibble, etc). This is just one way to manipulate data into the correct format to plot in CanvasXpress. - - -A variety of commonly-used canvasXpress options are used below to provide examples of how to position, resize and configure various aspects of the charts from the call to the CanvasXpress function in R. This includes items such as the Axis Titles, Legends, Colors, etc. All of these optional parameters are documented on the main CanvasXpress site at http://canvasXpress.org. - -```r -library(canvasXpress) -library(dplyr) -library(tibble) -library(tidyr) - -data <- USArrests %>% - rownames_to_column(var = "State") %>% - mutate(Total = (Assault + Rape + Murder), - Category = cut(Total, 3, - labels = c("low", "med", "high"), - ordered_result = T)) -``` - -### Scatter 2D Chart - -```r -cxdata <- data %>% select(Murder, Assault) -cxdata.varAnnot <- data %>% select(UrbanPop, Category) - -rownames(cxdata) <- data[, "State"] -rownames(cxdata.varAnnot) <- data[, "State"] - -canvasXpress(data = cxdata, - varAnnot = cxdata.varAnnot, - graphType = "Scatter2D", - colorBy = "UrbanPop", - shapeBy = "Category", - legendPosition = "right", - legendOrder = list("Category" = list("low", "med", "high")), - title = "Murder vs Assault Rates", - titleScaleFontFactor = 0.5) -``` -![Scatter2D](images/R-Scatter2D.png) - -### Stacked Bar Chart - -```r -cxdata <- t(data %>% select(Assault, Rape, Murder)) -colnames(cxdata) <- data$State - -canvasXpress(data = cxdata, - graphType = "Stacked", - colorScheme = "Blues", - graphOrientation = "vertical", - legendInside = TRUE, - legendPosition = "topRight", - smpLabelRotate = 20, - title = "US Arrests by State and Type", - titleScaleFontFactor = 0.5, - xAxisTitle = "Total Arrests", - xAxis2Title = "Total Arrests") -``` -![StackedBar](images/R-StackedBar.png) - -### Clustered Bar Chart - -#### CanvasXpress clustering - -```r -cxdata <- t(data %>% select(Assault, Rape, Murder)) -colnames(cxdata) <- data$State - -canvasXpress(data = cxdata, - graphType = "Stacked", - graphOrientation = "horizontal", - colorScheme = "Reds", - showSampleNames = FALSE, - title = "Clustered Arrests", - subtitle = "(by State and Type)", - titleScaleFontFactor = 0.5, - subtitleScaleFontFactor = 0.25, - xAxisShow = FALSE, - xAxis2Title = "Total Arrests", - legendPosition = "bottom", - legendColumns = 3, -#canvasXpress clustering options - samplesClustered = TRUE, - linkage = "single", - distance = "manhattan", - smpDendrogramPosition = "left") -``` -![ClusteredBar1](images/R-ClusteredBar1.png) - -#### Preclustered data in Newick format - -```r -cxdata <- t(data %>% select(Assault, Rape, Murder)) -colnames(cxdata) <- data$State - -cxdata.tree <- list("smps" = "((8,32):20.2,(((4,((0,7):14.7,(23,(1,(27,(21,(31,(12,17):6.8):7.8):11.0):14.0):14.7):15.8):16.2):17.9,(39,(30,(2,19):12.4):13.4):18.6):19.9,(((11,(6,(((34,43):5.6,(13,15):6.2):7.5,(26,(37,(16,25):3.8):4.8):7.6):7.6):9.0):9.3,((10,(33,(44,(48,(14,28):2.9):3.9):5.8):8.3):14.1,(22,(40,(18,47):7.1):9.7):17.2):20.1):20.2,((5,(24,(9,(42,(3,41):13.8):14.9):15.0):15.5):21.0,(38,(46,(36,(20,(35,(45,(29,49):5.8):6.0):7.6):7.9):13.0):14.3):23.7):24.2):29.1):33.8):43.2" -) - -canvasXpress(data = cxdata, - graphType = "Stacked", - graphOrientation = "horizontal", - colorScheme = "Reds", - - showSampleNames = FALSE, - title = "Clustered Arrests", - subtitle = "(by State and Type)", - titleScaleFontFactor = 0.5, - subtitleScaleFontFactor = 0.25, - xAxisShow = FALSE, - xAxis2Title = "Total Arrests", - legendPosition = "bottomRight", - legendInside = TRUE, -#user-provided clustering options - newickData = cxdata.tree, - smpDendrogramPosition = "left", - showSmpDendrogram = TRUE) -``` -![ClusteredBar2](images/R-ClusteredBar2.png) - - -### BoxPlot -#### CanvasXpress statistics - -```r -reshape <- data %>% gather(key = "Type", value = "Rate", - Assault, Rape, Murder) - -cxdata <- t(reshape %>% select(Rate)) -cxdata.smpAnnot <- t(reshape %>% select(Type)) - -colnames(cxdata.smpAnnot) <- colnames(cxdata) - - -canvasXpress(data = cxdata, - smpAnnot = cxdata.smpAnnot, - graphType = "Boxplot", - colorScheme = "Pastel", - graphOrientation = "vertical", - groupingFactors = list("Type"), - smpLabelFontStyle = "italic", - smpLabelRotate = 90, - showLegend = FALSE, - title = "US Arrests by Type", - titleScaleFontFactor = 0.5,) -``` -![BoxPlot1](images/R-BoxPlot1.png) - -#### Precalculated statistics - -```r -precalc.stats <- apply(data %>% select(Assault, Rape, Murder), 2, boxplot.stats) -precalc.data <- as.data.frame(lapply(precalc.stats, function(x) { x$stats })) -precalc.out <- data.frame(lapply(precalc.stats, function(x) { paste(x$out, collapse=",") }), stringsAsFactors = F) - -cxdata <- precalc.data %>% mutate_all(as.character) -cxdata <- bind_rows(cxdata, precalc.out) -rownames(cxdata) <- c("iqr1", "qtl1", "median", "qtl3", "iqr3", "outliers") - -canvasXpress(data = cxdata, - graphType = "Boxplot", - boxplotGroupData = "Type", - colorScheme = "Pastel", - graphOrientation = "vertical", - groupingFactors = list("Type"), - smpLabelFontStyle = "italic", - smpLabelRotate = 90, - showLegend = FALSE, - title = "US Arrests by Type", - titleScaleFontFactor = 0.5,) -``` -![BoxPlot2](images/R-BoxPlot2.png) - - - -## Additional Information - -Additional information and many examples with the JavaScript ***canvasXpress*** library can be found -[here](http://www.canvasxpress.org). diff --git a/inst/doc/additional_examples.html b/inst/doc/additional_examples.html deleted file mode 100644 index cc9ba1ae..00000000 --- a/inst/doc/additional_examples.html +++ /dev/null @@ -1,334 +0,0 @@ - - - - - - - - - - - - - - - - -Additional Examples for canvasXpress in R - - - - - - - - - - - - - - - - - -

Additional Examples for canvasXpress in R

-

Connie Brett

-

2017-08-13

- - -
- -
- -
-

Data from an R perspective

-

The canvasXpress javaScript functionality in the browser generally expects data to be in a wide format and utilizes both column- and row-names to cross-reference and access the various slices of data needed to make the charts. The package will warn you if that data you provide doesn’t match up, and it is likely that one of your structures is simply the wrong format or is missing the row or column names.

-
-

Variables

-

Variables are the rows of data and the variable names are drawn from the row names. It is helpful to keep in mind that there are a number of manipulations and functions in R that remove or reset rownames on various data structures.

-
-
-

Samples

-

Samples are the columns of data and the sample names are drawn from the column names.

-
-
-

Annotations

-

Annotations are considered to be extra information or characteristics. These data add to the information about samples or variables but are not a part of the main dataset.

-
-
-

Item Indexing

-

Some charts can be built in canvasXpress based on the index of the data instead of names. The JavaScript language uses 0-based indexing whereas the R language uses 1-based indexing. This means that to access the first item in a vectors column, row, etc in JavaScript the index would is 0, whereas the first item in that same structure in R would have an index of 1.

-

This discrepancy in indexing means that when sending data indexes to canvasXpress from R it is crucial to adjust your R index (subtract 1) since the canvasXpress charts (even within RStudio) are always created from a JavaScript perspective.

-
-
-

JSON Data (tips on matching R)

-

The JSON format for the data is essentially a list of lists. From a data perspective the y list (compartment) is where the numerical data resides with three sub-lists - the names of the variables, the names of the samples, and the actual data. The x list contains the sample annotation data, and the z list contains the variable annotation data.

-

When utilizing the canvasXpress functions from R the following mappings are made, which coveres the most common charts. There are additional named lists and properties that are mapped for specific chart types and covered with those chart examples below.

-
-

data -> y
-    y.vars = row names
-    y.smps = column names
-    y.data = values
-smpAnnot -> x
-varAnnot -> z

-
-
-
-
-

Examples

-
-

Data Preparation

-

Examples here use data manipulated with the tidyverse related packages (dplyr, tibble, etc). This is just one way to manipulate data into the correct format to plot in CanvasXpress.

-

A variety of commonly-used canvasXpress options are used below to provide examples of how to position, resize and configure various aspects of the charts from the call to the CanvasXpress function in R. This includes items such as the Axis Titles, Legends, Colors, etc. All of these optional parameters are documented on the main CanvasXpress site at http://canvasXpress.org.

-
library(canvasXpress)
-library(dplyr)
-library(tibble)
-library(tidyr)
-
-data <- USArrests %>%
-    rownames_to_column(var = "State") %>%
-    mutate(Total = (Assault + Rape + Murder),
-           Category = cut(Total, 3, 
-                          labels = c("low", "med", "high"),
-                          ordered_result = T)) 
-
-
-

Scatter 2D Chart

-
cxdata          <- data %>% select(Murder, Assault)
-cxdata.varAnnot <- data %>% select(UrbanPop, Category) 
-
-rownames(cxdata) <- data[, "State"]
-rownames(cxdata.varAnnot) <- data[, "State"]
-
-canvasXpress(data                    = cxdata,
-             varAnnot                = cxdata.varAnnot,
-             graphType               = "Scatter2D",
-             colorBy                 = "UrbanPop",
-             shapeBy                 = "Category",
-             legendPosition          = "right",
-             legendOrder             = list("Category" = list("low", "med", "high")),
-             title                   = "Murder vs Assault Rates",
-             titleScaleFontFactor    = 0.5)
-
-Scatter2D -

Scatter2D

-
-
-
-

Stacked Bar Chart

-
cxdata           <- t(data %>% select(Assault, Rape, Murder))
-colnames(cxdata) <- data$State
-
-canvasXpress(data                  = cxdata,
-             graphType             = "Stacked",
-             colorScheme           = "Blues",
-             graphOrientation      = "vertical",
-             legendInside          = TRUE,
-             legendPosition        = "topRight",
-             smpLabelRotate        = 20,
-             title                 = "US Arrests by State and Type",
-             titleScaleFontFactor  = 0.5,
-             xAxisTitle            = "Total Arrests",
-             xAxis2Title           = "Total Arrests")
-
-StackedBar -

StackedBar

-
-
-
-

Clustered Bar Chart

-
-

CanvasXpress clustering

-
cxdata           <- t(data %>% select(Assault, Rape, Murder))
-colnames(cxdata) <- data$State
-
-canvasXpress(data                    = cxdata,
-             graphType               = "Stacked",
-             graphOrientation        = "horizontal",
-             colorScheme             = "Reds",
-             showSampleNames         = FALSE,
-             title                   = "Clustered Arrests",
-             subtitle                = "(by State and Type)",
-             titleScaleFontFactor    = 0.5,
-             subtitleScaleFontFactor = 0.25,
-             xAxisShow               = FALSE,
-             xAxis2Title             = "Total Arrests",
-             legendPosition          = "bottom",
-             legendColumns           = 3,
-#canvasXpress clustering options  
-             samplesClustered        = TRUE,
-             linkage                 = "single",
-             distance                = "manhattan",
-             smpDendrogramPosition   = "left")
-
-ClusteredBar1 -

ClusteredBar1

-
-
-
-

Preclustered data in Newick format

-
cxdata           <- t(data %>% select(Assault, Rape, Murder))
-colnames(cxdata) <- data$State
-
-cxdata.tree      <- list("smps" = "((8,32):20.2,(((4,((0,7):14.7,(23,(1,(27,(21,(31,(12,17):6.8):7.8):11.0):14.0):14.7):15.8):16.2):17.9,(39,(30,(2,19):12.4):13.4):18.6):19.9,(((11,(6,(((34,43):5.6,(13,15):6.2):7.5,(26,(37,(16,25):3.8):4.8):7.6):7.6):9.0):9.3,((10,(33,(44,(48,(14,28):2.9):3.9):5.8):8.3):14.1,(22,(40,(18,47):7.1):9.7):17.2):20.1):20.2,((5,(24,(9,(42,(3,41):13.8):14.9):15.0):15.5):21.0,(38,(46,(36,(20,(35,(45,(29,49):5.8):6.0):7.6):7.9):13.0):14.3):23.7):24.2):29.1):33.8):43.2"
-)
-
-canvasXpress(data                    = cxdata,
-             graphType               = "Stacked",
-             graphOrientation        = "horizontal",
-             colorScheme             = "Reds",
-
-             showSampleNames         = FALSE,
-             title                   = "Clustered Arrests",
-             subtitle                = "(by State and Type)",
-             titleScaleFontFactor    = 0.5,
-             subtitleScaleFontFactor = 0.25,
-             xAxisShow             = FALSE,
-             xAxis2Title           = "Total Arrests",
-             legendPosition        = "bottomRight",
-             legendInside          = TRUE,
-#user-provided clustering options
-             newickData            = cxdata.tree,
-             smpDendrogramPosition = "left",
-             showSmpDendrogram     = TRUE)
-
-ClusteredBar2 -

ClusteredBar2

-
-
-
-
-

BoxPlot

-
-

CanvasXpress statistics

-
reshape <- data %>% gather(key = "Type", value = "Rate", 
-                           Assault, Rape, Murder)
-
-cxdata           <- t(reshape %>% select(Rate))
-cxdata.smpAnnot  <- t(reshape %>% select(Type))
-
-colnames(cxdata.smpAnnot) <- colnames(cxdata)
-
-
-canvasXpress(data                  = cxdata,
-             smpAnnot              = cxdata.smpAnnot,
-             graphType             = "Boxplot",
-             colorScheme           = "Pastel",
-             graphOrientation      = "vertical",
-             groupingFactors       = list("Type"),
-             smpLabelFontStyle     = "italic",
-             smpLabelRotate        = 90,
-             showLegend            = FALSE,
-             title                 = "US Arrests by Type",
-             titleScaleFontFactor  = 0.5,)
-
-BoxPlot1 -

BoxPlot1

-
-
-
-

Precalculated statistics

-
precalc.stats <- apply(data %>% select(Assault, Rape, Murder), 2, boxplot.stats)
-precalc.data  <- as.data.frame(lapply(precalc.stats, function(x) { x$stats }))
-precalc.out   <- data.frame(lapply(precalc.stats, function(x) { paste(x$out, collapse=',') }), stringsAsFactors = F)
-
-cxdata <- precalc.data %>% mutate_all(as.character)
-cxdata <- bind_rows(cxdata, precalc.out)
-rownames(cxdata) <- c("iqr1", "qtl1", "median", "qtl3", "iqr3", "outliers")
-
-canvasXpress(data                  = cxdata,
-             graphType             = "Boxplot",
-             boxplotGroupData      = "Type",
-             colorScheme           = "Pastel",
-             graphOrientation      = "vertical",
-             groupingFactors       = list("Type"),
-             smpLabelFontStyle     = "italic",
-             smpLabelRotate        = 90,
-             showLegend            = FALSE,
-             title                 = "US Arrests by Type",
-             titleScaleFontFactor  = 0.5,)
-
-BoxPlot2 -

BoxPlot2

-
-
-
-
-
-

Additional Information

-

Additional information and many examples with the JavaScript canvasXpress library can be found here.

-
- - - - - - - - diff --git a/inst/doc/getting_started.R b/inst/doc/getting_started.R deleted file mode 100644 index 8b137891..00000000 --- a/inst/doc/getting_started.R +++ /dev/null @@ -1 +0,0 @@ - diff --git a/inst/doc/getting_started.Rmd b/inst/doc/getting_started.Rmd deleted file mode 100644 index 4cfa7728..00000000 --- a/inst/doc/getting_started.Rmd +++ /dev/null @@ -1,84 +0,0 @@ ---- -title: "Getting Started with canvasXpress in R" -author: "Isaac Neuhaus" -date: "`r Sys.Date()`" -output: - rmarkdown::html_vignette: - toc: TRUE - toc_depth: 3 -vignette: > - %\VignetteIndexEntry{Getting Started with canvasXpress in R} - %\VignetteEngine{knitr::rmarkdown} - %\VignetteEncoding{UTF-8} ---- -## Overview - - - -***canvasXpress*** was developed as the core visualization component for bioinformatics and systems biology analysis -at Bristol-Myers Squibb. It supports a large number of [visualizations ](http://canvasxpress.org/html/gallery.html)to display scientific and non-scientific -data. ***canvasXpress*** also includes a simple and unobtrusive [user interface](http://canvasxpress.org/html/user-interface.html) to explore complex data sets, a sofisticated and unique mechanism to keep track of all user customization for [Reproducible Research ](http://canvasxpress.org/html/reproducible-research.html) purposes, as well as an 'out of the box' -broadcasting capability to synchronize selected data points in all ***canvasXpress*** plots in a page. Data can -be easily sorted, grouped, transposed, transformed or clustered dynamically. The fully customizable mouse events -as well as the zooming, panning and drag'n drop capabilities are features that make this library unique in its -class. - -***canvasXpress*** can be now simply used within R at the console to generate conventional plots, in R-Studio -or seamlessly embeded in [Shiny](http://shiny.rstudio.com) web applications. An full-fledged example of the ***canvasXpress*** library including the mouse events, zooming, and broadcasting capabilities is included in this package in the [shiny](shiny/example3) directory. This ***canvasXpress*** R library was created with the [htmlwidgets](https://github.com/ramnathv/htmlwidgets) package. - -## Examples - -### Scatter 3D Plot - -```r -data <- t(iris[,1:4]) -varAnnot <- as.matrix(iris[,5]) -colnames(varAnnot) <- "Species" -canvasXpress(t(data), varAnnot=varAnnot, graphType="Scatter3D", colorBy="Species") -``` -![Scatter3D](images/R-Scatter3D.png) - -### Scatter 2D Matrix Plot - -```r -data <- t(iris[,1:4]) -varAnnot <- as.matrix(iris[,5]) -colnames(varAnnot) <- "Species" -canvasXpress(t(data), varAnnot=varAnnot, scatterPlotMatrix=1, colorBy="Species") -``` -![Scatter2DMatrix](images/R-Scatter2DMatrix.png) - -### Boxplot - -```r -data <- t(iris[,1:4]) -smpAnnot <- as.matrix(iris[,5]) -colnames(smpAnnot) <- "Species" -canvasXpress(data, smpAnnot=smpAnnot, graphType="Boxplot", groupingFactors=list("Species")) -# or -canvasXpress(data, smpAnnot=smpAnnot, graphType="Boxplot", afterRender=list(list("groupSamples", list("Species")))) -``` -![Boxplot](images/R-Boxplot.png) - -### Heatmap - -```r -data <- t(iris[,1:4]) -smpAnnot <- as.matrix(iris[,5]) -colnames(smpAnnot) <- "Species" -canvasXpress(data, smpAnnot=smpAnnot, graphType="Heatmap", smpOverlays=list("Species"), variablesClustered=TRUE, showSampleNames=FALSE) -``` -![Heatmap](images/R-Heatmap.png) - -### Four-way Venn Diagram - -```r -vennData <- data.frame(A=57, B=12, C=67, D=72, AB=4, AC=67, AD=25, BC=67, BD=27, CD=38, ABC=69, ABD=28, ACD=52, BCD=46, ABCD=3) -canvasXpress(vennData=vennData, graphType="Venn", vennGroups=4, vennLegend=list(A="List1", B="List2", C="List3", D="List4")) -``` -![Venn](images/R-Venn.png) - -## Additional Information - -Additional information and many examples with the JavaScript ***canvasXpress*** library can be found -[here](http://canvasxpress.org). diff --git a/inst/doc/getting_started.html b/inst/doc/getting_started.html deleted file mode 100644 index aa610f4f..00000000 --- a/inst/doc/getting_started.html +++ /dev/null @@ -1,172 +0,0 @@ - - - - - - - - - - - - - - - - -Getting Started with canvasXpress in R - - - - - - - - - - - - - - - - - -

Getting Started with canvasXpress in R

-

Isaac Neuhaus

-

2017-08-13

- - -
- -
- -
-

Overview

-

-

canvasXpress was developed as the core visualization component for bioinformatics and systems biology analysis at Bristol-Myers Squibb. It supports a large number of visualizationsto display scientific and non-scientific data. canvasXpress also includes a simple and unobtrusive user interface to explore complex data sets, a sofisticated and unique mechanism to keep track of all user customization for Reproducible Research purposes, as well as an ‘out of the box’ broadcasting capability to synchronize selected data points in all canvasXpress plots in a page. Data can be easily sorted, grouped, transposed, transformed or clustered dynamically. The fully customizable mouse events as well as the zooming, panning and drag’n drop capabilities are features that make this library unique in its class.

-

canvasXpress can be now simply used within R at the console to generate conventional plots, in R-Studio or seamlessly embeded in Shiny web applications. An full-fledged example of the canvasXpress library including the mouse events, zooming, and broadcasting capabilities is included in this package in the shiny directory. This canvasXpress R library was created with the htmlwidgets package.

-
-
-

Examples

-
-

Scatter 3D Plot

-
data <- t(iris[,1:4])
-varAnnot <- as.matrix(iris[,5])
-colnames(varAnnot) <- "Species"
-canvasXpress(t(data), varAnnot=varAnnot, graphType='Scatter3D', colorBy='Species')
-
-Scatter3D -

Scatter3D

-
-
-
-

Scatter 2D Matrix Plot

-
data <- t(iris[,1:4])
-varAnnot <- as.matrix(iris[,5])
-colnames(varAnnot) <- "Species"
-canvasXpress(t(data), varAnnot=varAnnot, scatterPlotMatrix=1, colorBy='Species')
-
-Scatter2DMatrix -

Scatter2DMatrix

-
-
-
-

Boxplot

-
data <- t(iris[,1:4])
-smpAnnot <- as.matrix(iris[,5])
-colnames(smpAnnot) <- "Species"
-canvasXpress(data, smpAnnot=smpAnnot, graphType='Boxplot', groupingFactors=list('Species'))
-# or
-canvasXpress(data, smpAnnot=smpAnnot, graphType='Boxplot', afterRender=list(list('groupSamples', list('Species'))))
-
-Boxplot -

Boxplot

-
-
-
-

Heatmap

-
data <- t(iris[,1:4])
-smpAnnot <- as.matrix(iris[,5])
-colnames(smpAnnot) <- "Species"
-canvasXpress(data, smpAnnot=smpAnnot, graphType='Heatmap', smpOverlays=list('Species'), variablesClustered=TRUE, showSampleNames=FALSE)
-
-Heatmap -

Heatmap

-
-
-
-

Four-way Venn Diagram

-
vennData <- data.frame(A=57, B=12, C=67, D=72, AB=4, AC=67, AD=25, BC=67, BD=27, CD=38, ABC=69, ABD=28, ACD=52, BCD=46, ABCD=3)
-canvasXpress(vennData=vennData, graphType='Venn', vennGroups=4, vennLegend=list(A="List1", B="List2", C="List3", D="List4"))
-
-Venn -

Venn

-
-
-
-
-

Additional Information

-

Additional information and many examples with the JavaScript canvasXpress library can be found here.

-
- - - - - - - - diff --git a/inst/extdata/cX-mtcars-dat.txt b/inst/extdata/cX-mtcars-dat.txt new file mode 100644 index 00000000..9b73c7fa --- /dev/null +++ b/inst/extdata/cX-mtcars-dat.txt @@ -0,0 +1,33 @@ + mpg cyl disp hp drat wt qsec vs am gear carb +Mazda RX4 21 6 160 110 3.9 2.62 16.46 0 1 4 4 +Mazda RX4 Wag 21 6 160 110 3.9 2.875 17.02 0 1 4 4 +Datsun 710 22.8 4 108 93 3.85 2.32 18.61 1 1 4 1 +Hornet 4 Drive 21.4 6 258 110 3.08 3.215 19.44 1 0 3 1 +Hornet Sportabout 18.7 8 360 175 3.15 3.44 17.02 0 0 3 2 +Valiant 18.1 6 225 105 2.76 3.46 20.22 1 0 3 1 +Duster 360 14.3 8 360 245 3.21 3.57 15.84 0 0 3 4 +Merc 240D 24.4 4 146.7 62 3.69 3.19 20 1 0 4 2 +Merc 230 22.8 4 140.8 95 3.92 3.15 22.9 1 0 4 2 +Merc 280 19.2 6 167.6 123 3.92 3.44 18.3 1 0 4 4 +Merc 280C 17.8 6 167.6 123 3.92 3.44 18.9 1 0 4 4 +Merc 450SE 16.4 8 275.8 180 3.07 4.07 17.4 0 0 3 3 +Merc 450SL 17.3 8 275.8 180 3.07 3.73 17.6 0 0 3 3 +Merc 450SLC 15.2 8 275.8 180 3.07 3.78 18 0 0 3 3 +Cadillac Fleetwood 10.4 8 472 205 2.93 5.25 17.98 0 0 3 4 +Lincoln Continental 10.4 8 460 215 3 5.424 17.82 0 0 3 4 +Chrysler Imperial 14.7 8 440 230 3.23 5.345 17.42 0 0 3 4 +Fiat 128 32.4 4 78.7 66 4.08 2.2 19.47 1 1 4 1 +Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2 +Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.9 1 1 4 1 +Toyota Corona 21.5 4 120.1 97 3.7 2.465 20.01 1 0 3 1 +Dodge Challenger 15.5 8 318 150 2.76 3.52 16.87 0 0 3 2 +AMC Javelin 15.2 8 304 150 3.15 3.435 17.3 0 0 3 2 +Camaro Z28 13.3 8 350 245 3.73 3.84 15.41 0 0 3 4 +Pontiac Firebird 19.2 8 400 175 3.08 3.845 17.05 0 0 3 2 +Fiat X1-9 27.3 4 79 66 4.08 1.935 18.9 1 1 4 1 +Porsche 914-2 26 4 120.3 91 4.43 2.14 16.7 0 1 5 2 +Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.9 1 1 5 2 +Ford Pantera L 15.8 8 351 264 4.22 3.17 14.5 0 1 5 4 +Ferrari Dino 19.7 6 145 175 3.62 2.77 15.5 0 1 5 6 +Maserati Bora 15 8 301 335 3.54 3.57 14.6 0 1 5 8 +Volvo 142E 21.4 4 121 109 4.11 2.78 18.6 1 1 4 2 diff --git a/inst/htmlwidgets/canvasXpress.yaml b/inst/htmlwidgets/canvasXpress.yaml index 25170fff..03446c7a 100644 --- a/inst/htmlwidgets/canvasXpress.yaml +++ b/inst/htmlwidgets/canvasXpress.yaml @@ -1,6 +1,6 @@ dependencies: - name: canvasXpress - version: 20.5 + version: 21.6 src: "htmlwidgets/lib/canvasXpress" script: canvasXpress.min.js stylesheet: canvasXpress.css diff --git a/tests/cX-function.R b/tests/cX-ui-functions.R similarity index 97% rename from tests/cX-function.R rename to tests/cX-ui-functions.R index e184cf68..0a6b51f4 100644 --- a/tests/cX-function.R +++ b/tests/cX-ui-functions.R @@ -2289,6 +2289,7 @@ cXkaplanmeier1 <- function() { data=y, varAnnot=z, graphType="Scatter2D", + showConfidenceIntervals=FALSE, showDecorations=TRUE, showLegend=FALSE, showTransition=TRUE, @@ -2305,8 +2306,8 @@ cXkaplanmeier2 <- function() { data=y, varAnnot=z, graphType="Scatter2D", + showConfidenceIntervals=TRUE, showDecorations=TRUE, - showKaplanMeierConfidence=TRUE, showLegend=FALSE, showTransition=TRUE, title="Kaplan-Meier Plot", @@ -2325,11 +2326,7 @@ cXlayout1 <- function() { colorBy="Species", graphType="Scatter2D", layoutAdjust=TRUE, - scatterPlotMatrix=TRUE, - showTransition=TRUE, - transitionStep=50, - transitionTime=1500, - afterRender=list(list("addRegressionLine")) + scatterPlotMatrix=TRUE ) } @@ -2343,9 +2340,9 @@ cXlayout2 <- function() { broadcast=TRUE, colorBy="Species", graphType="Scatter2D", - layoutAdjust=FALSE, + layoutAdjust=TRUE, scatterPlotMatrix=TRUE, - showTransition=TRUE + afterRender=list(list("addRegressionLine", list("Species"))) ) } @@ -2359,14 +2356,45 @@ cXlayout3 <- function() { broadcast=TRUE, colorBy="Species", graphType="Scatter2D", - layoutAdjust=FALSE, + layoutAdjust=TRUE, scatterPlotMatrix=TRUE, - scatterPlotMatrixType="first", afterRender=list(list("addRegressionLine")) ) } cXlayout4 <- function() { + library(canvasXpress) + y=read.table(system.file("extdata", "cX-irist-dat.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) + z=read.table(system.file("extdata", "cX-irist-var.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) + canvasXpress( + data=y, + varAnnot=z, + broadcast=TRUE, + colorBy="Species", + graphType="Scatter2D", + layoutAdjust=FALSE, + scatterPlotMatrix=TRUE + ) +} + +cXlayout5 <- function() { + library(canvasXpress) + y=read.table(system.file("extdata", "cX-irist-dat.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) + z=read.table(system.file("extdata", "cX-irist-var.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) + canvasXpress( + data=y, + varAnnot=z, + broadcast=TRUE, + colorBy="Species", + graphType="Scatter2D", + layoutAdjust=FALSE, + scatterPlotMatrix=TRUE, + scatterPlotMatrixType="first", + afterRender=list(list("addRegressionLine", list("Species"))) + ) +} + +cXlayout6 <- function() { library(canvasXpress) y=read.table(system.file("extdata", "cX-iris-dat.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) x=read.table(system.file("extdata", "cX-iris-smp.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) @@ -2392,7 +2420,7 @@ cXlayout4 <- function() { ) } -cXlayout5 <- function() { +cXlayout7 <- function() { library(canvasXpress) y=read.table(system.file("extdata", "cX-cars-dat.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) x=read.table(system.file("extdata", "cX-cars-smp.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) @@ -2411,7 +2439,7 @@ cXlayout5 <- function() { ) } -cXlayout6 <- function() { +cXlayout8 <- function() { library(canvasXpress) y=read.table(system.file("extdata", "cX-generic-dat.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) x=read.table(system.file("extdata", "cX-generic-smp.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) @@ -2427,7 +2455,7 @@ cXlayout6 <- function() { ) } -cXlayout7 <- function() { +cXlayout9 <- function() { library(canvasXpress) y=read.table(system.file("extdata", "cX-generic-dat.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) x=read.table(system.file("extdata", "cX-generic-smp.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) @@ -2443,7 +2471,7 @@ cXlayout7 <- function() { ) } -cXlayout8 <- function() { +cXlayout10 <- function() { library(canvasXpress) y=read.table(system.file("extdata", "cX-scents-dat.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) x=read.table(system.file("extdata", "cX-scents-smp.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) @@ -2459,7 +2487,7 @@ cXlayout8 <- function() { ) } -cXlayout9 <- function() { +cXlayout11 <- function() { library(canvasXpress) y=read.table(system.file("extdata", "cX-overlays-dat.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) x=read.table(system.file("extdata", "cX-overlays-smp.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) @@ -2578,6 +2606,7 @@ cXmap2 <- function() { } cXmap3 <- function() { + library(canvasXpress) canvasXpress( data=FALSE, colorBy="variable", @@ -2590,6 +2619,7 @@ cXmap3 <- function() { } cXmap4 <- function() { + library(canvasXpress) canvasXpress( data=FALSE, colorBy="Order", @@ -2601,6 +2631,7 @@ cXmap4 <- function() { } cXmap5 <- function() { + library(canvasXpress) canvasXpress( data=FALSE, colorBy="Order", @@ -2723,6 +2754,53 @@ cXnetwork6 <- function() { ) } +cXnetwork7 <- function() { + library(canvasXpress) + canvasXpress( + data="https://canvasxpress.org/debug/hsa05222.xml", + appendNetworkData=list("https://canvasxpress.org/debug/hsa05222.txt", list(data=list("2"=list(Exp5=-3, Exp6=4, Exp7="H", Exp8=list(CL1=2, CL2=14, CL3=7), Exp9=list(CL1=32, CL2=1, CL3=5)), "3"=list(Exp5=-1, Exp6=15, Exp7="L", Exp8=list(CL1=2, CL2=40, CL3=22), Exp9=list(CL1=45, CL2=4)), "4"=list(Exp5=5, Exp6=40, Exp7="H", Exp8=list(CL1=32, CL2=4, CL3=15), Exp9=list(CL1=52, CL2=4)), "8"=list(Exp5=10, Exp6=24, Exp7="H", Exp8=list(CL1=12, CL2=4, CL3=1), Exp9=list(CL1=21, CL2=44, CL3=9)), "9"=list(Exp5=-8, Exp6=14, Exp7="M", Exp8=list(CL1=2, CL2=14, CL3=32), Exp9=list(CL1=12, CL2=4))), type="node")), + colorNodeBy="Exp1", + graphType="Network" + ) +} + +cXnetwork8 <- function() { + library(canvasXpress) + canvasXpress( + data="https://canvasxpress.org/debug/hsa05222.xml", + appendNetworkData=list("https://canvasxpress.org/debug/hsa05222.txt", list(data=list("2"=list(Exp5=-3, Exp6=4, Exp7="H", Exp8=list(CL1=2, CL2=14, CL3=7), Exp9=list(CL1=32, CL2=1, CL3=5)), "3"=list(Exp5=-1, Exp6=15, Exp7="L", Exp8=list(CL1=2, CL2=40, CL3=22), Exp9=list(CL1=45, CL2=4)), "4"=list(Exp5=5, Exp6=40, Exp7="H", Exp8=list(CL1=32, CL2=4, CL3=15), Exp9=list(CL1=52, CL2=4)), "8"=list(Exp5=10, Exp6=24, Exp7="H", Exp8=list(CL1=12, CL2=4, CL3=1), Exp9=list(CL1=21, CL2=44, CL3=9)), "9"=list(Exp5=-8, Exp6=14, Exp7="M", Exp8=list(CL1=2, CL2=14, CL3=32), Exp9=list(CL1=12, CL2=4))), type="node")), + decorations=list("Exp2", "Exp3"), + decorationsHeight=18, + decorationsPosition="right", + decorationsType="pie", + graphType="Network" + ) +} + +cXnetwork9 <- function() { + library(canvasXpress) + canvasXpress( + data="https://canvasxpress.org/debug/WP3624_95209.gpml", + graphType="Network" + ) +} + +cXnetwork10 <- function() { + library(canvasXpress) + canvasXpress( + data="https://canvasxpress.org/debug/example.xgmml", + graphType="Network" + ) +} + +cXnetwork11 <- function() { + library(canvasXpress) + canvasXpress( + data="https://canvasxpress.org/debug/Apoptosis.xml", + graphType="Network" + ) +} + cXnonlinearfit1 <- function() { library(canvasXpress) y=read.table(system.file("extdata", "cX-nonlinearfit-dat.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) @@ -3160,7 +3238,7 @@ cXscatter2d2 <- function() { canvasXpress( data=y, graphType="Scatter2D", - showLoessConfidence=TRUE, + showConfidenceIntervals=TRUE, showLoessFit=TRUE, title="Loess Fit", xAxis=list("E"), @@ -3195,6 +3273,37 @@ cXscatter2d3 <- function() { } cXscatter2d4 <- function() { + library(canvasXpress) + y=read.table(system.file("extdata", "cX-mtcars-dat.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) + canvasXpress( + data=y, + asSampleFactors=list("cyl"), + colorBy="cyl", + graphType="Scatter2D", + stringVariableFactors=list("cyl"), + xAxis=list("wt"), + yAxis=list("mpg"), + afterRender=list(list("addRegressionLine", list("cyl"))) + ) +} + +cXscatter2d5 <- function() { + library(canvasXpress) + y=read.table(system.file("extdata", "cX-mtcars-dat.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) + canvasXpress( + data=y, + asSampleFactors=list("cyl"), + colorBy="cyl", + graphType="Scatter2D", + showRegressionFullRange=TRUE, + stringVariableFactors=list("cyl"), + xAxis=list("wt"), + yAxis=list("mpg"), + afterRender=list(list("addRegressionLine", list("cyl"))) + ) +} + +cXscatter2d6 <- function() { library(canvasXpress) y=read.table(system.file("extdata", "cX-scentst-dat.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) z=read.table(system.file("extdata", "cX-scentst-var.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) @@ -3220,7 +3329,7 @@ cXscatter2d4 <- function() { ) } -cXscatter2d5 <- function() { +cXscatter2d7 <- function() { library(canvasXpress) y=read.table(system.file("extdata", "cX-ageheightt-dat.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) x=read.table(system.file("extdata", "cX-ageheightt-smp.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) @@ -3236,7 +3345,7 @@ cXscatter2d5 <- function() { ) } -cXscatter2d6 <- function() { +cXscatter2d8 <- function() { library(canvasXpress) y=read.table(system.file("extdata", "cX-breastcancert-dat.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) x=read.table(system.file("extdata", "cX-breastcancert-smp.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) @@ -3260,11 +3369,11 @@ cXscatter2d6 <- function() { xAxisTickColor="rgb(255,255,255)", yAxis=list("Temperature"), yAxisTickColor="rgb(255,255,255)", - afterRender=list(list("addRegressionLine", list('red'))) + afterRender=list(list("addRegressionLine", list(FALSE, 'red'))) ) } -cXscatter2d7 <- function() { +cXscatter2d9 <- function() { library(canvasXpress) y=read.table(system.file("extdata", "cX-nonlinearfit-dat.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) canvasXpress( @@ -3282,7 +3391,7 @@ cXscatter2d7 <- function() { ) } -cXscatter2d8 <- function() { +cXscatter2d10 <- function() { library(canvasXpress) y=read.table(system.file("extdata", "cX-scatterR-dat.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) z=read.table(system.file("extdata", "cX-scatterR-var.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) @@ -3301,6 +3410,7 @@ cXscatter2d8 <- function() { legendInside=TRUE, legendPosition="bottomRight", plotBox=FALSE, + showConfidenceIntervals=FALSE, showDecorations=TRUE, showLoessFit=TRUE, showTransition=TRUE, @@ -3314,7 +3424,7 @@ cXscatter2d8 <- function() { ) } -cXscatter2d9 <- function() { +cXscatter2d11 <- function() { library(canvasXpress) y=read.table(system.file("extdata", "cX-scatterR2-dat.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) z=read.table(system.file("extdata", "cX-scatterR2-var.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) @@ -3343,7 +3453,7 @@ cXscatter2d9 <- function() { ) } -cXscatter2d10 <- function() { +cXscatter2d12 <- function() { library(canvasXpress) y=read.table(system.file("extdata", "cX-scatterR3-dat.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) z=read.table(system.file("extdata", "cX-scatterR3-var.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) @@ -3375,7 +3485,7 @@ cXscatter2d10 <- function() { ) } -cXscatter2d11 <- function() { +cXscatter2d13 <- function() { library(canvasXpress) y=read.table(system.file("extdata", "cX-scatterR4-dat.txt", package = "canvasXpress"), header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) canvasXpress( @@ -3441,7 +3551,7 @@ cXscatter3d3 <- function() { canvasXpress( data=y, graphType="Scatter3D", - showLoessConfidence=TRUE, + showConfidenceIntervals=TRUE, showLoessFit=TRUE, title="Loess Fit", xAxis=list("E"), @@ -4042,7 +4152,7 @@ cXvenn1 <- function() { library(canvasXpress) canvasXpress( vennData=data.frame(AC=456, A=340, ABC=552, ABCD=148, BC=915, ACD=298, BCD=613, B=562, CD=143, ABD=578, C=620, D=592, AB=639, BD=354, AD=257), - vennLegend=list(A="List 1", D="List 4", C="List 3", B="List 2"), + vennLegend=list(A="List 1", B="List 2", C="List 3", D="List 4"), graphType="Venn", showTransition=TRUE, vennGroups=4 @@ -4053,7 +4163,7 @@ cXvenn2 <- function() { library(canvasXpress) canvasXpress( vennData=data.frame(AC=456, A=340, ABC=552, ABCD=148, BC=915, ACD=298, BCD=613, B=562, CD=143, ABD=578, C=620, D=592, AB=639, BD=354, AD=257), - vennLegend=list(A="List 1", D="List 4", C="List 3", B="List 2"), + vennLegend=list(A="List 1", B="List 2", C="List 3", D="List 4"), graphType="Venn", showTransition=TRUE, vennGroups=3 @@ -4064,7 +4174,7 @@ cXvenn3 <- function() { library(canvasXpress) canvasXpress( vennData=data.frame(AC=456, A=340, ABC=552, ABCD=148, BC=915, ACD=298, BCD=613, B=562, CD=143, ABD=578, C=620, D=592, AB=639, BD=354, AD=257), - vennLegend=list(A="List 1", D="List 4", C="List 3", B="List 2"), + vennLegend=list(A="List 1", B="List 2", C="List 3", D="List 4"), graphType="Venn", vennGroups=2 ) diff --git a/tests/cX-test-setup.R b/tests/cX-ui-generated-test-setup.R similarity index 91% rename from tests/cX-test-setup.R rename to tests/cX-ui-generated-test-setup.R index 62ec0c20..1ab42bb7 100644 --- a/tests/cX-test-setup.R +++ b/tests/cX-ui-generated-test-setup.R @@ -1,7 +1,7 @@ if (interactive()) { library(dplyr) - webFile <- readLines(con = "https://canvasxpress.org/data/cX-function.R") + webFile <- readLines(con = "http://canvasxpress.org/data/cX-function.R") #grab url download links dataUrls <- data.frame(line = webFile, stringsAsFactors = F) %>% @@ -31,7 +31,7 @@ if (interactive()) { paste0('system.file("extdata", "', filename, '.txt", package = "canvasXpress")'), orig)) %>% mutate(new = gsub('\\$', '$', new, fixed = T)) - writeLines(pkgFile$new, "tests/cX-function.R") + writeLines(pkgFile$new, "tests/cX-ui-functions.R") message("Package must be rebuilt and reloaded in order to realize any new data files for testing") } else { diff --git a/tests/testthat/helper-functions.R b/tests/testthat/helper-functions.R new file mode 100644 index 00000000..9def26f3 --- /dev/null +++ b/tests/testthat/helper-functions.R @@ -0,0 +1,20 @@ +# helper functions for tests + +if (interactive()) { + library(testthat) + library(canvasXpress) + library(htmlwidgets) + + source("tests/cX-ui-functions.R") +} else { + library(htmlwidgets) + + source("../cX-ui-functions.R") +} + +check_ui_test <- function(result){ + if (interactive()) { print(result) } + + expect_s3_class(result, "canvasXpress") + expect_s3_class(result, "htmlwidget") +} diff --git a/tests/testthat/test-area.R b/tests/testthat/test-area.R deleted file mode 100644 index a503a28c..00000000 --- a/tests/testthat/test-area.R +++ /dev/null @@ -1,52 +0,0 @@ -context("canvasXpress Web Charts - Area") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXarea1", { - result <- cXarea1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXarea2", { - result <- cXarea2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXarea3", { - result <- cXarea3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXarea4", { - result <- cXarea4() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXarea5", { - result <- cXarea5() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - - -test_that("cXarea6", { - result <- cXarea6() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-arealine.R b/tests/testthat/test-arealine.R deleted file mode 100644 index 2981352f..00000000 --- a/tests/testthat/test-arealine.R +++ /dev/null @@ -1,27 +0,0 @@ -context("canvasXpress Web Charts - AreaLine") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXarealine1", { - result <- cXarealine1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXarealine2", { - result <- cXarealine2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXarealine3", { - result <- cXarealine3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-bar.R b/tests/testthat/test-bar.R deleted file mode 100644 index b2cb81e7..00000000 --- a/tests/testthat/test-bar.R +++ /dev/null @@ -1,75 +0,0 @@ -context("canvasXpress Web Charts - Bar") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXbar1", { - result <- cXbar1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXbar2", { - result <- cXbar2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXbar3", { - result <- cXbar3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXbar4", { - result <- cXbar4() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXbar5", { - result <- cXbar5() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXbar6", { - result <- cXbar6() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXbar7", { - result <- cXbar7() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXbar8", { - result <- cXbar8() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXbar9", { - result <- cXbar9() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-barline.R b/tests/testthat/test-barline.R deleted file mode 100644 index 101ce2d7..00000000 --- a/tests/testthat/test-barline.R +++ /dev/null @@ -1,26 +0,0 @@ -context("canvasXpress Web Charts - BarLine") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - -test_that("cXbarline1", { - result <- cXbarline1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXbarline2", { - result <- cXbarline2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXbarline3", { - result <- cXbarline3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-boxplot.R b/tests/testthat/test-boxplot.R deleted file mode 100644 index a6811b54..00000000 --- a/tests/testthat/test-boxplot.R +++ /dev/null @@ -1,133 +0,0 @@ -context("canvasXpress Web Charts - Boxplot") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXboxplot1", { - result <- cXboxplot1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXboxplot2", { - result <- cXboxplot2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXboxplot3", { - result <- cXboxplot3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXboxplot4", { - result <- cXboxplot4() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXboxplot5", { - result <- cXboxplot5() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXboxplot6", { - result <- cXboxplot6() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXboxplot7", { - result <- cXboxplot7() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXboxplot8", { - result <- cXboxplot8() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXboxplot9", { - result <- cXboxplot9() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXboxplot10", { - result <- cXboxplot10() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXboxplot11", { - result <- cXboxplot11() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXboxplot12", { - result <- cXboxplot12() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXboxplot13", { - result <- cXboxplot13() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXboxplot14", { - result <- cXboxplot14() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXboxplot15", { - result <- cXboxplot15() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXboxplot16", { - result <- cXboxplot16() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - - diff --git a/tests/testthat/test-bubble.R b/tests/testthat/test-bubble.R deleted file mode 100644 index 806ae779..00000000 --- a/tests/testthat/test-bubble.R +++ /dev/null @@ -1,27 +0,0 @@ -context("canvasXpress Web Charts - Bubble") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXbubble1", { - result <- cXbubble1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXbubble2", { - result <- cXbubble2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXbubble3", { - result <- cXbubble3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-candlestick.R b/tests/testthat/test-candlestick.R deleted file mode 100644 index 30d5d583..00000000 --- a/tests/testthat/test-candlestick.R +++ /dev/null @@ -1,11 +0,0 @@ -context("canvasXpress Web Charts - Candlestick") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXcandlestick1", { - warning("candlestick - plot function missing") -}) - -test_that("cXcandlestick2", { - warning("candlestick - plot function missing") -}) diff --git a/tests/testthat/test-chord.R b/tests/testthat/test-chord.R deleted file mode 100644 index 298611fe..00000000 --- a/tests/testthat/test-chord.R +++ /dev/null @@ -1,27 +0,0 @@ -context("canvasXpress Web Charts - Chord") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXchord1", { - result <- cXchord1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXchord2", { - result <- cXchord2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXchord3", { - result <- cXchord3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-circular.R b/tests/testthat/test-circular.R deleted file mode 100644 index c895b3ec..00000000 --- a/tests/testthat/test-circular.R +++ /dev/null @@ -1,59 +0,0 @@ -context("canvasXpress Web Charts - Circular") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXcircular1", { - result <- cXcircular1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXcircular2", { - result <- cXcircular2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXcircular3", { - result <- cXcircular3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXcircular4", { - result <- cXcircular4() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXcircular5", { - result <- cXcircular5() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXcircular6", { - result <- cXcircular6() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXcircular7", { - result <- cXcircular7() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-contour.R b/tests/testthat/test-contour.R deleted file mode 100644 index c3a5eb60..00000000 --- a/tests/testthat/test-contour.R +++ /dev/null @@ -1,11 +0,0 @@ -context("canvasXpress Web Charts - Contour") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXcontour1", { - result <- cXcontour1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-correlation.R b/tests/testthat/test-correlation.R deleted file mode 100644 index 69331755..00000000 --- a/tests/testthat/test-correlation.R +++ /dev/null @@ -1,20 +0,0 @@ -context("canvasXpress Web Charts - Correlation") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXcorrelation1", { - result <- cXcorrelation1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXcorrelation2", { - result <- cXcorrelation2() - if (interactive()) { print(result) } - - warning('no legend showing') - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-density.R b/tests/testthat/test-density.R deleted file mode 100644 index 4ed8a500..00000000 --- a/tests/testthat/test-density.R +++ /dev/null @@ -1,67 +0,0 @@ -context("canvasXpress Web Charts - Density") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXdensity1", { - result <- cXdensity1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXdensity2", { - result <- cXdensity2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXdensity3", { - result <- cXdensity3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXdensity4", { - result <- cXdensity4() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXdensity5", { - result <- cXdensity5() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXdensity6", { - result <- cXdensity6() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXdensity7", { - result <- cXdensity7() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXdensity8", { - result <- cXdensity8() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-donnut.R b/tests/testthat/test-donnut.R deleted file mode 100644 index 1d113191..00000000 --- a/tests/testthat/test-donnut.R +++ /dev/null @@ -1,19 +0,0 @@ -context("canvasXpress Web Charts - Donnut") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXdonut1", { - result <- cXdonnut1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXdonut2", { - result <- cXdonnut2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-dotline.R b/tests/testthat/test-dotline.R deleted file mode 100644 index d43b27d1..00000000 --- a/tests/testthat/test-dotline.R +++ /dev/null @@ -1,27 +0,0 @@ -context("canvasXpress Web Charts - DotLine") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXdotline1", { - result <- cXdotline1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXdotline2", { - result <- cXdotline2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXdotline3 ", { - result <- cXdotline3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-dotplot.R b/tests/testthat/test-dotplot.R deleted file mode 100644 index 4a13d7dc..00000000 --- a/tests/testthat/test-dotplot.R +++ /dev/null @@ -1,84 +0,0 @@ -context("canvasXpress Web Charts - Dotplot") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXdotplot1", { - result <- cXdotplot1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXdotplot2", { - result <- cXdotplot2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXdotplot3", { - result <- cXdotplot3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXdotplot4", { - result <- cXdotplot4() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXdotplot5", { - result <- cXdotplot5() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXdotplot6", { - result <- cXdotplot6() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXdotplot7", { - result <- cXdotplot7() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXdotplot8", { - result <- cXdotplot8() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXdotplot9", { - result <- cXdotplot9() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXdotplot10", { - result <- cXdotplot10() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - diff --git a/tests/testthat/test-genome.R b/tests/testthat/test-genome.R deleted file mode 100644 index 94ac7427..00000000 --- a/tests/testthat/test-genome.R +++ /dev/null @@ -1,11 +0,0 @@ -context("canvasXpress Web Charts - Genome") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXgenome1", { - warning("genome - plot function missing") -}) - -test_that("cXgenome1", { - warning("genome - plot function missing") -}) diff --git a/tests/testthat/test-heatmap.R b/tests/testthat/test-heatmap.R deleted file mode 100644 index 55ae4c22..00000000 --- a/tests/testthat/test-heatmap.R +++ /dev/null @@ -1,101 +0,0 @@ -context("canvasXpress Web Charts - Heatmap") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXheatmap1", { - result <- cXheatmap1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXheatmap2", { - result <- cXheatmap2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXheatmap3", { - result <- cXheatmap3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXheatmap4", { - result <- cXheatmap4() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXheatmap5", { - result <- cXheatmap5() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXheatmap6", { - result <- cXheatmap6() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXheatmap7", { - result <- cXheatmap7() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXheatmap8", { - result <- cXheatmap8() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXheatmap9", { - result <- cXheatmap9() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXheatmap10", { - result <- cXheatmap10() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXheatmap11", { - result <- cXheatmap11() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXheatmap12", { - result <- cXheatmap12() - if (interactive()) { print(result) } - - message('middle section too small at default height - working as designed') - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - diff --git a/tests/testthat/test-histogram.R b/tests/testthat/test-histogram.R deleted file mode 100644 index cb7f1061..00000000 --- a/tests/testthat/test-histogram.R +++ /dev/null @@ -1,27 +0,0 @@ -context("canvasXpress Web Charts - Histogram") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXhistogram1", { - result <- cXhistogram1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXhistogram2", { - result <- cXhistogram2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXhistogram3", { - result <- cXhistogram3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-kaplanmeier.R b/tests/testthat/test-kaplanmeier.R deleted file mode 100644 index 9f2f558f..00000000 --- a/tests/testthat/test-kaplanmeier.R +++ /dev/null @@ -1,19 +0,0 @@ -context("canvasXpress Web Charts - Kaplanmeier") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXkaplanmeier1", { - result <- cXkaplanmeier1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXkaplanmeier2", { - result <- cXkaplanmeier2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-layout.R b/tests/testthat/test-layout.R deleted file mode 100644 index 262143d7..00000000 --- a/tests/testthat/test-layout.R +++ /dev/null @@ -1,80 +0,0 @@ -context("canvasXpress Web Charts - Layout") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXlayout1", { - result <- cXlayout1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXlayout2", { - result <- cXlayout2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXlayout3", { - result <- cXlayout3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXlayout4", { - result <- cXlayout4() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - - -test_that("cXlayout5", { - result <- cXlayout5() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - - -test_that("cXlayout6", { - result <- cXlayout6() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXlayout7", { - result <- cXlayout7() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - - -test_that("cXlayout8", { - result <- cXlayout8() - if (interactive()) { print(result) } - - warning("grouping results in different layout order") - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXlayout9", { - result <- cXlayout9() - if (interactive()) { print(result) } - - message('middle section too small at default height - working as designed') - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-line.R b/tests/testthat/test-line.R deleted file mode 100644 index 29904e80..00000000 --- a/tests/testthat/test-line.R +++ /dev/null @@ -1,27 +0,0 @@ -context("canvasXpress Web Charts - Line") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXline1", { - result <- cXline1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXline2", { - result <- cXline2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXline3", { - result <- cXline3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-map.R b/tests/testthat/test-map.R deleted file mode 100644 index 5576a270..00000000 --- a/tests/testthat/test-map.R +++ /dev/null @@ -1,43 +0,0 @@ -context("canvasXpress Web Charts - Map") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXmap1", { - result <- cXmap1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXmap2", { - result <- cXmap2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXmap3", { - result <- cXmap3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXmap4", { - result <- cXmap4() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXmap5", { - result <- cXmap5() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-network.R b/tests/testthat/test-network.R deleted file mode 100644 index 7ab05d98..00000000 --- a/tests/testthat/test-network.R +++ /dev/null @@ -1,56 +0,0 @@ -context("canvasXpress Web Charts - Network") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXnetwork1", { - result <- cXnetwork1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXnetwork2", { - result <- cXnetwork2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - - -test_that("cXnetwork3", { - result <- cXnetwork3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - - -test_that("cXnetwork4", { - result <- cXnetwork4() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXnetwork5", { - result <- cXnetwork5() - if (interactive()) { print(result) } - - warning('some lines missing, cross-domain download issue') - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXnetwork6", { - result <- cXnetwork6() - if (interactive()) { print(result) } - - warning('coloring off from web example, cross-domain download issue') - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - diff --git a/tests/testthat/test-nonlinearfit.R b/tests/testthat/test-nonlinearfit.R deleted file mode 100644 index 452a1169..00000000 --- a/tests/testthat/test-nonlinearfit.R +++ /dev/null @@ -1,19 +0,0 @@ -context("canvasXpress Web Charts - Nonlinearfit") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXnonlinearfit1", { - result <- cXnonlinearfit1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXnonlinearfit2", { - result <- cXnonlinearfit2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-oncoprint.R b/tests/testthat/test-oncoprint.R deleted file mode 100644 index fefbb0da..00000000 --- a/tests/testthat/test-oncoprint.R +++ /dev/null @@ -1,27 +0,0 @@ -context("canvasXpress Web Charts - Oncoprint") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXoncoprint1", { - result <- cXoncoprint1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXoncoprint2", { - result <- cXoncoprint2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXoncoprint3", { - result <- cXoncoprint3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test--BASE.R b/tests/testthat/test-other--BASE.R similarity index 93% rename from tests/testthat/test--BASE.R rename to tests/testthat/test-other--BASE.R index e67e69b7..dafe5671 100644 --- a/tests/testthat/test--BASE.R +++ b/tests/testthat/test-other--BASE.R @@ -12,11 +12,11 @@ data1.smp <- data.frame(a = c(30:32), b = c(40:42)) test_that("Object Structure Tests", { testobj <- canvasXpress(data = data1.df) - + expect_equal(testobj$width, 600) expect_equal(testobj$height, 400) expect_equivalent(class(testobj), c("canvasXpress", "htmlwidget")) - + expect_true("data" %in% names(testobj$x)) expect_true("config" %in% names(testobj$x)) expect_true("isR" %in% names(testobj$x$config)) @@ -36,13 +36,13 @@ test_that("Correct Data Types", { # Negative Tests test_that("Missing Data", { - expect_error(canvasXpress(data = NULL), + expect_error(canvasXpress(data = NULL), regexp = "data cannot be NULL!") }) test_that("Incorrect Data Types", { - expect_error(canvasXpress(data = "Test"), - regexp = "data must be a data.frame, matrix, or named list") + expect_error(canvasXpress(data = "'Test'"), + regexp = "[Couldn\'t|Could not] resolve host[ \'Test\'|: Test]") expect_error(canvasXpress(data = c(1, 2, 3)), regexp = "data must be a data.frame, matrix, or named list") }) @@ -65,7 +65,7 @@ test_that("Name mismatches", { regexp = "Row names in smpAnnot are different from column names in data") expect_silent(canvasXpress(data = data1.df, smpAnnot = data1.smp)) - + expect_error(canvasXpress(data = data1.df, varAnnot = data1.smp), regexp = "Row names in varAnnot are different from row names in data") diff --git a/tests/testthat/test-bar2.R b/tests/testthat/test-other-bar-data-types.R similarity index 100% rename from tests/testthat/test-bar2.R rename to tests/testthat/test-other-bar-data-types.R diff --git a/tests/testthat/test-other-custom-events.R b/tests/testthat/test-other-custom-events.R new file mode 100644 index 00000000..ac777dc6 --- /dev/null +++ b/tests/testthat/test-other-custom-events.R @@ -0,0 +1,32 @@ +context("canvasXpress customEvents") + + +test_that("Barplot customEvents", { + + y <- read.table(system.file("extdata", "cX-generic-dat.txt", package = "canvasXpress"),, header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + x <- read.table(system.file("extdata", "cX-generic-smp.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + z <- read.table(system.file("extdata", "cX-generic-var.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + + events <- heatmap_events <- JS("{ 'mousemove' : function(o, e, t) { + if (o.objectType == null) { + t.showInfoSpan(e, '' + o.y.vars[0] + '
' + + 'Sample:' + o.y.smps[0] + '
' + + 'Value:' + o.y.data[0][0]); + } + else { + t.showInfoSpan(e, o.display); + }; + }}") + result <- canvasXpress( + data = y, + smpAnnot = x, + varAnnot = z, + graphType = "Bar", + scatterType = "bar", + is3DPlot = TRUE, + title = "Barplot - customEvents", + events = events + ) + + check_ui_test(result) +}) diff --git a/tests/testthat/test-other-decorations.R b/tests/testthat/test-other-decorations.R new file mode 100644 index 00000000..a7812267 --- /dev/null +++ b/tests/testthat/test-other-decorations.R @@ -0,0 +1,60 @@ +context("canvasXpress decorations") + +data_y <- read.table(system.file("extdata", "cX-scatterR2-dat.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) +data_z <- read.table(system.file("extdata", "cX-scatterR2-var.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + +test_that("scatterplot referenceLines", { + + result <- canvasXpress( + data = data_y, + varAnnot = data_z, + colorBy = "Group", + colors = list("rgba(0,104,139,0.5)", "rgba(205,0,0,0.5)", "rgba(64,64,64,0.5)"), + graphType = "Scatter2D", + plotBox = FALSE, + showDecorations = TRUE, + sizeBy = "FC", + sizes = list(4, 14, 16, 18), + xAxis = list("logFC"), + yAxis = list("-log-pVal"), + showLegend = FALSE, + title = "Scatterplot - referenceLines", + decorations = list(line = list(list(color = "rgba(205,0,0,0.5)", width = 2, x = 0.5), list(color = "rgba(0,104,139,0.5)", width = 2, x = -0.5))) + ) + check_ui_test(result) +}) + +test_that("scatterplot notePoint", { + + result <- canvasXpress( + data = data_y, + varAnnot = data_z, + colorBy = "Group", + colors = list("rgba(0,104,139,0.5)", "rgba(205,0,0,0.5)", "rgba(64,64,64,0.5)"), + graphType = "Scatter2D", + plotBox = FALSE, + showDecorations = TRUE, + sizeBy = "FC", + sizes = list(4, 14, 16, 18), + xAxis = list("logFC"), + yAxis = list("-log-pVal"), + showLegend = FALSE, + title = "Scatterplot - notePoint", + decorations = list(marker = list(list(sample = list("logFC", "-log-pVal"), text = "Maybe an Outlier?", variable = "Gene30", x = 0.11, y = 0.45))) + ) + + check_ui_test(result) +}) + +test_that("barplot annotations", { + + y <- read.table(system.file("extdata", "cX-basic2-dat.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + result <- canvasXpress( + data = y, + graphType = "Bar", + graphOrientation = "vertical", + title = "Barplot - annotations", + decorations = list(marker=list(list(fontSize=12, sample="Sample1", text="p < 0.01 ***", type="annotation", variable="Variable1"), list(fontSize=12, sample="Sample2", text="p < 0.05 **", type="annotation", variable="Variable1"))) + ) + check_ui_test(result) +}) diff --git a/tests/testthat/test-other-legend-position.R b/tests/testthat/test-other-legend-position.R new file mode 100644 index 00000000..15fde48f --- /dev/null +++ b/tests/testthat/test-other-legend-position.R @@ -0,0 +1,179 @@ +context("canvasXpress LegendPosition") + +default_legend_position <- "right" +all_legend_positions <- c("topRight", "right", "bottomRight", "bottom", "bottomLeft", "left", "topLeft", "top") +inside_legend_only_positions <- c("topRight", "bottomRight", "bottomLeft", "topLeft") +segregated_legend_positions <- c("right", "bottom", "left", "top") +test_legend_positions <- setdiff(all_legend_positions, default_legend_position) + +barplot_y <- read.table(system.file("extdata", "cX-basic-dat.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) +boxplot_y <- read.table(system.file("extdata", "cX-toothgrowth-dat.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) +boxplot_x <- read.table(system.file("extdata", "cX-toothgrowth-smp.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + +print_legend_pos_warning <- function() { + warning(paste("Legend position not set correctly for :", paste(c("topLeft", "bottomLeft", "bottomRight", "topRight"), collapse = ","))) +} + +test_that("scatterplot legendposition", { + + y <- read.table(system.file("extdata", "cX-mtcars-dat.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + legend_inside <- FALSE + for (legend_pos in test_legend_positions) { + result <- canvasXpress( + data = y, + asSampleFactors = list("cyl"), + colorBy = "cyl", + graphType = "Scatter2D", + stringVariableFactors = list("cyl"), + title = paste("Scatterplot - LegendPosition", legend_pos), + legendPosition = legend_pos, + legendInside = ifelse(legend_pos %in% inside_legend_only_positions, TRUE, legend_inside) + ) + check_ui_test(result) + } +}) + +test_that("barplot legendposition", { + + legend_inside <- FALSE + for (legend_pos in test_legend_positions) { + result <- canvasXpress( + data = barplot_y, + graphOrientation = "vertical", + graphType = "Bar", + title = paste("Barplot - LegendPosition", legend_pos), + legendPosition = legend_pos, + legendInside = ifelse(legend_pos %in% inside_legend_only_positions, TRUE, legend_inside) + ) + check_ui_test(result) + } +}) + +test_that("barplot (segregated) legendposition", { + + z <- data.frame(Plot = "Bar1", stringsAsFactors = F) + rownames(z) <- rownames(barplot_y) + legend_inside <- FALSE + for (legend_pos in segregated_legend_positions) { + result <- canvasXpress( + data = barplot_y, + varAnnot = z, + graphOrientation = "vertical", + graphType = "Bar", + segregateVariablesBy = list("Plot"), + title = paste("Barplot (segregated) - LegendPosition", legend_pos), + legendPosition = legend_pos, + legendInside = ifelse(legend_pos %in% inside_legend_only_positions, TRUE, legend_inside) + ) + check_ui_test(result) + } +}) + +test_that("boxplot legendposition", { + + legend_inside <- FALSE + for (legend_pos in test_legend_positions) { + result <- canvasXpress( + data = boxplot_y, + smpAnnot = boxplot_x, + colorBy = "dose", + graphOrientation = "vertical", + graphType = "Boxplot", + groupingFactors = list("dose"), + showLegend = TRUE, + smpTitle = "dose", + stringSampleFactors = list("dose"), + title = paste("Boxplot - LegendPosition", legend_pos), + legendPosition = legend_pos, + legendInside = ifelse(legend_pos %in% inside_legend_only_positions, TRUE, legend_inside) + ) + check_ui_test(result) + } +}) + +test_that("boxplot (segregated) legendposition", { + + z <- data.frame(Plot = "Box1", stringsAsFactors = F) + rownames(z) <- rownames(boxplot_y) + legend_inside <- FALSE + for (legend_pos in segregated_legend_positions) { + result <- canvasXpress( + data = boxplot_y, + smpAnnot = boxplot_x, + varAnnot = z, + colorBy = "dose", + graphOrientation = "vertical", + graphType = "Boxplot", + segregateVariablesBy = list("Plot"), + groupingFactors = list("dose"), + showLegend = TRUE, + smpTitle = "dose", + stringSampleFactors = list("dose"), + title = paste("Boxplot (segregated) - LegendPosition", legend_pos), + legendPosition = legend_pos, + legendInside = ifelse(legend_pos %in% inside_legend_only_positions, TRUE, legend_inside) + ) + check_ui_test(result) + } +}) + +test_that("Scatterplot matrix legendposition", { + + y <- read.table(system.file("extdata", "cX-irist-dat.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + z <- read.table(system.file("extdata", "cX-irist-var.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + legend_inside <- FALSE + for (legend_pos in segregated_legend_positions) { + result <- canvasXpress( + data = y, + varAnnot = z, + colorBy = "Species", + graphType = "Scatter2D", + scatterPlotMatrix = TRUE, + title = paste("Scatterplot matrix - LegendPosition", legend_pos), + legendPosition = legend_pos, + legendInside = ifelse(legend_pos %in% inside_legend_only_positions, TRUE, legend_inside) + ) + check_ui_test(result) + } +}) + +test_that("dotplot legendposition", { + + y <- read.table(system.file("extdata", "cX-iris-dat.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + x <- read.table(system.file("extdata", "cX-iris-smp.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + + legend_inside <- TRUE + for (legend_pos in test_legend_positions) { + result <- canvasXpress( + data = y, + smpAnnot = x, + graphOrientation = "vertical", + graphType = "Dotplot", + afterRender = list(list("groupSamples", list("Species"))), + title = paste("Dotplot - LegendPosition", legend_pos), + legendPosition = legend_pos, + legendInside = ifelse(legend_pos %in% inside_legend_only_positions, TRUE, legend_inside) + ) + check_ui_test(result) + } +}) + +test_that("heatmap legendposition", { + + y <- read.table(system.file("extdata", "cX-multidimensionalheatmap-dat.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + y2 <- read.table(system.file("extdata", "cX-multidimensionalheatmap-dat3.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + + legend_inside <- FALSE + for (legend_pos in test_legend_positions) { + result <- canvasXpress( + data = list(y = y, data2 = y2), + shapeBy = "Shape", + shapeByData = "data2", + graphType = "Heatmap", + title = paste("Heatmap - LegendPosition", legend_pos), + legendPosition = legend_pos, + legendInside = ifelse(legend_pos %in% inside_legend_only_positions, TRUE, legend_inside) + ) + check_ui_test(result) + } +}) diff --git a/tests/testthat/test-other-legend-title.R b/tests/testthat/test-other-legend-title.R new file mode 100644 index 00000000..47ae8eee --- /dev/null +++ b/tests/testthat/test-other-legend-title.R @@ -0,0 +1,144 @@ +context("canvasXpress legendTitle") + +barplot_y <- read.table(system.file("extdata", "cX-simple-dat.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) +barplot_x <- read.table(system.file("extdata", "cX-simple-smp.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) +boxplot_y <- read.table(system.file("extdata", "cX-toothgrowth-dat.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) +boxplot_x <- read.table(system.file("extdata", "cX-toothgrowth-smp.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + +get_plot_title <- function(plot) { + paste(plot, "- No LegendTitle") +} + +test_that("scatterplot LegendTitle", { + + y = read.table(system.file("extdata", "cX-scatterR3-dat.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + z = read.table(system.file("extdata", "cX-scatterR3-var.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + result <- canvasXpress( + data = y, + varAnnot = z, + colorBy = "Group", + graphType = "Scatter2D", + title = get_plot_title("Scatterplot"), + showLegendTitle = FALSE + ) + check_ui_test(result) +}) + +test_that("barplot LegendTitle", { + + result <- canvasXpress( + data = barplot_y, + smpAnnot = barplot_x, + colorBy = "Drug Sensitivity", + graphOrientation = "vertical", + graphType = "Bar", + title = get_plot_title("Barplot"), + showLegendTitle = FALSE + ) + check_ui_test(result) +}) + +test_that("barplot (segregated) LegendTitle", { + + z <- data.frame(Plot = "Bar1", stringsAsFactors = F) + rownames(z) <- rownames(barplot_y) + result <- canvasXpress( + data = barplot_y, + smpAnnot = barplot_x, + varAnnot = z, + colorBy = "Drug Sensitivity", + graphOrientation = "vertical", + graphType = "Bar", + segregateVariablesBy = list("Plot"), + title = get_plot_title("Barplot (segregated)"), + showLegendTitle = FALSE + ) + check_ui_test(result) +}) + +test_that("boxplot LegendTitle", { + + result <- canvasXpress( + data = boxplot_y, + smpAnnot = boxplot_x, + colorBy = "dose", + graphOrientation = "vertical", + graphType = "Boxplot", + groupingFactors = list("dose"), + showLegend = TRUE, + smpTitle = "dose", + stringSampleFactors = list("dose"), + title = get_plot_title("Boxplot"), + showLegendTitle = FALSE + ) + check_ui_test(result) +}) + +test_that("boxplot (segregated) LegendTitle", { + + z <- data.frame(Plot = "Box1", stringsAsFactors = F) + rownames(z) <- rownames(boxplot_y) + result <- canvasXpress( + data = boxplot_y, + smpAnnot = boxplot_x, + varAnnot = z, + colorBy = "dose", + graphOrientation = "vertical", + graphType = "Boxplot", + segregateVariablesBy = list("Plot"), + groupingFactors = list("dose"), + showLegend = TRUE, + smpTitle = "dose", + stringSampleFactors = list("dose"), + title = get_plot_title("Boxplot (segregated)"), + showLegendTitle = FALSE + ) + check_ui_test(result) +}) + +test_that("Scatterplot matrix LegendTitle", { + + y <- read.table(system.file("extdata", "cX-irist-dat.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + z <- read.table(system.file("extdata", "cX-irist-var.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + result <- canvasXpress( + data = y, + varAnnot = z, + colorBy = "Species", + graphType = "Scatter2D", + scatterPlotMatrix = TRUE, + title = get_plot_title("Scatterplot matrix"), + showLegendTitle = FALSE + ) + check_ui_test(result) +}) + +test_that("dotplot LegendTitle", { + + result <- canvasXpress( + data = boxplot_y, + smpAnnot = boxplot_x, + colorBy = "dose", + stringSampleFactors = list("dose"), + groupingFactors = list("supp"), + graphOrientation = "vertical", + graphType = "Dotplot", + title = get_plot_title("Dotplot"), + showLegendTitle = FALSE + ) + check_ui_test(result) +}) + +test_that("heatmap LegendTitle", { + + y <- read.table(system.file("extdata", "cX-multidimensionalheatmap-dat.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + y2 <- read.table(system.file("extdata", "cX-multidimensionalheatmap-dat3.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + result <- canvasXpress( + data = list(y = y, data2 = y2), + shapeBy = "Shape", + shapeByData = "data2", + graphType = "Heatmap", + title = get_plot_title("Heatmap"), + showLegendTitle = FALSE + ) + check_ui_test(result) +}) diff --git a/tests/testthat/test-network2.R b/tests/testthat/test-other-network-data-types.R similarity index 90% rename from tests/testthat/test-network2.R rename to tests/testthat/test-other-network-data-types.R index 85f763ea..356e3d3b 100644 --- a/tests/testthat/test-network2.R +++ b/tests/testthat/test-other-network-data-types.R @@ -9,11 +9,8 @@ test_that("network as data list items", { edgeWidth = 2, graphType = "Network", nodeSize = 30) - - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") + + check_ui_test(result) }) test_that("network data requires both nodes and edges", { @@ -29,11 +26,11 @@ test_that("network data requires both nodes and edges", { }) test_that("network data types", { - expect_error(canvasXpress(nodeData = 2, + expect_error(canvasXpress(nodeData = 2, edgeData = e, graphType = "Network"), regexp = "nodeData must be a data.frame or matrix") - expect_error(canvasXpress(nodeData = n, + expect_error(canvasXpress(nodeData = n, edgeData = 2, graphType = "Network"), regexp = "edgeData must be a data.frame or matrix") diff --git a/tests/testthat/test-boxplot2.R b/tests/testthat/test-other-precalculated-boxplot.R similarity index 74% rename from tests/testthat/test-boxplot2.R rename to tests/testthat/test-other-precalculated-boxplot.R index 398dff9f..48b8a011 100644 --- a/tests/testthat/test-boxplot2.R +++ b/tests/testthat/test-other-precalculated-boxplot.R @@ -19,14 +19,11 @@ test_that("precalculated boxplot - dataframe data", { smpLabelFontStyle = "italic", smpLabelRotate = 90, showLegend = FALSE, - title = "US Arrests by Type", + title = "Precalculated boxplot - data without smpAnnot", titleScaleFontFactor = 0.5) - - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") - + + check_ui_test(result) + result <- canvasXpress(data = precalc.data, smpAnnot = precalc.data["type", ], graphType = "Boxplot", @@ -34,13 +31,10 @@ test_that("precalculated boxplot - dataframe data", { smpLabelFontStyle = "italic", smpLabelRotate = 90, showLegend = FALSE, - title = "US Arrests by Type", + title = "Precalculated boxplot - data with smpAnnot", titleScaleFontFactor = 0.5) - - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") + + check_ui_test(result) }) test_that("precalculated boxplot - list data", { @@ -51,14 +45,11 @@ test_that("precalculated boxplot - list data", { smpLabelFontStyle = "italic", smpLabelRotate = 90, showLegend = FALSE, - title = "US Arrests by Type", + title = "Precalculated boxplot - list data", titleScaleFontFactor = 0.5) - - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") - + + check_ui_test(result) + # with smpAnnot data result <- canvasXpress(data = precalc.data.l, smpAnnot = precalc.data["type",], @@ -67,14 +58,11 @@ test_that("precalculated boxplot - list data", { smpLabelFontStyle = "italic", smpLabelRotate = 90, showLegend = FALSE, - title = "US Arrests by Type", + title = "Precalculated boxplot - list data with smpAnnot", titleScaleFontFactor = 0.5) - - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") - + + check_ui_test(result) + # without smpAnnot result <- canvasXpress(data = precalc.data.l, graphType = "Boxplot", @@ -82,12 +70,9 @@ test_that("precalculated boxplot - list data", { smpLabelFontStyle = "italic", smpLabelRotate = 90, showLegend = FALSE, - title = "US Arrests by Type", + title = "Precalculated boxplot - list data without smpAnnot", titleScaleFontFactor = 0.5) - - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") + + check_ui_test(result) }) diff --git a/tests/testthat/test-other-regression-lines.R b/tests/testthat/test-other-regression-lines.R new file mode 100644 index 00000000..e45f2866 --- /dev/null +++ b/tests/testthat/test-other-regression-lines.R @@ -0,0 +1,69 @@ +context("canvasXpress regressionLines") + +y = read.table(system.file("extdata", "cX-ageheightt-dat.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) +x = read.table(system.file("extdata", "cX-ageheightt-smp.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + +test_that("scatterplot overall regressionLine", { + + result <- canvasXpress( + data = y, + smpAnnot = x, + graphType = "Scatter2D", + title = "Scatterplot - regressionLine", + afterRender = list(list("addRegressionLine")) + ) + check_ui_test(result) +}) + +test_that("scatterplot per-sample regressionLine", { + + y = read.table(system.file("extdata", "cX-mtcars-dat.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + result <- canvasXpress( + data = y, + asSampleFactors = list("cyl"), + colorBy = "cyl", + graphType = "Scatter2D", + title = "Scatterplot - per sample regressionLine", + showRegressionFullRange = TRUE, + stringVariableFactors = list("cyl"), + xAxis = list("wt"), + yAxis = list("mpg"), + afterRender = list(list("addRegressionLine", list("cyl"))) + ) + check_ui_test(result) +}) + + +data_y = read.table(system.file("extdata", "cX-irist-dat.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) +data_z = read.table(system.file("extdata", "cX-irist-var.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + +test_that("scatterplot per variable regressionLine", { + + result <- canvasXpress( + data = data_y, + varAnnot = data_z, + colorBy = "Species", + graphType = "Scatter2D", + title = "Scatterplot - per variable regressionLine", + showRegressionFullRange = TRUE, + scatterPlotMatrix = TRUE, + afterRender = list(list("addRegressionLine")) + ) + check_ui_test(result) +}) + +test_that("scatterplot per variable and sample regressionLine", { + + result <- canvasXpress( + data = data_y, + varAnnot = data_z, + colorBy = "Species", + graphType = "Scatter2D", + title = "Scatterplot - per variable and sample regressionLine", + showRegressionFullRange = TRUE, + scatterPlotMatrix = TRUE, + afterRender = list(list("addRegressionLine", list("Species"))) + ) + check_ui_test(result) +}) + diff --git a/tests/testthat/test-other-resizable.R b/tests/testthat/test-other-resizable.R new file mode 100644 index 00000000..2d1a824d --- /dev/null +++ b/tests/testthat/test-other-resizable.R @@ -0,0 +1,76 @@ +context("canvasXpress resizable") + + +y <- read.table("http://www.canvasxpress.org/data/cX-mtcars-dat.txt", header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + +test_that("scatterplot resizable", { + + result <- canvasXpress( + data = y, + asSampleFactors = list("cyl"), + colorBy = "cyl", + graphType = "Scatter2D", + stringVariableFactors = list("cyl"), + title = "Scatterplot - resizable", + resizable = TRUE + ) + check_ui_test(result) +}) + +test_that("scatterplot resizable width", { + + result <- canvasXpress( + data = y, + asSampleFactors = list("cyl"), + colorBy = "cyl", + graphType = "Scatter2D", + stringVariableFactors = list("cyl"), + title = "Scatterplot - resizable width", + resizableX = TRUE, + resizableY = FALSE + ) + check_ui_test(result) +}) + +test_that("scatterplot resizable height", { + + result <- canvasXpress( + data = y, + asSampleFactors = list("cyl"), + colorBy = "cyl", + graphType = "Scatter2D", + stringVariableFactors = list("cyl"), + title = "Scatterplot - resizable height", + resizableY = TRUE, + resizableX = FALSE + ) + check_ui_test(result) +}) + +test_that("scatterplot not resizable", { + + result <- canvasXpress( + data = y, + asSampleFactors = list("cyl"), + colorBy = "cyl", + graphType = "Scatter2D", + stringVariableFactors = list("cyl"), + title = "Scatterplot - not resizable", + resizable = FALSE + ) + check_ui_test(result) +}) + +test_that("bar chart not resizable", { + + y <- read.table(system.file("extdata", "cX-basic-dat.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + result <- canvasXpress( + data = y, + graphOrientation = "vertical", + graphType = "Bar", + title = "Barplot - not resizable", + resizable = FALSE + ) + check_ui_test(result) +}) + diff --git a/tests/testthat/test-layout2.R b/tests/testthat/test-other-segregation-layout-change.R similarity index 82% rename from tests/testthat/test-layout2.R rename to tests/testthat/test-other-segregation-layout-change.R index ca453672..7a1cd8cf 100644 --- a/tests/testthat/test-layout2.R +++ b/tests/testthat/test-other-segregation-layout-change.R @@ -10,14 +10,11 @@ test_that("segregation layout change - Samples", { smpAnnot = x, varAnnot = z, graphType = "Bar", + title = "Layout 1X3", segregateSamplesBy = list("Factor1"), layoutTopology = "1X3" ) - - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") + check_ui_test(result) }) test_that("segregation layout change - Variables", { @@ -25,12 +22,12 @@ test_that("segregation layout change - Variables", { smpAnnot = x, varAnnot = z, graphType = "Bar", + legendPosition = "top", + legendColumns = 4, + title = "Layout 4X1", segregateVariablesBy = list("Annt1"), layoutTopology = "4X1" ) - - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") + + check_ui_test(result) }) diff --git a/tests/testthat/test-other-selected-data-points.R b/tests/testthat/test-other-selected-data-points.R new file mode 100644 index 00000000..4b3e6e11 --- /dev/null +++ b/tests/testthat/test-other-selected-data-points.R @@ -0,0 +1,37 @@ +context("canvasXpress selectedDataPoints") + +vals = c(19.18,23.34,6.57,5.61,3.26,9.28,19.97,24.34,1.04,17.93,14.24,21.52,11.16,12.63,26.37,11.32,3.18,27.27,2.09,25.56,7.88,23.12,7.42,7.87,2.09,16.44,10.91,6.67,8.29,28.66,20.51,22.63,16.79,27.28,15.12,14.97,10.66,25.44,6.86,10.31,9.25,4.13,9.89,6.22,18.44,21.07,28.01,5.47,27.52,2.29,4.88,12.91,24.73,28.34,16.9,22.99,3.5,23.15,8.75,26.05,15.35,21.66,23.64,5.14,17.39,7.95,4.2,7.62,18.64,24.2,4,11.37,20.8,18.21,25.81,5.67,5.91,17.64,18.47,6.77,26.51,14.88,4.45,8.1,6.55,10.62,2.06,5.16,8.95,20.07,22.37,11.1,17.79,13.85,28.74,6.9,19.27,17.54,27.04,22.28,17.17,5.91,6.57,11.28,11.15,11.79,11.55,26.44,21.61,1.65,7.44,19.7,21.24,21.82,17.72,25.98,25.25,27.35,27.55,1.39,4.25,9.61,17.9,16.08,11.83,2.47,18.51,17.87,22.75,23.21,11.4,6.41,13.85,4.09,21.11,2.09,7.6,22.53,27.6,5.61,22.33,18.04,9.77,4.17,13.08,3.75,7.73,24.4,27.23,16.66,7.64,7.86,14.65,2.49,13.32,13.34,20.61,27.27,24.42,17.67,5.38,3.54,5.32,15.31,18.37,23.24,12.73,24.59,27.1,9.31,5.85,28.56,16.71,1.82,11.29,18.6,24.17,14.96,26.65,28.57,23.22,24.53,26.68,19.76,23.89,2.18,16.23,8.41,22.71,24.3,17.76,15.96,27.64,7.6,21.59,9.92,17.59,23.27,10.8,3.41,4.66,13.94,4.72,5.43,3.02,5.19,9.25,17.71,16.48,27.78,13.66,22.26,16.68,2.54,6.2,15.64,24.03,7.96,8.31,5.79,11.22,6.35,15.48,27.63,21.45,8.78,12.86,9.25,25.34,6.59,9.44,20.84,20.47,5.67,6.94,10.18,9.62,23.31,15.38,4.94,25.61,19.74,3.31,25.51,6.92,16.4,6.69,16.59,27.86,8.8,4.42,21.37,15.51,10.07,8.6,10.49,17.21,1.2,5.4,9.51,10.85,11.92,26.64,21.21,13.7,24.25,15.95,22.42,14.02,6.74,21.74,7.62,5.24,23.34,16.71,23.12,10.86,24.95,16.05,23.99,16.02,23.69,18.38,1.58,1.71,5.72,21.3,17.77,25.65,2.84,27.55,5.85,13.87,14.71,13.99,10.06,18.91,5.73,3.07,23.83,20.73,4.58,13.13,14.68,26.24,26.47,27.22,23.72,19.53,14.03,8.7,3.97,14.78,20.83,19.45,13.13,15.79,21.64,20.75,5.24,22.22,21.3,28.85,4.84,26.46,14.28,9.17,19.88,1.2,18.89,13.24,1.28,17.65,18.2,26.18,17.12,18.43,3.57,28.97,25.59,1.12,8.87,23.36,2.5,24.49,23.4,19.36,3.48,9.37,7.38,13.52,20.94,6.23,10.27,13.78,27.57,5.4,27.55,27.06,10.57,17.93,16.38,9.46,24.58,7.19,13.73,3.16,11.16,7.05,21.34,11.95,1.08,6.79,21.23,7.49,27.18,22.67,9.94,10.17,27.93,20.11,23.43,20.69,21.66,22.62,12.6,26.25,19.41,15.33,17.56,25.48,12.56,7.24,24.47,15.94,6.97,28.07,9.15,28.42,19.94) +vars = c("V1","V2","V3","V4","V5","V6","V7","V8","V9","V10","V11","V12","V13","V14","V15","V16","V17","V18","V19","V20") +smps = c("S1","S2","S3","S4","S5","S6","S7","S8","S9","S10","S11","S12","S13","S14","S15","S16","S17","S18","S19","S20") +data = as.data.frame(matrix(vals, nrow = 20, ncol = 20, byrow = TRUE, dimnames = list(vars, smps))) + +test_that("Scatter2D selectedDataPoints", { + + result <- canvasXpress( + data = data, + selectedDataPoints = list("V1"), + graphType = "Scatter2D", + title = "Scatter2D - selectedDataPoints : V1") + check_ui_test(result) +}) + +test_that("Scatter3D selectedDataPoints", { + + result <- canvasXpress( + data = data, + selectedDataPoints = list("V3","V4"), + graphType = "Scatter3D", + title = "Scatter3D - selectedDataPoints : V3,V4") + check_ui_test(result) +}) + +test_that("ScatterBubble2D selectedDataPoints", { + + result <- canvasXpress( + data = data, + selectedDataPoints = list("V5","V8", "V10"), + graphType = "ScatterBubble2D", + title = "ScatterBubble2D - selectedDataPoints : V5,V8,V10") + check_ui_test(result) +}) + diff --git a/tests/testthat/test-venn2.R b/tests/testthat/test-other-venn-data-types.R similarity index 76% rename from tests/testthat/test-venn2.R rename to tests/testthat/test-other-venn-data-types.R index 590c93a0..4564ff86 100644 --- a/tests/testthat/test-venn2.R +++ b/tests/testthat/test-other-venn-data-types.R @@ -3,39 +3,24 @@ context("canvasXpress Charts - Venn") vdata <- data.frame(AC = 456, A = 340, ABC = 552, ABCD = 148, BC = 915, ACD = 298, BCD = 613, B = 562, CD = 143, ABD = 578, C = 620, D = 592, AB = 639, BD = 354, AD = 257) -vlegend <- list(A = "List 1", D = "List 4", C = "List 3", B = "List 2") +vlegend <- list(A = "List 1", B = "List 2", C = "List 3", D = "List 4") test_that("vennData as list parameter", { result <- canvasXpress(vennData = list(vdata), vennLegend = vlegend, graphType = "Venn", + title = "vennData as list", vennGroups = 4) - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") + check_ui_test(result) }) test_that("vennData as data", { result <- canvasXpress(data = vdata, vennLegend = vlegend, graphType = "Venn", + title = "vennData as data", vennGroups = 4) - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("vennData as data list", { - result <- canvasXpress(data = list(vdata), - vennLegend = vlegend, - graphType = "Venn", - vennGroups = 4) - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") + check_ui_test(result) }) test_that("vennData required", { diff --git a/tests/testthat/test-other-webshot-print.R b/tests/testthat/test-other-webshot-print.R new file mode 100644 index 00000000..a27a3d35 --- /dev/null +++ b/tests/testthat/test-other-webshot-print.R @@ -0,0 +1,35 @@ +context("canvasXpress webshotPrint") + +temp.html <- tempfile('test', fileext = '.html') +result.png <- tempfile('test', fileext = '.png') + +test_that("scatterplot webshotPrint", { + + y <- read.table(system.file("extdata", "cX-ageheightt-dat.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + x <- read.table(system.file("extdata", "cX-ageheightt-smp.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + + result <- canvasXpress(data = y, + smpAnnot = x, + graphType = "Scatter2D", + title = "Scatterplot - webshot print") + + + # export to PNG and print in viewer + htmlwidgets::saveWidget(result, file = temp.html) + expect_true(file.exists(temp.html)) + + webshot::webshot(temp.html, + file = result.png, + vwidth = result$width, + vheight = result$height) + if (interactive()) { + expect_true(file.exists(result.png)) + grid::grid.raster(png::readPNG(result.png)) + } + else { + expect_true(TRUE) + } +}) + +# cleanup temp files +file.remove(c(temp.html, result.png)) diff --git a/tests/testthat/test-other-zoom-disable.R b/tests/testthat/test-other-zoom-disable.R new file mode 100644 index 00000000..8565e9fd --- /dev/null +++ b/tests/testthat/test-other-zoom-disable.R @@ -0,0 +1,145 @@ +context("canvasXpress zoomDisable") + +barplot_y <- read.table(system.file("extdata", "cX-basic-dat.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) +boxplot_y <- read.table(system.file("extdata", "cX-toothgrowth-dat.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) +boxplot_x <- read.table(system.file("extdata", "cX-toothgrowth-smp.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + +test_that("scatterplot zoomDisable", { + + y <- read.table("http://www.canvasxpress.org/data/cX-mtcars-dat.txt", header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + result <- canvasXpress( + data = y, + asSampleFactors = list("cyl"), + colorBy = "cyl", + graphType = "Scatter2D", + stringVariableFactors = list("cyl"), + title = "Scatterplot - zoomDisable", + zoomDisable = TRUE + ) + check_ui_test(result) +}) + +test_that("barplot zoomDisable", { + + result <- canvasXpress( + data = barplot_y, + graphOrientation = "vertical", + graphType = "Bar", + title = "Barplot - zoomDisable", + zoomDisable = TRUE + ) + check_ui_test(result) +}) + +test_that("barplot (segregated) zoomDisable", { + + z <- data.frame(Plot = "Bar1", stringsAsFactors = F) + rownames(z) <- rownames(barplot_y) + result <- canvasXpress( + data = barplot_y, + varAnnot = z, + graphOrientation = "vertical", + graphType = "Bar", + segregateVariablesBy = list("Plot"), + title = "Barplot (segregated) - zoomDisable", + zoomDisable = TRUE + ) + check_ui_test(result) +}) + +test_that("boxplot zoomDisable", { + + result <- canvasXpress( + data = boxplot_y, + smpAnnot = boxplot_x, + colorBy = "dose", + graphOrientation = "vertical", + graphType = "Boxplot", + groupingFactors = list("dose"), + showLegend = TRUE, + smpTitle = "dose", + stringSampleFactors = list("dose"), + title = "Boxplot - zoomDisable", + zoomDisable = TRUE + ) + + check_ui_test(result) +}) + +test_that("boxplot (segregated) zoomDisable", { + + z <- data.frame(Plot = "Box1", stringsAsFactors = F) + rownames(z) <- rownames(boxplot_y) + result <- canvasXpress( + data = boxplot_y, + smpAnnot = boxplot_x, + varAnnot = z, + colorBy = "dose", + graphOrientation = "vertical", + graphType = "Boxplot", + segregateVariablesBy = list("Plot"), + groupingFactors = list("dose"), + showLegend = TRUE, + smpTitle = "dose", + stringSampleFactors = list("dose"), + title = "Boxplot (segregated) - zoomDisable", + zoomDisable = TRUE + ) + + check_ui_test(result) +}) + +test_that("Scatterplot matrix zoomDisable", { + + y <- read.table(system.file("extdata", "cX-irist-dat.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + z <- read.table(system.file("extdata", "cX-irist-var.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + + result <- canvasXpress( + data = y, + varAnnot = z, + colorBy = "Species", + graphType = "Scatter2D", + scatterPlotMatrix = TRUE, + title = "Scatterplot matrix - zoomDisable", + zoomDisable = TRUE + ) + + check_ui_test(result) +}) + +test_that("dotplot zoomDisable", { + + y <- read.table(system.file("extdata", "cX-iris-dat.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + x <- read.table(system.file("extdata", "cX-iris-smp.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + + legend_inside <- TRUE + result <- canvasXpress( + data = y, + smpAnnot = x, + graphOrientation = "vertical", + graphType = "Dotplot", + afterRender = list(list("groupSamples", list("Species"))), + title = "Dotplot - zoomDisable", + zoomDisable = TRUE + ) + + check_ui_test(result) +}) + +test_that("heatmap zoomDisable", { + + y = read.table(system.file("extdata", "cX-heatmapR-dat.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + x = read.table(system.file("extdata", "cX-heatmapR-smp.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + z = read.table(system.file("extdata", "cX-heatmapR-var.txt", package = "canvasXpress"), header = TRUE, sep = "\t", quote = "", row.names = 1, fill = TRUE, check.names = FALSE, stringsAsFactors = FALSE) + result <- canvasXpress( + data = y, + smpAnnot = x, + varAnnot = z, + colorBy = "dose", + graphType = "Heatmap", + title = "Heatmap - zoomDisable", + zoomDisable = TRUE + ) + check_ui_test(result) +}) + diff --git a/tests/testthat/test-parallelcoordinates.R b/tests/testthat/test-parallelcoordinates.R deleted file mode 100644 index 624a7c5e..00000000 --- a/tests/testthat/test-parallelcoordinates.R +++ /dev/null @@ -1,20 +0,0 @@ -context("canvasXpress Web Charts - ParallelCoordinates") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXparallelcoordinates1", { - result <- cXparallelcoordinates1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXparallelcoordinates2", { - result <- cXparallelcoordinates2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - diff --git a/tests/testthat/test-pie.R b/tests/testthat/test-pie.R deleted file mode 100644 index 793123cd..00000000 --- a/tests/testthat/test-pie.R +++ /dev/null @@ -1,20 +0,0 @@ -context("canvasXpress Web Charts - Pie") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXpie1", { - result <- cXpie1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXpie2", { - result <- cXpie2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - diff --git a/tests/testthat/test-radar.R b/tests/testthat/test-radar.R deleted file mode 100644 index 2cc48009..00000000 --- a/tests/testthat/test-radar.R +++ /dev/null @@ -1,67 +0,0 @@ -context("canvasXpress Web Charts - Radar") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXradar1", { - result <- cXradar1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXradar2", { - result <- cXradar2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXradar3", { - result <- cXradar3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXradar4", { - result <- cXradar4() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXradar5", { - result <- cXradar5() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXradar6", { - result <- cXradar6() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXradar7", { - result <- cXradar7() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXradar8", { - result <- cXradar8() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-sankey.R b/tests/testthat/test-sankey.R deleted file mode 100644 index 791e1f78..00000000 --- a/tests/testthat/test-sankey.R +++ /dev/null @@ -1,35 +0,0 @@ -context("canvasXpress Web Charts - Sankey") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXsankey1", { - result <- cXsankey1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXsankey2", { - result <- cXsankey2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXsankey3", { - result <- cXsankey3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXsankey4", { - result <- cXsankey4() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-scatter2D.R b/tests/testthat/test-scatter2D.R deleted file mode 100644 index 105a4ed1..00000000 --- a/tests/testthat/test-scatter2D.R +++ /dev/null @@ -1,92 +0,0 @@ -context("canvasXpress Web Charts - Scatter2D") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXscatter2d1", { - result <- cXscatter2d1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXscatter2d2", { - result <- cXscatter2d2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXscatter2d3", { - result <- cXscatter2d3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXscatter2d4", { - result <- cXscatter2d4() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXscatter2d5", { - result <- cXscatter2d5() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXscatter2d6", { - result <- cXscatter2d6() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXscatter2d7", { - result <- cXscatter2d7() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXscatter2d8", { - result <- cXscatter2d8() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXscatter2d9", { - result <- cXscatter2d9() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXscatter2d10", { - result <- cXscatter2d10() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXscatter2d11", { - result <- cXscatter2d11() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - diff --git a/tests/testthat/test-scatter3D.R b/tests/testthat/test-scatter3D.R deleted file mode 100644 index a931612f..00000000 --- a/tests/testthat/test-scatter3D.R +++ /dev/null @@ -1,55 +0,0 @@ -context("canvasXpress Web Charts - Scatter3D") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXscatter3d1", { - result <- cXscatter3d1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXscatter3d2", { - result <- cXscatter3d2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXscatter3d3", { - result <- cXscatter3d3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXscatter3d4", { - result <- cXscatter3d4() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXscatter3d5", { - result <- cXscatter3d5() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXscatter3d6", { - result <- cXscatter3d6() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXscatter3d7", { - warning("scatter3d - plot function missing") -}) diff --git a/tests/testthat/test-scatterbubble2D.R b/tests/testthat/test-scatterbubble2D.R deleted file mode 100644 index ef7baf0c..00000000 --- a/tests/testthat/test-scatterbubble2D.R +++ /dev/null @@ -1,27 +0,0 @@ -context("canvasXpress Web Charts - ScatterBubble2D") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXscatterbubble2d1", { - result <- cXscatterbubble2d1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXscatterbubble2d2", { - result <- cXscatterbubble2d2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXscatterbubble2d3", { - result <- cXscatterbubble2d3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-stacked.R b/tests/testthat/test-stacked.R deleted file mode 100644 index 27371eda..00000000 --- a/tests/testthat/test-stacked.R +++ /dev/null @@ -1,43 +0,0 @@ -context("canvasXpress Web Charts - Stacked") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXstacked1", { - result <- cXstacked1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXstacked2", { - result <- cXstacked2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXstacked3", { - result <- cXstacked3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXstacked4", { - result <- cXstacked4() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXstacked5", { - result <- cXstacked5() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-stackedline.R b/tests/testthat/test-stackedline.R deleted file mode 100644 index a86d2ae7..00000000 --- a/tests/testthat/test-stackedline.R +++ /dev/null @@ -1,19 +0,0 @@ -context("canvasXpress Web Charts - StackedLine") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXstackedline1", { - result <- cXstackedline1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXstackedline2", { - result <- cXstackedline2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-stackedpercent.R b/tests/testthat/test-stackedpercent.R deleted file mode 100644 index 076a6831..00000000 --- a/tests/testthat/test-stackedpercent.R +++ /dev/null @@ -1,35 +0,0 @@ -context("canvasXpress Web Charts - StackedPercent") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXstackedpercent1", { - result <- cXstackedpercent1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXstackedpercent2", { - result <- cXstackedpercent2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXstackedpercent3", { - result <- cXstackedpercent3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXstackedpercent4", { - result <- cXstackedpercent4() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-stackedpercentline.R b/tests/testthat/test-stackedpercentline.R deleted file mode 100644 index afb2b117..00000000 --- a/tests/testthat/test-stackedpercentline.R +++ /dev/null @@ -1,19 +0,0 @@ -context("canvasXpress Web Charts - StackedPercentLine") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXstackedpercentline1", { - result <- cXstackedpercentline1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXstackedpercentline2", { - result <- cXstackedpercentline2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-sunburst.R b/tests/testthat/test-sunburst.R deleted file mode 100644 index 3147928e..00000000 --- a/tests/testthat/test-sunburst.R +++ /dev/null @@ -1,35 +0,0 @@ -context("canvasXpress Web Charts - Sunburst") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXsunburst1", { - result <- cXsunburst1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXsunburst2", { - result <- cXsunburst2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXsunburst3", { - result <- cXsunburst3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXsunburst4", { - result <- cXsunburst4() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-tagcloud.R b/tests/testthat/test-tagcloud.R deleted file mode 100644 index c591ec43..00000000 --- a/tests/testthat/test-tagcloud.R +++ /dev/null @@ -1,13 +0,0 @@ -context("canvasXpress Web Charts - TagCloud") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXtagcloud1", { - result <- cXtagcloud1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") - warning('Clicking legend gives countdown spinner, doesn\'t happen on the web') -}) - diff --git a/tests/testthat/test-tree.R b/tests/testthat/test-tree.R deleted file mode 100644 index 7e021fd0..00000000 --- a/tests/testthat/test-tree.R +++ /dev/null @@ -1,36 +0,0 @@ -context("canvasXpress Web Charts - Tree") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXtree1", { - result <- cXtree1() - - if (interactive()) { print(result) } - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXtree2", { - result <- cXtree2() - - if (interactive()) { print(result) } - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXtree3", { - result <- cXtree3() - - if (interactive()) { print(result) } - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXtree4", { - result <- cXtree4() - - if (interactive()) { print(result) } - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - diff --git a/tests/testthat/test-treemap.R b/tests/testthat/test-treemap.R deleted file mode 100644 index 700e1631..00000000 --- a/tests/testthat/test-treemap.R +++ /dev/null @@ -1,27 +0,0 @@ -context("canvasXpress Web Charts - Treemap") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXtreemap1", { - result <- cXtreemap1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXtreemap2", { - result <- cXtreemap2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXtreemap3", { - result <- cXtreemap3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-ui-area.R b/tests/testthat/test-ui-area.R new file mode 100644 index 00000000..aea984c4 --- /dev/null +++ b/tests/testthat/test-ui-area.R @@ -0,0 +1,25 @@ +context("canvasXpress Web Charts - Area") + +test_that("cXarea1", { + check_ui_test(cXarea1()) +}) + +test_that("cXarea2", { + check_ui_test(cXarea2()) +}) + +test_that("cXarea3", { + check_ui_test(cXarea3()) +}) + +test_that("cXarea4", { + check_ui_test(cXarea4()) +}) + +test_that("cXarea5", { + check_ui_test(cXarea5()) +}) + +test_that("cXarea6", { + check_ui_test(cXarea6()) +}) diff --git a/tests/testthat/test-ui-arealine.R b/tests/testthat/test-ui-arealine.R new file mode 100644 index 00000000..01be8e64 --- /dev/null +++ b/tests/testthat/test-ui-arealine.R @@ -0,0 +1,14 @@ +context("canvasXpress Web Charts - AreaLine") + + +test_that("cXarealine1", { + check_ui_test(cXarealine1()) +}) + +test_that("cXarealine2", { + check_ui_test(cXarealine2()) +}) + +test_that("cXarealine3", { + check_ui_test(cXarealine3()) +}) diff --git a/tests/testthat/test-ui-bar.R b/tests/testthat/test-ui-bar.R new file mode 100644 index 00000000..c99c9b8d --- /dev/null +++ b/tests/testthat/test-ui-bar.R @@ -0,0 +1,38 @@ +context("canvasXpress Web Charts - Bar") + + +test_that("cXbar1", { + check_ui_test(cXbar1()) +}) + +test_that("cXbar2", { + check_ui_test(cXbar2()) +}) + +test_that("cXbar3", { + check_ui_test(cXbar3()) +}) + +test_that("cXbar4", { + check_ui_test(cXbar4()) +}) + +test_that("cXbar5", { + check_ui_test(cXbar5()) +}) + +test_that("cXbar6", { + check_ui_test(cXbar6()) +}) + +test_that("cXbar7", { + check_ui_test(cXbar7()) +}) + +test_that("cXbar8", { + check_ui_test(cXbar8()) +}) + +test_that("cXbar9", { + check_ui_test(cXbar9()) +}) diff --git a/tests/testthat/test-ui-barline.R b/tests/testthat/test-ui-barline.R new file mode 100644 index 00000000..fcd9a356 --- /dev/null +++ b/tests/testthat/test-ui-barline.R @@ -0,0 +1,14 @@ +context("canvasXpress Web Charts - BarLine") + + +test_that("cXbarline1", { + check_ui_test(cXbarline1()) +}) + +test_that("cXbarline2", { + check_ui_test(cXbarline2()) +}) + +test_that("cXbarline3", { + check_ui_test(cXbarline3()) +}) diff --git a/tests/testthat/test-ui-boxplot.R b/tests/testthat/test-ui-boxplot.R new file mode 100644 index 00000000..44a20b9c --- /dev/null +++ b/tests/testthat/test-ui-boxplot.R @@ -0,0 +1,68 @@ +context("canvasXpress Web Charts - Boxplot") + + +test_that("cXboxplot1", { + check_ui_test(cXboxplot1()) +}) + +test_that("cXboxplot2", { + check_ui_test(cXboxplot2()) +}) + +test_that("cXboxplot3", { + check_ui_test(cXboxplot3()) +}) + +test_that("cXboxplot4", { + check_ui_test(cXboxplot4()) +}) + +test_that("cXboxplot5", { + check_ui_test(cXboxplot5()) +}) + +test_that("cXboxplot6", { + check_ui_test(cXboxplot6()) +}) + +test_that("cXboxplot7", { + check_ui_test(cXboxplot7()) +}) + +test_that("cXboxplot8", { + check_ui_test(cXboxplot8()) +}) + +test_that("cXboxplot9", { + check_ui_test(cXboxplot9()) +}) + +test_that("cXboxplot10", { + check_ui_test(cXboxplot10()) +}) + +test_that("cXboxplot11", { + check_ui_test(cXboxplot11()) +}) + +test_that("cXboxplot12", { + check_ui_test(cXboxplot12()) +}) + +test_that("cXboxplot13", { + check_ui_test(cXboxplot13()) +}) + +test_that("cXboxplot14", { + check_ui_test(cXboxplot14()) +}) + +test_that("cXboxplot15", { + check_ui_test(cXboxplot15()) +}) + +test_that("cXboxplot16", { + check_ui_test(cXboxplot16()) +}) + + diff --git a/tests/testthat/test-ui-bubble.R b/tests/testthat/test-ui-bubble.R new file mode 100644 index 00000000..3157c72e --- /dev/null +++ b/tests/testthat/test-ui-bubble.R @@ -0,0 +1,14 @@ +context("canvasXpress Web Charts - Bubble") + + +test_that("cXbubble1", { + check_ui_test(cXbubble1()) +}) + +test_that("cXbubble2", { + check_ui_test(cXbubble2()) +}) + +test_that("cXbubble3", { + check_ui_test(cXbubble3()) +}) diff --git a/tests/testthat/test-ui-candlestick.R b/tests/testthat/test-ui-candlestick.R new file mode 100644 index 00000000..444f835d --- /dev/null +++ b/tests/testthat/test-ui-candlestick.R @@ -0,0 +1,10 @@ +context("canvasXpress Web Charts - Candlestick") + + +test_that("cXcandlestick1", { + message("candlestick - plot function missing") +}) + +test_that("cXcandlestick2", { + message("candlestick - plot function missing") +}) diff --git a/tests/testthat/test-ui-chord.R b/tests/testthat/test-ui-chord.R new file mode 100644 index 00000000..ff770909 --- /dev/null +++ b/tests/testthat/test-ui-chord.R @@ -0,0 +1,20 @@ +context("canvasXpress Web Charts - Chord") + + +test_that("cXchord1", { + check_ui_test(cXchord1()) + + warning("Some chords are getting bigger when hovering in and out many times (only if plot is resized)") +}) + +test_that("cXchord2", { + check_ui_test(cXchord2()) + + warning("Some chords are getting bigger when hovering in and out many times (only if plot is resized)") +}) + +test_that("cXchord3", { + check_ui_test(cXchord3()) + + warning("Some chords are getting bigger when hovering in and out many times (only if plot is resized)") +}) diff --git a/tests/testthat/test-ui-circular.R b/tests/testthat/test-ui-circular.R new file mode 100644 index 00000000..99eb3e87 --- /dev/null +++ b/tests/testthat/test-ui-circular.R @@ -0,0 +1,30 @@ +context("canvasXpress Web Charts - Circular") + + +test_that("cXcircular1", { + check_ui_test(cXcircular1()) +}) + +test_that("cXcircular2", { + check_ui_test(cXcircular2()) +}) + +test_that("cXcircular3", { + check_ui_test(cXcircular3()) +}) + +test_that("cXcircular4", { + check_ui_test(cXcircular4()) +}) + +test_that("cXcircular5", { + check_ui_test(cXcircular5()) +}) + +test_that("cXcircular6", { + check_ui_test(cXcircular6()) +}) + +test_that("cXcircular7", { + check_ui_test(cXcircular7()) +}) diff --git a/tests/testthat/test-ui-contour.R b/tests/testthat/test-ui-contour.R new file mode 100644 index 00000000..8f163c38 --- /dev/null +++ b/tests/testthat/test-ui-contour.R @@ -0,0 +1,6 @@ +context("canvasXpress Web Charts - Contour") + + +test_that("cXcontour1", { + check_ui_test(cXcontour1()) +}) diff --git a/tests/testthat/test-ui-correlation.R b/tests/testthat/test-ui-correlation.R new file mode 100644 index 00000000..e6823a5f --- /dev/null +++ b/tests/testthat/test-ui-correlation.R @@ -0,0 +1,10 @@ +context("canvasXpress Web Charts - Correlation") + + +test_that("cXcorrelation1", { + check_ui_test(cXcorrelation1()) +}) + +test_that("cXcorrelation2", { + check_ui_test(cXcorrelation2()) +}) diff --git a/tests/testthat/test-ui-density.R b/tests/testthat/test-ui-density.R new file mode 100644 index 00000000..c0750efb --- /dev/null +++ b/tests/testthat/test-ui-density.R @@ -0,0 +1,34 @@ +context("canvasXpress Web Charts - Density") + + +test_that("cXdensity1", { + check_ui_test(cXdensity1()) +}) + +test_that("cXdensity2", { + check_ui_test(cXdensity2()) +}) + +test_that("cXdensity3", { + check_ui_test(cXdensity3()) +}) + +test_that("cXdensity4", { + check_ui_test(cXdensity4()) +}) + +test_that("cXdensity5", { + check_ui_test(cXdensity5()) +}) + +test_that("cXdensity6", { + check_ui_test(cXdensity6()) +}) + +test_that("cXdensity7", { + check_ui_test(cXdensity7()) +}) + +test_that("cXdensity8", { + check_ui_test(cXdensity8()) +}) diff --git a/tests/testthat/test-ui-donnut.R b/tests/testthat/test-ui-donnut.R new file mode 100644 index 00000000..46030fbd --- /dev/null +++ b/tests/testthat/test-ui-donnut.R @@ -0,0 +1,10 @@ +context("canvasXpress Web Charts - Donnut") + + +test_that("cXdonut1", { + check_ui_test(cXdonnut1()) +}) + +test_that("cXdonut2", { + check_ui_test(cXdonnut2()) +}) diff --git a/tests/testthat/test-ui-dotline.R b/tests/testthat/test-ui-dotline.R new file mode 100644 index 00000000..d055d7cd --- /dev/null +++ b/tests/testthat/test-ui-dotline.R @@ -0,0 +1,14 @@ +context("canvasXpress Web Charts - DotLine") + + +test_that("cXdotline1", { + check_ui_test(cXdotline1()) +}) + +test_that("cXdotline2", { + check_ui_test(cXdotline2()) +}) + +test_that("cXdotline3 ", { + check_ui_test(cXdotline3()) +}) diff --git a/tests/testthat/test-ui-dotplot.R b/tests/testthat/test-ui-dotplot.R new file mode 100644 index 00000000..3fe5e647 --- /dev/null +++ b/tests/testthat/test-ui-dotplot.R @@ -0,0 +1,43 @@ +context("canvasXpress Web Charts - Dotplot") + + +test_that("cXdotplot1", { + check_ui_test(cXdotplot1()) +}) + +test_that("cXdotplot2", { + check_ui_test(cXdotplot2()) +}) + +test_that("cXdotplot3", { + check_ui_test(cXdotplot3()) +}) + +test_that("cXdotplot4", { + check_ui_test(cXdotplot4()) +}) + +test_that("cXdotplot5", { + check_ui_test(cXdotplot5()) +}) + +test_that("cXdotplot6", { + check_ui_test(cXdotplot6()) +}) + +test_that("cXdotplot7", { + check_ui_test(cXdotplot7()) +}) + +test_that("cXdotplot8", { + check_ui_test(cXdotplot8()) +}) + +test_that("cXdotplot9", { + check_ui_test(cXdotplot9()) +}) + +test_that("cXdotplot10", { + check_ui_test(cXdotplot10()) +}) + diff --git a/tests/testthat/test-ui-genome.R b/tests/testthat/test-ui-genome.R new file mode 100644 index 00000000..050cc7c0 --- /dev/null +++ b/tests/testthat/test-ui-genome.R @@ -0,0 +1,10 @@ +context("canvasXpress Web Charts - Genome") + + +test_that("cXgenome1", { + message("genome - plot function missing") +}) + +test_that("cXgenome1", { + message("genome - plot function missing") +}) diff --git a/tests/testthat/test-ui-heatmap.R b/tests/testthat/test-ui-heatmap.R new file mode 100644 index 00000000..42a0aadf --- /dev/null +++ b/tests/testthat/test-ui-heatmap.R @@ -0,0 +1,53 @@ +context("canvasXpress Web Charts - Heatmap") + + +test_that("cXheatmap1", { + check_ui_test(cXheatmap1()) +}) + +test_that("cXheatmap2", { + check_ui_test(cXheatmap2()) +}) + +test_that("cXheatmap3", { + check_ui_test(cXheatmap3()) +}) + +test_that("cXheatmap4", { + check_ui_test(cXheatmap4()) +}) + +test_that("cXheatmap5", { + check_ui_test(cXheatmap5()) +}) + +test_that("cXheatmap6", { + check_ui_test(cXheatmap6()) +}) + +test_that("cXheatmap7", { + check_ui_test(cXheatmap7()) +}) + +test_that("cXheatmap8", { + check_ui_test(cXheatmap8()) +}) + +test_that("cXheatmap9", { + check_ui_test(cXheatmap9()) +}) + +test_that("cXheatmap10", { + check_ui_test(cXheatmap10()) +}) + +test_that("cXheatmap11", { + check_ui_test(cXheatmap11()) +}) + +test_that("cXheatmap12", { + check_ui_test(cXheatmap12()) + + message('middle section too small at default height - working as designed') +}) + diff --git a/tests/testthat/test-ui-histogram.R b/tests/testthat/test-ui-histogram.R new file mode 100644 index 00000000..34da8887 --- /dev/null +++ b/tests/testthat/test-ui-histogram.R @@ -0,0 +1,14 @@ +context("canvasXpress Web Charts - Histogram") + + +test_that("cXhistogram1", { + check_ui_test(cXhistogram1()) +}) + +test_that("cXhistogram2", { + check_ui_test(cXhistogram2()) +}) + +test_that("cXhistogram3", { + check_ui_test(cXhistogram3()) +}) diff --git a/tests/testthat/test-ui-kaplanmeier.R b/tests/testthat/test-ui-kaplanmeier.R new file mode 100644 index 00000000..e4f705b8 --- /dev/null +++ b/tests/testthat/test-ui-kaplanmeier.R @@ -0,0 +1,14 @@ +context("canvasXpress Web Charts - Kaplanmeier") + + +test_that("cXkaplanmeier1", { + check_ui_test(cXkaplanmeier1()) + + warning("Data 2 is not highlighted when hovering over that line until plot is resized - RStudio Viewer") +}) + +test_that("cXkaplanmeier2", { + check_ui_test(cXkaplanmeier2()) + + warning("Data 2 is not highlighted when hovering over that area until plot is resized - RStudio Viewer") +}) diff --git a/tests/testthat/test-ui-layout.R b/tests/testthat/test-ui-layout.R new file mode 100644 index 00000000..944d8745 --- /dev/null +++ b/tests/testthat/test-ui-layout.R @@ -0,0 +1,50 @@ +context("canvasXpress Web Charts - Layout") + + +test_that("cXlayout1", { + check_ui_test(cXlayout1()) +}) + +test_that("cXlayout2", { + check_ui_test(cXlayout2()) +}) + +test_that("cXlayout3", { + check_ui_test(cXlayout3()) +}) + +test_that("cXlayout4", { + check_ui_test(cXlayout4()) +}) + +test_that("cXlayout5", { + check_ui_test(cXlayout5()) +}) + +test_that("cXlayout6", { + check_ui_test(cXlayout6()) +}) + +test_that("cXlayout7", { + check_ui_test(cXlayout7()) +}) + +test_that("cXlayout8", { + check_ui_test(cXlayout8()) +}) + +test_that("cXlayout9", { + check_ui_test(cXlayout9()) +}) + +test_that("cXlayout10", { + check_ui_test(cXlayout10()) + + warning("grouping results in different layout order") +}) + +test_that("cXlayout11", { + check_ui_test(cXlayout11()) + + message('middle section too small at default height - working as designed') +}) diff --git a/tests/testthat/test-ui-line.R b/tests/testthat/test-ui-line.R new file mode 100644 index 00000000..1a2f549a --- /dev/null +++ b/tests/testthat/test-ui-line.R @@ -0,0 +1,14 @@ +context("canvasXpress Web Charts - Line") + + +test_that("cXline1", { + check_ui_test(cXline1()) +}) + +test_that("cXline2", { + check_ui_test(cXline2()) +}) + +test_that("cXline3", { + check_ui_test(cXline3()) +}) diff --git a/tests/testthat/test-ui-map.R b/tests/testthat/test-ui-map.R new file mode 100644 index 00000000..4f4113da --- /dev/null +++ b/tests/testthat/test-ui-map.R @@ -0,0 +1,22 @@ +context("canvasXpress Web Charts - Map") + + +test_that("cXmap1", { + check_ui_test(cXmap1()) +}) + +test_that("cXmap2", { + check_ui_test(cXmap2()) +}) + +test_that("cXmap3", { + check_ui_test(cXmap3()) +}) + +test_that("cXmap4", { + check_ui_test(cXmap4()) +}) + +test_that("cXmap5", { + check_ui_test(cXmap5()) +}) diff --git a/tests/testthat/test-ui-network.R b/tests/testthat/test-ui-network.R new file mode 100644 index 00000000..eef5fce8 --- /dev/null +++ b/tests/testthat/test-ui-network.R @@ -0,0 +1,60 @@ +context("canvasXpress Web Charts - Network") + + +test_that("cXnetwork1", { + check_ui_test(cXnetwork1()) + + warning("legend on the wrong side, by-design due to space issues") +}) + +test_that("cXnetwork2", { + check_ui_test(cXnetwork2()) +}) + + +test_that("cXnetwork3", { + check_ui_test(cXnetwork3()) +}) + + +test_that("cXnetwork4", { + check_ui_test(cXnetwork4()) +}) + +test_that("cXnetwork5", { + check_ui_test(cXnetwork5()) + + warning('some lines missing, cross-domain download issue') +}) + +test_that("cXnetwork6", { + check_ui_test(cXnetwork6()) + + warning('coloring off from web example, legend is continuous') +}) + +test_that("cXnetwork7", { + check_ui_test(cXnetwork7()) + + warning('coloring off from web example') +}) + +test_that("cXnetwork8", { + check_ui_test(cXnetwork8()) + + warning('coloring off from web example') +}) + +test_that("cXnetwork9", { + check_ui_test(cXnetwork9()) + + message("plot starts with a message popup - by design - author didn't define shapes for all items") +}) + +test_that("cXnetwork10", { + check_ui_test(cXnetwork10()) +}) + +test_that("cXnetwork11", { + check_ui_test(cXnetwork11()) +}) diff --git a/tests/testthat/test-ui-nonlinearfit.R b/tests/testthat/test-ui-nonlinearfit.R new file mode 100644 index 00000000..5688e22b --- /dev/null +++ b/tests/testthat/test-ui-nonlinearfit.R @@ -0,0 +1,10 @@ +context("canvasXpress Web Charts - Nonlinearfit") + + +test_that("cXnonlinearfit1", { + check_ui_test(cXnonlinearfit1()) +}) + +test_that("cXnonlinearfit2", { + check_ui_test(cXnonlinearfit2()) +}) diff --git a/tests/testthat/test-ui-oncoprint.R b/tests/testthat/test-ui-oncoprint.R new file mode 100644 index 00000000..92f6e921 --- /dev/null +++ b/tests/testthat/test-ui-oncoprint.R @@ -0,0 +1,14 @@ +context("canvasXpress Web Charts - Oncoprint") + + +test_that("cXoncoprint1", { + check_ui_test(cXoncoprint1()) +}) + +test_that("cXoncoprint2", { + check_ui_test(cXoncoprint2()) +}) + +test_that("cXoncoprint3", { + check_ui_test(cXoncoprint3()) +}) diff --git a/tests/testthat/test-ui-parallelcoordinates.R b/tests/testthat/test-ui-parallelcoordinates.R new file mode 100644 index 00000000..859b6f3e --- /dev/null +++ b/tests/testthat/test-ui-parallelcoordinates.R @@ -0,0 +1,11 @@ +context("canvasXpress Web Charts - ParallelCoordinates") + + +test_that("cXparallelcoordinates1", { + check_ui_test(cXparallelcoordinates1()) +}) + +test_that("cXparallelcoordinates2", { + check_ui_test(cXparallelcoordinates2()) +}) + diff --git a/tests/testthat/test-ui-pie.R b/tests/testthat/test-ui-pie.R new file mode 100644 index 00000000..11b2e698 --- /dev/null +++ b/tests/testthat/test-ui-pie.R @@ -0,0 +1,15 @@ +context("canvasXpress Web Charts - Pie") + + +test_that("cXpie1", { + check_ui_test(cXpie1()) + + warning('pie changes color on mouseover (if plot is not resized) - RStudio Viewer') +}) + +test_that("cXpie2", { + check_ui_test(cXpie2()) + + warning('pie changes color on mouseover (if plot is not resized) - RStudio Viewer') +}) + diff --git a/tests/testthat/test-ui-radar.R b/tests/testthat/test-ui-radar.R new file mode 100644 index 00000000..926d932d --- /dev/null +++ b/tests/testthat/test-ui-radar.R @@ -0,0 +1,36 @@ +context("canvasXpress Web Charts - Radar") + + +test_that("cXradar1", { + check_ui_test(cXradar1()) +}) + +test_that("cXradar2", { + check_ui_test(cXradar2()) + + warning('radar has brown overlay on mouseover (if plot is not resized) - RStudio Viewer') +}) + +test_that("cXradar3", { + check_ui_test(cXradar3()) +}) + +test_that("cXradar4", { + check_ui_test(cXradar4()) +}) + +test_that("cXradar5", { + check_ui_test(cXradar5()) +}) + +test_that("cXradar6", { + check_ui_test(cXradar6()) +}) + +test_that("cXradar7", { + check_ui_test(cXradar7()) +}) + +test_that("cXradar8", { + check_ui_test(cXradar8()) +}) diff --git a/tests/testthat/test-ui-sankey.R b/tests/testthat/test-ui-sankey.R new file mode 100644 index 00000000..58d25c1a --- /dev/null +++ b/tests/testthat/test-ui-sankey.R @@ -0,0 +1,18 @@ +context("canvasXpress Web Charts - Sankey") + + +test_that("cXsankey1", { + check_ui_test(cXsankey1()) +}) + +test_that("cXsankey2", { + check_ui_test(cXsankey2()) +}) + +test_that("cXsankey3", { + check_ui_test(cXsankey3()) +}) + +test_that("cXsankey4", { + check_ui_test(cXsankey4()) +}) diff --git a/tests/testthat/test-ui-scatter2D.R b/tests/testthat/test-ui-scatter2D.R new file mode 100755 index 00000000..82dba331 --- /dev/null +++ b/tests/testthat/test-ui-scatter2D.R @@ -0,0 +1,55 @@ +context("canvasXpress Web Charts - Scatter2D") + + +test_that("cXscatter2d1", { + check_ui_test(cXscatter2d1()) +}) + +test_that("cXscatter2d2", { + check_ui_test(cXscatter2d2()) +}) + +test_that("cXscatter2d3", { + check_ui_test(cXscatter2d3()) +}) + +test_that("cXscatter2d4", { + check_ui_test(cXscatter2d4()) +}) + +test_that("cXscatter2d5", { + check_ui_test(cXscatter2d5()) +}) + +test_that("cXscatter2d6", { + check_ui_test(cXscatter2d6()) +}) + +test_that("cXscatter2d7", { + check_ui_test(cXscatter2d7()) +}) + +test_that("cXscatter2d8", { + check_ui_test(cXscatter2d8()) +}) + +test_that("cXscatter2d9", { + check_ui_test(cXscatter2d9()) +}) + +test_that("cXscatter2d10", { + check_ui_test(cXscatter2d10()) +}) + +test_that("cXscatter2d11", { + check_ui_test(cXscatter2d11()) +}) + +test_that("cXscatter2d12", { + check_ui_test(cXscatter2d12()) +}) + +test_that("cXscatter2d13", { + check_ui_test(cXscatter2d13()) +}) + diff --git a/tests/testthat/test-ui-scatter3D.R b/tests/testthat/test-ui-scatter3D.R new file mode 100644 index 00000000..e1ff52b6 --- /dev/null +++ b/tests/testthat/test-ui-scatter3D.R @@ -0,0 +1,30 @@ +context("canvasXpress Web Charts - Scatter3D") + + +test_that("cXscatter3d1", { + check_ui_test(cXscatter3d1()) +}) + +test_that("cXscatter3d2", { + check_ui_test(cXscatter3d2()) +}) + +test_that("cXscatter3d3", { + check_ui_test(cXscatter3d3()) +}) + +test_that("cXscatter3d4", { + check_ui_test(cXscatter3d4()) +}) + +test_that("cXscatter3d5", { + check_ui_test(cXscatter3d5()) +}) + +test_that("cXscatter3d6", { + check_ui_test(cXscatter3d6()) +}) + +test_that("cXscatter3d7", { + message("scatter3d - plot function missing") +}) diff --git a/tests/testthat/test-ui-scatterbubble2D.R b/tests/testthat/test-ui-scatterbubble2D.R new file mode 100644 index 00000000..865e5a1d --- /dev/null +++ b/tests/testthat/test-ui-scatterbubble2D.R @@ -0,0 +1,14 @@ +context("canvasXpress Web Charts - ScatterBubble2D") + + +test_that("cXscatterbubble2d1", { + check_ui_test(cXscatterbubble2d1()) +}) + +test_that("cXscatterbubble2d2", { + check_ui_test(cXscatterbubble2d2()) +}) + +test_that("cXscatterbubble2d3", { + check_ui_test(cXscatterbubble2d3()) +}) diff --git a/tests/testthat/test-ui-stacked.R b/tests/testthat/test-ui-stacked.R new file mode 100644 index 00000000..830e2b3c --- /dev/null +++ b/tests/testthat/test-ui-stacked.R @@ -0,0 +1,22 @@ +context("canvasXpress Web Charts - Stacked") + + +test_that("cXstacked1", { + check_ui_test(cXstacked1()) +}) + +test_that("cXstacked2", { + check_ui_test(cXstacked2()) +}) + +test_that("cXstacked3", { + check_ui_test(cXstacked3()) +}) + +test_that("cXstacked4", { + check_ui_test(cXstacked4()) +}) + +test_that("cXstacked5", { + check_ui_test(cXstacked5()) +}) diff --git a/tests/testthat/test-ui-stackedline.R b/tests/testthat/test-ui-stackedline.R new file mode 100644 index 00000000..ada15cc6 --- /dev/null +++ b/tests/testthat/test-ui-stackedline.R @@ -0,0 +1,10 @@ +context("canvasXpress Web Charts - StackedLine") + + +test_that("cXstackedline1", { + check_ui_test(cXstackedline1()) +}) + +test_that("cXstackedline2", { + check_ui_test(cXstackedline2()) +}) diff --git a/tests/testthat/test-ui-stackedpercent.R b/tests/testthat/test-ui-stackedpercent.R new file mode 100644 index 00000000..94ef6e0e --- /dev/null +++ b/tests/testthat/test-ui-stackedpercent.R @@ -0,0 +1,18 @@ +context("canvasXpress Web Charts - StackedPercent") + + +test_that("cXstackedpercent1", { + check_ui_test(cXstackedpercent1()) +}) + +test_that("cXstackedpercent2", { + check_ui_test(cXstackedpercent2()) +}) + +test_that("cXstackedpercent3", { + check_ui_test(cXstackedpercent3()) +}) + +test_that("cXstackedpercent4", { + check_ui_test(cXstackedpercent4()) +}) diff --git a/tests/testthat/test-ui-stackedpercentline.R b/tests/testthat/test-ui-stackedpercentline.R new file mode 100644 index 00000000..27d55469 --- /dev/null +++ b/tests/testthat/test-ui-stackedpercentline.R @@ -0,0 +1,10 @@ +context("canvasXpress Web Charts - StackedPercentLine") + + +test_that("cXstackedpercentline1", { + check_ui_test(cXstackedpercentline1()) +}) + +test_that("cXstackedpercentline2", { + check_ui_test(cXstackedpercentline2()) +}) diff --git a/tests/testthat/test-ui-sunburst.R b/tests/testthat/test-ui-sunburst.R new file mode 100644 index 00000000..a021012e --- /dev/null +++ b/tests/testthat/test-ui-sunburst.R @@ -0,0 +1,18 @@ +context("canvasXpress Web Charts - Sunburst") + + +test_that("cXsunburst1", { + check_ui_test(cXsunburst1()) +}) + +test_that("cXsunburst2", { + check_ui_test(cXsunburst2()) +}) + +test_that("cXsunburst3", { + check_ui_test(cXsunburst3()) +}) + +test_that("cXsunburst4", { + check_ui_test(cXsunburst4()) +}) diff --git a/tests/testthat/test-ui-tagcloud.R b/tests/testthat/test-ui-tagcloud.R new file mode 100644 index 00000000..240a4807 --- /dev/null +++ b/tests/testthat/test-ui-tagcloud.R @@ -0,0 +1,9 @@ +context("canvasXpress Web Charts - TagCloud") + + +test_that("cXtagcloud1", { + check_ui_test(cXtagcloud1()) + + warning('Clicking legend or resizing gives countdown spinner - RStudio Viewer') +}) + diff --git a/tests/testthat/test-ui-tree.R b/tests/testthat/test-ui-tree.R new file mode 100644 index 00000000..0070f954 --- /dev/null +++ b/tests/testthat/test-ui-tree.R @@ -0,0 +1,19 @@ +context("canvasXpress Web Charts - Tree") + + +test_that("cXtree1", { + check_ui_test(cXtree1()) +}) + +test_that("cXtree2", { + check_ui_test(cXtree2()) +}) + +test_that("cXtree3", { + check_ui_test(cXtree3()) +}) + +test_that("cXtree4", { + check_ui_test(cXtree4()) +}) + diff --git a/tests/testthat/test-ui-treemap.R b/tests/testthat/test-ui-treemap.R new file mode 100644 index 00000000..448343cc --- /dev/null +++ b/tests/testthat/test-ui-treemap.R @@ -0,0 +1,14 @@ +context("canvasXpress Web Charts - Treemap") + + +test_that("cXtreemap1", { + check_ui_test(cXtreemap1()) +}) + +test_that("cXtreemap2", { + check_ui_test(cXtreemap2()) +}) + +test_that("cXtreemap3", { + check_ui_test(cXtreemap3()) +}) diff --git a/tests/testthat/test-ui-venn.R b/tests/testthat/test-ui-venn.R new file mode 100644 index 00000000..76c53346 --- /dev/null +++ b/tests/testthat/test-ui-venn.R @@ -0,0 +1,14 @@ +context("canvasXpress Web Charts - Venn") + + +test_that("cXvenn1", { + check_ui_test(cXvenn1()) +}) + +test_that("cXvenn2", { + check_ui_test(cXvenn2()) +}) + +test_that("cXvenn3", { + check_ui_test(cXvenn3()) +}) diff --git a/tests/testthat/test-ui-violin.R b/tests/testthat/test-ui-violin.R new file mode 100644 index 00000000..ad6f4c7e --- /dev/null +++ b/tests/testthat/test-ui-violin.R @@ -0,0 +1,70 @@ +context("canvasXpress Web Charts - Violin") + + +test_that("cXviolin1", { + check_ui_test(cXviolin1()) +}) + +test_that("cXviolin2", { + check_ui_test(cXviolin2()) +}) + +test_that("cXviolin3", { + check_ui_test(cXviolin3()) +}) + +test_that("cXviolin4", { + check_ui_test(cXviolin4()) +}) + +test_that("cXviolin5", { + check_ui_test(cXviolin5()) +}) + +test_that("cXviolin6", { + check_ui_test(cXviolin6()) +}) + +test_that("cXviolin7", { + check_ui_test(cXviolin7()) +}) + +test_that("cXviolin8", { + check_ui_test(cXviolin8()) +}) + +test_that("cXviolin9", { + check_ui_test(cXviolin9()) +}) + +test_that("cXviolin10", { + check_ui_test(cXviolin10()) +}) + +test_that("cXviolin11", { + check_ui_test(cXviolin11()) +}) + +test_that("cXviolin12", { + check_ui_test(cXviolin12()) +}) + +test_that("cXviolin13", { + check_ui_test(cXviolin13()) +}) + +test_that("cXviolin14", { + check_ui_test(cXviolin14()) +}) + +test_that("cXviolin15", { + check_ui_test(cXviolin15()) +}) + +test_that("cXviolin16", { + check_ui_test(cXviolin16()) +}) + +test_that("cXviolin17", { + check_ui_test(cXviolin17()) +}) diff --git a/tests/testthat/test-venn.R b/tests/testthat/test-venn.R deleted file mode 100644 index 9417e19d..00000000 --- a/tests/testthat/test-venn.R +++ /dev/null @@ -1,27 +0,0 @@ -context("canvasXpress Web Charts - Venn") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXvenn1", { - result <- cXvenn1() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXvenn2", { - result <- cXvenn2() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXvenn3", { - result <- cXvenn3() - if (interactive()) { print(result) } - - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) diff --git a/tests/testthat/test-violin.R b/tests/testthat/test-violin.R deleted file mode 100644 index b8b8d449..00000000 --- a/tests/testthat/test-violin.R +++ /dev/null @@ -1,139 +0,0 @@ -context("canvasXpress Web Charts - Violin") -ifelse(interactive(), source("tests/cX-function.R"), source("../cX-function.R")) - - -test_that("cXviolin1", { - result <- cXviolin1() - - if (interactive()) { print(result) } - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXviolin2", { - result <- cXviolin2() - - if (interactive()) { print(result) } - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXviolin3", { - result <- cXviolin3() - - if (interactive()) { print(result) } - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXviolin4", { - result <- cXviolin4() - - if (interactive()) { print(result) } - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXviolin5", { - result <- cXviolin5() - - if (interactive()) { print(result) } - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXviolin6", { - result <- cXviolin6() - - if (interactive()) { print(result) } - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXviolin7", { - result <- cXviolin7() - - if (interactive()) { print(result) } - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXviolin8", { - result <- cXviolin8() - - if (interactive()) { print(result) } - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXviolin9", { - result <- cXviolin9() - - if (interactive()) { print(result) } - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXviolin10", { - result <- cXviolin10() - - if (interactive()) { print(result) } - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXviolin11", { - result <- cXviolin11() - - if (interactive()) { print(result) } - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXviolin12", { - result <- cXviolin12() - - if (interactive()) { print(result) } - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXviolin13", { - result <- cXviolin13() - - if (interactive()) { print(result) } - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXviolin14", { - result <- cXviolin14() - - if (interactive()) { print(result) } - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXviolin15", { - result <- cXviolin15() - - if (interactive()) { print(result) } - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXviolin16", { - result <- cXviolin16() - - if (interactive()) { print(result) } - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -}) - -test_that("cXviolin17", { - result <- cXviolin17() - - if (interactive()) { print(result) } - expect_s3_class(result, "canvasXpress") - expect_s3_class(result, "htmlwidget") -})