Examples for 'metricsgraphics::mjs_add_mouseover'


Adds a custom rollover to a metricsgraphics chart

Aliases: mjs_add_mouseover

Keywords:

### ** Examples

set.seed(1492)
dat <- data.frame(date=as.Date('2009-01-01') + 0:9,
                  value=rnorm(10, 0, 2))
dat %>%
  mjs_plot(x=date, y=value) %>%
  mjs_line() %>%
  mjs_axis_x(xax_format = "date") %>%
  mjs_add_mouseover("function(d, i) {
                $('{{ID}} svg .mg-active-datapoint')
                    .text('custom text : ' + d.date + ' ' + i);
                 }")
Warning in widget_html(name = class(x)[1], package = attr(x, "package"), :
metricsgraphics_html returned an object of class `list` instead of a
`shiny.tag`.
Error in loadNamespace(name): there is no package called 'webshot'
# slightly different for scatterplots

dat <- data.frame(value=rnorm(n=30, mean=5, sd=1),
                  value2=rnorm(n=30, mean=4, sd=1),
                  test = c(rep(c('test', 'test2'), 15)))

dat %>%
  mjs_plot(x = value, y = value2) %>%
  mjs_point() %>%
  mjs_add_mouseover("function(d, i) {
                $('{{ID}} svg .mg-active-datapoint')
                    .text('custom text : ' + d.point.test + ' ' + i);
                 }")
Warning in widget_html(name = class(x)[1], package = attr(x, "package"), :
metricsgraphics_html returned an object of class `list` instead of a
`shiny.tag`.
Error in loadNamespace(name): there is no package called 'webshot'

[Package metricsgraphics version 0.9.0 Index]