Skip to content

Instantly share code, notes, and snippets.

@helgasoft
Last active January 14, 2026 03:07
Show Gist options
  • Select an option

  • Save helgasoft/e914fe6f4a9ed9407f78e41cb18b3aaa to your computer and use it in GitHub Desktop.

Select an option

Save helgasoft/e914fe6f4a9ed9407f78e41cb18b3aaa to your computer and use it in GitHub Desktop.
echarty announcements and temporary notes
#' This gist is for echarty announcements and notes
#' Comments are temporary, periodically deleted.
#' If you like echarty, please consider granting a Github star ⭐.
remotes::install_github('helgasoft/echarty') # get latest
library(echarty)
#------ segmentedDoughnut with ECharts v.6+ -----
ec.init(
load= 'https://cdn.jsdelivr.net/gh/apache/echarts-custom-series@main/custom-series/segmentedDoughnut/dist/index.auto.js',
ask= 'loadRemote',
series.param= list(
type= 'custom', renderItem= 'segmentedDoughnut',
coordinateSystem= 'none',
itemPayload= list(
radius= list('50%','65%'), segmentCount= 8,
label= list(show=T, formatter= '{c}/{b}', fontSize=35, color= '#555')
),
data= list(5) )
)
@helgasoft
Copy link
Author

@jack-davison, two or more charts fit together with grid :

gsize <- '57%'
data.frame(x= letters, y= 1:26) |>
ec.init(
  grid= list(    # two grids fit in chart container
    list(bottom= gsize, top=10),
    list(top= gsize, bottom=10)
  ),
  xAxis= list(       # one X-axis for each grid
    list(type='category'),   # default gridIndex=1
    list(type='category', gridIndex=2) 
  ),
  yAxis= list( list(gridIndex=1), list(gridIndex=2) ),
  series= list(
    list(type='bar'), # default xAxisIndex = yAxisIndex =1
    list(type='bar', xAxisIndex=2, yAxisIndex=2)
  )
) 
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment