timevis | ๐ Create interactive timeline visualizations in R | Data Visualization library
kandi X-RAY | timevis Summary
kandi X-RAY | timevis Summary
By Dean Attali ยท Demo. {timevis} lets you create rich and fully interactive timeline visualizations in R. Timelines can be included in Shiny apps and R markdown documents, or viewed from the R console and RStudio Viewer. {timevis} includes an extensive API to manipulate a timeline after creation, and supports getting data out of the visualization into R. This package is based on the visjs Timeline JavaScript library.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of timevis
timevis Key Features
timevis Examples and Code Snippets
Community Discussions
Trending Discussions on timevis
QUESTION
I have reviewed many posts on SO (including Using pivot_longer with multiple paired columns in the wide dataset), but have not found a solution to what I need to do.
having initial dataset:
...ANSWER
Answered 2022-Mar-03 at 16:46This will get you started
QUESTION
I use Timevis package. first of all I read an excel file with missions. In my code the user can see all the missions on a time line, and he can edit/add/remove any missions. after the user make a change I can see the update table below. I want to save to my excel file every update that the user make. this is my code:
...ANSWER
Answered 2021-Oct-30 at 23:18You can use actionButton
/ observe
to call saveworkbook
(package openxlsx) to save your changes. Technically you are not saving these changes, but replacing the file with an identical file containing the changes.
QUESTION
I'm trying to create multiple timelines one after the other to be displayed in a single shiny app. For a minimal example, let's say I have a dataframe from which I create a timeline like this
...ANSWER
Answered 2021-Sep-15 at 18:06This will create the timelines as desired and adds a content column that will display the 'name' of each timeline as Timeline {id}
.
QUESTION
I'm trying to color code the background of a timevis based timeline based on groups divided. I can see that it's possible to color-code the points according to groups, but I need to color-code the background. As you can see in below code, it will change the color of points accordingly.
...ANSWER
Answered 2021-Sep-10 at 23:03We can use some advanced CSS selectors to do the job. So instead of specify the group color inside the dataframe, we do it in the CSS.
Keep rows with the same color together and use ,
to separate the selector.
Number inside .vis-group:nth-of-type(N)
means the row number. It requires you to know which row a group will go to. If no special case, the first group will go to first row, second group second row, et al.
QUESTION
I'm using the package 'timevis' to create a timeline in my RShiny dashboard app. I want to visualize some planned deadlines of when to check machines for their maintenance. In the timeline, both executed checks and planned checks are visible. To visualize these different checks, I want to give it different colors (green for executed and red for planned). I succeeded to do this in a test environment, but when I copy the code in my dashboard, the colors are not visible (all blocks are just standard blue).
This is my code: test:
...ANSWER
Answered 2020-Dec-19 at 17:32As mentioned in the comments, it is very helpful when sample data is provided (as part of a minimal working example).
Here I tried to recreate an example you can work from. You might want to take advantage of className
to provide items with individual CSS styles. I added tags$style
to your ui
based on what you described for red and green.
QUESTION
How to show a timevis output in a modal dialogue in r shiny. Following the example from reactivity in timevis package: passing selectinput variable to subgroup I have tried to show the timeline in a modal dialogue. Thanks for any help.
The code:
...ANSWER
Answered 2020-Nov-20 at 12:27Following this example, you can use bsModal
from the shinyBS
package. I'm not sure if you can use XOutput
in the normal shiny modal.
QUESTION
Using the timevis package (dean attali) in R I would like to plot the timeline by group individually with a selectinput widget in r shiny: Error in : Can't subset columns that don't exist. x Column 2
doesn't exist. Can someone help? Thank you
My code:
...ANSWER
Answered 2020-Nov-07 at 11:42So you want to either show a timeline with the contents of group 1 or 2? Then you need to filter
your group
column; you can't select
the columns 1
or 2
because they don't exist, 1/2 are just the values within the group
column.
QUESTION
I need to show a series of events in a timeline. Some of this events are before common era. I'm using timevis
in R
.
So far, I've tried the following code:
...ANSWER
Answered 2020-Jul-16 at 08:11There was a discussion on github recently about this topic. Using the information from there, you need the following to make it work on RStudio and in an app:
- format the dates as strings
- for BCE dates, you need a minus as prefix and in total 6 digits for the year:
"-002000-01-01"
- for CE dates, you need in total 4 digits for the year:
"0010-01-01"
Example code that works for me in RStudio:
QUESTION
I'm on the home stretch thanks to Stephane Laurent!
I have an Rshiny app that generates a timeline based on a user selecting rows from a data table. The user can then download a zip file containing the table, the timeline, and hopefully the files associated with the rows selected in the table.
I believe I need to pass the filenames from my Rshiny table to JS in order for JS to add the file URL's to a function for JSZip. The files are stored in my app directory under the www folder. so "https://server.me/myapp/Room.pdf" is how navigate to a file. (I've only done something like this with php in the past.)
So in the code below, if a user clicked on the Big Room and Red Rover, then generated a timeline, and then downloaded. They would get a zip file containing timeline.png, timeline.csv, Room.pdf, and Activity.docx
Bonus I would also like the ability to add specific files to all downloads. (I imagine that's fairly simple as I can just point it to the specific url "https://server.me/myapp/Thanks_for_visiting.pdf" without needing Rshiny to do anything.)
Can I pass multiple "things: with session$sendCustomMessage ? Or do it twice? something like:
...ANSWER
Answered 2020-Jul-08 at 16:09library(base64enc)
js <- "
function downloadZIP(x){
var csv = Papa.unparse(x.table);
var URIs = x.URIs;
domtoimage.toPng(document.getElementById('appts'), {bgcolor: 'white'})
.then(function (dataUrl) {
var zip = new JSZip();
var idx = dataUrl.indexOf('base64,') + 'base64,'.length;
var content = dataUrl.substring(idx);
zip.file('timeline.png', content, {base64: true})
.file('timeline.csv', btoa(csv), {base64: true});
for(let i=0; i < URIs.length; ++i){
zip.file(URIs[i].filename, URIs[i].uri, {base64: true});
}
zip.generateAsync({type:'base64'}).then(function (b64) {
var link = document.createElement('a');
link.download = 'mytimeline.zip';
link.href = 'data:application/zip;base64,' + b64;
link.click();
});
});
}
$(document).on('shiny:connected', function(){
Shiny.addCustomMessageHandler('download', downloadZIP);
});"
observeEvent(input$download, {
filenames <- data[input$tbl1_rows_selected, "file_name"]
files <- file.path(".", "www", filenames)
URIs <- lapply(seq_along(files), function(i){
URI <- dataURI(file = files[i])
list(filename = filenames[i], uri = substr(URI, 14, nchar(URI)))
})
table <- fromJSON(toJSON(input$appts_data), simplifyDataFrame = FALSE)
session$sendCustomMessage(
"download",
list(table = table, URIs = URIs)
)
})
QUESTION
I am looking for info on having a download button in my app that pulls various files into a zip archive.
My app displays a timeline and a datatable, and will have files associated with entries on the datatable. The files will be stored in a directory in the app, and I will have a column of filenames in the datatable.
The idea is that when I click the download button, a zip archive will be created that contains a couple of standard files that I point to, a csv of the datatable, a png of the timeline, and any files that I have associated with the selected entries of the datatable.
I haven't begun to deal with the files associated with the datatable, but that's my ultimate end state.
Current Code
...ANSWER
Answered 2020-Jul-07 at 22:35Here is a way using the JavaScript libraries
dom-to-image to export the timeline as a PNG image;
table2CSV to convert the table to a CSV string;
JSZip to zip.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install timevis
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page