Skip to content

Commit

Permalink
Revert "fixes for kernel computation (#31)" (#32)
Browse files Browse the repository at this point in the history
This reverts commit ac3a406.
  • Loading branch information
bruceyyu authored Oct 1, 2024
1 parent ac3a406 commit c80fe8e
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 302 deletions.
7 changes: 2 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: GWalkR
Title: Interactive Exploratory Data Analysis Tool
Version: 0.2.0
Version: 0.1.5
Authors@R: c(
person("Yue", "Yu", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-9302-0793")),
Expand All @@ -17,7 +17,4 @@ Imports:
htmlwidgets,
jsonlite,
openssl,
shiny,
shinycssloaders,
DBI,
duckdb
shiny
4 changes: 0 additions & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
export(gwalkr)
export(gwalkrOutput)
export(renderGwalkr)
import(DBI)
import(duckdb)
import(htmlwidgets)
import(openssl)
import(shiny)
import(shinycssloaders)
importFrom(jsonlite,toJSON)
59 changes: 0 additions & 59 deletions R/duckdb_utils.R

This file was deleted.

59 changes: 24 additions & 35 deletions R/gwalkr.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,14 @@
#'
#' @import htmlwidgets
#' @import openssl
#' @importFrom jsonlite toJSON
#' @import shiny
#' @import shinycssloaders
#' @import DBI
#' @import duckdb
#'
#' @param data A data frame to be visualized in the GWalkR. The data frame should not be empty.
#' @param lang A character string specifying the language for the widget. Possible values are "en" (default), "ja", "zh".
#' @param dark A character string specifying the dark mode preference. Possible values are "light" (default), "dark", "media".
#' @param columnSpecs An optional list of lists to manually specify the types of some columns in the data frame.
#' Each top level element in the list corresponds to a column, and the list assigned to each column should have
#' two elements: `analyticalType` and `semanticType`. `analyticalType` can
#' only be one of "measure" or "dimension". `semanticType` can only be one of
#' @param columnSpecs An optional list of lists to manually specify the types of some columns in the data frame.
#' Each top level element in the list corresponds to a column, and the list assigned to each column should have
#' two elements: `analyticalType` and `semanticType`. `analyticalType` can
#' only be one of "measure" or "dimension". `semanticType` can only be one of
#' "quantitative", "temporal", "nominal" or "ordinal". For example:
#' \code{list(
#' "gender" = list(analyticalType = "dimension", semanticType = "nominal"),
Expand All @@ -25,7 +20,6 @@
#' @param visConfig An optional config string to reproduce your chart. You can copy the string by clicking "export config" button on the GWalkR interface.
#' @param visConfigFile An optional config file path to reproduce your chart. You can download the file by clicking "export config" button then "download" button on the GWalkR interface.
#' @param toolbarExclude An optional list of strings to exclude the tools from toolbar UI. However, Kanaries brand info is not allowed to be removed or changed unless you are granted with special permission.
#' @param kernelComputation An optional boolean to enable the kernel mode computation which is much more efficient. Default is FALSE.
#'
#' @return An \code{htmlwidget} object that can be rendered in R environments
#'
Expand All @@ -34,47 +28,42 @@
#' gwalkr(mtcars)
#'
#' @export
gwalkr <- function(data, lang = "en", dark = "light", columnSpecs = list(), visConfig = NULL, visConfigFile = NULL, toolbarExclude = list(), kernelComputation = FALSE) {
gwalkr <- function(data, lang = "en", dark = "light", columnSpecs = list(), visConfig = NULL, visConfigFile = NULL, toolbarExclude = list()) {
if (!is.data.frame(data)) stop("data must be a data frame")
if (!is.null(visConfig) && !is.null(visConfigFile)) stop("visConfig and visConfigFile are mutually exclusive")
lang <- match.arg(lang, choices = c("en", "ja", "zh"))

rawFields <- raw_fields(data, columnSpecs)
colnames(data) <- sapply(colnames(data), fname_encode)

if (!is.null(visConfigFile)) {
visConfig <- readLines(visConfigFile, warn=FALSE)
}
# forward options using x
x = list(
dataSource = jsonlite::toJSON(data),
rawFields = rawFields,
i18nLang = lang,
visSpec = visConfig,
dark = dark,
toolbarExclude = toolbarExclude
)

if (kernelComputation) {
gwalkr_kernel(data, lang, dark, rawFields, visConfig, toolbarExclude)
} else {
x = list(
dataSource = toJSON(data),
rawFields = rawFields,
i18nLang = lang,
visSpec = visConfig,
dark = dark,
toolbarExclude = toolbarExclude,
useKernel = FALSE
)

# create widget
htmlwidgets::createWidget(
name = 'gwalkr',
x,
package = 'GWalkR',
width='100%',
height='100%'
)
}
# create widget
htmlwidgets::createWidget(
name = 'gwalkr',
x,
package = 'GWalkR',
width='100%',
height='100%'
)
}

#' Shiny bindings for gwalkr
#'
#' Output and render functions for using gwalkr within Shiny
#' applications and interactive Rmd documents.
#'
#'
#' @import shiny
#'
#' @param outputId output variable to read from
Expand Down
80 changes: 0 additions & 80 deletions R/gwalkr_kernel.R

This file was deleted.

5 changes: 1 addition & 4 deletions man/gwalkr.Rd

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

4 changes: 1 addition & 3 deletions web_app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@
},
"dependencies": {
"@kanaries/graphic-walker": "^0.4.70",
"@kanaries/gw-dsl-parser": "^0.1.49",
"@rollup/plugin-commonjs": "^25.0.2",
"@rollup/plugin-replace": "^5.0.2",
"@rollup/plugin-terser": "^0.4.3",
"@rollup/plugin-typescript": "^11.1.2",
"mobx-react-lite": "^3.4.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"styled-components": "^5.3.6",
"vite-plugin-wasm": "^3.3.0"
"styled-components": "^5.3.6"
},
"devDependencies": {
"@types/react": "^18.2.14",
Expand Down
31 changes: 0 additions & 31 deletions web_app/src/dataSource/index.tsx

This file was deleted.

Loading

0 comments on commit c80fe8e

Please sign in to comment.