0

I have similar question as question. Is it possible to see different vaules (using add_tooltip of ggvis) when I click in different place in line? Right now,it shows only one value.

mtcars %>% ggvis(~wt, ~mpg) %>% 
  layer_lines() %>% 
  add_tooltip(function(df) df$wt)
Community
  • 1
  • 1
Nicolabo
  • 1,337
  • 12
  • 30
  • look at this answer http://stackoverflow.com/questions/24519980/add-data-to-ggvis-tooltip-thats-contained-in-the-input-dataset-but-not-directly/24528087#24528087 – Koundy Feb 16 '15 at 11:51
  • @ koundy Thanks but it is not an aswer, because that solution refers to `layer_points`, but I need solution to `layer_lines`. – Nicolabo Feb 16 '15 at 12:08
  • You need to combine it with `layer_points`. `layer_lines` will only show the first value. Check [here](http://stackoverflow.com/questions/28396900/r-ggvis-html-function-failing-to-add-tooltip/28399656#28399656) if you want an example. – LyzandeR Feb 16 '15 at 12:30
  • I was trying to do the same thing with lines in ggvis. There are a number of rCharts libraries that do this but I needed a few features that ggvis made easy. The upshot is that after quite a bit of trial and error I came to the same conclusion....to do this with ggvis you need layer_lines and layer_points. That works nicely. Check out the the new R package metricsgraphics. – miles2know Feb 27 '15 at 17:41

0 Answers0