Skip to content

Commit a61052e

Browse files
author
Larry Helgason
committed
1.7.2 renderItem
1 parent b89217f commit a61052e

File tree

5 files changed

+28
-28
lines changed

5 files changed

+28
-28
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: echarty
22
Title: Minimal R/Shiny Interface to JavaScript Library 'ECharts'
3-
Date: 2026-01-17
3+
Date: 2026-01-19
44
Version: 1.7.2
55
Authors@R: c(
66
person(given= "Larry", family= "Helgason", role= c("aut", "cre"), email= "larry@helgasoft.com", comment="initial code from John Coene's library echarts4r")

R/echarty.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ renderCustom <- setNames(as.list(plf[[2]]), plf[[1]])
146146
#' ec.init(
147147
#' series.param= list(
148148
#' renderItem= 'segmentedDoughnut', # v.6 from https://github.com/apache/echarts-custom-series
149-
#' itemPayload= list(segmentCount= 8, label= list(show=T, formatter= '{c}/{b}', fontSize=35) ),
149+
#' itemPayload= list(segmentCount= 8, label= list(show=TRUE, formatter= '{c}/{b}', fontSize=35) ),
150150
#' data= list(5) )
151151
#' )
152152
#'
@@ -408,7 +408,7 @@ ec.init <- function( df= NULL, preset= TRUE, ..., #ctype= 'scatter',
408408
lapply(hvals, \(x) {
409409
cnt <- length(gregexpr(spr, names(x), fixed=TRUE)[[1]])
410410
#if (cnt < 1) return(NULL)
411-
tt <- gsub(spr, '=list(', names(x), fixed=T)
411+
tt <- gsub(spr, '=list(', names(x), fixed=TRUE)
412412
mm <- if (is.character(unlist(x))) paste0('"',unlist(x, use.names=F),'"') else x
413413
tt <- paste('cc <- list(',tt,'=',mm, paste(rep(')',cnt+1), collapse='')) # close parenthesis
414414
tt <- eval(parse(text=tt))
@@ -551,7 +551,7 @@ ec.init <- function( df= NULL, preset= TRUE, ..., #ctype= 'scatter',
551551
if (!'yAxis' %in% namop) x$opts$yAxis <- list(show=TRUE)
552552
}
553553
if (dbg) cat('\n axad=',axad)
554-
#if ((!'legend' %in% namop) && isSname) cat("\nNote: Some series have names, could add legend with 'legend= list(show=T)'")
554+
#if ((!'legend' %in% namop) && isSname) cat("\nNote: Some series have names, could add legend with 'legend= list(show=TRUE)'")
555555

556556
# reading from encode set above # TODO: when names not 'x','y' ?
557557
tmp <- series.param$encode
@@ -1098,7 +1098,7 @@ ec.upd <- function(wt, ...) {
10981098
#' df |> ec.init( load='custom', # polygon only
10991099
#' legend= list(show= TRUE),
11001100
#' xAxis= list(type='category', boundaryGap=FALSE), # stack
1101-
#' #xAxis= list(scale=T, min='dataMin'), # polygon
1101+
#' #xAxis= list(scale=TRUE, min='dataMin'), # polygon
11021102
#' series= append(
11031103
#' list(list(type='line', color='blue', name='line1')),
11041104
#' banda

demo/examples.R

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ ec.init(df,
5252
type= 'time',
5353
axisLabel= list(
5454
formatter= '{dd} {HH}:{mm}', customValues= df$x,
55-
hideOverlap=T, showMinLabel=T, showMaxLabel=T)
55+
hideOverlap=TRUE, showMinLabel=TRUE, showMaxLabel=TRUE)
5656
),
5757
series = list(list(type= "line", clip= FALSE,
5858
markPoint= list(data= list(list(coord= list(df$x[4], 1.8)), list(type= "max") ))
5959
)),
6060
tooltip= list(trigger= 'axis'),
61-
dataZoom= list(show=T, filterMode='none')
61+
dataZoom= list(show=TRUE, filterMode='none')
6262
)
6363

6464
#------ Data grouping -----
@@ -176,7 +176,7 @@ cns <- data.frame(
176176
dim = c(44,66, 100)
177177
)
178178
cns |> group_by(nam) |> ec.init(load= 'world',
179-
timeline= list(s=TRUE), color=c('#eee','green'),
179+
timeline= list(show=TRUE), color=c('#eee','green'),
180180
series.param= list(type='map',
181181
encode=list(value='dim', name='nam')
182182
),
@@ -229,24 +229,24 @@ data <- data.frame( # triangles map
229229
subregion = c('sr1','sr1','sr1', 'sr2','sr2','sr2')
230230
)
231231
ec.init(
232-
# geo= list(roam=T, map='trgl', itemStyle= list(areaColor='pink')),
233-
series.param= list( type='map', map='trgl', roam=T,
232+
# geo= list(roam=TRUE, map='trgl', itemStyle= list(areaColor='pink')),
233+
series.param= list( type='map', map='trgl', roam=TRUE,
234234
data= list(
235235
list(name= 'sr1', value= 9),
236236
list(name= 'sr2', value= 1)
237237
)
238238
),
239239
visualMap= list( max=11, inRange= list(color= rev(rainbow(10)))),
240-
tooltip=list(show=T),
240+
tooltip=list(show=TRUE),
241241
registerMap= list(mapName='trgl', opt= list(geoJson= ec.data(data, 'borders')))
242242
) #|> ec.registerMap('trgl', ec.data(data, 'borders'))
243243

244244
# library(ggplot2) # CRAN complains
245245
# df <- ggplot2::map_data("world", c("taiwan")) |>
246246
# mutate(subregion= ifelse(is.na(subregion), region, subregion))
247247
# ec.init(
248-
# geo= list(roam=T, map='tw', itemStyle= list(areaColor='pink')),
249-
# tooltip=list(show=T)
248+
# geo= list(roam=TRUE, map='tw', itemStyle= list(areaColor='pink')),
249+
# tooltip=list(show=TRUE)
250250
# ) |> ec.registerMap('tw', ec.data(df, 'borders'))
251251

252252

@@ -461,7 +461,7 @@ ec.init(load= 'ecStat',
461461
iris |> ec.init(
462462
load='https://cdn.jsdelivr.net/gh/100pah/echarts-simple-transform@refs/heads/main/dist/ecSimpleTransform.min.js',
463463
js= c('echarts.registerTransform(ecSimpleTransform.aggregate)','',''),
464-
title= list( text='ecSimpleTransform.aggregate'), legend= list(show=T),
464+
title= list( text='ecSimpleTransform.aggregate'), legend= list(show=TRUE),
465465
series.param= list(name='scatter')
466466
) |> ec.upd({
467467
dataset <- append(dataset, list(list(
@@ -599,7 +599,7 @@ ec.init(
599599

600600
#------ multiple series + common series.param + dataset -----
601601
mtcars |> arrange(mpg) |> ec.init(
602-
legend= list(show=T), tooltip= list(show=T),
602+
legend= list(show=TRUE), tooltip= list(show=TRUE),
603603
preset=F, # dont add axes names
604604
series.param= list(symbolSize=11),
605605
series= list(
@@ -636,7 +636,7 @@ treeData <- ec.data(hc, format='dendrogram')[[1]]
636636
# # data 2
637637
# library(data.tree); data(acme)
638638
# tmp <- acme
639-
# cmax <- max(tmp$Get('cost'), na.rm=T)
639+
# cmax <- max(tmp$Get('cost'), na.rm=TRUE)
640640
# tmp$Do(function(x) { # works with or without values
641641
# cos <- as.numeric(x$cost); x$value <- ifelse(length(cos)==0, 0, cos) }) # add 'value'
642642
# treeData <- tmp |> ToListExplicit(unname =TRUE)
@@ -653,7 +653,7 @@ treeData <- ec.data(hc, format='dendrogram')[[1]]
653653
# tmp$Do(function(x) {
654654
# #pop <- as.numeric(x$population); x$value <- ifelse(length(pop)==0, 0, pop) }) # add 'value'
655655
# gni <- as.numeric(x$GNI); x$value <- ifelse(length(gni)==0, 0, gni) }) # add 'value'
656-
# cmax <- max(tmp$Get('GNI'), na.rm=T) # add -1e9(-1B) for population
656+
# cmax <- max(tmp$Get('GNI'), na.rm=TRUE) # add -1e9(-1B) for population
657657
# treeData <- tmp |> ToListExplicit(unname =TRUE)
658658

659659
# needed by JS for click event
@@ -686,14 +686,14 @@ ec.init(load= 'custom', title= list(text='flame tree', bottom='5%'),
686686

687687
#------ segmented donut v.6 -----
688688
ec.init(
689-
load= 'https://cdn.jsdelivr.net/gh/apache/echarts-custom-series@main/custom-series/segmentedDoughnut/dist/segmented-doughnut.auto.js',
690-
ask= 'loadRemote',
689+
#load= 'https://cdn.jsdelivr.net/gh/apache/echarts-custom-series@main/custom-series/segmentedDoughnut/dist/segmented-doughnut.auto.js',
690+
#ask= 'loadRemote',
691691
series.param= list(
692-
type= 'custom', renderItem= 'segmentedDoughnut',
693-
coordinateSystem= 'none',
692+
renderItem= 'segmentedDoughnut',
693+
# type= 'custom', coordinateSystem= 'none',
694694
itemPayload= list(
695695
radius= list('50%','65%'), segmentCount= 8,
696-
label= list(show=T, formatter= '{c}/{b}', fontSize=35, color= '#555')
696+
label= list(show=TRUE, formatter= '{c}/{b}', fontSize=35, color= '#555')
697697
),
698698
data= list(5) )
699699
)
@@ -755,7 +755,7 @@ ec.init(
755755

756756
#---- chord v.6 ----
757757
ec.init(
758-
tooltip = list(show=T), legend= list(show=T),
758+
tooltip = list(show=TRUE), legend= list(show=TRUE),
759759
series.param= list(type = "chord", name = "test",
760760
startAngle = 90, endAngle = -270, clockwise = FALSE,
761761
lineStyle = list(color = "target"),
@@ -842,8 +842,8 @@ url <- 'https://echarts.apache.org/examples/data/asset/geo/Veins_Medical_Diagram
842842
svg <- url |> readLines(encoding='UTF-8') |> paste0(collapse="")
843843
ec.init(
844844
title= list(text= 'mouseover events'),
845-
grid = list(left= "60%", top= "10%", bottom= "10%"), tooltip= list(show=T),
846-
xAxis = list(show=T),
845+
grid = list(left= "60%", top= "10%", bottom= "10%"), tooltip= list(show=TRUE),
846+
xAxis = list(show=TRUE),
847847
yAxis = list(type='category', data = list("heart", "large-intestine", "small-intestine", "spleen", "kidney", "lung", "liver")),
848848
series = list(
849849
list(type= "bar", emphasis= list(focus= "self"), data= list(121, 321, 141, 52, 198, 289, 139))
@@ -911,7 +911,7 @@ if (interactive()) {
911911
output$plot <- ecs.render({
912912
mtcars |> group_by(cyl) |>
913913
ec.init(dataZoom= list(type= 'inside'), title=list(text='mouseover,legend,zoom events'),
914-
series.param= list(selectedMode=T),
914+
series.param= list(selectedMode=TRUE),
915915
on= list( # event(s) with Javascript handler
916916
list(event= 'legendselectchanged',
917917
handler= ec.clmn("(e) => Shiny.setInputValue('lgnd', 'legend:'+e.name);"))

man/ec.init.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.

man/ecr.band.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.

0 commit comments

Comments
 (0)