Comments (7)
Can you write a small demo of {detourr} with Shiny?
from detourr.
I'll look in to it
from detourr.
Using detourr with Shiny will require a few changes:
- the
renderValue
method will need to be modified to prevent duplicate elements from being drawn each time it's called - shiny bindings will need to be added. I'll need to find a way of doing this that's generic across widgets.
- Using shiny gives some alignment issues between axes and axis labels
from detourr.
I've run in to a slight problem with Shiny, and I'm not sure the best way to work around it.
In order to get the widgets to work with both shiny and crosstalk, I need to write some shiny bindings. For example, for d3scatter
, the following bindings are used, both of which get called from a shiny app:
d3scatterOutput <- function(outputId, width = '100%', height = '400px'){
htmltools::attachDependencies(
tagList(
shinyWidgetOutput(outputId, 'd3scatter', width, height, package = 'd3scatter')
),
crosstalk::crosstalkLibs()
)
}
renderD3scatter <- function(expr, env = parent.frame(), quoted = FALSE) {
if (!quoted) { expr <- substitute(expr) } # force quoted
shinyRenderWidget(expr, d3scatterOutput, env, quoted = TRUE)
}
The problem I'm having is that the first function requires the widget name, but we don't know the widget name until we know the display method and dimension of the tour.
This can be inferred in the second function because we have expr
, which is the call to animate_tour
, and we can extract these values. But the first function only has the output_id which isn't enough to infer the widget name we are using.
@earowang Do you have any experience with writing shiny bindings, and can you suggest how to work around this issue? Ideally the widget name would remain hidden from the user.
The shiny example I'm going by is here: https://rstudio.github.io/crosstalk/shiny.html#:~:text=Adding%20reactive%20outputs
from detourr.
Looks like shinyWidgetOutput()
requires one function corresponding to one widget. I don't have any examples in my mind that can help with this. Maybe decompose animate_tour()
to two functions?
from detourr.
Any updates on this?
from detourr.
For shiny, I'll create wrapper functions that require passing in the widget name, e.g. display_scatter_3d. I intend to work on that this weekend
from detourr.
Related Issues (20)
- Selection default colour to {plotly} red HOT 2
- Vignette on tour plot interactivity
- Vignette on crosstalk and other compatible htmlwidgets HOT 1
- Vignette on how to extend {detourr} for other tour methods/displays
- Change `animate_tour` function name to `detourr` HOT 2
- Add a shape aesthetic for changing the shape of points HOT 2
- Create a new widget for the slice tour
- Interactivity on mobile
- axes for the corner? HOT 1
- pkgdown home page HOT 3
- User API ideas HOT 27
- Matrix multiplication performance HOT 1
- Examples vignette
- display_sage HOT 13
- readme logo size HOT 3
- Github action to run tests and checks
- Saving colours out to file? HOT 4
- Saving colour choices to swatches HOT 6
- Linking with static plot seems to have some errors HOT 3
- brushing overplotted points HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from detourr.