This file contains 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, |
This file contains 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
#' Demo - using Leaflet JS plugins in R and Shiny | |
#' directions from https://gist.github.com/jcheng5/c084a59717f18e947a17955007dc5f92 | |
#' implementing groupings to overlay layers : | |
#' https://github.com/ismyrnow/leaflet-groupedlayercontrol | |
#' todo: would be nice to addMarkers to group layers from R, not only from JS | |
library(shiny) | |
library(leaflet) | |
library(htmlwidgets) |
This file contains 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
library(shiny) | |
library(stringr) | |
library(echarty) | |
library(rclipboard) # for clipboard Copy button | |
library(formatR) | |
if (FALSE) { # notes | |
#' problem plot with Chinese chars: | |
#' text='<U+6F0F><U+6597><U+56FE>' > Sys.getlocale() |
This file contains 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
#'----------- echarty coding helper ------------ | |
#' Please report bugs and ask questions in https://github.com/helgasoft/echarty/issues | |
#' run in RStudio with command demo(coder), or demo(coder, package='echarty') | |
stopifnot('session non-interactive'= interactive()) | |
library(shiny) | |
library(shinyjs) | |
library(shinybusy) | |
library(dplyr) |
This file contains 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
set.seed(22) | |
data <- tibble(x = 2 * pi * (1:100)/100) |> | |
mutate( | |
y1_bar = 0.5 * (sin(x)) + 1, | |
y2_bar = 0.5 * (sin(x)) - 1, | |
deltaY1 = rnorm(100, sd = 0.1), | |
deltaY2 = rnorm(100, sd = 0.1), | |
y1 = y1_bar + deltaY1, | |
y2 = y2_bar + deltaY2, | |
sizeY1 = abs(deltaY1), |
This file contains 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
# https://echarts.apache.org/en/api.html#echartsInstance.resize | |
# https://echarts.apache.org/examples/en/editor.html?c=line-easing | |
library(shiny); library(dplyr); library(echarty) | |
ui <- fluidPage( titlePanel("Resize with echarty"), | |
fluidRow(ecs.output('chart')), | |
checkboxInput('toggle900','Toggle Size 900px'), | |
checkboxInput('toggle400','Toggle Size 400px') | |
) |
This file contains 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
library(shiny) | |
library(tidyverse) | |
library(echarty) | |
ui <- fluidPage( | |
HTML("Binding two charts on <b>inside zoom</b> only<br /> | |
Tooltips could be bound too, by `axis`<br /> | |
Alternative to ECharts <a href='https://echarts.apache.org/en/api.html#echarts.connect'>connect</a><br /> | |
Solution adapted from <a href='https://github.com/apache/echarts/blob/12f6620c25eb96faa3e9f9fbc13a076c3c8bdbbc/test/connect-manually.html'>this code</a>"), | |
tags$head(tags$script(HTML(" |
This file contains 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
#' echarty demo for marmap | |
library(shiny) | |
library(shinydashboard) | |
library(shinybusy) | |
library(echarty) | |
library(marmap) | |
ui = dashboardPage(title='marmap', dashboardHeader(title='Bathymetry Demo'), | |
sidebar = dashboardSidebar( | |
fluidRow( column(12, |
This file contains 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
library(echarty) | |
url <- 'https://test.softpower.tw/echartstw/example/svg/football.svg' | |
svg <- url |> readLines(encoding='UTF-8') |> paste0(collapse="") | |
p <- ec.init(preset=FALSE, | |
backgroundColor= '#228b22', | |
geo= list("map"="football"), | |
title= list(text ='2014 World Cup', textStyle=list( color='#FFFF00'), | |
subtext='original JS code', subtextStyle= list(color='#FFFF00'), | |
sublink='https://test.softpower.tw/echartstw/example/map19.html' | |
), |
This file contains 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
# Expanding on the great code from Milos Popovic | |
# new display as layer on Leaflet map, instead of ggplot | |
# original: https://github.com/milos-agathon/mapping-raster-files-with-terra-in-r | |
################################################################################ | |
# Mapping OSM and satelitte data with terra in R | |
# Milos Popovic | |
# 2022/09/22 | |
################################################################################ |
NewerOlder