Skip to contents

The toolbar holds the chart's own controls, in a corner of the chart: undo, redo and reset of moves, with GC_events()(drag = TRUE), and the save button of GC_chart()(save_button = TRUE). GC_toolbar() sets when and where it shows, which buttons it has, its colours and size, and the icons of its buttons. Colours and size can also be set for all charts of a theme, with GC_theme()(toolbar = list(...)); GC_toolbar() takes precedence.

Usage

GC_toolbar(
  GC_chart,
  show = NULL,
  position = NULL,
  buttons = NULL,
  size = NULL,
  color = NULL,
  hoverColor = NULL,
  tooltipBackground = NULL,
  tooltipColor = NULL,
  tooltipBorder = NULL,
  tooltipRadius = NULL,
  tooltipShadow = NULL,
  fontFamily = NULL,
  icons = NULL
)

Arguments

GC_chart

A GC chart object.

show

When the toolbar shows: "hover" (default) while the mouse is over the chart or one of its buttons has keyboard focus, "always" (e.g. on touch screens), or "never". Keyboard shortcuts work also when it does not show.

position

The corner of the chart: "topright" (default), "topleft", "bottomright" or "bottomleft".

buttons

The buttons, of "undo", "redo", "reset", "zoom" and "save" (default: all). Undo, redo and reset show with GC_events()(drag = TRUE), the zoom button (reset zoom) with GC_zoom() while zoomed in, the save button unless GC_chart()(save_button = FALSE).

size

Size of the icons in pixels (default 20).

color

Colour of the icons (default "#D3D3D3").

hoverColor

Colour of an icon under the mouse (default "#555555").

tooltipBackground

Background colour of the tooltips and of the menu of the save button (default "#333333").

tooltipColor

Text colour of the tooltips and the menu (default "white").

tooltipBorder

CSS border of the tooltips and the menu, e.g. "1px solid #b7b9be" (default none).

tooltipRadius

Corner radius of the tooltips and the menu: pixels, or a CSS length (default 3).

tooltipShadow

CSS box shadow of the tooltips and the menu, e.g. "1px 2px 10px rgba(0, 0, 0, 0.2)" (default none).

fontFamily

Font of the tooltips and the menu (default Arial).

icons

Icons of the buttons: a named list or character vector, with names of buttons, e.g. list(reset = "arrows-to-circle", save = "camera"). Buttons that are not named keep their icon.

Value

The GC chart object with the toolbar settings.

Details

Icons are Font Awesome icons, by name, e.g. "arrow-rotate-left" for a solid icon, or by their classes, e.g. "fa-regular fa-floppy-disk" for another style.

Examples

genes_data <- data.frame(
  start = c(10, 50, 90),
  end = c(40, 80, 120),
  name = c("Gene 1", "Gene 2", "Gene 3")
)
GC_chart(genes_data, height = "150px") %>%
  GC_labels("name") %>%
  GC_events(select = TRUE, drag = TRUE) %>%
  GC_toolbar(show = "always", position = "topleft", size = 16,
             color = "#9e9e9e", hoverColor = "black",
             icons = list(reset = "arrows-to-circle", save = "camera"))