Skip to content

Commit 57ef62d

Browse files
committed
v.1.6.3
1 parent a8c6eeb commit 57ef62d

File tree

10 files changed

+50
-38
lines changed

10 files changed

+50
-38
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ README.md
2222
^\.ccache$
2323
^tic\.R$
2424
^codecov\.yml$
25+
cleanup.bat

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: echarty
22
Title: Minimal R/Shiny Interface to JavaScript Library 'ECharts'
3-
Date: 2023-12-19
4-
Version: 1.6.2.02
3+
Date: 2024-01-10
4+
Version: 1.6.3
55
Author: Larry Helgason, with initial code from John Coene's library echarts4r
66
Maintainer: Larry Helgason <larry@helgasoft.com>
77
Description: Deliver the full functionality of 'ECharts' with minimal overhead. 'echarty' users build R lists for 'ECharts' API. Lean set of powerful commands.

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# history of package _echarty_
22

3-
## v.1.6.2.02 latest, in development
3+
## v.1.6.3
44

55
- added coder.R demo
66
- correct gridIndex numbering for xAxis/yAxis

R/echarty.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,8 @@ ec.init <- function( df= NULL, preset= TRUE, ctype= 'scatter', ...,
352352
pos <- which(colnames(df)==grnm)
353353
if (!is.null(tl.series) && !is.null(tl.series$groupBy))
354354
pos <- c(pos, which(colnames(df)==tl.series$groupBy))
355+
if (!is.null(series.param) && !is.null(series.param$groupBy))
356+
pos <- c(pos, which(colnames(df)==series.param$groupBy))
355357
allp <- rep(TRUE, length(colnames(df)))
356358
allp <- replace(allp, pos, FALSE)
357359
colX <- which(allp==TRUE)[1] # first two==TRUE are X,Y
@@ -625,14 +627,15 @@ ec.init <- function( df= NULL, preset= TRUE, ctype= 'scatter', ...,
625627

626628
# ------------- timeline -----------------
627629
if (is.null(tl.series) && is.null(opt1$timeline)) return(wt)
630+
if (!preset) return(wt)
628631
# timeline is evaluated last
629632
if (is.null(tl.series) &&
630633
!is.null(opt1$timeline) &&
631634
!is.null(series.param))
632635
tl.series <- series.param
633636

634637
if (is.null(df) || !is.grouped_df(df))
635-
stop('ec.init: tl.series requires a grouped data.frame df')
638+
stop('ec.init: tl.series requires a grouped data.frame df')
636639

637640
if (is.null(tl.series$encode))
638641
tl.series$encode <- list(x=1, y=2, z=3) # set default for non-map series

R/examples.R

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@
8686
#' dim = runif(3, 1, 100),
8787
#' nam = c('Brazil','China','India')
8888
#' )
89-
#' cns |> group_by(nam) |> ec.init(load= 'world',
90-
#' tl.series= list(type='map',
89+
#' cns |> group_by(nam) |> ec.init(load= 'world', timeline= list(s=TRUE),
90+
#' series.param= list(type='map',
9191
#' encode=list(value='val', name='nam')),
9292
#' toolbox= list(feature= list(restore= list())),
9393
#' visualMap= list(calculable=TRUE, dimension=2)
@@ -282,10 +282,14 @@
282282
#' xAxis= list(type= 'category', name= 'tree'),
283283
#' yAxis= list(max= max(Orange$circumference)),
284284
#' timeline= list(autoPlay= TRUE),
285-
#' tl.series= list(type= 'bar', encode= list(x='Tree', y='circumference'))
285+
#' series.param= list(type= 'bar', encode= list(x='Tree', y='circumference'))
286286
#' ) |> ec.upd({
287287
#' options <- lapply(options,
288-
#' function(o) { o$title$text <- paste('age',o$title$text,'days'); o })
288+
#' function(o) {
289+
#' vv <- o$series[[1]]$datasetIndex +1;
290+
#' vv <- dataset[[vv]]$transform$config[["="]]
291+
#' o$title$text <- paste('age',vv,'days');
292+
#' o })
289293
#' })
290294
#'
291295
#'
@@ -298,12 +302,12 @@
298302
#' color= c("blue","purple","red","gold","blue","purple","red","gold")
299303
#' )
300304
#' df |> group_by(group) |> ec.init(
301-
#' preset= FALSE,
302-
#' legend= list(selectedMode= "single"),
303-
#' tl.series= list(type= 'pie', roseType= 'radius',
304-
#' itemStyle= list(color=ec.clmn(5)),
305-
#' label= list(formatter=ec.clmn(4)),
306-
#' encode=list(value='value', itemName='type'))
305+
#' preset= FALSE, legend= list(selectedMode= "single"),
306+
#' timeline= list(show=TRUE),
307+
#' series.param= list(type= 'pie', roseType= 'radius',
308+
#' itemStyle= list(color=ec.clmn(5)),
309+
#' label= list(formatter=ec.clmn(4)),
310+
#' encode=list(value='value', itemName='type'))
307311
#' )
308312
#'
309313
#'

R/util.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#' \verb{ }... - optional custom series attributes like _itemStyle_\cr
3636
#' \verb{ }ppfill - optional fill color like '#F00', OR NULL for no-fill, for all Points and Polygons\cr
3737
#' \verb{ }nid - optional feature property for item name used in tooltips\cr
38-
#' \verb{ }optional geoJSON _feature properties_: color, ppfill, lwidth, ldash, radius(for points)\cr
38+
#' \verb{ }optional geoJson _feature properties_: color, ppfill, lwidth, ldash, radius(for points)\cr
3939
#' **cmd = 'layout'** \cr
4040
#' \verb{ }multiple charts in table-like rows/columns format\cr
4141
#' \verb{ }... - List of charts\cr

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ iris |> group_by(Species) |> ec.init(load= '3D')
8585
iris |> group_by(Species) |>
8686
ec.init(
8787
timeline= list(autoPlay= TRUE),
88-
tl.series= list(
89-
symbolSize= ec.clmn('Petal.Width', scale= 3),
90-
encode= list(y= c('Sepal.Width', 'Petal.Length')),
88+
series.param = list(
89+
symbolSize= ec.clmn('Petal.Width', scale= 9),
90+
encode= list(x= 'Sepal.Width', y='Petal.Length'),
9191
markLine= list(data= list(list(type='max'), list(type='min')))
9292
)
9393
)
@@ -99,12 +99,12 @@ echarty::ec.fromJson('https://helgasoft.github.io/echarty/test/pfull.json')
9999

100100
## Get started
101101

102+
The Coder is a good introduction, type ```library(echarty); demo(coder)```.
102103
The [**WEBSITE**](https://helgasoft.github.io/echarty) has a gallery with code and tutorials.
103-
<br /> The package has plenty of [**code
104-
examples**](https://github.com/helgasoft/echarty/blob/main/R/examples.R)
104+
The package itself has plenty of [**code examples**](https://github.com/helgasoft/echarty/blob/main/R/examples.R)
105105
included. Type
106106
**?ec.examples**, then copy/paste any code to
107-
see the result.
107+
see the chart.
108108

109109
Now you can start building [**beautiful
110110
ECharts**](https://echarts.apache.org/examples/en/index.html) (and

man/ec.examples.Rd

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

man/ec.util.Rd

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

tests/testthat/test-presets.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ test_that("ec.init presets for timeline", {
5656
)
5757
barTL <- function(data, timeline_var) { #}, x_var, bar_var) {
5858
bt <- data |> dplyr::group_by(!!dplyr::sym(timeline_var)) |>
59-
ec.init(tl.series = list(type='bar'), #,encode=list(x=x_var, y=bar_var)),
59+
ec.init(series.param = list(type='bar'), #,encode=list(x=x_var, y=bar_var)),
6060
xAxis= list(name='xval'),
6161
timeline= list(s=T) # data= c(1,2,3,4), axisType='value') #ok
6262
)
@@ -92,12 +92,12 @@ test_that("ec.init presets for timeline groupBy", {
9292
expect_equal(p$x$opts$options[[4]]$series[[1]]$encode$y, 'y')
9393
expect_equal(p$x$opts$yAxis$name, 'y')
9494

95-
p <- dat |> group_by(x1) |> ec.init(preset=F, #load='3D',
95+
p <- dat |> group_by(x1) |> ec.init(#load='3D',
9696
xAxis3D=list(s=T),yAxis3D=list(s=T),zAxis3D=list(s=T),grid3D=list(s=T),
97-
legend= list(show=TRUE),
98-
tl.series= list(encode= list(x='x', y='y', z='z'), type='scatter3D',
99-
symbolSize= ec.clmn('x4', scale=30),
100-
groupBy= 'x2')
97+
timeline=list(s=T), legend= list(show=TRUE),
98+
series.param= list(type='scatter3D', groupBy= 'x2',
99+
encode= list(x='x', y='y', z='z'),
100+
symbolSize= ec.clmn('x4', scale=30) )
101101
)
102102
expect_equal(p$x$opts$options[[1]]$series[[1]]$coordinateSystem, 'cartesian3D')
103103
expect_equal(length(p$x$opts$options[[1]]$series), 2)

0 commit comments

Comments
 (0)