gvisGauge
gvisGauge(data, labelvar = "", numvar = "", options = list(), chartid)
data.frame
to be displayed as a gaugehttps://developers.google.com/chart/interactive/docs/gallery/gauge#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 an internet
## connection to display the visualisation.
Gauge1 <- gvisGauge(CityPopularity, options=list(min=0, max=800, greenFrom=500,
greenTo=800, yellowFrom=300, yellowTo=500,
redFrom=0, redTo=300))
plot(Gauge1)
Run the code above in your browser using DataLab