eLine: Create an HTML line charts widget using the...

Description Usage Arguments Note Examples

View source: R/eLine.R

Description

This function creates an HTML widget to display matrix, data.frame and factor array, using the JavaScript library ECharts3.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
eLine(dat, xvar = NULL, yvar = NULL, series = NULL, size = NULL,
  horiz = FALSE, smooth = NULL, symbol = NULL, symbolSize = NULL,
  z = NULL, theme = "default", title = NULL, subtitle = NULL,
  title.x = "center", title.y = "top", legend = TRUE, legend.x = "left",
  legend.y = "top", legend.orient = "horizontal", toolbox = TRUE,
  toolbox.orient = "horizontal", toolbox.x = "right", toolbox.y = "top",
  dataView = TRUE, readOnly = FALSE, mark = TRUE, dataZoom = FALSE,
  magicType = TRUE, tooltip = TRUE, tooltip.trigger = "axis",
  formatter = "", axis.scale = TRUE, axis.line = TRUE,
  axis.tick = FALSE, axis.lable = TRUE, axis.splitLine = TRUE,
  axis.splitArea = FALSE, axis.boundaryGap = TRUE, xlab = TRUE,
  xlab.type = "category", xlab.data = NULL, xlab.position = "bottom",
  xlab.name = "", xlab.namePosition = "start", xlim = NULL, ylab = TRUE,
  ylab.type = "value", ylab.data = NULL, ylab.position = "left",
  ylab.name = "", ylab.namePosition = "start", ylim = NULL,
  calculable = TRUE, showLabel = TRUE, opt = list())

Arguments

dat

a data object (a matrix, a data frame or a factor array)

xvar, yvar

objects of class "formula" (or one that can be coerced to that class): x,y coordinates of the given data.frame colnames, e.g. xvar = ~xAxisName; yvar = ~yAxisName. xvar, yvar only needed for the data.frame data input.

series

an "formula" object: Associates the levels of variable with symbol color, e.g. series = ~groupName

size

an array of html widget width and height(either numeric pixels or percentage could be accepted): e.g. size = c(1024, 768).

smooth

wether the line should be smoothy or not.

symbol

Icon types provided by ECharts includes 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow'

symbolSize

symbol size. It can be set to single numbers like 10, or use an array to represent width and height. For example, [20, 10] means symbol width is 20, and height is10.

z

z -level

theme

an object of theme name. see(http://datatables.net/extensions/index) for detail. supported theme: c("default", "vintage", "dark", "westeros", "essos", "wonderland", "walden", "chalk", "infographic", "macarons", "roma", "shine", "purple-passion")

title

an overall title for the plot. you can modify title widget after chart has been generated: Echart + eTitle(title = "your title.")

title.x, title.y

the xy coordinates of main title, besides the excat exact pixels value, x accept c("left", "right", "center") and y accept c("top", "bottom", "center") as legal input. you can modify title widget after chart has been generated: Echart + eTitle(title="main title", x = "left", y=10)

legend

logical whether the legend widget show or not, default is TRUE. you can modify legend widget after chart has been generated, the legend position and legend orientation are available at present. Echart + eLegend(show = TRUE)

legend.x, legend.y

the xy coordinates of legend, besides the excat exact pixels value, x accept c("left", "right", "center") and y accept c("top", "bottom", "center") as legal input. you can modify legend widget after chart has been generated: Echart + eLegend(x = "right", y="top")

legend.orient

an element of c("horizontal", "vertical"), default is "horizontal" you can modify legend widget after chart has been generated: Echart + eLegend(orient = "vertical")

toolbox

logical whether the toolbox widget show or not, default is TRUE. you can modify toolbox widget after cahart has been generated, the toolbox position, toolbox element and toolbox orientation are available at present. Echart + eToolbox(show = TRUE)

toolbox.orient

an element of c("horizontal", "vertical"), default is "horizontal" you can modify toolbox widget after chart has been generated: Echart + eToolbox(orient = "vertical")

toolbox.x, toolbox.y

the xy coordinates of toolbox, besides the excat exact pixels value, x accept c("left", "right", "center") and y accept c("top", "bottom", "center") as legal input. you can modify toolbox widget after chart has been generated: Echart + eToolbox(x = "right", y="top")

tooltip

logical whether the tooltip widget for front-end interactive chart show or not. default is TRUE. you can modify tooltip widget after chart has been generated, the tooltip trigger and tooltip formatter is available at present. Echart + eTooltip(show = FALSE)

tooltip.trigger

an element of c("axis", "item"), default is "axis" for line chart. "axis" option for trigger will show all the information of mouse; "item" option for tirgger will only show the given item information of mouse. you can modify tooltip widget after chart has been generated: Echart + eTooltip(trigger = "axis")

calculable

logical whether the front-end interactive chart will support the drag-recalculable feature. the size and calculable option can be setted after line chart has been generated through eOption: Echart + eOption(calculable = TRUE)

dataview, mark, restore, dataZoom, magicType

logical variable whether the dataview , mark, restore, dataZoom or magicType tool in toolbox widget show or not, default is TRUE. you can modify toolbox widget after chart has been generated, the toolbox position, toolbox element and toolbox orientation are available at present. Echart + eToolbox(dataView = FALSE)

tooltip.formatter

the information formatter for tooltip widget, default is "<a>:<b><c>" for line chart. you can modify tooltip widget after chart has been generated: Echart + eTooltip(formatter = "<a><b>:<c>")

Note

You are recommended to use lazyPlot function for interactive chart option set through "shiny" server.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
  eLine(WorldPhones, theme=1)
  #mode 2 input.
  df2 <- data.frame(
    saleNum=c(10,20,30,40,50,60,70,15,25,35,45,55,65,75,25,35,45,55,65,75,85),
    seller=c(rep("Yellow",7), rep("Red",7), rep("White",7)),
  	 weekDay = c(rep(c("Mon","Tue","Wed","Thu","Fri","Sat","Sun"),3)),
    stringsAsFactors =FALSE
  )
  eLine(df2, xvar=~weekDay, yvar= ~saleNum, series=~seller)

 dat <- cut(rnorm(1000), -4:4)
 eLine(dat)

taiyun/recharts documentation built on June 7, 2018, 6:41 p.m.