Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/timelyportfolio/eventdropR
EventDrops d3.js timeline as R htmlwidget
https://github.com/timelyportfolio/eventdropR
d3 d3js d3v4 htmlwidgets interactive package r rstats timeline
Last synced: 3 months ago
JSON representation
EventDrops d3.js timeline as R htmlwidget
- Host: GitHub
- URL: https://github.com/timelyportfolio/eventdropR
- Owner: timelyportfolio
- Created: 2016-07-06T20:24:30.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-14T19:49:32.000Z (over 7 years ago)
- Last Synced: 2024-01-28T23:09:08.728Z (9 months ago)
- Topics: d3, d3js, d3v4, htmlwidgets, interactive, package, r, rstats, timeline
- Language: R
- Size: 148 KB
- Stars: 15
- Watchers: 5
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
- awesome-shiny-extensions - eventdropR - HTML widget for EventDrops, time based and event series interactive visualization using D3. (Visualization / Time Series)
- jimsghstars - timelyportfolio/eventdropR - EventDrops d3.js timeline as R htmlwidget (R)
README
---
output: github_document
---```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```Unfinished `htmlwidget` wrapper for [`EventDrops`](https://github.com/marmelab/EventDrops)
### Example
```
# install from github
# devtools::install_github("timelyportfolio/eventdropR")library(eventdropR)
# make some sample data
df <- data.frame(
# random times 30 days plus or minus current time
date = Sys.time() + runif(1000, -30, 30) * 24 * 60 * 60,
# make up five groups
group = paste0("grp_", LETTERS[runif(1000,1,5)]),
stringsAsFactors = FALSE
)# defaults
# date argument not needed since the date is in column date
eventdrop(
df,
name = "group" #if df column named "name" would not need
)# demonstrate how to set some options
eventdrop(
df,
name = "group",
labelsWidth = 150,
hasBottomAxis = TRUE,
mouseover = htmlwidgets::JS('function(d){console.log(d)}')
)# demonstrate how to use with shiny and get events
# can easily build this into our htmlwidget
ed <- eventdrop(
df,
name = "group",
mouseover = htmlwidgets::JS(
'
function(d){
console.log(d);
if(typeof(Shiny)!=="undefined") {
Shiny.onInputChange("eventdrop_click", {data:d});
}
}
'
)
)ed
# now integrate in simple shiny app
library(shiny)
shinyApp(
ui = ed,
server = function(input, output, session){
observeEvent(input$eventdrop_click,{
str(input$eventdrop_click)
})
}
)
```### Code of Conduct
Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by its terms.