Skip to content

Commit 4e8e913

Browse files
authored
updates for v0.1.5 (#24)
* chore: upgrade graphic-walker to 0.4.70 * feat: new param `toolbarExclude` to specify tools to be excluded * docs: add instruction for dev * bump version to 0.1.5
1 parent ef8fa98 commit 4e8e913

File tree

10 files changed

+445
-198
lines changed

10 files changed

+445
-198
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: GWalkR
22
Title: Interactive Exploratory Data Analysis Tool
3-
Version: 0.1.4
3+
Version: 0.1.5
44
Authors@R: c(
55
person("Yue", "Yu", , "yue.yu@connect.ust.hk", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0002-9302-0793")),
@@ -10,7 +10,7 @@ Description: Simplify your R data analysis and data visualization workflow by tu
1010
License: Apache License (>= 2)
1111
Encoding: UTF-8
1212
Roxygen: list(markdown = TRUE)
13-
RoxygenNote: 7.2.3
13+
RoxygenNote: 7.3.2
1414
URL: https://github.com/Kanaries/GWalkR/
1515
BugReports: https://github.com/Kanaries/GWalkR/issues
1616
Imports:

R/gwalkr.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#' )}
2020
#' @param visConfig An optional config string to reproduce your chart. You can copy the string by clicking "export config" button on the GWalkR interface.
2121
#' @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.
22+
#' @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.
2223
#'
2324
#' @return An \code{htmlwidget} object that can be rendered in R environments
2425
#'
@@ -27,7 +28,7 @@
2728
#' gwalkr(mtcars)
2829
#'
2930
#' @export
30-
gwalkr <- function(data, lang = "en", dark = "light", columnSpecs = list(), visConfig = NULL, visConfigFile = NULL) {
31+
gwalkr <- function(data, lang = "en", dark = "light", columnSpecs = list(), visConfig = NULL, visConfigFile = NULL, toolbarExclude = list()) {
3132
if (!is.data.frame(data)) stop("data must be a data frame")
3233
if (!is.null(visConfig) && !is.null(visConfigFile)) stop("visConfig and visConfigFile are mutually exclusive")
3334
lang <- match.arg(lang, choices = c("en", "ja", "zh"))
@@ -43,9 +44,9 @@ gwalkr <- function(data, lang = "en", dark = "light", columnSpecs = list(), visC
4344
dataSource = jsonlite::toJSON(data),
4445
rawFields = rawFields,
4546
i18nLang = lang,
46-
hideDataSourceConfig = TRUE,
4747
visSpec = visConfig,
48-
dark = dark
48+
dark = dark,
49+
toolbarExclude = toolbarExclude
4950
)
5051

5152
# create widget

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,18 @@ gwalkr(iris)
5252

5353
Showcase your data insights with editable and explorable charts on a webpage ([example](https://bruceyyu.github.io/show/tidytuesday_etymology.nb.html))!
5454

55-
<img width="700" alt="image" src="https://github.com/bruceyyu/GWalkR/assets/33870780/4798367c-0dd4-4ad3-b25b-7ea48b79205a">
55+
<img width="700" alt="image" src="https://github.com/bruceyyu/GWalkR/assets/33870780/4798367c-0dd4-4ad3-b25b-7ea48b79205a">
56+
57+
## Development
58+
We encourage developers from the amazing open-source community to help improve this R package!
59+
60+
Because the built web library is not tracked by git, the source code here is not directly runnable.
61+
Please follow the steps below to run the source code on your own device:
62+
63+
1. Run `git clone https://github.com/Kanaries/GWalkR.git` to clone this repository.
64+
2. Go to `/web_app` and `yarn install`.
65+
3. You can now implement your features either in the web app by changing the TypeScript code, or in the R scripts under `/R`.
66+
4. Run `yarn run build` to build the web app, and make sure the built library can be found under `/inst/htmlwidgets/lib/`.
67+
5. In R Studio, run `devtools::load_all("{DIR_OF_GWALKR}")` to load the package (make sure you've removed the installed GWalkR from CRAN before that).
68+
69+
For more information about R package development, please refer to this book, [*R Packages*](https://r-pkgs.org/).

docs/README.zh.md

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,45 @@ status](https://www.r-pkg.org/badges/version/GWalkR)](https://CRAN.R-project.org
2525

2626
### 安装 GWalkR
2727

28-
#### 通过 CRAN 安装 (推荐)
29-
3028
```R
3129
install.packages("GWalkR")
30+
library(GWalkR)
3231
```
3332

34-
#### 通过运行R脚本安装
35-
36-
如果您已在R中安装了`devtools`,您可以在脚本中运行以下R代码来下载。
37-
38-
```R
39-
devtools::install_url("https://kanaries-app.s3.ap-northeast-1.amazonaws.com/oss/gwalkr/GWalkR_latest.tar.gz")
40-
```
41-
42-
#### 通过下载 .tar.gz 文件包安装
43-
44-
或者,从[这个链接](https://kanaries-app.s3.ap-northeast-1.amazonaws.com/oss/gwalkr/GWalkR_latest.tar.gz)中下载包 GWalkR_latest.tar.gz。
45-
打开 R Studio,点击 "Packages" 窗口中的 "Install",然后在 "Install from" 中选择 "Package Archive File (.tgz; .tar.gz)"。然后,选择您的文件系统中的下载好的包,最后点击"Install"。
46-
4733
### 用一行代码开始您的数据探索吧
4834

4935
```R
50-
library(GWalkR)
5136
data(iris)
5237
gwalkr(iris)
5338
```
5439

5540
<img width="1437" alt="image" src="https://github.com/Bruceshark/GWalkR/assets/33870780/718d8ff6-4ad5-492d-9afb-c4ed67573f51">
5641

42+
## 主要功能
43+
### 查看数据概览
44+
<img width="700" alt="image" src="https://github.com/bruceyyu/GWalkR/assets/33870780/67131cfa-a25b-44ae-90a0-95902ea5edb1">
45+
46+
### 通过简单的拖拽操作创建数据可视化
47+
<img width="700" alt="image" src="https://github.com/Bruceshark/GWalkR/assets/33870780/718d8ff6-4ad5-492d-9afb-c4ed67573f51">
48+
49+
### 发现有趣的数据点?使用笔刷功能进一步分析!
50+
<img width="700" alt="image" src="https://github.com/bruceyyu/GWalkR/assets/33870780/8033885d-3699-4f50-84e1-2201b3846b5a">
51+
52+
### 为R Notebook(如R Markdown)提供强大支持
53+
54+
在网页上展示可编辑和交互的图表,让您的数据洞察更加生动 [(示例)]((https://bruceyyu.github.io/show/tidytuesday_etymology.nb.html))
55+
56+
<img width="700" alt="image" src="https://github.com/bruceyyu/GWalkR/assets/33870780/4798367c-0dd4-4ad3-b25b-7ea48b79205a">
57+
58+
## 开发指南
59+
我们欢迎来自开源社区的开发者帮助改进此R包!
60+
61+
由于构建的Web库不被Git追踪,这里的源代码无法直接运行。请按以下步骤在您的设备上运行源代码:
62+
63+
1. 运行 `git clone https://github.com/Kanaries/GWalkR.git` 克隆此仓库。
64+
2. 进入 `/web_app` 并运行 `yarn install`
65+
3. 您可以在TypeScript代码的Web应用或 `/R` 目录下的R脚本中实现您的功能。
66+
4. 运行 `yarn run build` 构建Web应用,并确保构建后的库位于 `/inst/htmlwidgets/lib/` 下。
67+
5. 在R Studio中运行 `devtools::load_all("{GWalkR的路径}")` 来加载包(确保您已经卸载了从CRAN安装的GWalkR)。
68+
69+
如需了解更多R包开发的相关信息,请参考 [*R Packages*](https://r-pkgs.org/) 这本书。

man/gwalkr.Rd

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web_app/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
<title>GWalkR App</title>
88
</head>
99
<body>
10-
<div id="rwalker-app"></div>
10+
<div id="gwalkr-app"></div>
1111
<script type="module">
12-
import GWalker from './src/index';
13-
GWalker({}, "rwalker-app");
12+
import GWalkR from './src/index';
13+
GWalkR({}, "gwalkr-app");
1414
</script>
1515
</body>
1616
</html>

web_app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"preview": "vite preview"
1111
},
1212
"dependencies": {
13-
"@kanaries/graphic-walker": "^0.4.61",
13+
"@kanaries/graphic-walker": "^0.4.70",
1414
"@rollup/plugin-commonjs": "^25.0.2",
1515
"@rollup/plugin-replace": "^5.0.2",
1616
"@rollup/plugin-terser": "^0.4.3",

web_app/src/index.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@ import { createRoot } from "react-dom/client";
33
import { observer } from "mobx-react-lite";
44
import { IAppProps } from "./interfaces";
55
import { GraphicWalker } from "@kanaries/graphic-walker";
6-
import type { VizSpecStore } from '@kanaries/graphic-walker/store/visualSpecStore';
6+
import type { VizSpecStore } from "@kanaries/graphic-walker/store/visualSpecStore";
77
import { getExportTool } from "./tools/exportTool";
88
import CodeExportModal from "./components/codeExportModal";
99
import { StyleSheetManager } from "styled-components";
1010
import tailwindStyle from "tailwindcss/tailwind.css?inline";
1111
import formatSpec from "./utils/formatSpec";
1212

1313
const App: React.FC<IAppProps> = observer((propsIn) => {
14-
const { dataSource, visSpec, rawFields, ...props } = propsIn;
15-
const storeRef = React.useRef<VizSpecStore|null>(null);
14+
const { dataSource, visSpec, rawFields, toolbarExclude, ...props } = propsIn;
15+
const storeRef = React.useRef<VizSpecStore | null>(null);
1616

17-
const specList = visSpec ? formatSpec(JSON.parse(visSpec) as any[], rawFields) : undefined
17+
const specList = visSpec ? formatSpec(JSON.parse(visSpec) as any[], rawFields) : undefined;
1818
const [exportOpen, setExportOpen] = useState(false);
1919

2020
const exportTool = getExportTool(setExportOpen);
2121

2222
const tools = [exportTool];
2323

2424
const toolbarConfig = {
25-
exclude: ["export_code"],
25+
exclude: toolbarExclude ? [...toolbarExclude, "export_code"] : ["export_code"],
2626
extra: tools,
2727
};
2828
return (
@@ -35,7 +35,7 @@ const App: React.FC<IAppProps> = observer((propsIn) => {
3535
);
3636
});
3737

38-
const GWalker = (props: IAppProps, id: string) => {
38+
const GWalkR = (props: IAppProps, id: string) => {
3939
const container = document.getElementById(id);
4040
if (container) {
4141
const shadowRoot = container.attachShadow({ mode: "open" });
@@ -52,10 +52,10 @@ const GWalker = (props: IAppProps, id: string) => {
5252
</StyleSheetManager>
5353
);
5454
}
55-
// If you want to execute GWalker after the document has loaded, you can do it here.
55+
// If you want to execute GWalkR after the document has loaded, you can do it here.
5656
// But remember, you will need to provide the 'props' and 'id' parameters.
57-
// GWalker(someProps, someId);
57+
// GWalkR(someProps, someId);
5858
// });
5959
};
6060

61-
export default GWalker;
61+
export default GWalkR;

web_app/src/interfaces/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ export interface IAppProps {
1010
specType?: string;
1111
dataSource: IRow[];
1212
rawFields: IMutField[];
13+
toolbarExclude: string[];
1314
}

0 commit comments

Comments
 (0)