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
library(shiny) | |
library(waiter) | |
spinner <- HTML( | |
'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="100px" height="100px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve"> | |
<path fill="#025fb6" stroke="none" class="tire" d="M96.986,49.287H100c-0.034-2.642-0.277-5.234-0.708-7.754l-2.974,0.547l-0.25-1.357l2.97-0.557 | |
c-0.558-2.803-1.353-5.518-2.358-8.135l-2.812,1.123l-0.514-1.279l2.813-1.133c-1.128-2.69-2.479-5.264-4.033-7.695l-2.528,1.7 | |
l-0.763-1.162l2.524-1.66c-1.646-2.417-3.496-4.678-5.527-6.768l-2.134,2.139l-0.981-0.977l2.135-2.139 | |
c-1.855-1.807-3.857-3.477-5.981-4.98l-1.714,2.495l-1.143-0.786l1.713-2.495c-2.338-1.567-4.823-2.935-7.422-4.092L69.116,7.1 | |
l-1.271-0.547l1.191-2.793c-2.656-1.099-5.43-1.973-8.296-2.598l-0.61,2.979l-1.357-0.278l0.615-2.979C56.566,0.3,53.7,0,50.7,0 |
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
--- | |
title: "Shiny HTTP response" | |
author: "John Coene" | |
date: "`r Sys.Date()`" | |
output: html_document | |
--- | |
Start from the application we put together previously (below). | |
```r |
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
library(shiny) | |
ui <- fluidPage( | |
uiOutput("intro") | |
) | |
server <- function(input, output, session){ | |
# serve the response | |
path <- session$registerDataObj( |
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
library(shiny) | |
ui <- fluidPage( | |
htmlwidgets::getDependency("echarts4r"), # add dependencies | |
tags$script(src="https://cdn.jsdelivr.net/npm/echarts-gl/dist/echarts-gl.min.js"), # add webgl | |
htmltools::includeScript("scatter.js"), | |
div(id="chart", style="height:90%; width:100%; min-height: 400px;") | |
) | |
server <- function(input, output, session) { |
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
library(shiny) | |
library(dplyr) | |
library(echarts4r) | |
color_it <- function(x){ | |
switch(x, | |
setosa = "#5858A0", | |
versicolor = "#9cd156", | |
virginica = "#c99535" | |
) |
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
library(echarts4r) | |
library(quantmod) | |
getSymbols("GS") #Goldman Sachs | |
GS <- as.data.frame(GS) | |
GS$date <- row.names(GS) | |
# https://echarts.apache.org/en/option.html#series-candlestick.itemStyle.color | |
GS %>% | |
e_charts(date) %>% |
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
library(shiny) | |
ui <- fluidPage( | |
gioOutput("globe"), | |
verbatimTextOutput("selected") | |
) | |
server <- function(input, output, session) { | |
output$globe <- renderGio({ |
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
library(echarts4r) | |
df <- data.frame( | |
x = rev(rep(letters, 2)), | |
y = runif(52), | |
group = factor(c(rep("C", 26), rep("A", 26)), levels = c("A", "C")) | |
) | |
df %>% | |
dplyr::arrange(group) %>% |
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
## app.R ## | |
library(shiny) | |
library(waiter) | |
library(shinydashboard) | |
# add JavaScript to add an id to the <section> tag so we can overlay waiter on top of it | |
add_id_to_section <- " | |
$( document ).ready(function() { | |
var section = document.getElementsByClassName('content'); | |
section[0].setAttribute('id', 'waiter-content'); |
NewerOlder