EVOLUTION-MANAGER
Edit File: tooltip_chart.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Helper to create charts in tooltips.</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for tooltip_chart {highcharter}"><tr><td>tooltip_chart {highcharter}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Helper to create charts in tooltips.</h2> <h3>Description</h3> <p>Helper to create charts in tooltips. </p> <h3>Usage</h3> <pre> tooltip_chart(accesor = NULL, hc_opts = NULL, width = 250, height = 150) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>accesor</code></td> <td> <p>A string indicating the name of the column where the data is.</p> </td></tr> <tr valign="top"><td><code>hc_opts</code></td> <td> <p>A list of options using the <a href="https://api.highcharts.com/highcharts/">https://api.highcharts.com/highcharts/</a> syntax.</p> </td></tr> <tr valign="top"><td><code>width</code></td> <td> <p>A numeric input in pixels indicating the with of the tooltip.</p> </td></tr> <tr valign="top"><td><code>height</code></td> <td> <p>A numeric input in pixels indicating the height of the tooltip.</p> </td></tr> </table> <h3>Details</h3> <p>This function needs to be used in the <code>pointFormatter</code> argument inside of <code>hc_tooltip</code> function an <code>useHTML = TRUE</code> option. </p> <h3>Examples</h3> <pre> require(dplyr) require(purrr) require(tidyr) require(gapminder) data(gapminder, package = "gapminder") gp <- gapminder %>% arrange(desc(year)) %>% distinct(country, .keep_all = TRUE) gp2 <- gapminder %>% nest(-country) %>% mutate( data = map(data, mutate_mapping, hcaes(x = lifeExp, y = gdpPercap), drop = TRUE), data = map(data, list_parse) ) %>% rename(ttdata = data) gptot <- left_join(gp, gp2) hc <- hchart( gptot, "point", hcaes( lifeExp, gdpPercap, name = country, size = pop, group = continent ) ) %>% hc_yAxis(type = "logarithmic") hc %>% hc_tooltip(useHTML = TRUE, pointFormatter = tooltip_chart(accesor = "ttdata")) hc %>% hc_tooltip(useHTML = TRUE, pointFormatter = tooltip_chart( accesor = "ttdata", hc_opts = list(chart = list(type = "column")) )) hc %>% hc_tooltip( useHTML = TRUE, positioner = JS("function () { return { x: this.chart.plotLeft + 10, y: 10}; }"), pointFormatter = tooltip_chart( accesor = "ttdata", hc_opts = list( title = list(text = "point.country"), xAxis = list(title = list(text = "lifeExp")), yAxis = list(title = list(text = "gdpPercap")) ) ) ) hc %>% hc_tooltip( useHTML = TRUE, pointFormatter = tooltip_chart( accesor = "ttdata", hc_opts = list( legend = list(enabled = TRUE), series = list(list(color = "gray", name = "point.name")) ) ) ) </pre> <hr /><div style="text-align: center;">[Package <em>highcharter</em> version 0.9.4 <a href="00Index.html">Index</a>]</div> </body></html>