init: Initialise

initR Documentation

Initialise

Description

Initialise a chart.

Usage

e_charts(
  data,
  x,
  width = NULL,
  height = NULL,
  elementId = NULL,
  dispose = TRUE,
  draw = TRUE,
  renderer = "canvas",
  timeline = FALSE,
  ...,
  reorder = TRUE
)

## Default S3 method:
e_charts(
  data,
  x,
  width = NULL,
  height = NULL,
  elementId = NULL,
  dispose = TRUE,
  draw = TRUE,
  renderer = "canvas",
  timeline = FALSE,
  ...,
  reorder = TRUE
)

## S3 method for class 'Node'
e_charts(
  data,
  x,
  width = NULL,
  height = NULL,
  elementId = NULL,
  dispose = TRUE,
  draw = TRUE,
  renderer = "canvas",
  timeline = FALSE,
  ...,
  reorder = TRUE
)

e_charts_(
  data,
  x = NULL,
  width = NULL,
  height = NULL,
  elementId = NULL,
  dispose = TRUE,
  draw = TRUE,
  renderer = "canvas",
  timeline = FALSE,
  ...,
  reorder = TRUE
)

e_chart(
  data,
  x,
  width = NULL,
  height = NULL,
  elementId = NULL,
  dispose = TRUE,
  draw = TRUE,
  renderer = "canvas",
  timeline = FALSE,
  ...,
  reorder = TRUE
)

e_data(e, data, x)

Arguments

data

A data.frame.

x

Column name containing x axis.

width, height

Must be a valid CSS unit (like '100%', '400px', 'auto') or a number, which will be coerced to a string and have 'px' appended.

elementId

Id of element.

dispose

Set to TRUE to force redraw of chart, set to FALSE to update.

draw

Whether to draw the chart, intended to be used with e_draw_p.

renderer

Renderer, takes canvas (default) or svg.

timeline

Set to TRUE to build a timeline, see timeline section.

...

Any other argument.

reorder

Set to FALSE to not reorder numeric x axis values.

e

An object of class echarts4r as returned by e_charts.

Details

The chart is created inside a parent '<div>' element, the dimensions of which are controlled by the 'width' and 'height' arguments. When these dimensions are small, it is possible that the chart 'grid' resizes to a size larger than the parent, which might result in unexpected size given the input arguments. To disable this automatic readjustment, define a static e_grid like the following: 'e_grid(e = current_chart, top = 0, left = 20, right = 0, bottom = 20)'.

Timeline

The timeline feature currently supports the following chart types.

  • e_bar

  • e_line

  • e_step

  • e_area

  • e_scatter

  • e_effect_scatter

  • e_candle

  • e_heatmap

  • e_pie

  • e_line_3d

  • e_lines_3d

  • e_bar_3d

  • e_lines

  • e_scatter_3d

  • e_scatter_gl

  • e_histogram

  • e_lm

  • e_loess

  • e_glm

  • e_density

  • e_pictorial

  • e_boxplot

  • e_map

  • e_map_3d

  • e_line_3d

  • e_gauge

Examples

mtcars |>
  e_charts(qsec) |>
  e_line(mpg)
points <- mtcars[1:3, ]
mtcars |>
  e_charts_("qsec") |>
  e_line(mpg) |>
  e_data(points, qsec) |>
  e_scatter(mpg, color = "red", symbol_size = 20)

JohnCoene/echarts4 documentation built on Feb. 23, 2024, 9:18 a.m.