0

When hovering over a line graph created with ggvis, I see only the first value of a data.frame displayed, regardless of where I move my mouse.

Example:

library(ggvis)

mtcars %>% ggvis(~wt, ~mpg) %>% 
layer_lines() %>% 
add_tooltip(function(df) df$wt)

I get the value 1.513 now matter where I hover. This problem does not happen when using layer_points.

Ben Rollert
  • 1,564
  • 1
  • 13
  • 21
  • I am simply guessing by seeing the actual code of `layer_lines`. Here `x` is defined using `auto_group`. I am guessing that each data point isn't probably treated as a data point. But, `layer_lines` is probably treating the entire line as one group and using the minimum value of x for `add_tooltip`. I added `stroke = ~factor(cal)` in `ggvis()` and saw that minimum value for `wt` in each factor level appeared. – jazzurro Dec 28 '14 at 04:25
  • 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:52

0 Answers0