eSankey: Create an HTML sankey charts widget using the...

Description Usage Arguments Note Examples

View source: R/eSankey.R

Description

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

Usage

1
2
3
4
5
eSankey(dat, candleColor, size = NULL, title = NULL, subtitle = NULL,
  title.x = "center", title.y = "top", toolbox = TRUE,
  toolbox.orient = "horizontal", toolbox.x = "right",
  toolbox.y = "top", tooltip = TRUE, tooltip.trigger = "item",
  calculable = TRUE, opt = list(), ...)

Arguments

dat

a data.frame object

size

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

title

an overall title for the plot. you can modify title widget after chart has been generated: sankeyEchart + 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: sankeyEchart + eTitle(title="main title", x = "left", y=10)

toolbox

logical whether the 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. sankeyEchart + eToolbox(show = TRUE)

toolbox.orient

an element of c("horizontal", "vertical"), default is "horizontal" you can modify toolbox widget after chart has been generated: sankeyEchart + 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: sankeyEchart + 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. sankeyEchart + eTooltip(show = FALSE)

tooltip.trigger

an element of c("axis", "item"), default is "item" for sankey 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: sankeyEchart + eTooltip(trigger = "item")

calculable

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

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
dat = data.frame(source=c("Agricultural 'waste'","Bio-conversion",
                          "Bio-conversion","Bio-conversion","Bio-conversion",
                          "Biofuel imports","Biomass imports","Coal imports",
                          "Coal reserves","Coal","District heating","District heating",
                          "District heating","Electricity grid","Electricity grid"),
                 target=c("Bio-conversion","Liquid","Losses","Solid","Gas","Liquid",
                          "Solid","Coal","Coal","Solid","Industry","Heating and cooling - commercial",
                          "Heating and cooling - homes","Over generation / exports","Heating and cooling - homes"),
                 value=c(124.729,0.597,26.862,280.322,81.144,35,35,11.606,63.965,75.571,
                         10.639,22.505,46.184,104.453,113.726))
eSankey(dat)

cosname/recharts documentation built on Aug. 29, 2020, 9:47 a.m.