Does nearPoints() and brushedPoints() functions in Shiny work on bar-graphs? - r

I am trying to use nearPoints() function in Shiny with bar-graphs(both basic and ggplot packages). But when the page is rendered, none of the click, dbclick, hover are not working with the bar-graphs.
My aim is to show either a dataTable or verbatimTextOutput (containing the rows of the clicked bar) when a bar on the bar-graph is clicked. I can do the above mentioned operations on a scattered plot but not on a bar graph.
The examples mentioned in the Shiny documentation page only showed the scattered plots examples. I just want to know if the nearPoints() and brushedPoints() (similar function for a range on the plot) functions work with bar-graphs or not ?

Winston Chang replied to the question in Shiny Apps discussion forum on Google groups. I am posting it here for future references. Here is the link

Related

How to implement interactive graph from plotly in overleaf?

I want to implement interactive graph from plotly in overleaf. However, overleaf removed the communication with plotly in the V2 version. Is it still possible somehow to implement interactive graph in overleaf and therefore in pdf?
I want to hide/unhide line, zoom in and see value of different points when clicking on it.
I saw this question a couple times before, but the answere was only to zoom in or use javascript and implementing different picture on top of eachother.
However, this is not what i am looking for. I am looking for a really interactive in PDF. Does somebody know how this is possible?

How to show an iplot without opening an additional window into r shiny

I'm trying to build interactive graphs in my shiny app. The user should be able to click on bars and see where the cases are displayed in another graph for example like a scatterplot next to the barplot.
There are different r packages, that are doing a great job: iplot, rggobi, acinonyx. I also found qtlcharts, but it does not exactly what I wanted. The problem is, I can't figure out, how to integrate different iplots into my shiny app boxes. Is there any way preventing iplots from opening separate windows for the graphs?
In acinonyx you can say window=FALSE, which prevents opening the java window of the graph. But the graph isn't displayed in the box as well. You could add/move the iplot into icontainer, iVisual or iWindow, but none of them can be integrated into the shiny boxes in the ui without printing the error: unsupported data frame or doing nothing at all.
I found the answer to my question: building reactive ggplots in shiny and adding coloured layers to one plot if the other plot is clicked will do the job.

How to show a plot in a tooltip with Shiny

I'm building a Shiny app using ggvis, and I need to show a plot (a bar chart, for example) in a tooltip.
So basically, when a user clicks one of the points in the main plot I want a tooltip (or something of the sort) to display a new plot with extra information.
Is it possible to do this with Shiny?
The shiny demo at: http://shiny.rstudio.com/gallery/plot-interaction-selecting-points.html shows code where clicking on (or near) a point produces text output, you could modify that to create the second graph instead. I don't know how to do it like a tool tip, but this would produce the graph next to, or just below the graph being clicked on. The example uses ggplot2 rather than ggvis, so I don't know how that would change things.

How can I build Shiny applications with Animation in R?

I am trying to build a shiny app to build interactive animations with R. I currently have a function that can build gifs/other output options using the Animation package(http://cran.r-project.org/package=animation) that loops through a series of ggplots(by date). And also a shiny app that can show a single ggplot based on the selected date.I want to build a shiny app that refreshes an animation based on a selected date range.
Are there examples of code that uses maybe saveHTML with UIoutput in Shiny? Would this be possible?
reset animation in Shiny R Studio shows someone trying to build an animation within Shiny. https://gist.github.com/yihui/5899181 is example of integrating a saveGIF function into a shiny app, but that is through a download.
Alternative suggestions/packages I could look at to approach this problem in R not necessarily using Animation and/or Shiny would also be appreciated.
I suggest using the googleVis package --> the tool, gvisMotionchart. It's really simple to work with, just make sure your data is numeric or time oriented in some way and also have some character/categorical variable to plot as circles. Best of all is that all animation tools are ALREADY included inside the motion chart.
If you want details how to create this, here is a model example of how to detailed in this thread.
Chart not generated in R shiny when run locally using googleVis
Here's a screenshot of an example of one I've created to visualize chess data.
googlevis example

Can R create a barplot image with clickable bars to insert on a webpage?

I know how to create a barplot, and how to stick it on a webpage; e.g, using hwriteImage in the hwriter package.
What I'd like is for each bar to be a region which highlights on mouseover, and where each bar has a different link when clicked. Similar to this map of the U.S. using the jQuery maphilight plugin, but for a barplot rather than a map. I imagine R could calculate the coordinates of the regions around each bar, generate the HTML AREA tag etc and pass this to maphilight quite easily. Has it been done already? I searched but no luck so far.
Have a look here, which summarises a couple of methods: rggobi and iplots. rggobi looks pretty promising, though maybe the installation looks a bit involved. iplots is only good for scatter plots.
Some other options (I think these are strongest ones at the moment):
googleVis
The googleVis package interfaces with the google charts API: try demo(googleVis) and the third & fourth one are bar chart (there could be more). It has the advantage of being pretty simple to get started with, although these are not R graphics:
df=data.frame(country=c("US", "GB", "BR"), val1=c(10,13,14), val2=c(23,12,32))
Column <- gvisColumnChart(df)
plot(Column)
gridSVG
The gridSVG exports the current grid graphics to an .svg file that can be included into a webpage. Unlike googleVis, it's R graphics (so you can use grid/ggplot2 which are more familiar). It looks like you may have to know some Javascript to further embellish your plots though (e.g. to animate on mouse over, you use grid.garnish(...,onmouseover=...)).
There's some example code you can try here (The really awesome ones are here - usually clicking on the "SVG file" link will have the full interactivity/animation.) (This one is a scatterplot where the points highlight when you move your mouse over them).
As I said - have a look at the package pages, demos, examples, etc to see which suits you.

Resources