gvisOrgChart
gvisOrgChart(data, idvar = "", parentvar = "", tipvar = "", options = list(), chartid)
data.frame
. The data has to have at least three
columns. Each row in the data table describes one node (a rectangle in the
graph). Each node (except the root node) has one or more parent nodes. Each
node is sized and colored according to its values relative to the other
nodes currently shown.data
describing the ID for each node. It
should be unique among all nodes, and can include any characters, including
spaces. This is shown on the node. You can specify a formatted value to show
on the chart instead, but the unformatted value is still used as the ID.data
that match to entries in
idvar
. If this is a root node, leave this NA
. Only one root is
allowed.data
for the tip variable. Tool-tip text
to show, when a user hovers over this node.https://developers.google.com/chart/interactive/docs/gallery/orgchart#Configuration_Options
The parameters can be set via a named list. The parameters have to map those of the Google documentation.
TRUE
or FALSE
, using the R syntax.
options=list(width=200, height=300)
.
Exceptions to this rule are the width and height options for
gvisAnnotatedTimeLine
and gvisAnnotationChart
.
For those two functions, width and height must be character strings of the
format "Xpx"
, where X
is a number, or "automatic"
.
For example,
options=list(width="200px", height="300px")
.
options=list(colors="['#cbb69d', '#603913', '#c69c6e']")
'true'
or 'false'
.
For example the Google documentaion states the formating options for the
vertical axis and states the parameter as vAxis.format
.
Then this paramter can be set in R as:options=list(vAxis="{format:'#,###%'}")
.
titleTextStyle.color
, titleTextStyle.fontName
and
titleTextStyle.fontSize
, then those can be combined in one list item
such as:
options=list(titleTextStyle="{color:'red', fontName:'Courier', fontSize:16}")
options=list(vAxes="[{title:'val1'}, {title:'val2'}]")
gvis.editor
a character label for an
on-page button that opens an in-page dialog box enabling
users to edit, change and customise the chart. By default no
value is given and therefore no button is displayed.
For more details see the Google API documentation and the R examples below.
tempfile
class
"gvis
" and "list
".
An object of class "gvis
" is a list containing at least the
following components:
type
chartid
html
header
...
,chart
jsHeader
tag and
reference to Google's JavaScript library.
jsData
data
as a JSON object.
jsDrawChart
jsDisplayChart
jsFooter
.
jsChart
jsDisplayChart
function.
divChart
container to embed the chart
into the page.
caption
footer
...
, including the used R and googleVis version
and link to Google's Terms of Use.
print.gvis
, plot.gvis
for printing and
plotting methods.
## Please note that by default the googleVis plot command
## will open a browser window and requires Internet
## connection to display the visualisation.
Regions
Org1 <- gvisOrgChart(Regions, idvar = "Region", parentvar = "Parent",
tipvar="Val")
plot(Org1)
## Set a few options
Org2 <- gvisOrgChart(Regions, idvar = "Region", parentvar = "Parent",
tipvar="Val",
options=list(width=600, height=400,
size='large', allowCollapse=TRUE))
plot(Org2)
Run the code above in your browser using DataLab