Skip to content

Commit 8b47399

Browse files
committed
get rid of the preview() function; print() is enough
1 parent 7b13c71 commit 8b47399

File tree

4 files changed

+11
-17
lines changed

4 files changed

+11
-17
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: gglite
22
Title: Lightweight Data Visualization via the Grammar of Graphics
3-
Version: 0.0.3
3+
Version: 0.0.4
44
Authors@R: person("Yihui", "Xie", role = c("aut", "cre"), email = "xie@yihui.name",
55
comment = c(ORCID = "0000-0003-0645-5666"))
66
Description: A lightweight R interface to the AntV G2 JavaScript visualization

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ export(mark_treemap)
5757
export(mark_vector)
5858
export(mark_word_cloud)
5959
export(padding_of)
60-
export(preview)
6160
export(renderG2)
6261
export(scale_of)
6362
export(scrollbar_of)

R/render.R

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ cdn_scripts = function() {
136136
#'
137137
#' @param chart A `g2` object.
138138
#' @param ... Additional arguments passed to [chart_html()].
139-
#' @return The path to the temporary HTML file (invisibly).
139+
#' @return The chart object (invisibly).
140140
#' @export
141-
preview = function(chart, ...) {
142-
body = chart_html(chart, ...)
141+
print.g2 = function(x, ...) {
142+
body = chart_html(x, ...)
143143
html = c(
144144
'<!DOCTYPE html>', '<html>', '<head>',
145145
'<meta charset="utf-8">',
@@ -149,12 +149,7 @@ preview = function(chart, ...) {
149149
'</body>', '</html>'
150150
)
151151
xfun::html_view(html)
152-
invisible(chart)
153-
}
154-
155-
#' @export
156-
print.g2 = function(x, ...) {
157-
preview(x, ...)
152+
invisible(x)
158153
}
159154

160155
#' Custom Printing in Knitr

man/preview.Rd renamed to man/print.g2.Rd

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

0 commit comments

Comments
 (0)