Last active
September 11, 2025 19:34
-
-
Save helgasoft/e914fe6f4a9ed9407f78e41cb18b3aaa to your computer and use it in GitHub Desktop.
echarty announcements and temporary notes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' This gist is for echarty announcements and notes | |
#' Comments are temporary, periodically deleted. | |
#' If you like echarty, please consider granting a Github star ⭐. | |
library(echarty) | |
data.frame(x = seq.int(1, 5, 1), | |
y = seq.int(1, 10, 2)) |> | |
ec.init( | |
series.param= list( | |
type='line', symbolSize= 10, | |
lineStyle = list(opacity= 0.7), | |
itemStyle = list(opacity= 1), | |
areaStyle= list(color= 'red', opacity= 0.5)) | |
) |
@bianchenhao, ECharts v.6.0 is supported in latest version of echarty
remotes::install_github('helgasoft/echarty') # latest
library(echarty)
mtx <- cor(swiss)
cols <- colnames(mtx)
mtx[upper.tri(mtx)] <- NA
datam <- as.data.frame(mtx)
datam <- tibble::rownames_to_column(datam, 'x')
# Convert to long format
long_data_base <- reshape( datam, direction= "long",
idvar = "x",
varying = list(colnames(mtx)),
v.names = "value",
timevar = "y",
times = cols # Custom labels for timevar
)
datam <- na.omit(long_data_base)
row.names(datam) <- NULL
vals <- lapply(cols, \(x) { list(value=x) })
ec.init(
title= list(text= 'demo: new matrix chart from ECharts v.6.0'),
preset=F, # to remove default axes
matrix= list(x= list(data=vals), y= list(data=vals)),
visualMap= list(type='continuous', min=-1,max=1, dimension=3,
calculable=TRUE, orient='horizontal', bottom=0, left='center'),
series= list(list(type= 'heatmap', coordinateSystem= 'matrix',
data= ec.data(datam),
label= list(show=TRUE, formatter= ec.clmn('%R2@', 3))
))
)

If you like echarty, please consider granting a Github star ⭐
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
echarty is on WebR - see the Coder.
Live R-code execution inside a single web page. No Rmd. No server. No installation. Wow!
Thanks to: @seanbirchall for the idea and @timelyportfolio for the solution 💐👑