gvisGauge: Google Gauge with R

Description Usage Arguments Value Author(s) References See Also Examples

Description

The gvisGauge function reads a data.frame and creates text output referring to the Google Visualisation API, which can be included into a web page, or as a stand-alone page. The actual chart is rendered by the web browser using SVG or VML.

Usage

1
gvisGauge(data, labelvar = "", numvar = "", options = list(), chartid)

Arguments

data

a data.frame to be displayed as a gauge

labelvar

name of the character column which contains the category labels for the slice labels.

numvar

a vector of column names of the numerical variables of the slice values.

options

list of configuration options for Google Gauge.

gvis.editor

a character label for an on-page button which opens an in-page dialog box that enables users to edit, change and customise the chart. By default no value is given and therefore no button is displayed.

Further possible components are, taken from https://google-developers.appspot.com/chart/interactive/docs/gallery/gauge.html#Configuration_Options:

greenColor

a string. Default '#109618'. The color to use for the green section, in HTML color notation.

greenFrom

a number. Default none. The lowest value for a range marked by a green color.

greenTo

a number. Default none. The highest value for a range marked by a green color.

height

a number. Default container's width. Height of the chart in pixels.

majorTicks

an JSON array of strings. Default none. Labels for major tick marks. The number of labels define the number of major ticks in all gauges. The default is five major ticks, with the labels of the minimal and maximal gauge value.

max

a number. Default 100. The maximal value of a gauge.

min

a number. Default 0. The minimal value of a gauge.

minorTicks

a number. Default 2. The number of minor tick section in each major tick section.

redColor

a string. Default '#DC3912'. The color to use for the red section, in HTML color notation.

redFrom

a number. Default none. The lowest value for a range marked by a red color.

redTo

a number. Default none. The highest value for a range marked by a red color.

width

a number. Default container's width. Width of the chart in pixels.

yellowColor

a string. Default '#FF9900'. The color to use for the yellow section, in HTML color notation.

yellowFrom

a number. Default none. The lowest value for a range marked by a yellow color.

yellowTo

a number/ Default none. The highest value for a range marked by a yellow color.

chartid

character. If missing (default) a random chart id will be generated based on chart type and tempfile

Value

gvisGauge returns list of class "gvis" and "list".

An object of class "gvis" is a list containing at least the following components:

type

Google visualisation type, here 'Gauge'

chartid

character id of the chart object. Unique chart ids are required to place several charts on the same page.

html

a list with the building blocks for a page

header

a character string of a html page header: <html>...<body>,

chart

a named character vector of the chart's building blocks:

jsHeader

Opening <script> tag and reference to Google's JavaScript library.

jsData

JavaScript function defining the input data as a JSON object.

jsDrawChart

JavaScript function combing the data with the visualisation API and user options.

jsDisplayChart

JavaScript function calling the handler to display the chart.

jsFooter

End tag </script>.

jsChart

Call of the jsDisplayChart function.

divChart

<div> container to embed the chart into the page.

caption

character string of a standard caption, including data name and chart id.

footer

character string of a html page footer: </body>...</html>, including the used R and googleVis version and link to Google's Terms of Use.

Author(s)

Markus Gesmann markus.gesmann@gmail.com,

Diego de Castillo decastillo@gmail.com

References

Google Gauge API: http://code.google.com/apis/chart/interactive/docs/gallery/gauge.html

Follow the link for Google's data policy.

See Also

See also print.gvis, plot.gvis for printing and plotting methods

Examples

1
2
3
4
5
6
7
8
9
## 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)

jburos/GoogleVis documentation built on May 18, 2019, 9:19 p.m.