Skip to content

Instantly share code, notes, and snippets.

@helgasoft
helgasoft / dxdel.html
Created October 3, 2018 05:04
Add and delete storage tables in IndexedDB thru Dexie.js
<!DOCTYPE html>
<html>
<head>
<title>Dexie.js Table Delete Demo</title>
<meta name="description" content="Add and delete storage tables in IndexedDB thru Dexie.js">
<meta name="author" content="helgasoft.com">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://unpkg.com/dexie/dist/dexie.min.js" type="text/javascript"></script>
<!--
@helgasoft
helgasoft / app.R
Last active September 26, 2019 19:18
add Volume inside quantmod candlechart
# https://gist.github.com/helgasoft/a766acbd3c0af07b9faf6e62a94f9246
library(shiny)
library(quantmod)
ui <- fluidPage(
titlePanel("Volume inside chart_Series"),
mainPanel(
@helgasoft
helgasoft / app.R
Last active December 13, 2019 02:14
remove time gaps from dygraph financial data display
# dygraph workaround: how to avoid time gaps in financial data display
# Please add your voice for a permanent fix in the following thread:
# https://github.com/rstudio/dygraphs/issues/70
# TODO: date+time "2017-01-25 09:00:00" - looks like the JS environment can't deal with this format !?
library(shiny)
library(dygraphs)
ui <- fluidPage(
titlePanel("Dygraph stock data"),
@helgasoft
helgasoft / app.R
Created December 28, 2019 01:11
Customize Shiny dropdown label thru Javascript
library(shiny)
indiv <- c('NA'=1,'STOCH'=2,'SMI'=3,'MACD'=4,'ROC'=5,'MFI'=6,'RSI'=7,'CCI'=8)
ui <- fluidPage(
titlePanel("Customize dropdown label thru Javascript"),
mainPanel(
fluidRow( selectInput(inputId="indik", label="Indicator", choices=indiv),
"click checkbox to reset the dropdown"
),
@helgasoft
helgasoft / loffline.html
Last active January 18, 2020 03:13
Leaflet.offline library demo with faster (async) tile download
<!DOCTYPE html>
<html>
<head>
<title>Example github pages</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="stylesheet"
href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css"
@helgasoft
helgasoft / echart.R
Last active July 22, 2020 19:34
echarts4r demo
# simple echart with one symbol and line,area,point
library(quantmod); library(echarts4r); library(dplyr)
getSymbols("IBM", from='2019-01-01')
IBM <- as.data.frame(IBM)
names(IBM) <- c("open", "high", "low", "close", "volume", "adjusted")
df <- round(IBM, 2) %>% mutate(sym="IBM", date=row.names(IBM))
ivl <- c("2019-10-03", "2020-04-03") # mark area interval
sset <- df %>% filter(between(as.Date(date), as.Date(ivl[1]),as.Date(ivl[2])))
fit <- lm(Cl(sset) ~ c(1:nrow(sset))) # linear regression btw two dates
@helgasoft
helgasoft / app.R
Last active November 14, 2020 15:47
Demo - using Leaflet JS plugins in R and Shiny
# Demo - using Leaflet JS plugins in R and Shiny
# directions from https://gist.github.com/jcheng5/c084a59717f18e947a17955007dc5f92
# implementing an Opacity plugin that works for tile-layers only:
# https://github.com/dayjournal/Leaflet.Control.Opacity
# download js/css files first, see note (2) below
library(shiny)
library(leaflet)
library(htmlwidgets)
@helgasoft
helgasoft / echarty.sunburst.chart.R
Created May 30, 2021 16:48
echarty sunburst chart
#' data from https://github.com/tungmilan
#' see Hierarchies in https://helgasoft.github.io/echarty/uc3.html
DF <- data.frame(
parents = c("Mid Stream","Mid Stream","Mid Stream","Mid Stream",
"Mid Stream","Mid Stream","Mid Stream","Mid Stream",
"Mid Stream","Mid Stream","Mid Stream","Mid Stream",
"Low Stream","Low Stream",
"Low Stream","Low Stream",
"Low Stream","Mac River","Mac River","Mac River",
@helgasoft
helgasoft / sel.serie.Rmd
Last active July 22, 2021 23:16
selecting series in Shiny with p_replace
---
title: "Select Serie"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
runtime: shiny
---
```{r setup, include=FALSE}
@helgasoft
helgasoft / eshiny.R
Last active July 22, 2021 23:21
Demo: echarty with Shiny
#'----------------- Interactive charts with echarty and Shiny -------------------
#' this code not maintained, see latest version in demo(eshiny, package='echarty')
library(shiny)
library(dplyr)
library(echarty)
base_df <- data.frame(ValX = c("A", "B", "C"), ValY = 1:3)
boxplot_df <- data.frame(ValX = sample(LETTERS[1:3], size = 20, replace = TRUE),
ValY = rnorm(20))