Skip to content

Set the Toolbar of a GC Chart ​

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 ​

r
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 ​

ArgumentDescription
GC_chartA GC chart object.
showWhen 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.
positionThe corner of the chart: "topright" (default), "topleft", "bottomright" or "bottomleft".
buttonsThe 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).
sizeSize of the icons in pixels (default 20).
colorColour of the icons (default "#D3D3D3").
hoverColorColour of an icon under the mouse (default "#555555").
tooltipBackgroundBackground colour of the tooltips and of the menu of the save button (default "#333333").
tooltipColorText colour of the tooltips and the menu (default "white").
tooltipBorderCSS border of the tooltips and the menu, e.g. "1px solid #b7b9be" (default none).
tooltipRadiusCorner radius of the tooltips and the menu: pixels, or a CSS length (default 3).
tooltipShadowCSS box shadow of the tooltips and the menu, e.g. "1px 2px 10px rgba(0, 0, 0, 0.2)" (default none).
fontFamilyFont of the tooltips and the menu (default Arial).
iconsIcons 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 ​

r
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"))