├── .Rbuildignore
├── .github
├── .gitignore
└── workflows
│ ├── R-CMD-check.yaml
│ └── pkgdown.yaml
├── .gitignore
├── DESCRIPTION
├── NAMESPACE
├── NEWS.md
├── R
├── gadget.R
├── gvis.R
├── gvisAnnotatedTimeLine.R
├── gvisAnnotationChart.R
├── gvisBubbleChart.R
├── gvisCalendar.R
├── gvisChartEditor.R
├── gvisCoreCharts.R
├── gvisGantt.R
├── gvisGeoChart.R
├── gvisGeoMap.R
├── gvisHistogram.R
├── gvisMap.R
├── gvisMethods.R
├── gvisMotionChart.R
├── gvisOrgChart.R
├── gvisPieGaugeChart.R
├── gvisSankey.R
├── gvisTable.R
├── gvisTimeLine.R
├── gvisTreeMap.R
├── gvisWordTree.R
├── shiny.R
└── zzz.R
├── README.md
├── THANKS
├── _pkgdown.yml
├── data
├── Andrew.RData
├── Cairo.RData
├── Cats.RData
├── CityPopularity.RData
├── Exports.RData
├── Fruits.RData
├── OpenClose.RData
├── Population.RData
├── Regions.RData
├── Stock.RData
└── dino.RData
├── demo
├── 00Index
├── EventListener.R
├── Roles.R
├── Trendlines.R
└── googleVis.R
├── googleVis.Rproj
├── inst
├── CITATION
├── googleVis_hexagon.R
├── mansections
│ ├── GoogleChartToolsURL.txt
│ ├── GoogleChartToolsURLConfigOptions.txt
│ ├── gvisOptions.txt
│ └── gvisOutputStructure.txt
└── shiny
│ ├── server.R
│ └── ui.R
├── man
├── Andrew.Rd
├── Cairo.Rd
├── Cats.Rd
├── CityPopularity.Rd
├── Exports.Rd
├── Fruits.Rd
├── OpenClose.Rd
├── Population.Rd
├── Regions.Rd
├── Stock.Rd
├── createGoogleGadget.Rd
├── dino.Rd
├── figures
│ └── logo.png
├── googleVis-package.Rd
├── gvisAnnotatedTimeLine.Rd
├── gvisAnnotationChart.Rd
├── gvisAreaChart.Rd
├── gvisBarChart.Rd
├── gvisBubbleChart.Rd
├── gvisCalendar.Rd
├── gvisCandlestickChart.Rd
├── gvisColumnChart.Rd
├── gvisComboChart.Rd
├── gvisGantt.Rd
├── gvisGauge.Rd
├── gvisGeoChart.Rd
├── gvisGeoMap.Rd
├── gvisHistogram.Rd
├── gvisLineChart.Rd
├── gvisMap.Rd
├── gvisMerge.Rd
├── gvisMethods.Rd
├── gvisMotionChart.Rd
├── gvisOrgChart.Rd
├── gvisPieChart.Rd
├── gvisSankey.Rd
├── gvisScatterChart.Rd
├── gvisSteppedAreaChart.Rd
├── gvisTable.Rd
├── gvisTimeline.Rd
├── gvisTreeMap.Rd
├── gvisWordTree.Rd
└── renderGvis.Rd
├── pkgdown
└── favicon
│ ├── apple-touch-icon-120x120.png
│ ├── apple-touch-icon-152x152.png
│ ├── apple-touch-icon-180x180.png
│ ├── apple-touch-icon-60x60.png
│ ├── apple-touch-icon-76x76.png
│ ├── apple-touch-icon.png
│ ├── favicon-16x16.png
│ ├── favicon-32x32.png
│ └── favicon.ico
└── vignettes
├── googleVis.bib
├── googleVis_examples.R
├── googleVis_examples.Rmd
└── googleVis_intro.Rmd
/.Rbuildignore:
--------------------------------------------------------------------------------
1 | ^.*\.Rproj$
2 | ^\.Rproj\.user$
3 | ^\.travis\.yml$
4 | ^\.github$
5 | ^_pkgdown\.yml$
6 | ^docs$
7 | ^pkgdown$
8 |
--------------------------------------------------------------------------------
/.github/.gitignore:
--------------------------------------------------------------------------------
1 | *.html
2 |
--------------------------------------------------------------------------------
/.github/workflows/R-CMD-check.yaml:
--------------------------------------------------------------------------------
1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3 | on:
4 | push:
5 | branches: [main, master]
6 | pull_request:
7 | branches: [main, master]
8 |
9 | name: R-CMD-check
10 |
11 | jobs:
12 | R-CMD-check:
13 | runs-on: ${{ matrix.config.os }}
14 |
15 | name: ${{ matrix.config.os }} (${{ matrix.config.r }})
16 |
17 | strategy:
18 | fail-fast: false
19 | matrix:
20 | config:
21 | - {os: macos-latest, r: 'release'}
22 | - {os: windows-latest, r: 'release'}
23 | - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
24 | - {os: ubuntu-latest, r: 'release'}
25 | - {os: ubuntu-latest, r: 'oldrel-1'}
26 |
27 | env:
28 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
29 | R_KEEP_PKG_SOURCE: yes
30 |
31 | steps:
32 | - uses: actions/checkout@v3
33 |
34 | - uses: r-lib/actions/setup-pandoc@v2
35 |
36 | - uses: r-lib/actions/setup-r@v2
37 | with:
38 | r-version: ${{ matrix.config.r }}
39 | http-user-agent: ${{ matrix.config.http-user-agent }}
40 | use-public-rspm: true
41 |
42 | - uses: r-lib/actions/setup-r-dependencies@v2
43 | with:
44 | extra-packages: any::rcmdcheck
45 | needs: check
46 |
47 | - uses: r-lib/actions/check-r-package@v2
48 | with:
49 | upload-snapshots: true
50 |
--------------------------------------------------------------------------------
/.github/workflows/pkgdown.yaml:
--------------------------------------------------------------------------------
1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3 | on:
4 | push:
5 | branches: [main, master]
6 | pull_request:
7 | branches: [main, master]
8 | release:
9 | types: [published]
10 | workflow_dispatch:
11 |
12 | name: pkgdown
13 |
14 | jobs:
15 | pkgdown:
16 | runs-on: ubuntu-latest
17 | # Only restrict concurrency for non-PR jobs
18 | concurrency:
19 | group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
20 | env:
21 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
22 | steps:
23 | - uses: actions/checkout@v3
24 |
25 | - uses: r-lib/actions/setup-pandoc@v2
26 |
27 | - uses: r-lib/actions/setup-r@v2
28 | with:
29 | use-public-rspm: true
30 |
31 | - uses: r-lib/actions/setup-r-dependencies@v2
32 | with:
33 | extra-packages: any::pkgdown, local::.
34 | needs: website
35 |
36 | - name: Build site
37 | run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
38 | shell: Rscript {0}
39 |
40 | - name: Deploy to GitHub pages 🚀
41 | if: github.event_name != 'pull_request'
42 | uses: JamesIves/github-pages-deploy-action@v4.4.1
43 | with:
44 | clean: false
45 | branch: gh-pages
46 | folder: docs
47 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .Rproj.user
2 | .Rhistory
3 | .RData
4 | docs
5 |
--------------------------------------------------------------------------------
/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: googleVis
2 | Type: Package
3 | Title: R Interface to Google Charts
4 | Version: 0.7.3
5 | Date: 2024-05-25
6 | Authors@R: c(person("Markus", "Gesmann", role = c("aut", "cre"),
7 | email = "markus.gesmann@googlemail.com"),
8 | person("Diego", "de Castillo", role = "aut",
9 | email = "decastillo@gmail.com"),
10 | person("Joe", "Cheng", role = "ctb",
11 | email = "joe@rstudio.com"),
12 | person("Ashley", "Baldry", role = "ctb"),
13 | person("Durey", "Ingeniería", role = "ctb"))
14 | Description: R interface to Google's chart tools, allowing users
15 | to create interactive charts based on data frames. Charts
16 | are displayed locally via the R HTTP help server. A modern
17 | browser with an Internet connection is required. The data
18 | remains local and is not uploaded to Google.
19 | Depends:
20 | R (>= 3.0.2)
21 | Imports:
22 | methods,
23 | jsonlite,
24 | utils
25 | Suggests:
26 | shiny (>= 0.4.0),
27 | httpuv (>= 1.2.0),
28 | knitr (>= 1.5),
29 | rmarkdown,
30 | markdown,
31 | data.table
32 | License: GPL (>= 2)
33 | URL: https://mages.github.io/googleVis/
34 | BugReports: https://github.com/mages/googleVis/issues
35 | LazyLoad: yes
36 | LazyData: yes
37 | BuildManual: yes
38 | VignetteBuilder: knitr, rmarkdown
39 | RoxygenNote: 7.3.1
40 | Encoding: UTF-8
41 |
--------------------------------------------------------------------------------
/NAMESPACE:
--------------------------------------------------------------------------------
1 | importFrom(methods, setMethod, is)
2 | importFrom(utils, packageDescription, browseURL, type.convert)
3 | importFrom(stats, na.omit, reshape)
4 | importFrom(tools, startDynamicHelp)
5 | importFrom(jsonlite, toJSON)
6 | importFrom(jsonlite, unbox)
7 | # Methods
8 | S3method(plot, gvis)
9 | S3method(print, gvis)
10 |
11 | # gvis Charts
12 | export(gvisMotionChart)
13 | export(gvisGeoMap)
14 | export(gvisTreeMap)
15 | export(gvisTable)
16 | export(gvisPieChart)
17 | export(gvisGauge)
18 | export(gvisOrgChart)
19 | export(gvisBubbleChart)
20 | export(gvisAnnotatedTimeLine)
21 | export(gvisMap)
22 | export(gvisGeoChart)
23 | export(gvisScatterChart)
24 | export(gvisLineChart)
25 | export(gvisAreaChart)
26 | export(gvisBarChart)
27 | export(gvisColumnChart)
28 | export(gvisComboChart)
29 | export(gvisCandlestickChart)
30 | export(gvisSteppedAreaChart)
31 | export(gvisCalendar)
32 | export(gvisHistogram)
33 | export(gvisAnnotationChart)
34 | export(gvisTimeline)
35 | export(gvisSankey)
36 | export(gvisWordTree)
37 | export(gvisGantt)
38 |
39 | # Support function
40 | export(renderGvis)
41 | export(createGoogleGadget)
42 | export(gvisMerge)
43 |
44 |
--------------------------------------------------------------------------------
/R/gadget.R:
--------------------------------------------------------------------------------
1 | createGoogleGadget <- function(gvis){
2 |
3 | if(!"gvis" %in% class(gvis)){
4 | stop("A gvis object is as input required.")
5 | }
6 | sprintf('
7 |
8 |
9 |
10 |
13 |
14 |
15 | ', gvis$chartid, paste(gvis$html$chart, collapse="\n") )
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/R/gvisBubbleChart.R:
--------------------------------------------------------------------------------
1 | ### Part of the R package googleVis
2 | ### Copyright 2011 - 2014 Markus Gesmann, Diego de Castillo
3 |
4 | ### It is made available under the terms of the GNU General Public
5 | ### License, version 2, or at your option, any later version,
6 | ### incorporated herein by reference.
7 | ###
8 | ### This program is distributed in the hope that it will be
9 | ### useful, but WITHOUT ANY WARRANTY; without even the implied
10 | ### warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 | ### PURPOSE. See the GNU General Public License for more
12 | ### details.
13 | ###
14 | ### You should have received a copy of the GNU General Public
15 | ### License along with this program; if not, write to the Free
16 | ### Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 | ### MA 02110-1301, USA
18 |
19 |
20 |
21 | #' Google Bubble Chart with R
22 | #' \Sexpr{googleChartName <- "bubblechart"}
23 | #' \Sexpr{gvisChartName <- "gvisBubbleChart"}
24 | #'
25 | #'
26 | #' The gvisBubbleChart function reads a data.frame and creates text output
27 | #' referring to the Google Visualisation API, which can be included into a web
28 | #' page, or as a stand-alone page.
29 | #'
30 | #' A bubble chart is used to visualize a data set with 2 to 4 dimensions. The
31 | #' first two dimensions are visualized as coordinates, the 3rd as color and the
32 | #' 4th as size.
33 | #'
34 | #' The bubble chart is rendered within the browser using SVG or VML and
35 | #' displays tips when hovering over points.
36 | #'
37 | #'
38 | #' @param data a \code{\link{data.frame}} to be displayed as a bubble chart.
39 | #' The data has to have at least three columns for \code{idvar, xvar}, and
40 | #' \code{yvar}.
41 | #' @param idvar column name of \code{data} with the bubble
42 | #' @param xvar column name of a numerical vector in \code{data} to be plotted
43 | #' on the x-axis.
44 | #' @param yvar column name of a numerical vector in \code{data} to be plotted
45 | #' on the y-axis.
46 | #' @param colorvar column name of data that identifies bubbles in the same
47 | #' series. Use the same value to identify all bubbles that belong to the same
48 | #' series; bubbles in the same series will be assigned the same color. Series
49 | #' can be configured using the \code{series} option.
50 | #' @param sizevar values in this column are mapped to actual pixel values using
51 | #' the \code{sizeAxis} option.
52 | #' @param options list of configuration options, see:
53 | #'
54 | #' % START DYNAMIC CONTENT
55 | #'
56 | #' \Sexpr[results=rd]{gsub("CHARTNAME",
57 | #' googleChartName,
58 | #' readLines(file.path(".", "inst", "mansections",
59 | #' "GoogleChartToolsURLConfigOptions.txt")))}
60 | #'
61 | #' \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
62 | #' "mansections", "gvisOptions.txt")))}
63 | #'
64 | #' @param chartid character. If missing (default) a random chart id will be
65 | #' generated based on chart type and \code{\link{tempfile}}.
66 | #'
67 | #' @return \Sexpr[results=rd]{paste(gvisChartName)} returns list
68 | #' of \code{\link{class}}
69 | #' \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
70 | #' "mansections", "gvisOutputStructure.txt")))}
71 | #'
72 | #' @references Google Chart Tools API:
73 | #' \Sexpr[results=rd]{gsub("CHARTNAME",
74 | #' googleChartName,
75 | #' readLines(file.path(".", "inst", "mansections",
76 | #' "GoogleChartToolsURL.txt")))}
77 | #'
78 | #' % END DYNAMIC CONTENT
79 | #' @author Markus Gesmann \email{markus.gesmann@@gmail.com},
80 | #'
81 | #' Diego de Castillo \email{decastillo@@gmail.com}
82 | #' @seealso See also \code{\link{gvisMotionChart}} for a moving bubble chart
83 | #' over time, and \code{\link{print.gvis}}, \code{\link{plot.gvis}} for
84 | #' printing and plotting methods.
85 | #' @keywords iplot
86 | #' @examples
87 | #'
88 | #'
89 | #' bubble1 <- gvisBubbleChart(Fruits, idvar="Fruit", xvar="Sales", yvar="Expenses")
90 | #' plot(bubble1)
91 | #'
92 | #' ## Set color and size
93 | #' bubble2 <- gvisBubbleChart(Fruits, idvar="Fruit", xvar="Sales", yvar="Expenses",
94 | #' colorvar="Location", sizevar="Profit",
95 | #' options=list(hAxis='{minValue:75, maxValue:125}'))
96 | #'
97 | #' plot(bubble2)
98 | #'
99 | #' ## Use year to color the bubbles
100 | #' bubble3 <- gvisBubbleChart(Fruits, idvar="Fruit", xvar="Sales", yvar="Expenses",
101 | #' colorvar="Year", sizevar="Profit",
102 | #' options=list(hAxis='{minValue:75, maxValue:125}'))
103 | #' plot(bubble3)
104 | #'
105 | #' ## Gradient colour example
106 | #' bubble4 <- gvisBubbleChart(Fruits, idvar="Fruit", xvar="Sales", yvar="Expenses",
107 | #' sizevar="Profit",
108 | #' options=list(hAxis='{minValue:75, maxValue:125}',
109 | #' colorAxis="{colors: ['lightblue', 'blue']}"))
110 | #' plot(bubble4)
111 | #'
112 | #' \dontrun{
113 | #' ## Moving bubble chart over time, aka motion chart
114 | #'
115 | #' M <- gvisMotionChart(Fruits, Fruit, Year)
116 | #' plot(M)
117 | #' }
118 | #'
119 | #'
120 | #'
121 | #'
122 | gvisBubbleChart <- function(data, idvar="", xvar="", yvar="", colorvar="", sizevar="", options=list(), chartid){
123 |
124 | my.type <- "BubbleChart"
125 | dataName <- deparse(substitute(data))
126 |
127 | my.options <- list(gvis=options,
128 | dataName=dataName,
129 | data=list(idvar=idvar,
130 | xvar=xvar,
131 | yvar=yvar,
132 | colorvar=colorvar,
133 | sizevar=sizevar,
134 | allowed=c("number", "string")
135 | )
136 | )
137 |
138 |
139 | checked.data <- gvisCheckBubbleChartData(data, my.options)
140 |
141 | output <- gvisChart(type=my.type, checked.data=checked.data, options=my.options, chartid=chartid,
142 | package="corechart")
143 |
144 | return(output)
145 | }
146 |
147 |
148 |
149 |
150 | gvisCheckBubbleChartData <- function(data, options){
151 |
152 | varNames <- names(data)
153 |
154 | data.structure <- list(
155 | idvar = list(mode="required", FUN=check.char),
156 | xvar = list(mode="required", FUN=check.num),
157 | yvar = list(mode="required", FUN=check.num),
158 | colorvar = list(mode="optional", FUN=check.char.num),
159 | sizevar = list(mode="optional", FUN=check.num))
160 |
161 | x <- gvisCheckData(data=data,options=options,data.structure=data.structure)
162 | x <- data.frame(x)
163 |
164 | return(x)
165 | }
166 |
--------------------------------------------------------------------------------
/R/gvisCalendar.R:
--------------------------------------------------------------------------------
1 | ### Part of the R package googleVis
2 | ### Copyright 2010 - 2014 Markus Gesmann, Diego de Castillo
3 |
4 | ### It is made available under the terms of the GNU General Public
5 | ### License, version 2, or at your option, any later version,
6 | ### incorporated herein by reference.
7 | ###
8 | ### This program is distributed in the hope that it will be
9 | ### useful, but WITHOUT ANY WARRANTY; without even the implied
10 | ### warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 | ### PURPOSE. See the GNU General Public License for more
12 | ### details.
13 | ###
14 | ### You should have received a copy of the GNU General Public
15 | ### License along with this program; if not, write to the Free
16 | ### Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 | ### MA 02110-1301, USA
18 |
19 |
20 |
21 | #' Google Calendar Chart with R
22 | #' \Sexpr{googleChartName <- "calendar"}
23 | #' \Sexpr{gvisChartName <- "gvisCalendar"}
24 | #'
25 | #' A calendar chart is a visualization used to show activity over the course
26 | #' of a long span of time, such as months or years. They're best used when
27 | #' you want to illustrate how some quantity varies depending on the day of
28 | #' the week, or how it trends over time.
29 | #'
30 | #' @param data a \code{data.frame}. The data has to have at least two columns,
31 | #' one with date information (\code{datevar}) and one numerical variable.
32 | #' @param datevar column name of \code{data} which shows the date dimension.
33 | #' The information has to be of class \code{\link{Date}} or \code{POSIX*} time
34 | #' series.
35 | #' @param numvar column name of \code{data} which shows the values to be
36 | #' displayed against \code{datevar}. The information has to be
37 | #' \code{\link{numeric}}.
38 | #' @param options list of configuration options, see:
39 | #'
40 | #' % START DYNAMIC CONTENT
41 | #'
42 | #' \Sexpr[results=rd]{gsub("CHARTNAME",
43 | #' googleChartName,
44 | #' readLines(file.path(".", "inst", "mansections",
45 | #' "GoogleChartToolsURLConfigOptions.txt")))}
46 | #'
47 | #' \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
48 | #' "mansections", "gvisOptions.txt")))}
49 | #'
50 | #' @param chartid character. If missing (default) a random chart id will be
51 | #' generated based on chart type and \code{\link{tempfile}}.
52 | #'
53 | #' @return \Sexpr[results=rd]{paste(gvisChartName)} returns list
54 | #' of \code{\link{class}}
55 | #' \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
56 | #' "mansections", "gvisOutputStructure.txt")))}
57 | #'
58 | #' @references Google Chart Tools API:
59 | #' \Sexpr[results=rd]{gsub("CHARTNAME",
60 | #' googleChartName,
61 | #' readLines(file.path(".", "inst", "mansections",
62 | #' "GoogleChartToolsURL.txt")))}
63 | #'
64 | #' % END DYNAMIC CONTENT
65 | #' @author Markus Gesmann \email{markus.gesmann@@gmail.com},
66 | #'
67 | #' Diego de Castillo \email{decastillo@@gmail.com}
68 | #'
69 | #' @section Warning:
70 | #' The calendar chart may be undergoing substantial revisions in future
71 | #' Google Charts releases.
72 | #'
73 | #' @seealso
74 | #'
75 | #' See also \code{\link{print.gvis}}, \code{\link{plot.gvis}} for printing and
76 | #' plotting methods.
77 | #' @keywords iplot
78 | #' @examples
79 | #' cl1 <- gvisCalendar(Cairo, datevar="Date", numvar="Temp")
80 | #' plot(cl1)
81 | #'
82 | #'## Not all months shown?
83 | #'## We can change the setting of the width ...
84 | #'
85 | #' cl2 <- gvisCalendar(Cairo, datevar="Date", numvar="Temp",
86 | #' options=list(width=1000))
87 | #' plot(cl2)
88 | #'
89 | #' ## ... or the cell size
90 | #' cl3 <- gvisCalendar(Cairo, datevar="Date",
91 | #' numvar="Temp",
92 | #' options=list(calendar="{ cellSize: 10 }"))
93 | #' plot(cl3)
94 | #'
95 | #' ## Example with many options set
96 | #' cl4 <- gvisCalendar(Cairo, datevar="Date", numvar="Temp",
97 | #' options=list(
98 | #' title="Daily temperature in Cairo",
99 | #' height=320,
100 | #' calendar="{yearLabel: { fontName: 'Times-Roman',
101 | #' fontSize: 32, color: '#1A8763', bold: true},
102 | #' cellSize: 10,
103 | #' cellColor: { stroke: 'red', strokeOpacity: 0.2 },
104 | #' focusedCellColor: {stroke:'red'}}")
105 | #' )
106 | #' plot(cl4)
107 | #'
108 |
109 | gvisCalendar <- function(data, datevar="",
110 | numvar="",
111 | options=list(), chartid){
112 |
113 |
114 | my.type <- "Calendar"
115 | dataName <- deparse(substitute(data))
116 |
117 | my.options <- list(gvis=modifyList(list(width = 600, height=500), options),
118 | dataName=dataName,
119 | data=list(datevar=datevar, numvar=numvar,
120 | allowed=c("number", "date", "datetime"))
121 | )
122 |
123 | checked.data <- gvisCheckCalendar(data, datevar, numvar)
124 | output <- gvisChart(type=my.type, checked.data=checked.data,
125 | options=my.options, chartid=chartid)
126 |
127 | return(output)
128 | }
129 |
130 | gvisCheckCalendar <- function(data, datevar, numvar){
131 |
132 | if(any(c(datevar, numvar) %in% ""))
133 | return(data[, 1:2])
134 |
135 | if(numvar %in% "")
136 | return(cbind(data[, datevar], data[, 2]))
137 |
138 | if(datevar %in% "")
139 | return(cbind(data[, 1], data[, numvar]))
140 |
141 | return(data[, c(datevar, numvar)])
142 |
143 | }
144 |
145 |
--------------------------------------------------------------------------------
/R/gvisChartEditor.R:
--------------------------------------------------------------------------------
1 | ### File R/gvisChartEditor.R
2 | ### Part of the R package googleVis
3 | ### Copyright 2010, 2011, 2012, 2013 Markus Gesmann, Diego de Castillo
4 |
5 | ### It is made available under the terms of the GNU General Public
6 | ### License, version 2, or at your option, any later version,
7 | ### incorporated herein by reference.
8 | ###
9 | ### This program is distributed in the hope that it will be
10 | ### useful, but WITHOUT ANY WARRANTY; without even the implied
11 | ### warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 | ### PURPOSE. See the GNU General Public License for more
13 | ### details.
14 | ###
15 | ### You should have received a copy of the GNU General Public
16 | ### License along with this program; if not, write to the Free
17 | ### Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 | ### MA 02110-1301, USA
19 |
20 | gvisChartEditor <- function(data, type="Table",options=list(),...){
21 |
22 | ## myCall <- paste("gvis", type, "options=modifyList(list(gvis.editor='Editor'),options),...)", sep="")
23 | ## eval(parse(text=mvCall)
24 |
25 |
26 | if (type=="Table"){
27 |
28 | gvis.object <- gvisTable(data,
29 | options=modifyList(list(gvis.editor="Editor"),options),...)
30 | }
31 | if (type=="LineChart"){
32 | gvis.object <- gvisLineChart(data,
33 | options=modifyList(list(gvis.editor="Editor"),options),...)
34 | }
35 | gvis.object
36 | }
37 |
--------------------------------------------------------------------------------
/R/gvisHistogram.R:
--------------------------------------------------------------------------------
1 | ### Part of the R package googleVis
2 | ### Copyright 2011 - 2014 Markus Gesmann, Diego de Castillo
3 |
4 | ### It is made available under the terms of the GNU General Public
5 | ### License, version 2, or at your option, any later version,
6 | ### incorporated herein by reference.
7 | ###
8 | ### This program is distributed in the hope that it will be
9 | ### useful, but WITHOUT ANY WARRANTY; without even the implied
10 | ### warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 | ### PURPOSE. See the GNU General Public License for more
12 | ### details.
13 | ###
14 | ### You should have received a copy of the GNU General Public
15 | ### License along with this program; if not, write to the Free
16 | ### Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 | ### MA 02110-1301, USA
18 |
19 |
20 | #' Google Histogram Chart with R
21 | #' \Sexpr{googleChartName <- "histogram"}
22 | #' \Sexpr{gvisChartName <- "gvisHistogram"}
23 | #'
24 | #' The gvisHistogram function reads a data.frame and creates text output
25 | #' referring to the Google Visualisation API, which can be included into a web
26 | #' page, or as a stand-alone page. The actual chart is rendered by the web
27 | #' browser using SVG or VML.
28 | #'
29 | #'
30 | #' @param data a \code{\link{data.frame}} to be displayed as a histogram.
31 | #' Each column will be displayed as a histogram.
32 | #'
33 | #' @param options list of configuration options, see
34 | #'
35 | #' % START DYNAMIC CONTENT
36 | #'
37 | #' \Sexpr[results=rd]{gsub("CHARTNAME",
38 | #' googleChartName,
39 | #' readLines(file.path(".", "inst", "mansections",
40 | #' "GoogleChartToolsURLConfigOptions.txt")))}
41 | #'
42 | #' \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
43 | #' "mansections", "gvisOptions.txt")))}
44 | #'
45 | #' @param chartid character. If missing (default) a random chart id will be
46 | #' generated based on chart type and \code{\link{tempfile}}.
47 | #'
48 | #' @return \Sexpr[results=rd]{paste(gvisChartName)} returns list
49 | #' of \code{\link{class}}
50 | #' \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
51 | #' "mansections", "gvisOutputStructure.txt")))}
52 | #'
53 | #' @references Google Chart Tools API:
54 | #' \Sexpr[results=rd]{gsub("CHARTNAME",
55 | #' googleChartName,
56 | #' readLines(file.path(".", "inst", "mansections",
57 | #' "GoogleChartToolsURL.txt")))}
58 | #'
59 | #' % END DYNAMIC CONTENT
60 | #' @author Markus Gesmann \email{markus.gesmann@@gmail.com},
61 | #'
62 | #' Diego de Castillo \email{decastillo@@gmail.com}
63 | #' @seealso See also \code{\link{print.gvis}}, \code{\link{plot.gvis}} for
64 | #' printing and plotting methods
65 | #' @keywords iplot
66 | #' @examples
67 | #'
68 | #' ## Please note that by default the googleVis plot command
69 | #' ## will open a browser window and requires an internet
70 | #' ## connection to display the visualisation.
71 | #'
72 | #'
73 | #' hist1 <- gvisHistogram(dino)
74 | #' plot(hist1)
75 | #'
76 | #' ## Histogram of the top 20 countries
77 | #' pop <- Population[1:20,c("Country", "Population")]
78 | #' pop=transform(pop, Population=round(Population/1e6))
79 | #'
80 | #' hist2 <- gvisHistogram(pop, option=list(title="Country Populations",
81 | #' legend="{ position: 'none' }",
82 | #' colors="['green']"))
83 | #' plot(hist2)
84 | #'
85 | #' set.seed(123)
86 | #' dat=data.frame(A=rpois(100, 20),
87 | #' B=rpois(100, 5),
88 | #' C=rpois(100, 50))
89 | #' hist3 <- gvisHistogram(dat, options=list(
90 | #' legend="{ position: 'top', maxLines: 2 }",
91 | #' colors="['#5C3292', '#1A8763', '#871B47']"))
92 | #'
93 | #' plot(hist3)
94 |
95 | gvisHistogram <- function(data, options=list(), chartid){##, editor
96 |
97 | my.type <- "Histogram"
98 | dataName <- deparse(substitute(data))
99 |
100 | my.options <- list(gvis=modifyList(list(allowHtml=TRUE),options),
101 | dataName=dataName,
102 | data=list(allowed=c("number", "string")))
103 |
104 | output <- gvisChart(type=my.type, checked.data=data,
105 | options=my.options, chartid=chartid,
106 | package="corechart")
107 | }
108 |
--------------------------------------------------------------------------------
/R/gvisMap.R:
--------------------------------------------------------------------------------
1 | ### File R/gvisMap.R
2 | ### Part of the R package googleVis
3 | ### Copyright 2010 - 2014 Markus Gesmann, Diego de Castillo
4 |
5 | ### It is made available under the terms of the GNU General Public
6 | ### License, version 2, or at your option, any later version,
7 | ### incorporated herein by reference.
8 | ###
9 | ### This program is distributed in the hope that it will be
10 | ### useful, but WITHOUT ANY WARRANTY; without even the implied
11 | ### warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 | ### PURPOSE. See the GNU General Public License for more
13 | ### details.
14 | ###
15 | ### You should have received a copy of the GNU General Public
16 | ### License along with this program; if not, write to the Free
17 | ### Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 | ### MA 02110-1301, USA
19 |
20 |
21 |
22 | #' Google Maps with R
23 | #' \Sexpr{googleChartName <- "map"}
24 | #' \Sexpr{gvisChartName <- "gvisMap"}
25 | #'
26 | #' The gvisMap function reads a data.frame and creates text output referring to
27 | #' the Google Visualisation API, which can be included into a web page, or as a
28 | #' stand-alone page.
29 | #'
30 | #' The maps are the well known Google Maps.
31 | #'
32 | #' @param data a \code{data.frame}. The data has to have at least two columns
33 | #' with location name (\code{locationvar}) and the variable to display the text
34 | #' in the tip icon (\code{tipvar}).
35 | #'
36 | #' @param locationvar column name of \code{data} with the geo locations to be
37 | #' analysed. The locations can be provide in two formats: \describe{
38 | #' \item{Format 1}{'latitude:longitude'. See the example below.} \item{Format
39 | #' 2}{The first column should be a string that contains an address. This
40 | #' address should be as complete as you can make it. } }
41 | #' @param tipvar column name of \code{data} with the string text displayed over
42 | #' the tip icon.
43 | #' @param options list of configuration options for Google Map.
44 | #'
45 | #' % START DYNAMIC CONTENT
46 | #'
47 | #' \Sexpr[results=rd]{gsub("CHARTNAME",
48 | #' googleChartName,
49 | #' readLines(file.path(".", "inst", "mansections",
50 | #' "GoogleChartToolsURLConfigOptions.txt")))}
51 | #'
52 | #' \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
53 | #' "mansections", "gvisOptions.txt")))}
54 | #'
55 | #' @param chartid character. If missing (default) a random chart id will be
56 | #' generated based on chart type and \code{\link{tempfile}}
57 | #'
58 | #' @return \Sexpr[results=rd]{paste(gvisChartName)} returns list
59 | #' of \code{\link{class}}
60 | #' \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
61 | #' "mansections", "gvisOutputStructure.txt")))}
62 | #'
63 | #' @references Google Chart Tools API:
64 | #' \Sexpr[results=rd]{gsub("CHARTNAME",
65 | #' googleChartName,
66 | #' readLines(file.path(".", "inst", "mansections",
67 | #' "GoogleChartToolsURL.txt")))}
68 | #'
69 | #' % END DYNAMIC CONTENT
70 | #'
71 | #' @author Markus Gesmann \email{markus.gesmann@@gmail.com},
72 | #'
73 | #' Diego de Castillo \email{decastillo@@gmail.com}
74 | #' @seealso
75 | #'
76 | #' See also \code{\link{print.gvis}}, \code{\link{plot.gvis}} for printing and
77 | #' plotting methods, \code{\link{gvisGeoChart}} for an alternative to \code{gvisMap}.
78 | #'
79 | #' @keywords iplot
80 | #' @examples
81 | #'
82 | #' ## Please note that by default the googleVis plot command
83 | #' ## will open a browser window and requires Internet
84 | #' ## connection to display the visualisation.
85 | #'
86 | #' ## Example with latitude and longitude information
87 | #' ## Plot Hurricane Andrew (1992) storm path:
88 | #'
89 | #' data(Andrew)
90 | #'
91 | #' M1 <- gvisMap(Andrew, "LatLong" , "Tip",
92 | #' options=list(showTip=TRUE, showLine=TRUE, enableScrollWheel=TRUE,
93 | #' mapType='hybrid', useMapTypeControl=TRUE,
94 | #' width=800,height=400))
95 | #'
96 | #' plot(M1)
97 | #'
98 | #'
99 | #' ## Example with address, here UK post-code and some html code in tooltip
100 | #'
101 | #' df <- data.frame(Postcode=c("EC3M 7HA", "EC2P 2EJ"),
102 | #' Tip=c("Lloyd's",
103 | #' "Guildhall"))
104 | #'
105 | #' M2 <- gvisMap(df, "Postcode", "Tip",
106 | #' options=list(showTip=TRUE, mapType='normal',
107 | #' enableScrollWheel=TRUE))
108 | #'
109 | #' plot(M2)
110 | #'
111 | #' ## Change mapping icons
112 | #' M3 <- gvisMap(df, "Postcode", "Tip",
113 | #' options=list(showTip=TRUE, mapType='normal',
114 | #' enableScrollWheel=TRUE,
115 | #' icons=paste0("{",
116 | #' "'default': {'normal': 'https://icons.iconarchive.com/",
117 | #' "icons/icons-land/vista-map-markers/48/",
118 | #' "Map-Marker-Ball-Azure-icon.png',\n",
119 | #' "'selected': 'https://icons.iconarchive.com/",
120 | #' "icons/icons-land/vista-map-markers/48/",
121 | #' "Map-Marker-Ball-Right-Azure-icon.png'",
122 | #' "}}")))
123 | #'
124 | #' plot(M3)
125 |
126 | gvisMap <- function(data, locationvar="", tipvar="",options=list(), chartid){
127 |
128 | my.type <- "Map"
129 | dataName <- deparse(substitute(data))
130 | my.options <- list(gvis=modifyList(list(showTip = TRUE),options),
131 | dataName=dataName,
132 | data=list(locationvar=locationvar, tipvar=tipvar,
133 | allowed=c("number","string"))
134 | )
135 |
136 | checked.data <- gvisCheckMapData(data, my.options)
137 |
138 | output <- gvisChart(type=my.type, checked.data=checked.data, options=my.options, chartid=chartid)
139 |
140 | return(output)
141 | }
142 |
143 | gvisCheckMapData <- function(data, options){
144 |
145 | data.structure <- list(
146 | locationvar = list(mode="required",FUN=check.location),
147 | tipvar = list(mode="required",FUN=check.char))
148 |
149 | x <- gvisCheckData(data=data,options=options,data.structure=data.structure)
150 |
151 | if (sum(nchar(gsub("[[:digit:].-]+:[[:digit:].-]+", "", x[[1]]))) == 0){
152 | # split first index and delete this one
153 | latlong <- as.data.frame(do.call("rbind",strsplit(as.character(x[[1]]),':')))
154 | x[[1]] <- NULL
155 | varNames <- names(x)
156 | x$Latitude <- as.numeric(as.character(latlong$V1))
157 | x$Longitude <- as.numeric(as.character(latlong$V2))
158 | x <- x[c("Latitude","Longitude",varNames)]
159 | }
160 |
161 | return(data.frame(x))
162 | }
163 |
--------------------------------------------------------------------------------
/R/gvisOrgChart.R:
--------------------------------------------------------------------------------
1 | ### File R/gvisOrgChart.R
2 | ### Part of the R package googleVis
3 | ### Copyright 2010 - 2014 Markus Gesmann, Diego de Castillo
4 |
5 | ### It is made available under the terms of the GNU General Public
6 | ### License, version 2, or at your option, any later version,
7 | ### incorporated herein by reference.
8 | ###
9 | ### This program is distributed in the hope that it will be
10 | ### useful, but WITHOUT ANY WARRANTY; without even the implied
11 | ### warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 | ### PURPOSE. See the GNU General Public License for more
13 | ### details.
14 | ###
15 | ### You should have received a copy of the GNU General Public
16 | ### License along with this program; if not, write to the Free
17 | ### Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 | ### MA 02110-1301, USA
19 |
20 |
21 |
22 | #' Google Org Chart with R
23 | #' \Sexpr{googleChartName <- "orgchart"}
24 | #' \Sexpr{gvisChartName <- "gvisOrgChart"}
25 | #'
26 | #' An organizational chart that supports selection.
27 | #'
28 | #' The gvisOrgChart function reads a data.frame and creates text output
29 | #' referring to the Google Visualisation API, which can be included into a web
30 | #' page, or as a stand-alone page. The actual chart is rendered by the web
31 | #' browser.
32 | #'
33 | #'
34 | #' @param data a \code{data.frame}. The data has to have at least three
35 | #' columns. Each row in the data table describes one node (a rectangle in the
36 | #' graph). Each node (except the root node) has one or more parent nodes. Each
37 | #' node is sized and colored according to its values relative to the other
38 | #' nodes currently shown.
39 | #' @param idvar column name of \code{data} describing the ID for each node. It
40 | #' should be unique among all nodes, and can include any characters, including
41 | #' spaces. This is shown on the node. You can specify a formatted value to show
42 | #' on the chart instead, but the unformatted value is still used as the ID.
43 | #' @param parentvar column name of \code{data} that match to entries in
44 | #' \code{idvar}. If this is a root node, leave this \code{NA}. Only one root is
45 | #' allowed.
46 | #' @param tipvar column name of \code{data} for the tip variable. Tool-tip text
47 | #' to show, when a user hovers over this node.
48 | #' @param options list of configuration options, see:
49 | #'
50 | #' % START DYNAMIC CONTENT
51 | #'
52 | #' \Sexpr[results=rd]{gsub("CHARTNAME",
53 | #' googleChartName,
54 | #' readLines(file.path(".", "inst", "mansections",
55 | #' "GoogleChartToolsURLConfigOptions.txt")))}
56 | #'
57 | #' \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
58 | #' "mansections", "gvisOptions.txt")))}
59 | #'
60 | #' @param chartid character. If missing (default) a random chart id will be
61 | #' generated based on chart type and \code{\link{tempfile}}
62 | #'
63 | #' @return \Sexpr[results=rd]{paste(gvisChartName)} returns list
64 | #' of \code{\link{class}}
65 | #' \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
66 | #' "mansections", "gvisOutputStructure.txt")))}
67 | #'
68 | #' @references Google Chart Tools API:
69 | #' \Sexpr[results=rd]{gsub("CHARTNAME",
70 | #' googleChartName,
71 | #' readLines(file.path(".", "inst", "mansections",
72 | #' "GoogleChartToolsURL.txt")))}
73 | #'
74 | #' % END DYNAMIC CONTENT
75 | #' @author Markus Gesmann \email{markus.gesmann@@gmail.com},
76 | #'
77 | #' Diego de Castillo \email{decastillo@@gmail.com}
78 | #' @seealso
79 | #'
80 | #' See also \code{\link{print.gvis}}, \code{\link{plot.gvis}} for printing and
81 | #' plotting methods.
82 | #' @keywords iplot
83 | #'
84 | #' @examples
85 | #'
86 | #' ## Please note that by default the googleVis plot command
87 | #' ## will open a browser window and requires Internet
88 | #' ## connection to display the visualisation.
89 | #'
90 | #' Regions
91 | #' Org1 <- gvisOrgChart(Regions, idvar = "Region", parentvar = "Parent",
92 | #' tipvar="Val")
93 | #' plot(Org1)
94 | #'
95 | #' ## Set a few options
96 | #' Org2 <- gvisOrgChart(Regions, idvar = "Region", parentvar = "Parent",
97 | #' tipvar="Val",
98 | #' options=list(width=600, height=400,
99 | #' size='large', allowCollapse=TRUE))
100 | #' plot(Org2)
101 | #'
102 |
103 |
104 |
105 | gvisOrgChart <- function(data, idvar="", parentvar="", tipvar="", options=list(), chartid){
106 |
107 | my.type <- "OrgChart"
108 | dataName <- deparse(substitute(data))
109 | my.options <- list(gvis=modifyList(list(width = 600, height=400), options),
110 | dataName=dataName,
111 | data=list(idvar=idvar, parentvar=parentvar, tipvar=tipvar,
112 | allowed=c("string"))
113 | )
114 |
115 | checked.data <- gvisCheckOrgChartData(data, my.options)
116 |
117 | output <- gvisChart(type=my.type, checked.data=checked.data, options=my.options, chartid)
118 |
119 | return(output)
120 | }
121 |
122 |
123 | ## plot(gvisOrgChart(Regions))
124 | ## plot(gvisOrgChart(Regions, options=list(width=600, height=400, size='large', allowCollapse=TRUE)))
125 |
126 | gvisCheckOrgChartData <- function(data, options){
127 |
128 | data.structure <- list(
129 | idvar = list(mode="required",FUN=check.char),
130 | parentvar = list(mode="required",FUN=check.char),
131 | tipvar = list(mode="required",FUN=check.char))
132 |
133 | x <- gvisCheckData(data=data,options=options,data.structure=data.structure)
134 |
135 | # is there parent for every id?
136 | parent.match.id <- x[[2]][!(x[[2]] %in% x[[1]])]
137 | if (sum(is.na(parent.match.id))!=1 || length(parent.match.id)!=1){
138 | stop("parentvar and idvar do not fit together.")
139 | }
140 |
141 | return(data.frame(x))
142 | }
143 |
--------------------------------------------------------------------------------
/R/gvisSankey.R:
--------------------------------------------------------------------------------
1 | ### Copyright 2010 - 2014 Markus Gesmann
2 | ### It is made available under the terms of the GNU General Public
3 | ### License, version 2, or at your option, any later version,
4 | ### incorporated herein by reference.
5 | ###
6 | ### This program is distributed in the hope that it will be
7 | ### useful, but WITHOUT ANY WARRANTY; without even the implied
8 | ### warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9 | ### PURPOSE. See the GNU General Public License for more
10 | ### details.
11 | ###
12 | ### You should have received a copy of the GNU General Public
13 | ### License along with this program; if not, write to the Free
14 | ### Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
15 | ### MA 02110-1301, USA
16 |
17 | #' Google Sankey Chart with R
18 | #' \Sexpr{googleChartName <- "sankey"}
19 | #' \Sexpr{gvisChartName <- "gvisSankey"}
20 | #' @description
21 | #' A sankey diagram is a visualization used to depict a flow from one set of
22 | #' values to another. The things being connected are called nodes and the
23 | #' connections are called links. They're named after Captain Sankey, who created
24 | #' a diagram of steam engine efficiency that used arrows having widths
25 | #' proportional to heat loss.
26 | #'
27 | #' @param data data.frame that contains the data to be visualised
28 | #' @param from a string that refers to the column name in
29 | #' \code{data} for the source nodes to be used
30 | #' @param to a string that refers to the column name in
31 | #' \code{data} for the destination nodes to be used
32 | #' @param weight name of the column with the numerical weight of the connections
33 | #' @param options list of configuration options.
34 | #' The options are documented in detail by Google online:
35 | #'
36 | #' % START DYNAMIC CONTENT
37 | #'
38 | #' \Sexpr[results=rd]{gsub("CHARTNAME",
39 | #' googleChartName,
40 | #' readLines(file.path(".", "inst", "mansections",
41 | #' "GoogleChartToolsURLConfigOptions.txt")))}
42 | #'
43 | #' \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
44 | #' "mansections", "gvisOptions.txt")))}
45 | #'
46 | #' @param chartid character. If missing (default) a random chart id will be
47 | #' generated based on chart type and \code{\link{tempfile}}
48 | #'
49 | #' @return \Sexpr[results=rd]{paste(gvisChartName)} returns list
50 | #' of \code{\link{class}}
51 | #' \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
52 | #' "mansections", "gvisOutputStructure.txt")))}
53 | #'
54 | #' @references Google Chart Tools API:
55 | #' \Sexpr[results=rd]{gsub("CHARTNAME",
56 | #' googleChartName,
57 | #' readLines(file.path(".", "inst", "mansections",
58 | #' "GoogleChartToolsURL.txt")))}
59 | #'
60 | #' % END DYNAMIC CONTENT
61 | #'
62 | #' @author Markus Gesmann \email{markus.gesmann@@gmail.com}
63 | #'
64 | #' @section Warning:
65 | #' The sankey chart may be undergoing substantial revisions in
66 | #' future Google Charts releases.
67 | #'
68 | #' @keywords iplot
69 | #'
70 | #' @examples
71 | #' dat <- data.frame(From=c(rep("A",3), rep("B", 3)),
72 | #' To=c(rep(c("X", "Y", "Z"),2)),
73 | #' Weight=c(5,7,6,2,9,4))
74 | #'
75 | #' sk1 <- gvisSankey(dat, from="From", to="To", weight="Weight")
76 | #' plot(sk1)
77 | #'
78 | #' sk2 <- gvisSankey(dat, from="From", to="To", weight="Weight",
79 | #' options=list(sankey="{link: {color: { fill: '#d799ae' } },
80 | #' node: { color: { fill: '#a61d4c' },
81 | #' label: { color: '#871b47' } }}"))
82 | #' plot(sk2)
83 | #'
84 |
85 | gvisSankey <- function(data, from="", to="", weight="",
86 | options=list(), chartid){
87 |
88 | my.type <- "Sankey"
89 | dataName <- deparse(substitute(data))
90 |
91 | my.options <- list(gvis=modifyList(list(width=400, height=400),options), dataName=dataName,
92 | data=list(from=from, to=to, weight=weight,
93 | allowed=c("number", "string"))
94 | )
95 |
96 |
97 | #checked.data <- gvisCheckSankeyData(data, my.options)
98 |
99 | output <- gvisChart(type=my.type, checked.data=data, options=my.options,
100 | chartid=chartid, package="sankey")
101 |
102 | return(output)
103 | }
104 | #
105 | # gvisCheckSankeyData <- function(data, options){
106 | #
107 | # data.structure <- list(
108 | # from = list(mode="required", FUN=check.char),
109 | # to = list(mode="required", FUN=check.char),
110 | # weight = list(mode="required", FUN=check.num)
111 | # )
112 | # data <- gvisCheckData(data=data, options=options, data.structure=data.structure)
113 | #
114 | # return(data)
115 | # }
116 |
117 |
--------------------------------------------------------------------------------
/R/gvisTable.R:
--------------------------------------------------------------------------------
1 | ### File R/gvisTable.R
2 | ### Part of the R package googleVis
3 | ### Copyright 2010 - 2014 Markus Gesmann, Diego de Castillo
4 |
5 | ### It is made available under the terms of the GNU General Public
6 | ### License, version 2, or at your option, any later version,
7 | ### incorporated herein by reference.
8 | ###
9 | ### This program is distributed in the hope that it will be
10 | ### useful, but WITHOUT ANY WARRANTY; without even the implied
11 | ### warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 | ### PURPOSE. See the GNU General Public License for more
13 | ### details.
14 | ###
15 | ### You should have received a copy of the GNU General Public
16 | ### License along with this program; if not, write to the Free
17 | ### Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 | ### MA 02110-1301, USA
19 |
20 |
21 |
22 | #' Google Table Chart with R
23 | #' \Sexpr{googleChartName <- "table"}
24 | #' \Sexpr{gvisChartName <- "gvisTable"}
25 | #'
26 | #'
27 | #' The gvisTable function reads a data.frame and creates text output referring
28 | #' to the Google Visualisation API, which can be included into a web page, or
29 | #' as a stand-alone page. The actual chart is rendered by the web browser.
30 | #'
31 | #' A table that can be sorted and paged. Table cells can be formatted using
32 | #' format strings, or by directly inserting HTML as cell values. Numeric values
33 | #' are right-aligned; boolean values are displayed as check marks. Users can
34 | #' select single rows either with the keyboard or the mouse. Users can sort
35 | #' rows by clicking on column headers. The header row remains fixed as the user
36 | #' scrolls. The table fires a number of events corresponding to user
37 | #' interaction.
38 | #'
39 | #'
40 | #' @param data a \code{\link{data.frame}} to be displayed as a table
41 | #' @param formats named list. If \code{NULL} (default) no specific format will
42 | #' be used. The named list needs to contain the column names of the data and
43 | #' the specified format. The format string is a subset of the ICU pattern set.
44 | #' For instance, \{pattern:'#,###\%'\`\} will result in output values "1,000\%",
45 | #' "750\%", and "50\%" for values 10, 7.5, and 0.5.
46 | #' @param options list of configuration options, see:
47 | #'
48 | #' % START DYNAMIC CONTENT
49 | #'
50 | #' \Sexpr[results=rd]{gsub("CHARTNAME",
51 | #' googleChartName,
52 | #' readLines(file.path(".", "inst", "mansections",
53 | #' "GoogleChartToolsURLConfigOptions.txt")))}
54 | #'
55 | #' \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
56 | #' "mansections", "gvisOptions.txt")))}
57 | #'
58 | #' @param chartid character. If missing (default) a random chart id will be
59 | #' generated based on chart type and \code{\link{tempfile}}
60 | #'
61 | #' @return \Sexpr[results=rd]{paste(gvisChartName)} returns list
62 | #' of \code{\link{class}}
63 | #' \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
64 | #' "mansections", "gvisOutputStructure.txt")))}
65 | #'
66 | #' @references Google Chart Tools API:
67 | #' \Sexpr[results=rd]{gsub("CHARTNAME",
68 | #' googleChartName,
69 | #' readLines(file.path(".", "inst", "mansections",
70 | #' "GoogleChartToolsURL.txt")))}
71 | #'
72 | #' % END DYNAMIC CONTENT
73 | #'
74 | #' @author Markus Gesmann \email{markus.gesmann@@gmail.com},
75 | #'
76 | #' Diego de Castillo \email{decastillo@@gmail.com}
77 | #' @seealso See also \code{\link{print.gvis}}, \code{\link{plot.gvis}} for
78 | #' printing and plotting methods.
79 | #' @keywords iplot
80 | #' @examples
81 | #'
82 | #' ## Please note that by default the googleVis plot command
83 | #' ## will open a browser window and requires Flash and Internet
84 | #' ## connection to display the visualisation.
85 | #'
86 | #' ## Table with links to wikipedia (flags)
87 | #' tbl1 <- gvisTable(Population)
88 | #' plot(tbl1)
89 | #'
90 | #' ## Table with enabled paging
91 | #' tbl2 <- gvisTable(Population, options=list(page='enable',
92 | #' height='automatic',
93 | #' width='automatic'))
94 | #'
95 | #' plot(tbl2)
96 | #'
97 | #' ## Table with formating options
98 | #' tbl3 <- gvisTable(Population, formats=list(Population="#,###"))
99 | #'
100 | #' Population[['% of World Population']] <- Population[['% of World Population']]/100
101 | #' tbl4 <- gvisTable(Population, formats=list(Population="#,###",
102 | #' '% of World Population'='#.#%'))
103 | #' plot(tbl4)
104 | #'
105 | gvisTable <- function(data, options=list(), chartid, formats = NULL){
106 |
107 | my.type <- "Table"
108 | dataName <- deparse(substitute(data))
109 |
110 | my.options <- list(gvis=modifyList(list(allowHtml=TRUE),options),
111 | dataName=dataName,
112 | data=list(allowed=c("number","string","date","datetime","boolean")))
113 |
114 | checked.data <- gvisCheckTableData(data)
115 |
116 | output <- gvisChart(type=my.type, checked.data=checked.data, options=my.options,
117 | chartid=chartid, formats = formats)
118 |
119 | return(output)
120 | }
121 |
122 |
123 | gvisCheckTableData <- function(data){
124 |
125 | # nothing to check at the moment here
126 | return(data)
127 | }
128 |
--------------------------------------------------------------------------------
/R/gvisTimeLine.R:
--------------------------------------------------------------------------------
1 | ### File R/gvisPieChart.R
2 | ### Part of the R package googleVis
3 | ### Copyright 2010, 2011, 2012, 2013 Markus Gesmann, Diego de Castillo
4 |
5 | ### It is made available under the terms of the GNU General Public
6 | ### License, version 2, or at your option, any later version,
7 | ### incorporated herein by reference.
8 | ###
9 | ### This program is distributed in the hope that it will be
10 | ### useful, but WITHOUT ANY WARRANTY; without even the implied
11 | ### warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 | ### PURPOSE. See the GNU General Public License for more
13 | ### details.
14 | ###
15 | ### You should have received a copy of the GNU General Public
16 | ### License along with this program; if not, write to the Free
17 | ### Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 | ### MA 02110-1301, USA
19 |
20 | #' Google Timeline Chart with R
21 | #' \Sexpr{googleChartName <- "timeline"}
22 | #' \Sexpr{gvisChartName <- "gvisTimeline"}
23 | #'
24 | #' @description
25 | #' A timeline is a chart that depicts how a set of resources are used
26 | #' over time. One popular type of timeline is the Gantt chart.
27 | #'
28 | #' @param data data.frame that contains the data to be visualised
29 | #' @param rowlabel a string that refers to the column name in
30 | #' \code{data} for the row labels to be used
31 | #' @param barlabel a string that refers to the column name in
32 | #' \code{data} for the bar labels to be used
33 | #' @param start number, date or datetime for the start dates
34 | #' @param end number, date or datetime for the end dates
35 | #' @param options list of configuration options.
36 | #' The options are documented in detail by Google online:
37 | #'
38 | #' % START DYNAMIC CONTENT
39 | #'
40 | #' \Sexpr[results=rd]{gsub("CHARTNAME",
41 | #' googleChartName,
42 | #' readLines(file.path(".", "inst", "mansections",
43 | #' "GoogleChartToolsURLConfigOptions.txt")))}
44 | #'
45 | #' \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
46 | #' "mansections", "gvisOptions.txt")))}
47 | #'
48 | #' @param chartid character. If missing (default) a random chart id will be
49 | #' generated based on chart type and \code{\link{tempfile}}
50 | #'
51 | #' @return \Sexpr[results=rd]{paste(gvisChartName)} returns list
52 | #' of \code{\link{class}}
53 | #' \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
54 | #' "mansections", "gvisOutputStructure.txt")))}
55 | #'
56 | #' @references Google Chart Tools API:
57 | #' \Sexpr[results=rd]{gsub("CHARTNAME",
58 | #' googleChartName,
59 | #' readLines(file.path(".", "inst", "mansections",
60 | #' "GoogleChartToolsURL.txt")))}
61 | #'
62 | #' % END DYNAMIC CONTENT
63 | #'
64 | #' @author Markus Gesmann \email{markus.gesmann@@gmail.com}
65 | #'
66 | #' @keywords iplot
67 | #'
68 | #' @examples
69 | #' dat <- data.frame(Term=c("1","2","3"),
70 | #' President=c("Whasington", "Adams", "Jefferson"),
71 | #' start=as.Date(x=c("1789-03-29", "1797-02-03", "1801-02-03")),
72 | #' end=as.Date(x=c("1797-02-03", "1801-02-03", "1809-02-03")))
73 | #'
74 | #' tl <- gvisTimeline(data=dat[,-1], rowlabel="President",
75 | #' start="start", end="end")
76 | #' plot(tl)
77 | #'
78 | #' tl <- gvisTimeline(data=dat, barlabel="President",
79 | #' start="start", end="end")
80 | #' plot(tl)
81 | #'
82 | #' tl <- gvisTimeline(data=dat, rowlabel="President",
83 | #' start="start", end="end",
84 | #' options=list(timeline="{showRowLabels:false}"))
85 | #' plot(tl)
86 | #'
87 | #' dat <- data.frame(Position=c(rep("President", 3), rep("Vice", 3)),
88 | #' Name=c("Washington", "Adams", "Jefferson",
89 | #' "Adams", "Jefferson", "Burr"),
90 | #' start=as.Date(x=rep(c("1789-03-29", "1797-02-03", "1801-02-03"),2)),
91 | #' end=as.Date(x=rep(c("1797-02-03", "1801-02-03", "1809-02-03"),2)))
92 | #'
93 | #' tl <- gvisTimeline(data=dat, rowlabel="Name",barlabel="Position",
94 | #' start="start", end="end",
95 | #' options=list(timeline="{showRowLabels:true}"))
96 | #' plot(tl)
97 | #'
98 | #' tl <- gvisTimeline(data=dat, rowlabel="Name",barlabel="Position",
99 | #' start="start", end="end",
100 | #' options=list(timeline="{groupByRowLabel:false}",
101 | #' backgroundColor='#ffd', height=350,
102 | #' colors="['#cbb69d', '#603913', '#c69c6e']"))
103 | #'
104 | #' plot(tl)
105 | #'
106 | #' # Datetime example
107 | #' dat <- data.frame(Room=c("Room 1","Room 2","Room 3"),
108 | #' Language=c("English", "German", "French"),
109 | #' start=as.POSIXct(c("2014-03-14 14:00", "2014-03-14 15:00",
110 | #' "2014-03-14 14:30")),
111 | #' end=as.POSIXct(c("2014-03-14 15:00", "2014-03-14 16:00",
112 | #' "2014-03-14 15:30")))
113 | #' tl <- gvisTimeline(data=dat, rowlabel="Language",
114 | #' start="start", end="end")
115 | #' plot(tl)
116 | #'
117 | #' \dontrun{
118 | #' require(timeline)
119 | #' data(ww2)
120 | #' timeline(ww2, ww2.events, event.spots=2, event.label='', event.above=FALSE)
121 | #' ww2$Person <- gsub("\\n" ," ", ww2$Person)
122 | #' plot(gvisTimeline(ww2, barlabel="Person", rowlabel="Group",
123 | #' start="StartDate", end="EndDate",
124 | #' options=list(width=600, height=350))
125 | #' )
126 | #' }
127 |
128 | gvisTimeline <- function(data, rowlabel="", barlabel="", start="",
129 | end="", options=list(), chartid){
130 |
131 | my.type <- "Timeline"
132 | dataName <- deparse(substitute(data))
133 |
134 | my.options <- list(gvis=modifyList(list(width=600, height=200),options), dataName=dataName,
135 | data=list(rowlabel=rowlabel, barlabel=barlabel, start=start, end=end,
136 | allowed=c("number", "string", "date", "datetime"))
137 | )
138 |
139 |
140 | checked.data <- gvisCheckTimelineData(data, rl=rowlabel, bl=barlabel,
141 | start=start, end=end)
142 |
143 | output <- gvisChart(type=my.type, checked.data=checked.data, options=my.options,
144 | chartid=chartid, package="timeline")
145 |
146 | return(output)
147 | }
148 |
149 | gvisCheckTimelineData <- function(data, rl, bl, start, end){
150 |
151 | if(any(c(rl, bl, start, end) %in% ""))
152 | return(data)
153 | else
154 | return(data[, c(rl, bl, start, end)])
155 | }
156 |
157 |
--------------------------------------------------------------------------------
/R/shiny.R:
--------------------------------------------------------------------------------
1 | ### File R/shiny.R
2 | ### Part of the R package googleVis
3 |
4 | ### It is made available under the terms of the GNU General Public
5 | ### License, version 2, or at your option, any later version,
6 | ### incorporated herein by reference.
7 | ###
8 | ### This program is distributed in the hope that it will be
9 | ### useful, but WITHOUT ANY WARRANTY; without even the implied
10 | ### warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 | ### PURPOSE. See the GNU General Public License for more
12 | ### details.
13 | ###
14 | ### You should have received a copy of the GNU General Public
15 | ### License along with this program; if not, write to the Free
16 | ### Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 | ### MA 02110-1301, USA
18 |
19 | #' renderGvis
20 | #'
21 | #' Use a googleVis Chart as Shiny Output
22 | #'
23 | #' @description
24 | #' This function lets you use googleVis charts as Shiny output.
25 | #' Use it to wrap a googleVis-generating function that you assign to an
26 | #' \code{output} element in \code{server.R}; then create an \code{htmlOutput}
27 | #' with the same name in \code{ui.R}.
28 | #'
29 | #' @param expr An expression that returns a gvis object.
30 | #' @param env The environment in which to evaluate \code{expr}
31 | #' @param quoted Is \code{expr} a quoted expression (with \code{quote()})?
32 | #' This is useful if you want to save an expression in a variable.
33 | #'
34 | #' @section Details:
35 | #' More information about shiny is available online:
36 | #' \url{https://shiny.posit.co/}.
37 | #' You find further examples with googleVis on shiny on mages' blog:
38 | #' \url{https://magesblog.com/tags/shiny/}
39 | #'
40 | #' @return Returns a function that can be assigned to a Shiny \code{output}
41 | #' element.
42 | #'
43 | #' @author Joe Cheng, \email{joe@@rstudio.com}
44 | #'
45 | #' @keywords shiny
46 | #'
47 | #' @examples
48 | #' \dontrun{
49 | #' # To run this example:
50 | #' shiny::runApp(system.file("shiny/", package="googleVis"))
51 | #' # server.R
52 | #' library(googleVis)
53 | #'
54 | #' shinyServer(function(input, output) {
55 | #' datasetInput <- reactive({
56 | #' switch(input$dataset,
57 | #' "rock" = rock,
58 | #' "pressure" = pressure,
59 | #' "cars" = cars)
60 | #' })
61 | #'
62 | #' output$view <- renderGvis({
63 | #' gvisScatterChart(datasetInput(),
64 | #' options=list(title=paste('Data:',input$dataset)))
65 | #' })
66 | #' })
67 | #'
68 | #' # ui.R
69 | #' shinyUI(pageWithSidebar(
70 | #' headerPanel("googleVis on Shiny"),
71 | #' sidebarPanel(
72 | #' selectInput("dataset", "Choose a dataset:",
73 | #' choices = c("rock", "pressure", "cars"))
74 | #' ),
75 | #' mainPanel(
76 | #' htmlOutput("view")
77 | #' )
78 | #' ))
79 | #' }
80 | #'
81 | #'
82 | renderGvis <- function(expr, env=parent.frame(), quoted=FALSE) {
83 | # Convert expr to a function
84 | func <- shiny::exprToFunction(expr, env, quoted)
85 |
86 | function() {
87 | chart <- func()
88 | paste(chart$html$chart, collapse="\n")
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/R/zzz.R:
--------------------------------------------------------------------------------
1 | ### File R/zzz.R
2 | ### Part of the R package googleVis
3 | ### Copyright 2010, 2011, 2012 Markus Gesmann, Diego de Castillo
4 |
5 | ### It is made available under the terms of the GNU General Public
6 | ### License, version 2, or at your option, any later version,
7 | ### incorporated herein by reference.
8 | ###
9 | ### This program is distributed in the hope that it will be
10 | ### useful, but WITHOUT ANY WARRANTY; without even the implied
11 | ### warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 | ### PURPOSE. See the GNU General Public License for more
13 | ### details.
14 | ###
15 | ### You should have received a copy of the GNU General Public
16 | ### License along with this program; if not, write to the Free
17 | ### Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 | ### MA 02110-1301, USA
19 |
20 | #' @importFrom utils, packageDescription, browseURL, type.convert
21 | #' @importFrom stats, na.omit, reshape
22 | #' @importFrom tools, startDynamicHelp
23 | #' @importFrom jsonlite, toJSON, unbox
24 |
25 |
26 | .onLoad<- function(lib, pkg,...)
27 | {
28 |
29 | options(gvis.plot.tag=NULL)
30 | options(gvis.print.tag="html")
31 | options(googleVis.viewer=getOption("viewer"))
32 |
33 | ## Set possible gvis.out.options
34 | ## Output from
35 | ## unique(unlist(strsplit(names(unlist( gvisTable(data.frame(x=1, y=1)))),".", fixed=TRUE)))
36 |
37 | gvis.tags <- c("type", "chartid", "html", "header", "chart", "jsHeader", "jsData", "jsDrawChart",
38 | "jsDisplayChart", "jsFooter", "jsChart", "divChart", "caption", "footer")
39 | options(gvis.tags=gvis.tags)
40 |
41 | ## This function are required to set option in googleVis functions,
42 | ## e.g. to set startZoom and stopZoom windows in gvisAnnotatedTimeLine
43 | suppressMessages(
44 | setMethod("toJSON", "Date",
45 | function(x, container = length(x) > 1 || length(names(x)) > 0, ...) {
46 | dt <- as.Date(x)
47 | y <- format(dt,"%Y")
48 | m <- as.numeric(format(dt,"%m")) -1
49 | d <- as.numeric(format(dt,"%d"))
50 |
51 | tmp <- paste("new Date(",y,",",m,",",d,")",sep="")
52 | paste(tmp, collapse=", ")
53 | })
54 | )
55 | suppressMessages(
56 | setMethod("toJSON", "POSIXct",
57 | function(x, container = length(x) > 1 || length(names(x)) > 0, ...) {
58 | dt <- as.POSIXct(x)
59 | y <- format(dt,"%Y")
60 | m <- as.numeric(format(dt,"%m")) -1
61 | d <- as.numeric(format(dt,"%d"))
62 | H <- as.numeric(format(dt,"%H"))
63 | M <- as.numeric(format(dt,"%M"))
64 | S <- as.numeric(format(dt,"%S"))
65 |
66 | tmp <- paste("new Date(",y,",",m,",",d,",",H,",",M,",",S,")",sep="")
67 | paste(tmp, collapse=", ")
68 | })
69 | )
70 | suppressMessages(
71 | setMethod("toJSON", "POSIXlt",
72 | function(x, container = length(x) > 1 || length(names(x)) > 0, ...) {
73 | dt <- as.POSIXlt(x)
74 | y <- format(dt,"%Y")
75 | m <- as.numeric(format(dt,"%m")) -1
76 | d <- as.numeric(format(dt,"%d"))
77 | H <- as.numeric(format(dt,"%H"))
78 | M <- as.numeric(format(dt,"%M"))
79 | S <- as.numeric(format(dt,"%S"))
80 |
81 | tmp <- paste("new Date(",y,",",m,",",d,",",H,",",M,",",S,")",sep="")
82 | paste(tmp, collapse=", ")
83 | })
84 | )
85 | invisible()
86 | }
87 |
88 | .onAttach <- function(lib, pkg,...){
89 | packageStartupMessage(gvisWelcomeMessage())
90 | }
91 | gvisWelcomeMessage <- function(){
92 |
93 | # if(is.null(getOption("viewer")))
94 | display <- "the standard browser to display its output.\n"
95 | # else
96 | # display <- paste("the RStudio Viewer pane to display its output.\n",
97 | # "Set options('googleVis.viewer'=NULL) to use your browser.\n",
98 | # sep="")
99 | paste("\n",
100 | "Welcome to googleVis version ", packageDescription("googleVis")$Version, "\n",
101 | "\n",
102 | "Please read Google's Terms of Use\n",
103 | "before you start using the package:\n",
104 | "https://developers.google.com/terms/\n",
105 | "\n",
106 | "Note, the plot method of googleVis will by default use\n",
107 | display,
108 | "\n",
109 | "See the googleVis package vignettes for more details,\n",
110 | "or visit https://mages.github.io/googleVis/.\n",
111 | "\n",
112 | "To suppress this message use:\n",
113 | "suppressPackageStartupMessages(library(googleVis))\n",
114 | sep="")
115 | }
116 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # googleVis
2 |
3 | [](https://github.com/mages/googleVis/actions)
4 |
5 | [](https://cran.r-project.org/package=googleVis) [](https://cran.r-project.org/package=googleVis)
6 |
7 |
8 | The googleVis package provides an interface between R and the [Google's charts tools](https://developers.google.com/chart/).
9 | It allows users to create web pages with interactive charts based on R data frames. Charts are displayed locally via the R HTTP help server.
10 | A modern browser with Internet connection is required. The data remains local and is not uploaded to
11 | Google.
12 |
13 | Check out the [examples](https://mages.github.io/googleVis/articles/googleVis_examples.html) from the googleVis demo.
14 |
15 | Please read [Google's Terms of Use](https://developers.google.com/terms/) before you start using the package.
16 |
17 | ## Installation
18 |
19 | You can install the stable version from
20 | [CRAN](https://cran.r-project.org/package=googleVis/):
21 |
22 | ```s
23 | install.packages('googleVis')
24 | ```
25 |
26 | ## Usage
27 |
28 | ```s
29 | library(googleVis)
30 | ?googleVis
31 | demo(googleVis)
32 | ```
33 |
34 | See the googleVis package [vignette](https://mages.github.io/googleVis/articles/googleVis_intro.html) for more details. For a brief introduction read the five page [R Journal article](https://journal.r-project.org/archive/2011-2/RJournal_2011-2_Gesmann+de~Castillo.pdf).
35 |
36 | ## License
37 |
38 | This package is free and open source software, licensed under GPL 2 or later.
39 |
40 | 
41 | googleVis documentation by Markus Gesmann & Diego de Castillo is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License
--------------------------------------------------------------------------------
/THANKS:
--------------------------------------------------------------------------------
1 | Thanks to:
2 | o Google, who make the visualisation API available
3 | o All the guys behind www.gapminder.org and Hans Rosling for telling
4 | everyone that data is not boring
5 | o Sebastian Pérez Saaibi for his inspiring talk on 'Generator
6 | Tool for Google Motion Charts' at the R/RMETRICS conference 2010
7 | o Henrik Bengtsson for providing the 'R.rsp: R Server Pages'
8 | package and his reviews and comments
9 | o Duncan Temple Lang for providing the 'RJSONIO' package
10 | o Deepayan Sarkar for showing us in the lattice package how to deal
11 | with lists of options
12 | o Paul Cleary for a bug report on the handling of months:
13 | Google date objects expect the months Jan.- Dec. as 0 - 11 and
14 | not 1 - 12.
15 | o Ben Bolker for comments on plot.gvis and the usage of temporary
16 | files
17 | o John Verzani for pointing out how to use the R http help server
18 | o Cornelius Puschmann and Jeffrey Breen for highlighting a
19 | dependency issue with RJONSIO version 0.7-1
20 | o Manoj Ananthapadmanabhan and Anand Ramalingam for providing
21 | ideas and code to animate a Google Geo Map
22 | o Rahul Premraj for pointing out a rounding issue with Google Maps
23 | o Mike Silberbauer for an example showing how to shade the
24 | areas in annotated time line charts
25 | o Tony Breyal for providing instructions on changing the Flash
26 | security settings to display Flash charts locally
27 | o Alexander Holcroft for reporting a bug in gvisMotionChart
28 | when displaying data with special characters in column names
29 | o Pat Burns for pointing out typos in the vignette
30 | o Jason Pickering for providing a patch to allow for quarterly
31 | and weekly time dimensions to be displayed with gvisMotionChart
32 | o Oliver Jay and Wai Tung Ho for reporting an issue with one-row
33 | data sets
34 | o Erik Bülow for pointing out how to load the Google API via a
35 | secure connection
36 | o Sebastian Kranz for comments to enhance the argument list for
37 | gvisMotionChart to make it more user friendly
38 | o Sebastian Kranz and Wei Luo for providing ideas and code to
39 | improve the transformation of R data frames into JSON code
40 | o Sebastian Kranz for reporting a bug in version 0.3.0
41 | o Leonardo Trabuco for helping to clarify the usage of the
42 | argument state in the help file of gvisMotionChart
43 | o Mark Melling for reporting an issue with jsDisplayChart and
44 | providing a solution
45 | o Joe Cheng for code contribution to make googleVis work with shiny
46 | o John Maindonald for reporting that the WorldBank demo didn't
47 | download all data, but only the first 12000 records.
48 | o Sebastian Campbell for reporting a typo in the Andrew and Stock
49 | data set and pointing out that the core charts, such as line
50 | charts accept also date variables for the x-axis.
51 | o John Maindonald for providing a simplified version of the
52 | WorldBank demo using the WDI package.
53 | o John Muschelli for suggesting to add hovervar as an additional
54 | argument to gvisGeoChart.
55 | o Jacqueline Buros for providing code to include formats parameter
56 | to gvisTable()
57 | o JJ Allaire for pointing out how to use the viewer pane in RStudio
58 | o Oliver Gjoneski and Ashton Trey Belew for patches on roles and
59 | tooltips
60 | o Yihui Xie for pointing out formatting issues of the markdown
61 | vignettes
62 | o John Taveras for reporting in gvisCheckCoreChartData
63 | o Paul Murrell for reporting an issue with setting width and height of
64 | googleVis charts
65 | o Kurt Hornik for pointing out issues with README.md
66 | o stanstrup for reporting an issue with gvisCoreChart
67 | o Jason Miller for highlighting that the column "% of World
68 | Population" in sample data set "Population" needed to be
69 | devided by 100
70 | o Juuso Parkkinen for reporting a bug in gvisMotionChart
71 | o Nick Salkowski for suggestions to improve the documentation
72 | o Kurt Hornik for informing of CRAN and R changes
73 | o Sarang Brahme for comments on the documentation of gvisIntensityMap
74 | o Carsten Langer for reporting an issue with ordered factors
75 | o Ashley Baldry for contributing the code for the gvisWordTree function
76 | o Durey Ingeniería for contributing code to allow custom HTML tooltips in gvisGeoCharts
77 |
--------------------------------------------------------------------------------
/_pkgdown.yml:
--------------------------------------------------------------------------------
1 | url: https://mages.github.io/googleVis/
2 | template:
3 | bootstrap: 5
4 |
5 | navbar:
6 | structure:
7 | left: [articles, reference, news]
8 | right: [search, github]
9 |
--------------------------------------------------------------------------------
/data/Andrew.RData:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mages/googleVis/00b6a2be6c12082d6cba1e95203e1e17f1bf27c2/data/Andrew.RData
--------------------------------------------------------------------------------
/data/Cairo.RData:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mages/googleVis/00b6a2be6c12082d6cba1e95203e1e17f1bf27c2/data/Cairo.RData
--------------------------------------------------------------------------------
/data/Cats.RData:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mages/googleVis/00b6a2be6c12082d6cba1e95203e1e17f1bf27c2/data/Cats.RData
--------------------------------------------------------------------------------
/data/CityPopularity.RData:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mages/googleVis/00b6a2be6c12082d6cba1e95203e1e17f1bf27c2/data/CityPopularity.RData
--------------------------------------------------------------------------------
/data/Exports.RData:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mages/googleVis/00b6a2be6c12082d6cba1e95203e1e17f1bf27c2/data/Exports.RData
--------------------------------------------------------------------------------
/data/Fruits.RData:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mages/googleVis/00b6a2be6c12082d6cba1e95203e1e17f1bf27c2/data/Fruits.RData
--------------------------------------------------------------------------------
/data/OpenClose.RData:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mages/googleVis/00b6a2be6c12082d6cba1e95203e1e17f1bf27c2/data/OpenClose.RData
--------------------------------------------------------------------------------
/data/Population.RData:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mages/googleVis/00b6a2be6c12082d6cba1e95203e1e17f1bf27c2/data/Population.RData
--------------------------------------------------------------------------------
/data/Regions.RData:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mages/googleVis/00b6a2be6c12082d6cba1e95203e1e17f1bf27c2/data/Regions.RData
--------------------------------------------------------------------------------
/data/Stock.RData:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mages/googleVis/00b6a2be6c12082d6cba1e95203e1e17f1bf27c2/data/Stock.RData
--------------------------------------------------------------------------------
/data/dino.RData:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mages/googleVis/00b6a2be6c12082d6cba1e95203e1e17f1bf27c2/data/dino.RData
--------------------------------------------------------------------------------
/demo/00Index:
--------------------------------------------------------------------------------
1 | googleVis Examples of various googleVis functions and plots
2 | EventListener Examples of basic JavaScript event handlers
3 | Trendlines Adding trendlines to Scatter Charts, Bar Charts, Column Charts, and Line Charts
4 | Roles Concept and use of roles with googleVis
5 |
--------------------------------------------------------------------------------
/demo/EventListener.R:
--------------------------------------------------------------------------------
1 | ## The parameter gvis.listener.jscode embeds code inside
2 | ## a select event listener.
3 | ## It is possible to add javascript code and access the build in
4 | ## method getSelection().
5 | ##
6 | ## The following code shows two examples:
7 |
8 | jscode <- "window.open('https://en.wikipedia.org/wiki/'+data.getValue(chart.getSelection()[0].row,0)); "
9 | J1 <- gvisGeoMap(Exports, locationvar='Country', numvar='Profit',
10 | options=list(dataMode="regions",gvis.listener.jscode=jscode))
11 |
12 | plot(J1)
13 | ## Similarly the code can also be used for other charts, e.g. org chart and line chart
14 |
15 | plot(gvisOrgChart(Regions, options=list(gvis.listener.jscode=jscode)))
16 |
17 | plot(gvisLineChart(Regions[,c(1,3)], options=list(gvis.listener.jscode=jscode)))
18 |
19 |
20 | jscode <- "
21 | var sel = chart.getSelection();
22 | var row = sel[0].row;
23 | var text = data.getValue(row,1);
24 | alert(text);
25 | "
26 |
27 | J2 <- gvisTable(Population,options=list(gvis.listener.jscode=jscode))
28 |
29 | plot(J2)
30 |
31 | ## For more details see
32 | ## https://developers.google.com/chart/interactive/docs/reference?csw=1#addlistener
33 |
34 | ## See demo(package='googleVis') for other available demos.
35 |
--------------------------------------------------------------------------------
/demo/Roles.R:
--------------------------------------------------------------------------------
1 | # Add the ability to pass columns roles for further
2 | # processing downstream
3 | #
4 | # Thanks to Oliver Gjoneski
5 | #
6 | # Role columns must follow column they pertain to. Proper naming
7 | # conventions must be be observed. For example, roles fulfilling tooltip
8 | # roles and must be called "foo.blah.tooltip".
9 | #
10 | # For more details see:
11 | # https://developers.google.com/chart/interactive/docs/roles
12 |
13 | ## ---- Tooltip ----
14 | df <- data.frame(year=1:11,pop=1:11,
15 | pop.html.tooltip=letters[1:11])
16 | plot(
17 | gvisScatterChart(df)
18 | )
19 |
20 | ## ---- TooltipHTML ----
21 | levels(df$pop.html.tooltip)[1] <-
22 | '
'
23 | plot(
24 | gvisScatterChart(df,
25 | options=list(tooltip="{isHtml:'true'}"))
26 | )
27 |
28 | ## ---- CertaintyScopeEmphasis ----
29 | df <- data.frame(year=1:11, x=1:11,
30 | x.scope=c(rep(TRUE, 8), rep(FALSE, 3)),
31 | y=11:1, y.html.tooltip=LETTERS[11:1],
32 | y.certainty=c(rep(TRUE, 5), rep(FALSE, 6)),
33 | y.emphasis=c(rep(FALSE, 4), rep(TRUE, 7)))
34 | plot(
35 | gvisScatterChart(df,options=list(lineWidth=2))
36 | )
37 |
38 | ## ---- ColumnChart ----
39 | dat <- data.frame(Year=2010:2013,
40 | Sales=c(600, 1500, 800, 1000),
41 | Sales.html.tooltip=c('$600K in our first year!',
42 | 'Sunspot activity made this our best year ever!',
43 | '$800K in 2012.',
44 | '$1M in sales last year.'),
45 | Sales.certainty=c(TRUE, FALSE, TRUE, FALSE))
46 | plot(
47 | gvisColumnChart(dat, xvar='Year',
48 | yvar=c('Sales', 'Sales.certainty')
49 | )
50 | )
51 |
52 | ## ---- Interval ----
53 | df <- data.frame(Year=2013:2014, Sales=c(120, 130),
54 | Sales.interval.1=c(100,110),
55 | Sales.interval.2=c(140, 150),
56 | Sales.interval.3=c(90, 100),
57 | Sales.interval.4=c(150, 170),
58 | Sales.style=c('red', 'gold'),
59 | Sales.annotation=c("North", "South"),
60 | check.names=FALSE)
61 |
62 | plot(
63 | gvisBarChart(df, xvar='Year',
64 | yvar=c('Sales',
65 | 'Sales.interval.1',
66 | 'Sales.interval.2',
67 | 'Sales.style',
68 | 'Sales.annotation')
69 | )
70 | )
71 |
72 | plot(
73 | gvisLineChart(df, xvar='Year',
74 | yvar=c('Sales',
75 | 'Sales.interval.1',
76 | 'Sales.interval.2'),
77 | options=list(series="[{color:'purple'}]")
78 | )
79 | )
80 |
81 |
82 | plot(
83 | gvisLineChart(df, xvar='Year',
84 | yvar=c('Sales',
85 | 'Sales.interval.1',
86 | 'Sales.interval.2',
87 | 'Sales.interval.3',
88 | 'Sales.interval.4'),
89 | options=list(series="[{color:'purple'}]",
90 | lineWidth=4,
91 | interval="{
92 | 'i1': { 'style':'line', 'color':'#D3362D', 'lineWidth': 0.5 },
93 | 'i2': { 'style':'line', 'color':'#F1CA3A', 'lineWidth': 1 },
94 | 'i3': { 'style':'line', 'color':'#5F9654', 'lineWidth': 2 },
95 | 'i4': { 'style':'line', 'color':'#5F9654', 'lineWidth': 3 }
96 | }")
97 | )
98 | )
99 |
100 |
101 | plot(
102 | gvisLineChart(df, xvar='Year',
103 | yvar=c('Sales',
104 | 'Sales.interval.1',
105 | 'Sales.interval.2',
106 | 'Sales.interval.3',
107 | 'Sales.interval.4'),
108 | options=list(series="[{color:'purple'}]",
109 | lineWidth=4,
110 | intervals="{ 'style':'area' }",
111 | interval="{
112 | 'i1': { 'color': '#4374E0', 'style':'bars', 'barWidth':0, 'lineWidth':4, 'pointSize':10, 'fillOpacity':1 },
113 | 'i2': { 'color': '#E49307', 'style':'bars', 'barWidth':0, 'lineWidth':4, 'pointSize':10, 'fillOpacity':1 }}"
114 | )
115 | )
116 | )
117 |
118 |
119 | ## ---- TwoLines ----
120 | df <- data.frame(country=c("US", "GB", "BR"),
121 | val1=c(1,3,4),
122 | val1.emphasis=c(TRUE, TRUE, FALSE),
123 | val2=c(23,12,32))
124 | plot(
125 | gvisLineChart(df, xvar="country",
126 | yvar=c("val1", "val1.emphasis")
127 | )
128 | )
129 |
130 | plot(
131 | gvisLineChart(df, xvar="country",
132 | yvar=c("val1", "val1.emphasis", "val2")
133 | )
134 | )
135 |
136 | ## ---- VerticalReferenceLine ----
137 | dat <- data.frame(Year=2010:2013,
138 | Sales=c(600, 1500, 800, 1000),
139 | Sales.annotation=c('First year', NA, NA, 'Last Year'),
140 | Sales.annotationText=c('$600K in our first year!',
141 | NA,
142 | NA,
143 | '$1M in sales last year.'))
144 |
145 | plot(
146 | gvisLineChart(dat, xvar='Year',
147 | yvar=c('Sales',
148 | 'Sales.annotation',
149 | 'Sales.annotationText'),
150 | options=list(annotations = "{style:'line'}")
151 | )
152 | )
153 |
154 | ## ---- GeoChartTooltip ----
155 | Exports$Profit.tooltip <- paste("Test", Exports$Profit)
156 | Exports$Tooltip.header <- ""
157 | GeoTooltip <- gvisGeoChart(
158 | Exports,
159 | locationvar = "Country",
160 | colorvar = "Profit",
161 | hovervar = "Tooltip.header",
162 | options = list(tooltip = "{isHtml: true}")
163 | )
164 | plot(GeoTooltip)
165 |
--------------------------------------------------------------------------------
/demo/Trendlines.R:
--------------------------------------------------------------------------------
1 | ## Trend line demo
2 | # A trendline is a line superimposed on a chart revealing the overall direction
3 | # of the data. Google Charts can automatically generate trendlines for
4 | # Scatter Charts, Bar Charts, Column Charts, and Line Charts.
5 | #
6 | # Fore more details see:
7 | # https://developers.google.com/chart/interactive/docs/gallery/trendlines
8 |
9 | ## Linear trend line
10 |
11 | ## Add a trend line to the first series
12 | ## ---- LinearTrend ----
13 | plot(
14 | gvisScatterChart(women, options=list(trendlines="0"))
15 | )
16 |
17 | ## ---- ExponentialTrend ----
18 | plot(
19 | gvisScatterChart(women, options=list(
20 | trendlines="{0: { type: 'exponential',
21 | visibleInLegend: 'true',
22 | color: 'green',
23 | lineWidth: 10,
24 | opacity: 0.5}}",
25 | chartArea="{left:50,top:20,width:'50%',height:'75%'}"))
26 | )
27 |
28 | ## ---- ColumnChartWithTrendline ----
29 | dat <- data.frame(val1=c(1,3,4,5,6,8),
30 | val2=c(12,23,32,40,50,55))
31 | plot(
32 | gvisColumnChart(dat,
33 | options=list(trendlines="{0: {}}"))
34 | )
35 |
36 | ## ---- DifferentLabels ----
37 | dat$val3 <- c(5,6,10,12,15,20)
38 | plot(
39 | gvisColumnChart(dat,
40 | options=list(trendlines="{
41 | 0: {
42 | labelInLegend: 'Trendline 1',
43 | visibleInLegend: true,},
44 | 1:{
45 | labelInLegend: 'Trendline 2',
46 | visibleInLegend: true}
47 | }",
48 | chartArea="{left:50,top:20,
49 | width:'50%',height:'75%'}"
50 | ))
51 | )
52 |
53 |
--------------------------------------------------------------------------------
/googleVis.Rproj:
--------------------------------------------------------------------------------
1 | Version: 1.0
2 |
3 | RestoreWorkspace: No
4 | SaveWorkspace: No
5 | AlwaysSaveHistory: Yes
6 |
7 | EnableCodeIndexing: Yes
8 | UseSpacesForTab: Yes
9 | NumSpacesForTab: 2
10 | Encoding: UTF-8
11 |
12 | RnwWeave: Sweave
13 | LaTeX: pdfLaTeX
14 |
15 | BuildType: Package
16 | PackageUseDevtools: Yes
17 | PackageInstallArgs: --no-multiarch --with-keep.source
18 | PackageBuildArgs: --compact-vignettes=both
19 | PackageBuildBinaryArgs: --compact-vignettes=both
20 | PackageCheckArgs: --as-cran
21 | PackageRoxygenize: rd,vignette
22 |
--------------------------------------------------------------------------------
/inst/CITATION:
--------------------------------------------------------------------------------
1 | bibentry(
2 | bibtype = "Article",
3 | header = "To cite googleVis in publications, please use",
4 | textVersion = "Markus Gesmann and Diego de Castillo. Using the Google Visualisation API with R. The R Journal, 3(2):40-44, December 2011.",
5 | title = "googleVis: Interface between R and the Google Visualisation API",
6 | author = "Markus Gesmann and Diego de Castillo",
7 | journal = "The R Journal",
8 | year = "2011",
9 | volume = "3",
10 | number = "2",
11 | pages = "40--44",
12 | month = "December",
13 | url = "https://journal.r-project.org/archive/2011-2/RJournal_2011-2_Gesmann+de~Castillo.pdf"
14 | )
--------------------------------------------------------------------------------
/inst/googleVis_hexagon.R:
--------------------------------------------------------------------------------
1 | library(hexSticker)
2 | library(ggplot2)
3 | N <- 50
4 | set.seed(121)
5 | DF <- data.frame(x=runif(N)*0.9, y=runif(N)*0.9,
6 | z = sample(1:4, N, replace = TRUE),
7 | w = sample(1:5, N, replace = TRUE))
8 | p <- ggplot(DF, aes(x=x, y=y, color = factor(z))) +
9 | geom_point(pch = c("G", "o", "o", "g", "l", "e")[DF$w], cex=10)
10 | p <- p + labs(y="", x="") +
11 | xlim(0,1) + ylim(0,1) +
12 | scale_color_manual(values = c("#3cba54", "#db3236", "#f4c20d", "#4885ed")) +
13 | theme_void() + theme_transparent() +
14 | theme(legend.position = 'none')
15 | p
16 | sticker(p, package="googleVis", p_size=20, s_x=1, s_y=.75, s_width=1, s_height=0.91,
17 | h_fill="white", h_color="#4885ed", p_color = "#db3236",
18 | filename="man/figures/logo.png")
19 |
--------------------------------------------------------------------------------
/inst/mansections/GoogleChartToolsURL.txt:
--------------------------------------------------------------------------------
1 | \url{https://developers.google.com/chart/interactive/docs/gallery/CHARTNAME}
2 |
3 |
--------------------------------------------------------------------------------
/inst/mansections/GoogleChartToolsURLConfigOptions.txt:
--------------------------------------------------------------------------------
1 | \url{https://developers.google.com/chart/interactive/docs/gallery/CHARTNAME#Configuration_Options}
2 |
3 |
--------------------------------------------------------------------------------
/inst/mansections/gvisOptions.txt:
--------------------------------------------------------------------------------
1 | The parameters can be set via a named list. The parameters have to map those
2 | of the Google documentation.
3 | \itemize{
4 | \item{Boolean arguments are set to
5 | either \code{TRUE} or \code{FALSE}, using the R syntax.
6 | }
7 | \item{Google API parameters with a single value and with names that don't
8 | include a "." are set like one would do in R, that is
9 | \code{options=list(width=200, height=300)}.
10 | Exceptions to this rule are the width and height options for
11 | \code{\link{gvisAnnotatedTimeLine}} and \code{\link{gvisAnnotationChart}}.
12 | For those two functions, width and height must be character strings of the
13 | format \code{"Xpx"}, where \code{X} is a number, or \code{"automatic"}.
14 | For example,
15 | \code{options=list(width="200px", height="300px")}.
16 | }
17 | \item{Google API parameters with names that don't include a ".", but require
18 | multivalues are set as a character, wrapped in "[ ]" and separated by commas,
19 | e.g.
20 |
21 | \code{options=list(colors="['#cbb69d', '#603913', '#c69c6e']")}
22 | }
23 | \item{Google API parameters with names that do include a "." present parameters with
24 | several sub-options and have to be set as a character wrapped in "\{ \}".
25 | The values of those sub-options are set via parameter:value. Boolean values
26 | have to be stated as \code{'true'} or \code{'false'}.
27 | For example the Google documentaion states the formating options for the
28 | vertical axis and states the parameter as \code{vAxis.format}.
29 | Then this paramter can be set in R as:
30 |
31 | \code{options=list(vAxis="\{format:'#,###\%'\}")}.
32 | }
33 | \item{If several sub-options have to be set, e.g.
34 |
35 | \code{titleTextStyle.color}, \code{titleTextStyle.fontName} and
36 | \code{titleTextStyle.fontSize}, then those can be combined in one list item
37 | such as:
38 |
39 | \code{options=list(titleTextStyle="\{color:'red', fontName:'Courier', fontSize:16\}")}
40 | }
41 | \item{parameters that can have more than one value per sub-options are
42 | wrapped in "[ ]". For example to set the labels for left and right axes use:
43 |
44 | \code{options=list(vAxes="[\{title:'val1'\}, \{title:'val2'\}]")}
45 | }
46 | \item{\code{gvis.editor} a character label for an
47 | on-page button that opens an in-page dialog box enabling
48 | users to edit, change and customise the chart. By default no
49 | value is given and therefore no button is displayed.
50 | }
51 | }
52 | For more details see the Google API documentation and the R examples below.
53 |
--------------------------------------------------------------------------------
/inst/mansections/gvisOutputStructure.txt:
--------------------------------------------------------------------------------
1 | "\code{gvis}" and "\code{list}".
2 | An object of class "\code{gvis}" is a list containing at least the
3 | following components:
4 | \describe{
5 | \item{\code{type}}{Google visualisation type}
6 | \item{\code{chartid}}{character id of the chart object. Unique chart
7 | ids are required to place several charts on the same page.
8 | }
9 | \item{\code{html}}{a list with the building blocks for a page
10 | \describe{
11 | \item{\code{header}}{a character string of a html page header:
12 | \code{...
},}
13 | \item{\code{chart}}{a named character vector of the chart's building blocks:
14 | \describe{
15 | \item{\code{jsHeader}}{Opening \code{}.
28 | }
29 | \item{\code{jsChart}}{Call of the \code{jsDisplayChart} function.
30 | }
31 | \item{\code{divChart}}{\code{} container to embed the chart
32 | into the page.
33 | }
34 | }
35 | }
36 | \item{\code{caption}}{character string of a standard caption,
37 | including data name and chart id.
38 | }
39 | \item{\code{footer}}{character string of a html page footer:
40 | \code{...}, including the used R and googleVis version
41 | and link to Google's Terms of Use.}
42 | }}
43 | }
44 |
--------------------------------------------------------------------------------
/inst/shiny/server.R:
--------------------------------------------------------------------------------
1 | library(googleVis)
2 |
3 | shinyServer(function(input, output) {
4 | datasetInput <- reactive({
5 | switch(input$dataset,
6 | "rock" = rock,
7 | "pressure" = pressure,
8 | "cars" = cars)
9 | })
10 |
11 | output$view <- renderGvis({
12 | gvisScatterChart(datasetInput(),
13 | options=list(title=paste('Data:',input$dataset)))
14 | })
15 | })
--------------------------------------------------------------------------------
/inst/shiny/ui.R:
--------------------------------------------------------------------------------
1 | shinyUI(pageWithSidebar(
2 | headerPanel("googleVis on Shiny"),
3 | sidebarPanel(
4 | selectInput("dataset", "Choose a dataset:",
5 | choices = c("rock", "pressure", "cars"))
6 | ),
7 | mainPanel(
8 | htmlOutput("view")
9 | )
10 | ))
--------------------------------------------------------------------------------
/man/Andrew.Rd:
--------------------------------------------------------------------------------
1 | \name{Andrew}
2 | \alias{Andrew}
3 | \docType{data}
4 | \title{
5 | Hurricane Andrew: googleVis example data set
6 | }
7 | \description{
8 | Hurricane Andrew storm path from 16 August to 28 August 1992
9 | }
10 | \usage{data(Andrew)}
11 | \format{
12 | A data frame with 47 observations on the following 8 variables.
13 | \describe{
14 | \item{\code{Date/Time UTC}}{a POSIXct}
15 | \item{\code{Lat}}{a numeric vector}
16 | \item{\code{Long}}{a numeric vector}
17 | \item{\code{Pressure_mb}}{a numeric vector}
18 | \item{\code{Speed_kt}}{a numeric vector}
19 | \item{\code{Category}}{a factor with levels \code{Hurricane} \code{Tropical Depression} \code{Tropical Storm}}
20 | \item{\code{LatLong}}{a character vector}
21 | \item{\code{Tip}}{a character vector}
22 | }
23 | }
24 | %%\details{
25 | %% ~~ If necessary, more details than the __description__ above ~~
26 | %%}
27 | \source{
28 | National Hurricane Center: \url{https://www.nhc.noaa.gov/1992andrew.html}
29 | }
30 | %%\references{
31 | %% ~~ possibly secondary sources and usages ~~
32 | %%}
33 | \examples{
34 | data(Andrew)
35 |
36 | AndrewGeoMap <- gvisGeoMap(Andrew, locationvar='LatLong', numvar='Speed_kt',
37 | hovervar='Category',
38 | options=list(width=800,height=400,
39 | region='US', dataMode='Markers'))
40 |
41 | AndrewMap <- gvisMap(Andrew, 'LatLong' , 'Tip',
42 | options=list(showTip=TRUE, showLine=TRUE,
43 | enableScrollWheel=TRUE,
44 | mapType='hybrid', useMapTypeControl=TRUE,
45 | width=800,height=400))
46 |
47 | AndrewTable <- gvisTable(Andrew,options=list(width=800))
48 |
49 | ## Combine the outputs into one page:
50 |
51 | AndrewVis <- gvisMerge(AndrewGeoMap, AndrewMap)
52 |
53 | plot(AndrewVis)
54 |
55 | }
56 | \keyword{datasets}
57 |
--------------------------------------------------------------------------------
/man/Cairo.Rd:
--------------------------------------------------------------------------------
1 | \name{Cairo}
2 | \alias{Cairo}
3 | \docType{data}
4 | \title{
5 | Daily temperature data for Cairo
6 | }
7 | \description{
8 | The average air temperature (C) in Cairo from 2002 to 2004.
9 | }
10 | \usage{data(Cairo)}
11 | \format{
12 | A data frame with 1091 observations on the following 2 variables.
13 | \describe{
14 | \item{\code{Date}}{calendar date}
15 | \item{\code{Temp}}{average temperatur in Celsius}
16 | }
17 | }
18 | %\details{
19 | %}
20 | \references{
21 | Wood, S.N. (2006) Generalized Additive Models: An Introduction with R
22 | }
23 | \examples{
24 | data(Cairo)
25 | plot(gvisCalendar(Cairo))
26 | }
27 | \keyword{datasets}
28 |
--------------------------------------------------------------------------------
/man/Cats.Rd:
--------------------------------------------------------------------------------
1 | \name{Cats}
2 | \alias{Cats}
3 | \docType{data}
4 | \title{
5 | Cat Search Terms
6 | }
7 | \description{
8 | A set of responses for search terms for cats
9 | }
10 | \usage{data(Cats)}
11 | \format{
12 | A data frame with 18 observations on the following 3 variables.
13 | \describe{
14 | \item{\code{Phrase}}{Search term for cats}
15 | \item{\code{Size}}{Number of times term has been searched}
16 | \item{\code{Sentiment}}{Numeric value from 0-10 of sentiment of term}
17 | }
18 | }
19 | %\details{
20 | %}
21 | \examples{
22 | data(Cats)
23 | plot(gvisWordTree(Cats, textvar = "Phrase"))
24 | }
25 | \keyword{datasets}
26 |
--------------------------------------------------------------------------------
/man/CityPopularity.Rd:
--------------------------------------------------------------------------------
1 | \name{CityPopularity}
2 | \alias{CityPopularity}
3 | \docType{data}
4 | \title{
5 | CityPopularity: googleVis example data set
6 | }
7 | \description{
8 | Example data set to illustrate the use of the googleVis package.
9 | }
10 | \usage{data(CityPopularity)}
11 | \format{
12 | A data frame with 6 observations on the following 2 variables.
13 | \describe{
14 | \item{\code{City}}{a factor with levels \code{Boston} \code{Chicago} \code{Houston} \code{Los Angeles} \code{Miami} \code{New York}}
15 | \item{\code{Popularity}}{a numeric vector}
16 | }
17 | }
18 | %%\details{
19 | %% ~~ If necessary, more details than the __description__ above ~~
20 | %%}
21 | \source{
22 | Google Geo Map API: \url{https://developers.google.com/chart/interactive/docs/gallery/geomap.html}
23 | }
24 | %%\references{
25 | %% ~~ possibly secondary sources and usages ~~
26 | %}
27 | \examples{
28 | data(CityPopularity)
29 | str(CityPopularity)
30 | }
31 | \keyword{datasets}
32 |
--------------------------------------------------------------------------------
/man/Exports.Rd:
--------------------------------------------------------------------------------
1 | \name{Exports}
2 | \alias{Exports}
3 | \docType{data}
4 | \title{
5 | Exports: googleVis example data set
6 | }
7 | \description{
8 | Example data set to illustrate the use of the googleVis package.
9 | }
10 | \usage{data(Exports)}
11 | \format{
12 | A data frame with 10 observations on the following 3 variables.
13 | \describe{
14 | \item{\code{Country}}{a factor with levels \code{Brazil}, \code{Germany} ...}
15 | \item{\code{Profit}}{a numeric vector}
16 | \item{\code{Online}}{a logical vector}
17 | }
18 | }
19 | \examples{
20 | data(Exports)
21 | str(Exports)
22 | }
23 | \keyword{datasets}
24 |
--------------------------------------------------------------------------------
/man/Fruits.Rd:
--------------------------------------------------------------------------------
1 | \name{Fruits}
2 | \alias{Fruits}
3 | \docType{data}
4 | \title{
5 | Fruits: googleVis example data set
6 | }
7 | \description{
8 | Example data set to illustrate the use of the googleVis package.
9 | }
10 | \usage{data(Fruits)}
11 | \format{
12 | A data frame with 9 observations on the following 7 variables.
13 | \describe{
14 | \item{\code{Fruit}}{a factor with levels \code{Apples} \code{Bananas} \code{Oranges}}
15 | \item{\code{Year}}{a numeric vector}
16 | \item{\code{Location}}{a factor with levels \code{East} \code{West}}
17 | \item{\code{Sales}}{a numeric vector}
18 | \item{\code{Expenses}}{a numeric vector}
19 | \item{\code{Profit}}{a numeric vector}
20 | \item{\code{Date}}{a Date}
21 | }
22 | }
23 | \examples{
24 | data(Fruits)
25 | M <- gvisMotionChart(Fruits, idvar="Fruit", timevar="Year")
26 |
27 | \dontrun{
28 | plot(M)
29 | }
30 | }
31 | \keyword{datasets}
32 |
--------------------------------------------------------------------------------
/man/OpenClose.Rd:
--------------------------------------------------------------------------------
1 | \name{OpenClose}
2 | \alias{OpenClose}
3 | \docType{data}
4 | \title{
5 | OpenClose: googleVis example data set
6 | }
7 | \description{
8 | Example data set to illustrate the use of the googleVis package.
9 | }
10 | \usage{data(OpenClose)}
11 | \format{
12 | A data frame with 5 observations on the following 5 variables.
13 | \describe{
14 | \item{\code{Weekday}}{a factor with levels \code{Fri} \code{Mon} \code{Thurs} \code{Tues} \code{Wed}}
15 | \item{\code{Low}}{a numeric vector}
16 | \item{\code{Open}}{a numeric vector}
17 | \item{\code{Close}}{a numeric vector}
18 | \item{\code{High}}{a numeric vector}
19 | }
20 | }
21 | %\details{
22 | %% ~~ If necessary, more details than the __description__ above ~~
23 | %%}
24 | \source{
25 | Google Visualisation: Candlestick Chart
26 | \url{https://developers.google.com/chart/interactive/docs/gallery/candlestickchart?csw=1}
27 | }
28 | %%\references{
29 | %% ~~ possibly secondary sources and usages ~~
30 | %%}
31 | \examples{
32 | OpenClose
33 | plot(gvisCandlestickChart(OpenClose, options=list(legend='none')))
34 | }
35 | \keyword{datasets}
36 |
--------------------------------------------------------------------------------
/man/Population.Rd:
--------------------------------------------------------------------------------
1 | \name{Population}
2 | \alias{Population}
3 | \docType{data}
4 | \title{
5 | Population: googleVis example data set
6 | }
7 | \description{
8 | Example data set to illustrate the use of the googleVis package.
9 | }
10 | \usage{data(Population)}
11 | \format{
12 | A data frame with 195 observations on the following 7 variables.
13 | \describe{
14 | \item{\code{Rank}}{a numeric vector with population ranking}
15 | \item{\code{Country}}{country name as character}
16 | \item{\code{Population}}{population}
17 | \item{\code{\% of World Population}}{\% of world population}
18 | \item{\code{Flag}}{html image-tag to wikipedia with country flag}
19 | \item{\code{Mode}}{logical test vector}
20 | \item{\code{Date}}{date test vector}
21 | }
22 | }
23 | \source{
24 | Sourced from Wikipedia (columns 1 to 5):
25 | \url{https://en.wikipedia.org/wiki/List_of_countries_by_population},
26 | 9 October 2010.
27 | }
28 | \examples{
29 | data(Population)
30 | tbl <- gvisTable(Population)
31 |
32 | \dontrun{
33 | plot(tbl)
34 | }
35 | }
36 | \keyword{datasets}
37 |
--------------------------------------------------------------------------------
/man/Regions.Rd:
--------------------------------------------------------------------------------
1 | \name{Regions}
2 | \alias{Regions}
3 | \docType{data}
4 | \title{
5 | Regions: googleVis example data set
6 | }
7 | \description{
8 | Example data set to illustrate the use of the googleVis package.
9 | }
10 | \usage{data(Regions)}
11 | \format{
12 | A data frame with 11 observations on the following 4 variables.
13 | \describe{
14 | \item{\code{Region}}{a factor with levels \code{America}, \code{Asia} ...}
15 | \item{\code{Parent}}{parent region identifier}
16 | \item{\code{Val}}{a numeric vector}
17 | \item{\code{Fac}}{a numeric vector}
18 | }
19 | }
20 | \examples{
21 | data(Regions)
22 | Tree <- gvisTreeMap(Regions, "Region", "Parent", "Val", "Fac",
23 | options=list(width=600, height=500,
24 | showScale=TRUE, fontSize=16))
25 | \dontrun{
26 | plot(Tree)
27 | }
28 | }
29 | \keyword{datasets}
30 |
--------------------------------------------------------------------------------
/man/Stock.Rd:
--------------------------------------------------------------------------------
1 | \name{Stock}
2 | \alias{Stock}
3 | \docType{data}
4 | \title{
5 | Stock: googleVis example data set
6 | }
7 | \description{
8 | Example data set to illustrate the use of the googleVis package.
9 | }
10 | \usage{data(Stock)}
11 | \format{
12 | A data frame with 12 observations on the following 5 variables.
13 | \describe{
14 | \item{\code{Date}}{a Date}
15 | \item{\code{Device}}{a character vector}
16 | \item{\code{Value}}{a numeric vector}
17 | \item{\code{Title}}{a factor with levels \code{Bought pencils} \code{Out of stock}}
18 | \item{\code{Annotation}}{a factor with levels \code{Bought 200k pencils} \code{Ran of stock on pens at 4pm}}
19 | }
20 | }
21 | %%\details{
22 | %% ~~ If necessary, more details than the __description__ above ~~
23 | %%}
24 | \source{
25 | Google Annotated Time Line API:
26 | \url{https://developers.google.com/chart/interactive/docs/gallery/annotatedtimeline.html}
27 | }
28 | %%\references{
29 | %% ~~ possibly secondary sources and usages ~~
30 | %%}
31 | \examples{
32 | ## Create data as used by Google in their annotated time line example
33 |
34 | Date <- as.Date(paste("2008-1-", 1:6, sep=""))
35 | Pencils <- c(3000, 14045, 5502, 75284, 41476, 333222)
36 | Pencils.titles <-c(rep(NA,4), 'Bought pencils', NA)
37 | Pencils.annotation <-c(rep(NA,4), 'Bought 200k pencils', NA)
38 | Pens <- c(40645, 20374, 50766, 14334, 66467, 39463)
39 | Pens.titles <- c(rep(NA, 3), 'Out of stock', NA, NA)
40 | Pens.annotation <- c(rep(NA, 3), 'Ran of out stock of pens at 4pm', NA, NA)
41 |
42 | original.df=data.frame(Date, Pencils, Pencils.titles,
43 | Pencils.annotation, Pens, Pens.titles,
44 | Pens.annotation)
45 |
46 |
47 | Stock <- reshape(original.df, idvar="Date", times=c("Pencils", "Pens"),
48 | timevar="Device",
49 | varying=list(c("Pencils", "Pens"),
50 | c("Pencils.titles", "Pens.titles"),
51 | c("Pencils.annotation", "Pens.annotation")),
52 | v.names=c("Value", "Title", "Annotation"),
53 | direction="long")
54 |
55 | }
56 | \keyword{datasets}
57 |
--------------------------------------------------------------------------------
/man/createGoogleGadget.Rd:
--------------------------------------------------------------------------------
1 | \name{createGoogleGadget}
2 | \alias{createGoogleGadget}
3 | \title{
4 | Create a Google Gadget
5 | }
6 | \description{
7 | Create a Google Gadget based on a Google Visualisation Object
8 | }
9 | \usage{
10 | createGoogleGadget(gvis)
11 | }
12 | \arguments{
13 | \item{gvis}{an object of class 'gvis', e.g. output of a googleVis visualisation functions.
14 | }
15 | }
16 | %\details{
17 | %% ~~ If necessary, more details than the description above ~~
18 | %}
19 | \value{
20 | createGoogleGadget returns a Google Gadget XML string.
21 | }
22 | \author{
23 | Markus Gesmann
24 | }
25 | \note{
26 | Google Gadgets can be embedded in various Google products, for example
27 | as part of a Google Code wiki page, Blogger or Google Sites.
28 | In all cases the XML gadget file has to be hosted online, e.g. using Google Docs.
29 |
30 | In Blogger the gadgets can be embedded via the design tab, and in a Google Sites via
31 | the menu "Insert" -> "More gadgets ..." -> "Add gadget ULR".
32 |
33 | In a Google Code wiki the gadget can be embedded via
34 |
35 | \code{
}
36 |
37 | }
38 |
39 |
40 | \seealso{
41 | See also as \code{\link{print.gvis}}, \code{\link{cat}}
42 | }
43 | \examples{
44 | M <- gvisMotionChart(Fruits, idvar="Fruit", timevar="Year")
45 | gdgt <- createGoogleGadget(M)
46 | cat(gdgt)
47 | }
48 | \keyword{ intreface }
49 |
--------------------------------------------------------------------------------
/man/dino.Rd:
--------------------------------------------------------------------------------
1 | \name{dino}
2 | \alias{dino}
3 | \docType{data}
4 | \title{
5 | Dinosaur data
6 | }
7 | \description{
8 | Lenght of dinosaurs
9 | }
10 | \usage{data(dino)}
11 | \format{
12 | A data frame with 28 observations on 2 variables, dinosaur and length.
13 | }
14 | %\details{
15 | %% ~~ If necessary, more details than the __description__ above ~~
16 | %}
17 | \source{
18 | \url{https://developers.google.com/chart/interactive/docs/gallery/histogram}
19 | }
20 | %\references{
21 | %% ~~ possibly secondary sources and usages ~~
22 | %}
23 | \examples{
24 | data(dino)
25 | str(dino)
26 | }
27 | \keyword{datasets}
28 |
--------------------------------------------------------------------------------
/man/figures/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mages/googleVis/00b6a2be6c12082d6cba1e95203e1e17f1bf27c2/man/figures/logo.png
--------------------------------------------------------------------------------
/man/googleVis-package.Rd:
--------------------------------------------------------------------------------
1 | \name{googleVis-package}
2 | \alias{googleVis-package}
3 | \alias{googleVis}
4 | \docType{package}
5 | \title{
6 | R Interface to Google Charts
7 | }
8 | \description{
9 | R interface to Google Charts API, allowing users
10 | to create interactive charts based on data frames. Charts
11 | are displayed locally via the R HTTP help server. A modern
12 | browser with Internet connection is required and for some
13 | charts Flash. The data remains local and is not uploaded to
14 | Google.
15 |
16 | Please visit the project web site for more information:
17 | \url{https://github.com/mages/googleVis}.
18 |
19 | You find further notes on Markus' blog:
20 | \url{https://magesblog.com/tags/googlevis/}
21 | }
22 | %\details{
23 | % }
24 | \author{
25 | Markus Gesmann, Diego de Castillo
26 | }
27 | \note{
28 | See \code{vignette("googleVis")} for an introduction to the
29 | \code{googleVis} package.
30 | }
31 | \references{
32 | \itemize{
33 | \item Google Charts API: \url{https://developers.google.com/chart/}
34 | \item Google Terms of Use: \url{https://developers.google.com/terms/}
35 | \item Google Maps API Terms of Service: \url{https://cloud.google.com/maps-platform/terms/}
36 | }
37 | }
38 | \examples{
39 | \dontrun{
40 | demo(googleVis)
41 | ## For other demos see
42 | demo(package='googleVis')
43 | }
44 | }
45 | \keyword{ package }
46 |
--------------------------------------------------------------------------------
/man/gvisAnnotatedTimeLine.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gvisAnnotatedTimeLine.R
3 | \name{gvisAnnotatedTimeLine}
4 | \alias{gvisAnnotatedTimeLine}
5 | \title{Google Annotated Time Line with R
6 | \Sexpr{googleChartName <- "annotatedtimeline"}
7 | \Sexpr{gvisChartName <- "gvisAnnotatedTimeLine"}}
8 | \usage{
9 | gvisAnnotatedTimeLine(
10 | data,
11 | datevar = "",
12 | numvar = "",
13 | idvar = "",
14 | titlevar = "",
15 | annotationvar = "",
16 | date.format = "\%Y/\%m/\%d",
17 | options = list(),
18 | chartid
19 | )
20 | }
21 | \arguments{
22 | \item{data}{a \code{data.frame}. The data has to have at least two columns,
23 | one with date information (\code{datevar}) and one numerical variable.}
24 |
25 | \item{datevar}{column name of \code{data} which shows the date dimension.
26 | The information has to be of class \code{\link{Date}} or \code{POSIX*} time
27 | series.}
28 |
29 | \item{numvar}{column name of \code{data} which shows the values to be
30 | displayed against \code{datevar}. The information has to be
31 | \code{\link{numeric}}.}
32 |
33 | \item{idvar}{column name of \code{data} which identifies different groups of
34 | the data. The information has to be of class \code{\link{character}} or
35 | \code{\link{factor}}.}
36 |
37 | \item{titlevar}{column name of \code{data} which shows the title of the
38 | annotations. The information has to be of class \code{\link{character}} or
39 | \code{\link{factor}}. Missing information can be set to \code{NA}. See
40 | section 'Details' for more details.}
41 |
42 | \item{annotationvar}{column name of \code{data} which shows the annotation
43 | text. The information has to be of class \code{\link{character}} or
44 | \code{\link{factor}}. Missing information can be set to \code{NA}. See
45 | section 'Details' for more details.}
46 |
47 | \item{date.format}{if \code{datevar} is of class \code{\link{Date}} then
48 | this argument specifies how the dates are reformatted to be used by
49 | JavaScript.}
50 |
51 | \item{options}{list of configuration options, see:
52 |
53 | % START DYNAMIC CONTENT
54 |
55 | \Sexpr[results=rd]{gsub("CHARTNAME",
56 | googleChartName,
57 | readLines(file.path(".", "inst", "mansections",
58 | "GoogleChartToolsURLConfigOptions.txt")))}
59 |
60 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
61 | "mansections", "gvisOptions.txt")))}}
62 |
63 | \item{chartid}{character. If missing (default) a random chart id will be
64 | generated based on chart type and \code{\link{tempfile}}}
65 | }
66 | \value{
67 | \Sexpr[results=rd]{paste(gvisChartName)} returns list
68 | of \code{\link{class}}
69 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
70 | "mansections", "gvisOutputStructure.txt")))}
71 | }
72 | \description{
73 | The gvisAnnotatedTimeLine function reads a data.frame and creates text
74 | output referring to the Google Visualisation API, which can be included into
75 | a web page, or as a stand-alone page.
76 | }
77 | \details{
78 | An annotated time line is an interactive time series line chart with
79 | optional annotations. The chart is rendered within the browser using Flash.
80 | }
81 | \section{Warnings}{
82 |
83 | AnnotatedTimeline (gvisAnnotatedTimeLine) is no longer supported by Google.
84 | The annotated timeline now automatically uses Annotation Charts instead.
85 |
86 | Important: To use this visualization, you must specify the height and width
87 | of the container element explicitly on your page. So, for example:
88 | options=list(width="600px", height="350px")
89 |
90 | Use \code{\link{gvisAnnotationChart}} for a non-Flash version of this plot.
91 | }
92 |
93 | \examples{
94 |
95 | ## Please note that by default the googleVis plot command
96 | ## will open a browser window and requires Flash and Internet
97 | ## connection to display the visualisation.
98 |
99 |
100 | data(Stock)
101 | Stock
102 | A1 <- gvisAnnotatedTimeLine(Stock, datevar="Date",
103 | numvar="Value", idvar="Device",
104 | titlevar="Title", annotationvar="Annotation",
105 | options=list(displayAnnotations=TRUE,
106 | legendPosition='newRow',
107 | width="600px", height="350px")
108 | )
109 | plot(A1)
110 |
111 | ## Two Y-axis
112 | A2 <- gvisAnnotatedTimeLine(Stock, datevar="Date",
113 | numvar="Value", idvar="Device",
114 | titlevar="Title", annotationvar="Annotation",
115 | options=list(displayAnnotations=TRUE,
116 | width="600px", height="350px", scaleColumns='[0,1]',
117 | scaleType='allmaximized')
118 | )
119 | plot(A2)
120 |
121 |
122 |
123 | ## Colouring the area below the lines to create an area chart
124 | A3 <- gvisAnnotatedTimeLine(Stock, datevar="Date",
125 | numvar="Value", idvar="Device",
126 | titlevar="Title", annotationvar="Annotation",
127 | options=list(
128 | width="600px", height="350px",
129 | fill=10, displayExactValues=TRUE,
130 | colors="['#0000ff','#00ff00']")
131 | )
132 |
133 | plot(A3)
134 |
135 |
136 | ## Data with POSIXct datetime variable
137 | A4 <- gvisAnnotatedTimeLine(Andrew, datevar="Date/Time UTC",
138 | numvar="Pressure_mb",
139 | options=list(scaleType='maximized',
140 | width="600px", height="350px")
141 | )
142 |
143 | plot(A4)
144 |
145 |
146 |
147 | }
148 | \references{
149 | Google Chart Tools API:
150 | \Sexpr[results=rd]{gsub("CHARTNAME",
151 | googleChartName,
152 | readLines(file.path(".", "inst", "mansections",
153 | "GoogleChartToolsURL.txt")))}
154 |
155 | % END DYNAMIC CONTENT
156 | }
157 | \seealso{
158 | See also \code{\link{print.gvis}}, \code{\link{plot.gvis}} for printing and
159 | plotting methods. Further see \code{\link{reshape}} for reshaping data, e.g.
160 | from a wide format into a long format.
161 | }
162 | \author{
163 | Markus Gesmann \email{markus.gesmann@gmail.com},
164 |
165 | Diego de Castillo \email{decastillo@gmail.com}
166 | }
167 | \keyword{iplot}
168 |
--------------------------------------------------------------------------------
/man/gvisAnnotationChart.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gvisAnnotationChart.R
3 | \name{gvisAnnotationChart}
4 | \alias{gvisAnnotationChart}
5 | \title{Google Annotation Chart with R
6 | \Sexpr{googleChartName <- "annotationchart"}
7 | \Sexpr{gvisChartName <- "gvisAnnotationChart"}}
8 | \usage{
9 | gvisAnnotationChart(
10 | data,
11 | datevar = "",
12 | numvar = "",
13 | idvar = "",
14 | titlevar = "",
15 | annotationvar = "",
16 | date.format = "\%Y/\%m/\%d",
17 | options = list(),
18 | chartid
19 | )
20 | }
21 | \arguments{
22 | \item{data}{a \code{data.frame}. The data has to have at least two columns,
23 | one with date information (\code{datevar}) and one numerical variable.}
24 |
25 | \item{datevar}{column name of \code{data} which shows the date dimension.
26 | The information has to be of class \code{\link{Date}} or \code{POSIX*} time
27 | series.}
28 |
29 | \item{numvar}{column name of \code{data} which shows the values to be
30 | displayed against \code{datevar}. The information has to be
31 | \code{\link{numeric}}.}
32 |
33 | \item{idvar}{column name of \code{data} which identifies different groups of
34 | the data. The information has to be of class \code{\link{character}} or
35 | \code{\link{factor}}.}
36 |
37 | \item{titlevar}{column name of \code{data} which shows the title of the
38 | annotations. The information has to be of class \code{\link{character}} or
39 | \code{\link{factor}}. Missing information can be set to \code{NA}. See
40 | section 'Details' for more details.}
41 |
42 | \item{annotationvar}{column name of \code{data} which shows the annotation
43 | text. The information has to be of class \code{\link{character}} or
44 | \code{\link{factor}}. Missing information can be set to \code{NA}. See
45 | section 'Details' for more details.}
46 |
47 | \item{date.format}{if \code{datevar} is of class \code{\link{Date}} then
48 | this argument specifies how the dates are reformatted to be used by
49 | JavaScript.}
50 |
51 | \item{options}{list of configuration options, see:
52 |
53 | % START DYNAMIC CONTENT
54 |
55 | \Sexpr[results=rd]{gsub("CHARTNAME",
56 | googleChartName,
57 | readLines(file.path(".", "inst", "mansections",
58 | "GoogleChartToolsURLConfigOptions.txt")))}
59 |
60 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
61 | "mansections", "gvisOptions.txt")))}}
62 |
63 | \item{chartid}{character. If missing (default) a random chart id will be
64 | generated based on chart type and \code{\link{tempfile}}.}
65 | }
66 | \value{
67 | \Sexpr[results=rd]{paste(gvisChartName)} returns list
68 | of \code{\link{class}}
69 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
70 | "mansections", "gvisOutputStructure.txt")))}
71 | }
72 | \description{
73 | gvisAnnotationChart charts are interactive time series line charts that support
74 | annotations. Unlike the gvisAnnotatedTimeLine, which uses Flash,
75 | annotation charts are SVG/VML and should be preferred whenever possible.
76 | }
77 | \examples{
78 |
79 | ## Please note that by default the googleVis plot command
80 | ## will open a browser window and requires Internet
81 | ## connection to display the visualisation.
82 |
83 |
84 | data(Stock)
85 | Stock
86 | A1 <- gvisAnnotationChart(Stock, datevar="Date",
87 | numvar="Value", idvar="Device",
88 | titlevar="Title", annotationvar="Annotation",
89 | options=list(displayAnnotations=TRUE,
90 | legendPosition='newRow',
91 | width=600, height=350)
92 | )
93 | plot(A1)
94 |
95 | ## Two Y-axis
96 | A2 <- gvisAnnotationChart(Stock, datevar="Date",
97 | numvar="Value", idvar="Device",
98 | titlevar="Title", annotationvar="Annotation",
99 | options=list(displayAnnotations=TRUE,
100 | width=600, height=350, scaleColumns='[0,1]',
101 | scaleType='allmaximized')
102 | )
103 | plot(A2)
104 |
105 |
106 |
107 | ## Colouring the area below the lines to create an area chart
108 | A3 <- gvisAnnotationChart(Stock, datevar="Date",
109 | numvar="Value", idvar="Device",
110 | titlevar="Title", annotationvar="Annotation",
111 | options=list(
112 | width=600, height=350,
113 | fill=10, displayExactValues=TRUE,
114 | colors="['#0000ff','#00ff00']")
115 | )
116 |
117 | plot(A3)
118 |
119 |
120 | ## Data with POSIXct datetime variable
121 | A4 <- gvisAnnotationChart(Andrew, datevar="Date/Time UTC",
122 | numvar="Pressure_mb",
123 | options=list(scaleType='maximized')
124 | )
125 |
126 | plot(A4)
127 |
128 | # Change background to blue
129 | A5 <- gvisAnnotationChart(Stock, datevar="Date",
130 | numvar="Value", idvar="Device",
131 | titlevar="Title", annotationvar="Annotation",
132 | options=list(
133 | displayAnnotations=TRUE,
134 | chart = "{chartArea:{backgroundColor:'#003b70'}}",
135 | legendPosition='newRow',
136 | width=600, height=350))
137 |
138 | plot(A5)
139 |
140 | }
141 | \references{
142 | Google Chart Tools API:
143 | \Sexpr[results=rd]{gsub("CHARTNAME",
144 | googleChartName,
145 | readLines(file.path(".", "inst", "mansections",
146 | "GoogleChartToolsURL.txt")))}
147 |
148 | % END DYNAMIC CONTENT
149 | }
150 | \seealso{
151 | See also \code{\link{print.gvis}}, \code{\link{plot.gvis}} for printing and
152 | plotting methods. Further see \code{\link{reshape}} for reshaping data, e.g.
153 | from a wide format into a long format.
154 | }
155 | \author{
156 | Markus Gesmann \email{markus.gesmann@gmail.com},
157 | Diego de Castillo \email{decastillo@gmail.com}
158 | }
159 | \keyword{iplot}
160 |
--------------------------------------------------------------------------------
/man/gvisAreaChart.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gvisCoreCharts.R
3 | \name{gvisAreaChart}
4 | \alias{gvisAreaChart}
5 | \title{Google Area Chart with R
6 | \Sexpr{googleChartName <- "areachart"}
7 | \Sexpr{gvisChartName <- "gvisAreaChart"}}
8 | \usage{
9 | gvisAreaChart(data, xvar = "", yvar = "", options = list(), chartid)
10 | }
11 | \arguments{
12 | \item{data}{a \code{\link{data.frame}} to be displayed as an area chart}
13 |
14 | \item{xvar}{name of the character column which contains the category labels
15 | for the x-axes.}
16 |
17 | \item{yvar}{a vector of column names of the numerical variables to be
18 | plotted. Each column is displayed as a separate line.}
19 |
20 | \item{options}{list of configuration options, see:
21 |
22 | % START DYNAMIC CONTENT
23 |
24 | \Sexpr[results=rd]{gsub("CHARTNAME",
25 | googleChartName,
26 | readLines(file.path(".", "inst", "mansections",
27 | "GoogleChartToolsURLConfigOptions.txt")))}
28 |
29 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
30 | "mansections", "gvisOptions.txt")))}}
31 |
32 | \item{chartid}{character. If missing (default) a random chart id will be
33 | generated based on chart type and \code{\link{tempfile}}}
34 | }
35 | \value{
36 | \Sexpr[results=rd]{paste(gvisChartName)} returns list
37 | of \code{\link{class}}
38 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
39 | "mansections", "gvisOutputStructure.txt")))}
40 | }
41 | \description{
42 | The gvisAreaChart function reads a data.frame and creates text output
43 | referring to the Google Visualisation API, which can be included into a web
44 | page, or as a stand-alone page.
45 | }
46 | \details{
47 | The area chart is rendered within the browser using SVG or VML and displays
48 | tips when hovering over points.
49 | }
50 | \examples{
51 |
52 | ## Please note that by default the googleVis plot command
53 | ## will open a browser window and requires an internet
54 | ## connection to display the visualisation.
55 |
56 | df=data.frame(country=c("US", "GB", "BR"), val1=c(1,3,4), val2=c(23,12,32))
57 |
58 | ## Area chart
59 | Area1 <- gvisAreaChart(df, xvar="country", yvar=c("val1", "val2"))
60 | plot(Area1)
61 |
62 | ## Stacked chart
63 | Area2 <- gvisAreaChart(df, xvar="country", yvar=c("val1", "val2"),
64 | options=list(isStacked=TRUE))
65 | plot(Area2)
66 |
67 |
68 | ## Add a customised title
69 | Area3 <- gvisAreaChart(df, xvar="country", yvar=c("val1", "val2"),
70 | options=list(title="Hello World",
71 | titleTextStyle="{color:'red',fontName:'Courier',fontSize:16}"))
72 | plot(Area3)
73 |
74 | \dontrun{
75 | ## Change y-axis to percentages
76 | Area3 <- gvisAreaChart(df, xvar="country", yvar=c("val1", "val2"),
77 | options=list(vAxis="{format:'#,###\%'}"))
78 | plot(Area3)
79 | }
80 |
81 | }
82 | \references{
83 | Google Chart Tools API:
84 | \Sexpr[results=rd]{gsub("CHARTNAME",
85 | googleChartName,
86 | readLines(file.path(".", "inst", "mansections",
87 | "GoogleChartToolsURL.txt")))}
88 |
89 | % END DYNAMIC CONTENT
90 | }
91 | \seealso{
92 | See also \code{\link{print.gvis}}, \code{\link{plot.gvis}} for
93 | printing and plotting methods
94 | }
95 | \author{
96 | Markus Gesmann \email{markus.gesmann@gmail.com},
97 |
98 | Diego de Castillo \email{decastillo@gmail.com}
99 | }
100 | \keyword{iplot}
101 |
--------------------------------------------------------------------------------
/man/gvisBarChart.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gvisCoreCharts.R
3 | \name{gvisBarChart}
4 | \alias{gvisBarChart}
5 | \title{Google Bar Chart with R
6 | \Sexpr{googleChartName <- "barchart"}
7 | \Sexpr{gvisChartName <- "gvisBarChart"}}
8 | \usage{
9 | gvisBarChart(data, xvar = "", yvar = "", options = list(), chartid)
10 | }
11 | \arguments{
12 | \item{data}{a \code{\link{data.frame}} to be displayed as a bar chart}
13 |
14 | \item{xvar}{name of the character column which contains the category labels
15 | for the x-axes.}
16 |
17 | \item{yvar}{a vector of column names of the numerical variables to be
18 | plotted. Each column is displayed as a separate bar/column.}
19 |
20 | \item{options}{list of configuration options, see:
21 |
22 | % START DYNAMIC CONTENT
23 |
24 | \Sexpr[results=rd]{gsub("CHARTNAME",
25 | googleChartName,
26 | readLines(file.path(".", "inst", "mansections",
27 | "GoogleChartToolsURLConfigOptions.txt")))}
28 |
29 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
30 | "mansections", "gvisOptions.txt")))}}
31 |
32 | \item{chartid}{character. If missing (default) a random chart id will be
33 | generated based on chart type and \code{\link{tempfile}}}
34 | }
35 | \value{
36 | \Sexpr[results=rd]{paste(gvisChartName)} returns list
37 | of \code{\link{class}}
38 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
39 | "mansections", "gvisOutputStructure.txt")))}
40 | }
41 | \description{
42 | The gvisBarChart function reads a data.frame and creates text output
43 | referring to the Google Visualisation API, which can be included into a web
44 | page, or as a stand-alone page. The actual chart is rendered by the web
45 | browser using SVG or VML.
46 | }
47 | \examples{
48 |
49 | ## Please note that by default the googleVis plot command
50 | ## will open a browser window and requires an internet
51 | ## connection to display the visualisation.
52 |
53 | df <- data.frame(country=c("US", "GB", "BR"),
54 | val1=c(1,3,4),
55 | val2=c(23,12,32))
56 |
57 | ## Bar chart
58 | Bar1 <- gvisBarChart(df, xvar="country", yvar=c("val1", "val2"))
59 | plot(Bar1)
60 |
61 | ## Stacked bar chart
62 | Bar2 <- gvisBarChart(df, xvar="country", yvar=c("val1", "val2"),
63 | options=list(isStacked=TRUE))
64 | plot(Bar2)
65 |
66 |
67 | ## Add a customised title and change width of bars
68 | Bar3 <- gvisBarChart(df, xvar="country", yvar=c("val1", "val2"),
69 | options=list(title="Hello World",
70 | titleTextStyle="{color:'red',fontName:'Courier',fontSize:16}",
71 | bar="{groupWidth:'100\%'}"))
72 | plot(Bar3)
73 |
74 | \dontrun{
75 | ## Change x-axis to percentages
76 | Bar4 <- gvisBarChart(df, xvar="country", yvar=c("val1", "val2"),
77 | options=list(hAxis="{format:'#,###\%'}"))
78 | plot(Bar4)
79 |
80 | ## The following example reads data from a Wikipedia table and displays
81 | ## the information in a bar chart.
82 | ## We use the readHMLTable function of the XML package to get the data
83 | library(XML)
84 | ## Get the data of the biggest ISO container companies from Wikipedia
85 | ##(table 3):
86 | df=readHTMLTable(readLines("https://en.wikipedia.org/wiki/Intermodal_freight_transport"))[[3]][,1:2]
87 | ## Rename the second column
88 | names(df)[2]="TEU capacity"
89 | ## The numbers are displayed with commas to separate thousands, so let's
90 | ## get rid of them:
91 | df[,2]=as.numeric(gsub(",", "", as.character(df[,2])))
92 |
93 | ## Finally we can create a nice bar chart:
94 | Bar5 <- gvisBarChart(df, options=list(
95 | chartArea="{left:250,top:50,width:\"50\%\",height:\"75\%\"}",
96 | legend="bottom",
97 | title="Top 20 container shipping companies in order of TEU capacity"))
98 |
99 | plot(Bar5)
100 |
101 | }
102 |
103 | }
104 | \references{
105 | Google Chart Tools API:
106 | \Sexpr[results=rd]{gsub("CHARTNAME",
107 | googleChartName,
108 | readLines(file.path(".", "inst", "mansections",
109 | "GoogleChartToolsURL.txt")))}
110 |
111 | % END DYNAMIC CONTENT
112 | }
113 | \seealso{
114 | See also \code{\link{print.gvis}}, \code{\link{plot.gvis}} for
115 | printing and plotting methods
116 | }
117 | \author{
118 | Markus Gesmann \email{markus.gesmann@gmail.com},
119 |
120 | Diego de Castillo \email{decastillo@gmail.com}
121 | }
122 | \keyword{iplot}
123 |
--------------------------------------------------------------------------------
/man/gvisBubbleChart.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gvisBubbleChart.R
3 | \name{gvisBubbleChart}
4 | \alias{gvisBubbleChart}
5 | \title{Google Bubble Chart with R
6 | \Sexpr{googleChartName <- "bubblechart"}
7 | \Sexpr{gvisChartName <- "gvisBubbleChart"}}
8 | \usage{
9 | gvisBubbleChart(
10 | data,
11 | idvar = "",
12 | xvar = "",
13 | yvar = "",
14 | colorvar = "",
15 | sizevar = "",
16 | options = list(),
17 | chartid
18 | )
19 | }
20 | \arguments{
21 | \item{data}{a \code{\link{data.frame}} to be displayed as a bubble chart.
22 | The data has to have at least three columns for \code{idvar, xvar}, and
23 | \code{yvar}.}
24 |
25 | \item{idvar}{column name of \code{data} with the bubble}
26 |
27 | \item{xvar}{column name of a numerical vector in \code{data} to be plotted
28 | on the x-axis.}
29 |
30 | \item{yvar}{column name of a numerical vector in \code{data} to be plotted
31 | on the y-axis.}
32 |
33 | \item{colorvar}{column name of data that identifies bubbles in the same
34 | series. Use the same value to identify all bubbles that belong to the same
35 | series; bubbles in the same series will be assigned the same color. Series
36 | can be configured using the \code{series} option.}
37 |
38 | \item{sizevar}{values in this column are mapped to actual pixel values using
39 | the \code{sizeAxis} option.}
40 |
41 | \item{options}{list of configuration options, see:
42 |
43 | % START DYNAMIC CONTENT
44 |
45 | \Sexpr[results=rd]{gsub("CHARTNAME",
46 | googleChartName,
47 | readLines(file.path(".", "inst", "mansections",
48 | "GoogleChartToolsURLConfigOptions.txt")))}
49 |
50 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
51 | "mansections", "gvisOptions.txt")))}}
52 |
53 | \item{chartid}{character. If missing (default) a random chart id will be
54 | generated based on chart type and \code{\link{tempfile}}.}
55 | }
56 | \value{
57 | \Sexpr[results=rd]{paste(gvisChartName)} returns list
58 | of \code{\link{class}}
59 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
60 | "mansections", "gvisOutputStructure.txt")))}
61 | }
62 | \description{
63 | The gvisBubbleChart function reads a data.frame and creates text output
64 | referring to the Google Visualisation API, which can be included into a web
65 | page, or as a stand-alone page.
66 | }
67 | \details{
68 | A bubble chart is used to visualize a data set with 2 to 4 dimensions. The
69 | first two dimensions are visualized as coordinates, the 3rd as color and the
70 | 4th as size.
71 |
72 | The bubble chart is rendered within the browser using SVG or VML and
73 | displays tips when hovering over points.
74 | }
75 | \examples{
76 |
77 |
78 | bubble1 <- gvisBubbleChart(Fruits, idvar="Fruit", xvar="Sales", yvar="Expenses")
79 | plot(bubble1)
80 |
81 | ## Set color and size
82 | bubble2 <- gvisBubbleChart(Fruits, idvar="Fruit", xvar="Sales", yvar="Expenses",
83 | colorvar="Location", sizevar="Profit",
84 | options=list(hAxis='{minValue:75, maxValue:125}'))
85 |
86 | plot(bubble2)
87 |
88 | ## Use year to color the bubbles
89 | bubble3 <- gvisBubbleChart(Fruits, idvar="Fruit", xvar="Sales", yvar="Expenses",
90 | colorvar="Year", sizevar="Profit",
91 | options=list(hAxis='{minValue:75, maxValue:125}'))
92 | plot(bubble3)
93 |
94 | ## Gradient colour example
95 | bubble4 <- gvisBubbleChart(Fruits, idvar="Fruit", xvar="Sales", yvar="Expenses",
96 | sizevar="Profit",
97 | options=list(hAxis='{minValue:75, maxValue:125}',
98 | colorAxis="{colors: ['lightblue', 'blue']}"))
99 | plot(bubble4)
100 |
101 | \dontrun{
102 | ## Moving bubble chart over time, aka motion chart
103 |
104 | M <- gvisMotionChart(Fruits, Fruit, Year)
105 | plot(M)
106 | }
107 |
108 |
109 |
110 |
111 | }
112 | \references{
113 | Google Chart Tools API:
114 | \Sexpr[results=rd]{gsub("CHARTNAME",
115 | googleChartName,
116 | readLines(file.path(".", "inst", "mansections",
117 | "GoogleChartToolsURL.txt")))}
118 |
119 | % END DYNAMIC CONTENT
120 | }
121 | \seealso{
122 | See also \code{\link{gvisMotionChart}} for a moving bubble chart
123 | over time, and \code{\link{print.gvis}}, \code{\link{plot.gvis}} for
124 | printing and plotting methods.
125 | }
126 | \author{
127 | Markus Gesmann \email{markus.gesmann@gmail.com},
128 |
129 | Diego de Castillo \email{decastillo@gmail.com}
130 | }
131 | \keyword{iplot}
132 |
--------------------------------------------------------------------------------
/man/gvisCalendar.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gvisCalendar.R
3 | \name{gvisCalendar}
4 | \alias{gvisCalendar}
5 | \title{Google Calendar Chart with R
6 | \Sexpr{googleChartName <- "calendar"}
7 | \Sexpr{gvisChartName <- "gvisCalendar"}}
8 | \usage{
9 | gvisCalendar(data, datevar = "", numvar = "", options = list(), chartid)
10 | }
11 | \arguments{
12 | \item{data}{a \code{data.frame}. The data has to have at least two columns,
13 | one with date information (\code{datevar}) and one numerical variable.}
14 |
15 | \item{datevar}{column name of \code{data} which shows the date dimension.
16 | The information has to be of class \code{\link{Date}} or \code{POSIX*} time
17 | series.}
18 |
19 | \item{numvar}{column name of \code{data} which shows the values to be
20 | displayed against \code{datevar}. The information has to be
21 | \code{\link{numeric}}.}
22 |
23 | \item{options}{list of configuration options, see:
24 |
25 | % START DYNAMIC CONTENT
26 |
27 | \Sexpr[results=rd]{gsub("CHARTNAME",
28 | googleChartName,
29 | readLines(file.path(".", "inst", "mansections",
30 | "GoogleChartToolsURLConfigOptions.txt")))}
31 |
32 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
33 | "mansections", "gvisOptions.txt")))}}
34 |
35 | \item{chartid}{character. If missing (default) a random chart id will be
36 | generated based on chart type and \code{\link{tempfile}}.}
37 | }
38 | \value{
39 | \Sexpr[results=rd]{paste(gvisChartName)} returns list
40 | of \code{\link{class}}
41 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
42 | "mansections", "gvisOutputStructure.txt")))}
43 | }
44 | \description{
45 | A calendar chart is a visualization used to show activity over the course
46 | of a long span of time, such as months or years. They're best used when
47 | you want to illustrate how some quantity varies depending on the day of
48 | the week, or how it trends over time.
49 | }
50 | \section{Warning}{
51 |
52 | The calendar chart may be undergoing substantial revisions in future
53 | Google Charts releases.
54 | }
55 |
56 | \examples{
57 | cl1 <- gvisCalendar(Cairo, datevar="Date", numvar="Temp")
58 | plot(cl1)
59 |
60 | ## Not all months shown?
61 | ## We can change the setting of the width ...
62 |
63 | cl2 <- gvisCalendar(Cairo, datevar="Date", numvar="Temp",
64 | options=list(width=1000))
65 | plot(cl2)
66 |
67 | ## ... or the cell size
68 | cl3 <- gvisCalendar(Cairo, datevar="Date",
69 | numvar="Temp",
70 | options=list(calendar="{ cellSize: 10 }"))
71 | plot(cl3)
72 |
73 | ## Example with many options set
74 | cl4 <- gvisCalendar(Cairo, datevar="Date", numvar="Temp",
75 | options=list(
76 | title="Daily temperature in Cairo",
77 | height=320,
78 | calendar="{yearLabel: { fontName: 'Times-Roman',
79 | fontSize: 32, color: '#1A8763', bold: true},
80 | cellSize: 10,
81 | cellColor: { stroke: 'red', strokeOpacity: 0.2 },
82 | focusedCellColor: {stroke:'red'}}")
83 | )
84 | plot(cl4)
85 |
86 | }
87 | \references{
88 | Google Chart Tools API:
89 | \Sexpr[results=rd]{gsub("CHARTNAME",
90 | googleChartName,
91 | readLines(file.path(".", "inst", "mansections",
92 | "GoogleChartToolsURL.txt")))}
93 |
94 | % END DYNAMIC CONTENT
95 | }
96 | \seealso{
97 | See also \code{\link{print.gvis}}, \code{\link{plot.gvis}} for printing and
98 | plotting methods.
99 | }
100 | \author{
101 | Markus Gesmann \email{markus.gesmann@gmail.com},
102 |
103 | Diego de Castillo \email{decastillo@gmail.com}
104 | }
105 | \keyword{iplot}
106 |
--------------------------------------------------------------------------------
/man/gvisCandlestickChart.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gvisCoreCharts.R
3 | \name{gvisCandlestickChart}
4 | \alias{gvisCandlestickChart}
5 | \title{Google Candlestick chart with R
6 | \Sexpr{googleChartName <- "candlestickchart"}
7 | \Sexpr{gvisChartName <- "gvisCandlestickChart"}}
8 | \usage{
9 | gvisCandlestickChart(
10 | data,
11 | xvar = "",
12 | low = "",
13 | open = "",
14 | close = "",
15 | high = "",
16 | options = list(),
17 | chartid
18 | )
19 | }
20 | \arguments{
21 | \item{data}{a \code{\link{data.frame}} to be displayed as a candlestick
22 | chart. The data has to have at least 5 columns.}
23 |
24 | \item{xvar}{name of the character column which contains the category labels
25 | for the x-axes.}
26 |
27 | \item{low}{name of the numeric column specifying the low/minimum value of
28 | this marker. This is the base of the candle's center line.}
29 |
30 | \item{open}{name of the numeric column specifying the opening/initial value
31 | of this marker. This is one vertical border of the candle. If less than the
32 | \code{close} value, the candle will be filled; otherwise it will be hollow.}
33 |
34 | \item{close}{name of the numeric column specifying the closing/final value
35 | of this marker. This is the second vertical border of the candle. If less
36 | than the \code{open} value, the candle will be hollow; otherwise it will be
37 | filled.}
38 |
39 | \item{high}{name of the numeric column specifying the high/maximum value of
40 | this marker. This is the top of the candle's center line.}
41 |
42 | \item{options}{list of configuration options, see:
43 |
44 | % START DYNAMIC CONTENT
45 |
46 | \Sexpr[results=rd]{gsub("CHARTNAME",
47 | googleChartName,
48 | readLines(file.path(".", "inst", "mansections",
49 | "GoogleChartToolsURLConfigOptions.txt")))}
50 |
51 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
52 | "mansections", "gvisOptions.txt")))}}
53 |
54 | \item{chartid}{character. If missing (default) a random chart id will be
55 | generated based on chart type and \code{\link{tempfile}}}
56 | }
57 | \value{
58 | \Sexpr[results=rd]{paste(gvisChartName)} returns list
59 | of \code{\link{class}}
60 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
61 | "mansections", "gvisOutputStructure.txt")))}
62 | }
63 | \description{
64 | An interactive candlestick chart.
65 | }
66 | \details{
67 | The gvisCandlestickChart function reads a data.frame and creates text output
68 | referring to the Google Visualisation API, which can be included into a web
69 | page, or as a stand-alone page. The actual chart is rendered by the web
70 | browser using SVG or VML.
71 |
72 | A candlestick chart is used to show an opening and closing value overlaid on
73 | top of a total variance. Candlestick charts are often used to show stock
74 | value behavior. In this chart, items where the opening value is less than
75 | the closing value (a gain) are drawn as filled boxes, and items where the
76 | opening value is more than the closing value (a loss) are drawn as hollow
77 | boxes.
78 | }
79 | \examples{
80 |
81 | ## Please note that by default the googleVis plot command
82 | ## will open a browser window and requires an internet
83 | ## connection to display the visualisation.
84 |
85 | ## Example data set
86 | OpenClose
87 |
88 | C1 <- gvisCandlestickChart(OpenClose, xvar="Weekday", low="Low",
89 | open="Open", close="Close",
90 | high="High",
91 | options=list(legend='none'))
92 |
93 | plot(C1)
94 |
95 |
96 | }
97 | \references{
98 | Google Chart Tools API:
99 | \Sexpr[results=rd]{gsub("CHARTNAME",
100 | googleChartName,
101 | readLines(file.path(".", "inst", "mansections",
102 | "GoogleChartToolsURL.txt")))}
103 |
104 | % END DYNAMIC CONTENT
105 | }
106 | \seealso{
107 | See also \code{\link{print.gvis}}, \code{\link{plot.gvis}} for
108 | printing and plotting methods
109 | }
110 | \author{
111 | Markus Gesmann \email{markus.gesmann@gmail.com},
112 |
113 | Diego de Castillo \email{decastillo@gmail.com}
114 | }
115 | \keyword{iplot}
116 |
--------------------------------------------------------------------------------
/man/gvisColumnChart.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gvisCoreCharts.R
3 | \name{gvisColumnChart}
4 | \alias{gvisColumnChart}
5 | \title{Google Column Chart with R
6 | \Sexpr{googleChartName <- "columnchart"}
7 | \Sexpr{gvisChartName <- "gvisColumnChart"}}
8 | \usage{
9 | gvisColumnChart(data, xvar = "", yvar = "", options = list(), chartid)
10 | }
11 | \arguments{
12 | \item{data}{a \code{\link{data.frame}} to be displayed as a column chart}
13 |
14 | \item{xvar}{name of the character column which contains the category labels
15 | for the x-axes.}
16 |
17 | \item{yvar}{a vector of column names of the numerical variables to be
18 | plotted. Each column is displayed as a separate bar/column.}
19 |
20 | \item{options}{list of configuration options, see:
21 |
22 | % START DYNAMIC CONTENT
23 |
24 | \Sexpr[results=rd]{gsub("CHARTNAME",
25 | googleChartName,
26 | readLines(file.path(".", "inst", "mansections",
27 | "GoogleChartToolsURLConfigOptions.txt")))}
28 |
29 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
30 | "mansections", "gvisOptions.txt")))}}
31 |
32 | \item{chartid}{character. If missing (default) a random chart id will be
33 | generated based on chart type and \code{\link{tempfile}}}
34 | }
35 | \value{
36 | \Sexpr[results=rd]{paste(gvisChartName)} returns list
37 | of \code{\link{class}}
38 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
39 | "mansections", "gvisOutputStructure.txt")))}
40 | }
41 | \description{
42 | The gvisColumnChart function reads a data.frame and creates text output
43 | referring to the Google Visualisation API, which can be included into a web
44 | page, or as a stand-alone page. The actual chart is rendered by the web
45 | browser using SVG or VML.
46 | }
47 | \examples{
48 |
49 | ## Please note that by default the googleVis plot command
50 | ## will open a browser window and requires an internet
51 | ## connection to display the visualisation.
52 |
53 | df=data.frame(country=c("US", "GB", "BR"), val1=c(1,3,4), val2=c(23,12,32))
54 |
55 | ## Column chart
56 | Col1 <- gvisColumnChart(df, xvar="country", yvar=c("val1", "val2"))
57 | plot(Col1)
58 |
59 | ## Stacked column chart
60 | Col2 <- gvisColumnChart(df, xvar="country", yvar=c("val1", "val2"),
61 | options=list(isStacked=TRUE))
62 | plot(Col2)
63 |
64 |
65 | ## Add a customised title and and change width of columns
66 | Col3 <- gvisColumnChart(df, xvar="country", yvar=c("val1", "val2"),
67 | options=list(title="Hello World",
68 | titleTextStyle="{color:'red',fontName:'Courier',fontSize:16}",
69 | bar="{groupWidth:'100\%'}"))
70 | plot(Col3)
71 |
72 | \dontrun{
73 | ## Change y-axis to percentages
74 | Col4 <- gvisColumnChart(df, xvar="country", yvar=c("val1", "val2"),
75 | options=list(vAxis="{format:'#,###\%'}"))
76 | plot(Col4)
77 | }
78 |
79 |
80 | }
81 | \references{
82 | Google Chart Tools API:
83 | \Sexpr[results=rd]{gsub("CHARTNAME",
84 | googleChartName,
85 | readLines(file.path(".", "inst", "mansections",
86 | "GoogleChartToolsURL.txt")))}
87 |
88 | % END DYNAMIC CONTENT
89 | }
90 | \seealso{
91 | See also \code{\link{print.gvis}}, \code{\link{plot.gvis}} for
92 | printing and plotting methods
93 | }
94 | \author{
95 | Markus Gesmann \email{markus.gesmann@gmail.com},
96 |
97 | Diego de Castillo \email{decastillo@gmail.com}
98 | }
99 | \keyword{iplot}
100 |
--------------------------------------------------------------------------------
/man/gvisComboChart.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gvisCoreCharts.R
3 | \name{gvisComboChart}
4 | \alias{gvisComboChart}
5 | \title{Google Combo Chart with R
6 | \Sexpr{googleChartName <- "combochart"}
7 | \Sexpr{gvisChartName <- "gvisComboChart"}}
8 | \usage{
9 | gvisComboChart(data, xvar = "", yvar = "", options = list(), chartid)
10 | }
11 | \arguments{
12 | \item{data}{a \code{\link{data.frame}} to be displayed as a columns, line
13 | and area chart.}
14 |
15 | \item{xvar}{name of the character column which contains the category labels
16 | for the x-axes.}
17 |
18 | \item{yvar}{a vector of column names of the numerical variables to be
19 | plotted. Each column is displayed as a separate column, line or area
20 | series.}
21 |
22 | \item{options}{list of configuration options, see:
23 |
24 | % START DYNAMIC CONTENT
25 |
26 | \Sexpr[results=rd]{gsub("CHARTNAME",
27 | googleChartName,
28 | readLines(file.path(".", "inst", "mansections",
29 | "GoogleChartToolsURLConfigOptions.txt")))}
30 |
31 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
32 | "mansections", "gvisOptions.txt")))}}
33 |
34 | \item{chartid}{character. If missing (default) a random chart id will be
35 | generated based on chart type and \code{\link{tempfile}}}
36 | }
37 | \value{
38 | \Sexpr[results=rd]{paste(gvisChartName)} returns list
39 | of \code{\link{class}}
40 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
41 | "mansections", "gvisOutputStructure.txt")))}
42 | }
43 | \description{
44 | A chart that lets you render each series as a different marker type from the
45 | following list: columns, lines, and area lines.
46 | }
47 | \details{
48 | The gvisComboChart function reads a data.frame and creates text output
49 | referring to the Google Visualisation API, which can be included into a web
50 | page, or as a stand-alone page. The actual chart is rendered by the web
51 | browser using SVG or VML.
52 | }
53 | \examples{
54 |
55 | ## Please note that by default the googleVis plot command
56 | ## will open a browser window and requires an internet
57 | ## connection to display the visualisation.
58 |
59 | CityPopularity
60 | ## Add the mean
61 | CityPopularity$Mean=mean(CityPopularity$Popularity)
62 |
63 | C1 <- gvisComboChart(CityPopularity, xvar="City",
64 | yvar=c("Mean", "Popularity"),
65 | options=list(seriesType="bars",
66 | title="City Popularity",
67 | series='{0: {type:"line"}}'))
68 | plot(C1)
69 |
70 | ## Changing the width of columsn
71 | C2 <- gvisComboChart(CityPopularity, xvar="City",
72 | yvar=c("Mean", "Popularity"),
73 | options=list(seriesType="bars",
74 | bar="{groupWidth:'100\%'}",
75 | title="City Popularity",
76 | series='{0: {type:"line"}}'))
77 | plot(C2)
78 |
79 |
80 | }
81 | \references{
82 | Google Chart Tools API:
83 | \Sexpr[results=rd]{gsub("CHARTNAME",
84 | googleChartName,
85 | readLines(file.path(".", "inst", "mansections",
86 | "GoogleChartToolsURL.txt")))}
87 |
88 | % END DYNAMIC CONTENT
89 | }
90 | \seealso{
91 | See also \code{\link{print.gvis}}, \code{\link{plot.gvis}} for
92 | printing and plotting methods
93 | }
94 | \author{
95 | Markus Gesmann \email{markus.gesmann@gmail.com},
96 |
97 | Diego de Castillo \email{decastillo@gmail.com}
98 | }
99 | \keyword{iplot}
100 |
--------------------------------------------------------------------------------
/man/gvisGantt.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gvisGantt.R
3 | \name{gvisGantt}
4 | \alias{gvisGantt}
5 | \title{Google Gantt Chart with R
6 | \Sexpr{googleChartName <- "ganttchart"}
7 | \Sexpr{gvisChartName <- "gvisGantt"}}
8 | \usage{
9 | gvisGantt(
10 | data,
11 | taskID = "",
12 | taskName = "",
13 | resource = "",
14 | start = "",
15 | end = "",
16 | duration = "",
17 | percentComplete = "",
18 | dependencies = "",
19 | options = list(),
20 | chartid
21 | )
22 | }
23 | \arguments{
24 | \item{data}{data.frame that contains the data to be visualised}
25 |
26 | \item{taskID}{a string that refers to the column name in
27 | \code{data} for the task ID to be used}
28 |
29 | \item{taskName}{a string that refers to the column name in
30 | \code{data} for the task name to be used}
31 |
32 | \item{resource}{a string that refers to the column name in
33 | \code{data} for the resource to be used}
34 |
35 | \item{start}{a string that refers to the date column name in
36 | \code{data} for the start dates}
37 |
38 | \item{end}{a string that refers to the date column name in
39 | \code{data} for the end dates}
40 |
41 | \item{duration}{a string that refers to the numeric column name in
42 | \code{data} for the task duration in milliseconds}
43 |
44 | \item{percentComplete}{a string that refers to the numeric column name in
45 | \code{data} for the percent complete to be used}
46 |
47 | \item{dependencies}{a string that refers to the column name in
48 | \code{data} for the dependencies to be used}
49 |
50 | \item{options}{list of configuration options.
51 | The options are documented in detail by Google online:
52 |
53 | % START DYNAMIC CONTENT
54 |
55 | \Sexpr[results=rd]{gsub("CHARTNAME",
56 | googleChartName,
57 | readLines(file.path(".", "inst", "mansections",
58 | "GoogleChartToolsURLConfigOptions.txt")))}
59 |
60 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
61 | "mansections", "gvisOptions.txt")))}}
62 |
63 | \item{chartid}{character. If missing (default) a random chart id will be
64 | generated based on chart type and \code{\link{tempfile}}}
65 | }
66 | \value{
67 | \Sexpr[results=rd]{paste(gvisChartName)} returns list
68 | of \code{\link{class}}
69 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
70 | "mansections", "gvisOutputStructure.txt")))}
71 | }
72 | \description{
73 | A Gantt chart is a type of chart that illustrates the breakdown of a
74 | project into its component tasks.
75 | }
76 | \examples{
77 |
78 | # Helper function to generate example data
79 | daysToMilliseconds <- function(days){
80 | days * 24 * 60 * 60 * 1000
81 | }
82 |
83 | dat <- data.frame(
84 | taskID = c("Research", "Write", "Cite", "Complete", "Outline"),
85 | taskName = c("Find sources", "Write Paper", "Create bibliography",
86 | "Hand in paper", "Outline paper"),
87 | resource = c(NA, "write", "write", "complete", "write"),
88 | start = c(as.Date("2015-01-01"), NA, NA, NA, NA),
89 | end = as.Date(c("2015-01-05", "2015-01-09", "2015-01-07",
90 | "2015-01-10", "2015-01-06")),
91 | duration = c(NA, daysToMilliseconds(c(3, 1, 1, 1))),
92 | percentComplete = c(100, 25, 20, 0, 100),
93 | dependencies = c(NA, "Research, Outline", "Research",
94 | "Cite, Write", "Research")
95 | )
96 |
97 | gntt1 <- gvisGantt(dat, taskID = "taskID",
98 | taskName = "taskName",
99 | resource = "resource",
100 | start = "start",
101 | end = "end",
102 | duration = "duration",
103 | percentComplete = "percentComplete",
104 | dependencies = "dependencies")
105 | plot(gntt1)
106 |
107 | ## gantt chart with options set
108 |
109 | gntt2 <- gvisGantt(dat, taskID = "taskID",
110 | taskName = "taskName",
111 | resource = "resource",
112 | start = "start",
113 | end = "end",
114 | duration = "duration",
115 | percentComplete = "percentComplete",
116 | dependencies = "dependencies",
117 | options = list(
118 | height = 275,
119 | gantt = "{
120 | criticalPathEnabled: true,
121 | innerGridHorizLine: {
122 | stroke: '#ffe0b2',
123 | strokeWidth: 2
124 | },
125 | innerGridTrack: {fill: '#fff3e0'},
126 | innerGridDarkTrack: {fill: '#ffcc80'},
127 | labelStyle: {
128 | fontName: 'Arial',
129 | fontSize: 14
130 | }}"
131 | ))
132 | plot(gntt2)
133 |
134 | # Example with date time
135 | dat <- data.frame(
136 | taskID = c("Research", "Write", "Complete"),
137 | taskName = c("Find sources", "Write Paper", "Hand in paper"),
138 | resource = c(NA, "write", "complete"),
139 | start = c(as.POSIXct("2015-01-01 6:00:00"), NA, NA),
140 | end = as.POSIXct(c("2015-01-01 8:00:00", "2015-01-01 13:30:00",
141 | "2015-01-01 20:30:00")),
142 | duration = c(NA, daysToMilliseconds(c(.1, .05))),
143 | percentComplete = c(100, 25, 0),
144 | dependencies = c(NA, "Research", "Write"))
145 |
146 | gntt3 <- gvisGantt(dat, taskID = "taskID",
147 | taskName = "taskName",
148 | resource = "resource",
149 | start = "start",
150 | end = "end",
151 | duration = "duration",
152 | percentComplete = "percentComplete",
153 | dependencies = "dependencies")
154 | plot(gntt3)
155 |
156 | }
157 | \references{
158 | Google Chart Tools API:
159 | \Sexpr[results=rd]{gsub("CHARTNAME",
160 | googleChartName,
161 | readLines(file.path(".", "inst", "mansections",
162 | "GoogleChartToolsURL.txt")))}
163 |
164 | % END DYNAMIC CONTENT
165 | }
166 | \author{
167 | Markus Gesmann \email{markus.gesmann@gmail.com}
168 | }
169 | \keyword{iplot}
170 |
--------------------------------------------------------------------------------
/man/gvisGauge.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gvisPieGaugeChart.R
3 | \name{gvisGauge}
4 | \alias{gvisGauge}
5 | \title{Google Gauge with R
6 | \Sexpr{googleChartName <- "gauge"}
7 | \Sexpr{gvisChartName <- "gvisGauge"}}
8 | \usage{
9 | gvisGauge(data, labelvar = "", numvar = "", options = list(), chartid)
10 | }
11 | \arguments{
12 | \item{data}{a \code{\link{data.frame}} to be displayed as a gauge}
13 |
14 | \item{labelvar}{name of the character column which contains the category
15 | labels for the slice labels.}
16 |
17 | \item{numvar}{a vector of column names of the numerical variables of the
18 | slice values.}
19 |
20 | \item{options}{list of configuration options, see:
21 |
22 | % START DYNAMIC CONTENT
23 |
24 | \Sexpr[results=rd]{gsub("CHARTNAME",
25 | googleChartName,
26 | readLines(file.path(".", "inst", "mansections",
27 | "GoogleChartToolsURLConfigOptions.txt")))}
28 |
29 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
30 | "mansections", "gvisOptions.txt")))}}
31 |
32 | \item{chartid}{character. If missing (default) a random chart id will be
33 | generated based on chart type and \code{\link{tempfile}}}
34 | }
35 | \value{
36 | \Sexpr[results=rd]{paste(gvisChartName)} returns list
37 | of \code{\link{class}}
38 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
39 | "mansections", "gvisOutputStructure.txt")))}
40 | }
41 | \description{
42 | The gvisGauge function reads a data.frame and creates text output referring
43 | to the Google Visualisation API, which can be included into a web page, or
44 | as a stand-alone page. The actual chart is rendered by the web browser using
45 | SVG or VML.
46 | }
47 | \examples{
48 |
49 | ## Please note that by default the googleVis plot command
50 | ## will open a browser window and requires an internet
51 | ## connection to display the visualisation.
52 |
53 | Gauge1 <- gvisGauge(CityPopularity, options=list(min=0, max=800, greenFrom=500,
54 | greenTo=800, yellowFrom=300, yellowTo=500,
55 | redFrom=0, redTo=300))
56 |
57 | plot(Gauge1)
58 |
59 | }
60 | \references{
61 | Google Chart Tools API:
62 | \Sexpr[results=rd]{gsub("CHARTNAME",
63 | googleChartName,
64 | readLines(file.path(".", "inst", "mansections",
65 | "GoogleChartToolsURL.txt")))}
66 |
67 | % END DYNAMIC CONTENT
68 | }
69 | \seealso{
70 | See also \code{\link{print.gvis}}, \code{\link{plot.gvis}} for
71 | printing and plotting methods
72 | }
73 | \author{
74 | Markus Gesmann \email{markus.gesmann@gmail.com},
75 |
76 | Diego de Castillo \email{decastillo@gmail.com}
77 | }
78 | \keyword{iplot}
79 |
--------------------------------------------------------------------------------
/man/gvisGeoChart.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gvisGeoChart.R
3 | \name{gvisGeoChart}
4 | \alias{gvisGeoChart}
5 | \title{Google Geo Chart with R
6 | \Sexpr{googleChartName <- "geochart"}
7 | \Sexpr{gvisChartName <- "gvisGeoChart"}}
8 | \usage{
9 | gvisGeoChart(
10 | data,
11 | locationvar = "",
12 | colorvar = "",
13 | sizevar = "",
14 | hovervar = "",
15 | options = list(),
16 | chartid
17 | )
18 | }
19 | \arguments{
20 | \item{data}{a \code{data.frame}. The data has to have at least one column
21 | with location name (\code{locationvar}), value to be mapped to location. The
22 | format of the data varies depending on which display mode that you use:
23 | Regions or Markers.}
24 |
25 | \item{locationvar}{column name of \code{data} with the geo locations to be
26 | analysed. The locations can be provide in two formats: \describe{
27 | \item{Format 1}{'latitude:longitude'. See the example below.} \item{Format
28 | 2}{Address, country name, region name locations, or US metropolitan area
29 | codes, see
30 | \url{https://developers.google.com/adwords/api/docs/appendix/geotargeting?csw=1l}.
31 | This format works with the \code{dataMode} option set to either 'markers' or
32 | 'regions'. The following formats are accepted: A specific address (for
33 | example, "1600 Pennsylvania Ave"). A country name as a string (for example,
34 | "England"), or an uppercase ISO-3166 code or its English text equivalent
35 | (for example, "GB" or "United Kingdom"). An uppercase ISO-3166-2 region
36 | code name or its English text equivalent (for example, "US-NJ" or "New
37 | Jersey"). } }}
38 |
39 | \item{colorvar}{column name of \code{data} with the optional numeric column
40 | used to assign a color to this marker, based on the scale specified in the
41 | \code{colorAxis.colors} property. If this column is not present, all markers
42 | will be the same color. If the column is present, null values are not
43 | allowed. Values are scaled relative to each other, or absolutely to values
44 | specified in the \code{colorAxis.values} property.}
45 |
46 | \item{sizevar}{only used for \code{displayMode='markers'}. Column name of
47 | \code{data} with the optional numeric column used to assign the marker size,
48 | relative to the other marker sizes. If this column is not present, the value
49 | from the previous column will be used (or default `size, if no color column
50 | is provided as well). If the column is present, null valuesare not allowed.}
51 |
52 | \item{hovervar}{column name of \code{data} with the additional string text
53 | displayed when the user hovers over this region.}
54 |
55 | \item{options}{list of configuration options, see:
56 |
57 | % START DYNAMIC CONTENT
58 |
59 | \Sexpr[results=rd]{gsub("CHARTNAME",
60 | googleChartName,
61 | readLines(file.path(".", "inst", "mansections",
62 | "GoogleChartToolsURLConfigOptions.txt")))}
63 |
64 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
65 | "mansections", "gvisOptions.txt")))}}
66 |
67 | \item{chartid}{character. If missing (default) a random chart id will be
68 | generated based on chart type and \code{\link{tempfile}}}
69 | }
70 | \value{
71 | \Sexpr[results=rd]{paste(gvisChartName)} returns list
72 | of \code{\link{class}}
73 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
74 | "mansections", "gvisOutputStructure.txt")))}
75 | }
76 | \description{
77 | The gvisGeoChart function reads a data.frame and creates text output
78 | referring to the Google Visualisation API, which can be included into a web
79 | page, or as a stand-alone page.
80 | }
81 | \details{
82 | A geo chart is a map of a country, a continent, or a region with two modes:
83 | The region mode colorizes whole regions, such as countries, provinces, or
84 | states. The marker mode marks designated regions using bubbles that are
85 | scaled according to a value that you specify.
86 |
87 | A geo chart is rendered within the browser using SVG or VML. Note that the
88 | map is not scrollable or draggable.
89 | }
90 | \examples{
91 |
92 | ## Please note that by default the googleVis plot command
93 | ## will open a browser window and requires Internet
94 | ## connection to display the visualisation.
95 |
96 | ## Regions examples
97 | ## The regions style fills entire regions (typically countries) with
98 | ## colors corresponding to the values that you assign
99 |
100 | G1a <- gvisGeoChart(Exports, locationvar='Country', colorvar='Profit')
101 |
102 | plot(G1a)
103 |
104 | ## Change projection
105 | G1b <- gvisGeoChart(Exports, locationvar='Country', colorvar='Profit',
106 | options=list(projection="kavrayskiy-vii"))
107 |
108 | plot(G1b)
109 |
110 | ## Plot only Europe
111 | G2 <- gvisGeoChart(Exports, "Country", "Profit",
112 | options=list(region="150"))
113 |
114 | plot(G2)
115 |
116 |
117 | ## Example showing US data by state
118 | require(datasets)
119 |
120 | states <- data.frame(state.name, state.x77)
121 | G3 <- gvisGeoChart(states, "state.name", "Illiteracy",
122 | options=list(region="US", displayMode="regions",
123 | resolution="provinces",
124 | width=600, height=400))
125 | plot(G3)
126 |
127 |
128 | G4 <- gvisGeoChart(Andrew, "LatLong", colorvar='Speed_kt',
129 | options=list(region="US"))
130 | plot(G4)
131 |
132 |
133 | G5 <- gvisGeoChart(Andrew, "LatLong", sizevar='Speed_kt',
134 | colorvar="Pressure_mb", options=list(region="US"))
135 | plot(G5)
136 |
137 | ## Create lat:long values and plot a map of Oceania
138 | ## Set background colour to light-blue
139 |
140 | require(stats)
141 | data(quakes)
142 | head(quakes)
143 | quakes$latlong<-paste(quakes$lat, quakes$long, sep=":")
144 |
145 | G6 <- gvisGeoChart(quakes, "latlong", "depth", "mag",
146 | options=list(displayMode="Markers", region="009",
147 | colorAxis="{colors:['red', 'grey']}",
148 | backgroundColor="lightblue"))
149 |
150 | plot(G6)
151 |
152 |
153 | }
154 | \references{
155 | Google Chart Tools API:
156 | \Sexpr[results=rd]{gsub("CHARTNAME",
157 | googleChartName,
158 | readLines(file.path(".", "inst", "mansections",
159 | "GoogleChartToolsURL.txt")))}
160 |
161 | % END DYNAMIC CONTENT
162 | }
163 | \seealso{
164 | See also \code{\link{print.gvis}}, \code{\link{plot.gvis}}
165 | for printing and plotting methods.
166 | }
167 | \author{
168 | Markus Gesmann \email{markus.gesmann@gmail.com},
169 | Diego de Castillo \email{decastillo@gmail.com}
170 | }
171 | \keyword{iplot}
172 |
--------------------------------------------------------------------------------
/man/gvisGeoMap.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gvisGeoMap.R
3 | \name{gvisGeoMap}
4 | \alias{gvisGeoMap}
5 | \title{Google Geo Map with R
6 | \Sexpr{googleChartName <- "geomap"}
7 | \Sexpr{gvisChartName <- "gvisGeoMap"}}
8 | \usage{
9 | gvisGeoMap(
10 | data,
11 | locationvar = "",
12 | numvar = "",
13 | hovervar = "",
14 | options = list(),
15 | chartid
16 | )
17 | }
18 | \arguments{
19 | \item{data}{\code{data.frame}. The data has to have at least two
20 | columns with location name (\code{locationvar}), value to be mapped
21 | to location (\code{numvar}) and an optional variable to display any
22 | text while the mouse hovers over the location (\code{hovervar}).}
23 |
24 | \item{locationvar}{column name of \code{data} with the geo locations to be
25 | analysed. The locations can be provide in two formats:
26 |
27 | \describe{
28 | \item{Format 1}{'latitude:longitude'. See the example below.}
29 | \item{Format 2}{Address, country name, region name locations, or
30 | US metropolitan area codes, see
31 | \url{https://developers.google.com/adwords/api/docs/appendix/geotargeting?csw=1}.
32 | This format works with the \code{dataMode} option set to either
33 | 'markers' or 'regions'. The following formats are accepted:
34 | A specific address (for example, "1600 Pennsylvania Ave").
35 | A country name as a string (for example, "England"), or an uppercase ISO-3166 code
36 | or its English text equivalent (for example, "GB" or "United Kingdom").
37 | An uppercase ISO-3166-2 region code name or its English text
38 | equivalent (for example, "US-NJ" or "New Jersey").
39 | }
40 | }}
41 |
42 | \item{numvar}{column name of \code{data} with the numeric value
43 | displayed when the user hovers over this region.}
44 |
45 | \item{hovervar}{column name of \code{data} with the additional string
46 | text displayed when the user hovers over this region.}
47 |
48 | \item{options}{list of configuration options.
49 | The options are documented in detail by Google online:
50 |
51 | % START DYNAMIC CONTENT
52 |
53 | \Sexpr[results=rd]{gsub("CHARTNAME",
54 | googleChartName,
55 | readLines(file.path(".", "inst", "mansections",
56 | "GoogleChartToolsURLConfigOptions.txt")))}
57 |
58 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
59 | "mansections", "gvisOptions.txt")))}}
60 |
61 | \item{chartid}{character. If missing (default) a random chart id will be
62 | generated based on chart type and \code{\link{tempfile}}}
63 | }
64 | \value{
65 | \Sexpr[results=rd]{paste(gvisChartName)} returns list
66 | of \code{\link{class}}
67 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
68 | "mansections", "gvisOutputStructure.txt")))}
69 | }
70 | \description{
71 | The gvisGeoMap function reads a data.frame and
72 | creates text output referring to the Google Visualisation API, which can be
73 | included into a web page, or as a stand-alone page.
74 |
75 | A geo map is a map of a country, continent, or region map, with colours
76 | and values assigned to specific regions. Values are displayed as a colour
77 | scale, and you can specify optional hover-text for regions. The map is
78 | rendered in the browser. Note that the
79 | map is not scroll-able or drag-gable, but can be configured to allow
80 | zooming.
81 | }
82 | \section{Warnings}{
83 |
84 | GeoMap (gvisGeoMap) is Flash based, conisder using GeoChart (gvisGeoChart) instead.
85 | For more details visit: goo.gl/tkiEV8
86 |
87 | Because of Flash security settings the chart
88 | might not work correctly when accessed from a file location in the
89 | browser (e.g., file:///c:/webhost/myhost/myviz.html) rather than
90 | from a web server URL (e.g. https://www.myhost.com/myviz.html).
91 | See the googleVis package vignette and the Macromedia web
92 | site (\url{https://www.macromedia.com/support/documentation/en/flashplayer/help/})
93 | for more details.
94 | }
95 |
96 | \examples{
97 | ## Please note that by default the googleVis plot command
98 | ## will open a browser window and requires Internet
99 | ## connection to display the visualisation.
100 |
101 | ## Regions Example
102 | ## The regions style fills entire regions (typically countries) with colors
103 | ## corresponding to the values that you assign. Specify the regions style
104 | ## by assigning options['dataMode'] = 'regions' in your code.
105 |
106 | G1 <- gvisGeoMap(Exports, locationvar='Country', numvar='Profit',
107 | options=list(dataMode="regions"))
108 |
109 | plot(G1)
110 |
111 | ## Markers Example
112 | ## The "markers" style displays a circle, sized and colored to indicate
113 | ## a value, over the regions that you specify.
114 | G2 <- gvisGeoMap(CityPopularity, locationvar='City', numvar='Popularity',
115 | options=list(region='US', height=350,
116 | dataMode='markers',
117 | colors='[0xFF8747, 0xFFB581, 0xc06000]'))
118 |
119 | plot(G2)
120 |
121 | ## Example showing US data by state
122 |
123 | require(datasets)
124 | states <- data.frame(state.name, state.x77)
125 |
126 | G3 <- gvisGeoMap(states, "state.name", "Illiteracy",
127 | options=list(region="US", dataMode="regions",
128 | width=600, height=400))
129 | plot(G3)
130 |
131 | ## Example with latitude and longitude information
132 | ## Show Hurricane Andrew (1992) storm track
133 | G4 <- gvisGeoMap(Andrew, locationvar="LatLong", numvar="Speed_kt",
134 | hovervar="Category",
135 | options=list(height=350, region="US", dataMode="markers"))
136 |
137 | plot(G4)
138 |
139 | ## World population
140 | WorldPopulation=data.frame(Country=Population$Country,
141 | Population.in.millions=round(Population$Population/1e6,0),
142 | Rank=paste(Population$Country, "Rank:", Population$Rank))
143 |
144 | G5 <- gvisGeoMap(WorldPopulation, "Country", "Population.in.millions", "Rank",
145 | options=list(dataMode="regions", width=600, height=300))
146 | plot(G5)
147 |
148 | }
149 | \references{
150 | Google Chart Tools API:
151 | \Sexpr[results=rd]{gsub("CHARTNAME",
152 | googleChartName,
153 | readLines(file.path(".", "inst", "mansections",
154 | "GoogleChartToolsURL.txt")))}
155 |
156 | % END DYNAMIC CONTENT
157 | }
158 | \author{
159 | Markus Gesmann \email{markus.gesmann@gmail.com},
160 | Diego de Castillo \email{decastillo@gmail.com}
161 | }
162 | \keyword{iplot}
163 |
--------------------------------------------------------------------------------
/man/gvisHistogram.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gvisHistogram.R
3 | \name{gvisHistogram}
4 | \alias{gvisHistogram}
5 | \title{Google Histogram Chart with R
6 | \Sexpr{googleChartName <- "histogram"}
7 | \Sexpr{gvisChartName <- "gvisHistogram"}}
8 | \usage{
9 | gvisHistogram(data, options = list(), chartid)
10 | }
11 | \arguments{
12 | \item{data}{a \code{\link{data.frame}} to be displayed as a histogram.
13 | Each column will be displayed as a histogram.}
14 |
15 | \item{options}{list of configuration options, see
16 |
17 | % START DYNAMIC CONTENT
18 |
19 | \Sexpr[results=rd]{gsub("CHARTNAME",
20 | googleChartName,
21 | readLines(file.path(".", "inst", "mansections",
22 | "GoogleChartToolsURLConfigOptions.txt")))}
23 |
24 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
25 | "mansections", "gvisOptions.txt")))}}
26 |
27 | \item{chartid}{character. If missing (default) a random chart id will be
28 | generated based on chart type and \code{\link{tempfile}}.}
29 | }
30 | \value{
31 | \Sexpr[results=rd]{paste(gvisChartName)} returns list
32 | of \code{\link{class}}
33 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
34 | "mansections", "gvisOutputStructure.txt")))}
35 | }
36 | \description{
37 | The gvisHistogram function reads a data.frame and creates text output
38 | referring to the Google Visualisation API, which can be included into a web
39 | page, or as a stand-alone page. The actual chart is rendered by the web
40 | browser using SVG or VML.
41 | }
42 | \examples{
43 |
44 | ## Please note that by default the googleVis plot command
45 | ## will open a browser window and requires an internet
46 | ## connection to display the visualisation.
47 |
48 |
49 | hist1 <- gvisHistogram(dino)
50 | plot(hist1)
51 |
52 | ## Histogram of the top 20 countries
53 | pop <- Population[1:20,c("Country", "Population")]
54 | pop=transform(pop, Population=round(Population/1e6))
55 |
56 | hist2 <- gvisHistogram(pop, option=list(title="Country Populations",
57 | legend="{ position: 'none' }",
58 | colors="['green']"))
59 | plot(hist2)
60 |
61 | set.seed(123)
62 | dat=data.frame(A=rpois(100, 20),
63 | B=rpois(100, 5),
64 | C=rpois(100, 50))
65 | hist3 <- gvisHistogram(dat, options=list(
66 | legend="{ position: 'top', maxLines: 2 }",
67 | colors="['#5C3292', '#1A8763', '#871B47']"))
68 |
69 | plot(hist3)
70 | }
71 | \references{
72 | Google Chart Tools API:
73 | \Sexpr[results=rd]{gsub("CHARTNAME",
74 | googleChartName,
75 | readLines(file.path(".", "inst", "mansections",
76 | "GoogleChartToolsURL.txt")))}
77 |
78 | % END DYNAMIC CONTENT
79 | }
80 | \seealso{
81 | See also \code{\link{print.gvis}}, \code{\link{plot.gvis}} for
82 | printing and plotting methods
83 | }
84 | \author{
85 | Markus Gesmann \email{markus.gesmann@gmail.com},
86 |
87 | Diego de Castillo \email{decastillo@gmail.com}
88 | }
89 | \keyword{iplot}
90 |
--------------------------------------------------------------------------------
/man/gvisLineChart.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gvisCoreCharts.R
3 | \name{gvisLineChart}
4 | \alias{gvisLineChart}
5 | \title{Google Line Chart with R
6 | \Sexpr{googleChartName <- "linechart"}
7 | \Sexpr{gvisChartName <- "gvisLineChart"}}
8 | \usage{
9 | gvisLineChart(data, xvar = "", yvar = "", options = list(), chartid)
10 | }
11 | \arguments{
12 | \item{data}{a \code{\link{data.frame}} to be displayed as a line chart}
13 |
14 | \item{xvar}{name of the character column which contains the category labels
15 | for the x-axes.}
16 |
17 | \item{yvar}{a vector of column names of the numerical variables to be
18 | plotted. Each column is displayed as a separate line.}
19 |
20 | \item{options}{list of configuration options, see
21 |
22 | % START DYNAMIC CONTENT
23 |
24 | \Sexpr[results=rd]{gsub("CHARTNAME",
25 | googleChartName,
26 | readLines(file.path(".", "inst", "mansections",
27 | "GoogleChartToolsURLConfigOptions.txt")))}
28 |
29 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
30 | "mansections", "gvisOptions.txt")))}}
31 |
32 | \item{chartid}{character. If missing (default) a random chart id will be
33 | generated based on chart type and \code{\link{tempfile}}}
34 | }
35 | \value{
36 | \Sexpr[results=rd]{paste(gvisChartName)} returns list
37 | of \code{\link{class}}
38 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
39 | "mansections", "gvisOutputStructure.txt")))}
40 | }
41 | \description{
42 | The gvisLineChart function reads a data.frame and creates text output
43 | referring to the Google Visualisation API, which can be included into a web
44 | page, or as a stand-alone page. The actual chart is rendered by the web
45 | browser using SVG or VML.
46 | }
47 | \examples{
48 |
49 | ## Please note that by default the googleVis plot command
50 | ## will open a browser window and requires an internet
51 | ## connection to display the visualisation.
52 |
53 | df <- data.frame(country=c("US", "GB", "BR"), val1=c(1,3,4), val2=c(23,12,32))
54 |
55 | ## Line chart
56 | Line1 <- gvisLineChart(df, xvar="country", yvar=c("val1", "val2"))
57 | plot(Line1)
58 |
59 |
60 | ## Add a customised title and smoothed curve
61 | Line2 <- gvisLineChart(df, xvar="country", yvar=c("val1", "val2"),
62 | options=list(title="Hello World",
63 | titleTextStyle="{color:'red',fontName:'Courier',fontSize:16}",
64 | curveType='function'))
65 | plot(Line2)
66 |
67 | \dontrun{
68 | ## Change y-axis to percentages
69 | Line3 <- gvisLineChart(df, xvar="country", yvar=c("val1", "val2"),
70 | options=list(vAxis="{format:'#,###\%'}"))
71 | plot(Line3)
72 |
73 | }
74 |
75 | ## Create a chart with two y-axis:
76 | Line4 <- gvisLineChart(df, "country", c("val1","val2"),
77 | options=list(series="[{targetAxisIndex: 0},
78 | {targetAxisIndex:1}]",
79 | vAxes="[{title:'val1'}, {title:'val2'}]"
80 | ))
81 | plot(Line4)
82 |
83 | ## Line chart with edit button
84 | Line5 <- gvisLineChart(df, xvar="country", yvar=c("val1", "val2"),
85 | options=list(gvis.editor="Edit me!"))
86 | plot(Line5)
87 |
88 | ## Customizing lines
89 | Dashed <- gvisLineChart(df, xvar="country", yvar=c("val1","val2"),
90 | options=list(
91 | series="[{color:'green', targetAxisIndex: 0,
92 | lineWidth: 1, lineDashStyle: [2, 2, 20, 2, 20, 2]},
93 | {color: 'blue',targetAxisIndex: 1,
94 | lineWidth: 2, lineDashStyle: [4, 1]}]",
95 | vAxes="[{title:'val1'}, {title:'val2'}]"
96 | ))
97 | plot(Dashed)
98 |
99 | }
100 | \references{
101 | Google Chart Tools API:
102 | \Sexpr[results=rd]{gsub("CHARTNAME",
103 | googleChartName,
104 | readLines(file.path(".", "inst", "mansections",
105 | "GoogleChartToolsURL.txt")))}
106 |
107 | % END DYNAMIC CONTENT
108 | }
109 | \seealso{
110 | See also \code{\link{print.gvis}}, \code{\link{plot.gvis}} for
111 | printing and plotting methods
112 | }
113 | \author{
114 | Markus Gesmann \email{markus.gesmann@gmail.com},
115 |
116 | Diego de Castillo \email{decastillo@gmail.com}
117 | }
118 | \keyword{iplot}
119 |
--------------------------------------------------------------------------------
/man/gvisMap.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gvisMap.R
3 | \name{gvisMap}
4 | \alias{gvisMap}
5 | \title{Google Maps with R
6 | \Sexpr{googleChartName <- "map"}
7 | \Sexpr{gvisChartName <- "gvisMap"}}
8 | \usage{
9 | gvisMap(data, locationvar = "", tipvar = "", options = list(), chartid)
10 | }
11 | \arguments{
12 | \item{data}{a \code{data.frame}. The data has to have at least two columns
13 | with location name (\code{locationvar}) and the variable to display the text
14 | in the tip icon (\code{tipvar}).}
15 |
16 | \item{locationvar}{column name of \code{data} with the geo locations to be
17 | analysed. The locations can be provide in two formats: \describe{
18 | \item{Format 1}{'latitude:longitude'. See the example below.} \item{Format
19 | 2}{The first column should be a string that contains an address. This
20 | address should be as complete as you can make it. } }}
21 |
22 | \item{tipvar}{column name of \code{data} with the string text displayed over
23 | the tip icon.}
24 |
25 | \item{options}{list of configuration options for Google Map.
26 |
27 | % START DYNAMIC CONTENT
28 |
29 | \Sexpr[results=rd]{gsub("CHARTNAME",
30 | googleChartName,
31 | readLines(file.path(".", "inst", "mansections",
32 | "GoogleChartToolsURLConfigOptions.txt")))}
33 |
34 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
35 | "mansections", "gvisOptions.txt")))}}
36 |
37 | \item{chartid}{character. If missing (default) a random chart id will be
38 | generated based on chart type and \code{\link{tempfile}}}
39 | }
40 | \value{
41 | \Sexpr[results=rd]{paste(gvisChartName)} returns list
42 | of \code{\link{class}}
43 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
44 | "mansections", "gvisOutputStructure.txt")))}
45 | }
46 | \description{
47 | The gvisMap function reads a data.frame and creates text output referring to
48 | the Google Visualisation API, which can be included into a web page, or as a
49 | stand-alone page.
50 | }
51 | \details{
52 | The maps are the well known Google Maps.
53 | }
54 | \examples{
55 |
56 | ## Please note that by default the googleVis plot command
57 | ## will open a browser window and requires Internet
58 | ## connection to display the visualisation.
59 |
60 | ## Example with latitude and longitude information
61 | ## Plot Hurricane Andrew (1992) storm path:
62 |
63 | data(Andrew)
64 |
65 | M1 <- gvisMap(Andrew, "LatLong" , "Tip",
66 | options=list(showTip=TRUE, showLine=TRUE, enableScrollWheel=TRUE,
67 | mapType='hybrid', useMapTypeControl=TRUE,
68 | width=800,height=400))
69 |
70 | plot(M1)
71 |
72 |
73 | ## Example with address, here UK post-code and some html code in tooltip
74 |
75 | df <- data.frame(Postcode=c("EC3M 7HA", "EC2P 2EJ"),
76 | Tip=c("
Lloyd's",
77 | "
Guildhall"))
78 |
79 | M2 <- gvisMap(df, "Postcode", "Tip",
80 | options=list(showTip=TRUE, mapType='normal',
81 | enableScrollWheel=TRUE))
82 |
83 | plot(M2)
84 |
85 | ## Change mapping icons
86 | M3 <- gvisMap(df, "Postcode", "Tip",
87 | options=list(showTip=TRUE, mapType='normal',
88 | enableScrollWheel=TRUE,
89 | icons=paste0("{",
90 | "'default': {'normal': 'https://icons.iconarchive.com/",
91 | "icons/icons-land/vista-map-markers/48/",
92 | "Map-Marker-Ball-Azure-icon.png',\n",
93 | "'selected': 'https://icons.iconarchive.com/",
94 | "icons/icons-land/vista-map-markers/48/",
95 | "Map-Marker-Ball-Right-Azure-icon.png'",
96 | "}}")))
97 |
98 | plot(M3)
99 | }
100 | \references{
101 | Google Chart Tools API:
102 | \Sexpr[results=rd]{gsub("CHARTNAME",
103 | googleChartName,
104 | readLines(file.path(".", "inst", "mansections",
105 | "GoogleChartToolsURL.txt")))}
106 |
107 | % END DYNAMIC CONTENT
108 | }
109 | \seealso{
110 | See also \code{\link{print.gvis}}, \code{\link{plot.gvis}} for printing and
111 | plotting methods, \code{\link{gvisGeoChart}} for an alternative to \code{gvisMap}.
112 | }
113 | \author{
114 | Markus Gesmann \email{markus.gesmann@gmail.com},
115 |
116 | Diego de Castillo \email{decastillo@gmail.com}
117 | }
118 | \keyword{iplot}
119 |
--------------------------------------------------------------------------------
/man/gvisMerge.Rd:
--------------------------------------------------------------------------------
1 | \name{gvisMerge}
2 | \alias{gvisMerge}
3 | \title{
4 | Merge two googleVis charts into one gvis-object
5 | }
6 | \description{
7 | gvisMerge merges two gvis-objects, either next or below
8 | each other into one gvis-object. The objects are arranged in a HTML table.
9 | }
10 | \usage{
11 | gvisMerge(x, y, horizontal = FALSE,
12 | tableOptions = "border=\"0\"", chartid)
13 | }
14 | \arguments{
15 | \item{x}{a \code{gvis}-object.
16 | }
17 | \item{y}{a \code{gvis}-object.
18 | }
19 | \item{horizontal}{boolean. Default \code{FALSE}. If \code{FALSE} the
20 | two \code{gvis}-objects are arranged below each other, otherwise
21 | next to each other.
22 | }
23 | \item{tableOptions}{a valid HTML table option string. Default \code{"border=\"0\""}.
24 | }
25 | \item{chartid}{character. If missing (default) a random chart id will be generated based on
26 | chart type and \code{\link{tempfile}}
27 | }
28 | }
29 | %\details{
30 | %% ~~ If necessary, more details than the description above ~~
31 | %}
32 | \value{
33 | \code{gvisMerge} returns list of \code{\link{class}} "\code{gvis}" and "\code{list}".
34 |
35 | An object of class "\code{gvis}" is a list containing at least the following components:
36 | \item{\code{type}}{Google visualisation type, here 'gvisMerge'}
37 | \item{\code{chartid}}{character id of the chart object. Unique chart
38 | ids are required to place several charts on the same page.
39 | }
40 | \item{\code{html}}{a list with the building blocks for a page
41 | \describe{
42 | \item{\code{header}}{a character string of a html page header:
43 | \code{...},}
44 | \item{\code{chart}}{a named character vector of the chart's building blocks:
45 | \describe{
46 | \item{\code{jsHeader}}{Opening \code{}.
60 | }
61 | \item{\code{jsChart}}{Call of the \code{jsDisplayChart}
62 | function.
63 | }
64 | \item{\code{divChart}}{\code{
} container to embed the chart
65 | into the page.
66 | }
67 | }
68 | }
69 | \item{\code{caption}}{character string of a standard caption,
70 | including data name and chart id.
71 | }
72 | \item{\code{footer}}{character string of a html page footer:
73 | \code{...}, including the used R and googleVis version
74 | and link to Google's Terms of Use.}
75 | }
76 | }
77 | }
78 | \references{
79 | Google Chart Tools API: \url{https://developers.google.com/chart/}
80 |
81 | Follow the link for Google's data policy.
82 | }
83 | \author{
84 | Markus Gesmann \email{markus.gesmann@gmail.com},
85 | }
86 | %%\note{
87 | %% ~~further notes~~
88 | %%}
89 |
90 | \seealso{
91 | See also \code{\link{print.gvis}}, \code{\link{plot.gvis}} for
92 | printing and plotting methods
93 | }
94 | \examples{
95 | ## Please note that by default the googleVis plot command
96 | ## will open a browser window and requires Internet
97 | ## connection to display the visualisation.
98 |
99 | Pie1 <- gvisPieChart(CityPopularity)
100 |
101 | ## Doughnut chart - a pie with a hole
102 | Pie2 <- gvisPieChart(CityPopularity, options=list(
103 | slices="{4: {offset: 0.2}, 0: {offset: 0.3}}",
104 | title='City popularity',
105 | legend='none',
106 | pieSliceText='label',
107 | pieHole=0.5))
108 |
109 | plot(gvisMerge(Pie2, Pie1,
110 | tableOptions = "cellspacing=\"20\" bgcolor=\"#AABBCC\"",
111 | horizontal=TRUE))
112 |
113 | ## Nested charts
114 |
115 | G <- gvisGeoChart(Exports, "Country", "Profit",
116 | options=list(width=250, height=100))
117 | T <- gvisTable(Exports,
118 | options=list(width=250, height=300))
119 |
120 | GT <- gvisMerge(G,T, horizontal=FALSE)
121 | plot(GT)
122 |
123 | M <- gvisMotionChart(Fruits, "Fruit", "Year",
124 | options=list(width=400, height=410))
125 |
126 | GTM <- gvisMerge(GT, M, horizontal=TRUE,
127 | tableOptions="cellspacing=10")
128 | plot(GTM)
129 |
130 |
131 | line <- gvisLineChart(OpenClose, "Weekday", c("Open", "Close"),
132 | options=list(legend='none', width=300, height=150))
133 | column <- gvisColumnChart(OpenClose, "Weekday", c("Open", "Close"),
134 | options=list(legend='none', width=300, height=150))
135 | area <- gvisAreaChart(OpenClose, "Weekday", c("Open", "Close"),
136 | options=list(legend='none', width=300, height=150))
137 | bar <- gvisBarChart(OpenClose, "Weekday", c("Open", "Close"),
138 | options=list(legend='none', width=300, height=150))
139 | LBCA <- gvisMerge(gvisMerge(line, bar), gvisMerge(column, area),
140 | horizontal=TRUE, tableOptions="bgcolor=\"#AABBCC\"")
141 |
142 | plot(LBCA)
143 |
144 | ## Applying gvisMerge successively
145 |
146 | p <- Reduce(gvisMerge, list(line, column, area, bar))
147 | plot(p)
148 |
149 | }
150 | \keyword{ aplot }
151 |
--------------------------------------------------------------------------------
/man/gvisOrgChart.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gvisOrgChart.R
3 | \name{gvisOrgChart}
4 | \alias{gvisOrgChart}
5 | \title{Google Org Chart with R
6 | \Sexpr{googleChartName <- "orgchart"}
7 | \Sexpr{gvisChartName <- "gvisOrgChart"}}
8 | \usage{
9 | gvisOrgChart(
10 | data,
11 | idvar = "",
12 | parentvar = "",
13 | tipvar = "",
14 | options = list(),
15 | chartid
16 | )
17 | }
18 | \arguments{
19 | \item{data}{a \code{data.frame}. The data has to have at least three
20 | columns. Each row in the data table describes one node (a rectangle in the
21 | graph). Each node (except the root node) has one or more parent nodes. Each
22 | node is sized and colored according to its values relative to the other
23 | nodes currently shown.}
24 |
25 | \item{idvar}{column name of \code{data} describing the ID for each node. It
26 | should be unique among all nodes, and can include any characters, including
27 | spaces. This is shown on the node. You can specify a formatted value to show
28 | on the chart instead, but the unformatted value is still used as the ID.}
29 |
30 | \item{parentvar}{column name of \code{data} that match to entries in
31 | \code{idvar}. If this is a root node, leave this \code{NA}. Only one root is
32 | allowed.}
33 |
34 | \item{tipvar}{column name of \code{data} for the tip variable. Tool-tip text
35 | to show, when a user hovers over this node.}
36 |
37 | \item{options}{list of configuration options, see:
38 |
39 | % START DYNAMIC CONTENT
40 |
41 | \Sexpr[results=rd]{gsub("CHARTNAME",
42 | googleChartName,
43 | readLines(file.path(".", "inst", "mansections",
44 | "GoogleChartToolsURLConfigOptions.txt")))}
45 |
46 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
47 | "mansections", "gvisOptions.txt")))}}
48 |
49 | \item{chartid}{character. If missing (default) a random chart id will be
50 | generated based on chart type and \code{\link{tempfile}}}
51 | }
52 | \value{
53 | \Sexpr[results=rd]{paste(gvisChartName)} returns list
54 | of \code{\link{class}}
55 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
56 | "mansections", "gvisOutputStructure.txt")))}
57 | }
58 | \description{
59 | An organizational chart that supports selection.
60 | }
61 | \details{
62 | The gvisOrgChart function reads a data.frame and creates text output
63 | referring to the Google Visualisation API, which can be included into a web
64 | page, or as a stand-alone page. The actual chart is rendered by the web
65 | browser.
66 | }
67 | \examples{
68 |
69 | ## Please note that by default the googleVis plot command
70 | ## will open a browser window and requires Internet
71 | ## connection to display the visualisation.
72 |
73 | Regions
74 | Org1 <- gvisOrgChart(Regions, idvar = "Region", parentvar = "Parent",
75 | tipvar="Val")
76 | plot(Org1)
77 |
78 | ## Set a few options
79 | Org2 <- gvisOrgChart(Regions, idvar = "Region", parentvar = "Parent",
80 | tipvar="Val",
81 | options=list(width=600, height=400,
82 | size='large', allowCollapse=TRUE))
83 | plot(Org2)
84 |
85 | }
86 | \references{
87 | Google Chart Tools API:
88 | \Sexpr[results=rd]{gsub("CHARTNAME",
89 | googleChartName,
90 | readLines(file.path(".", "inst", "mansections",
91 | "GoogleChartToolsURL.txt")))}
92 |
93 | % END DYNAMIC CONTENT
94 | }
95 | \seealso{
96 | See also \code{\link{print.gvis}}, \code{\link{plot.gvis}} for printing and
97 | plotting methods.
98 | }
99 | \author{
100 | Markus Gesmann \email{markus.gesmann@gmail.com},
101 |
102 | Diego de Castillo \email{decastillo@gmail.com}
103 | }
104 | \keyword{iplot}
105 |
--------------------------------------------------------------------------------
/man/gvisPieChart.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gvisPieGaugeChart.R
3 | \name{gvisPieChart}
4 | \alias{gvisPieChart}
5 | \title{Google Pie Chart with R
6 | \Sexpr{googleChartName <- "piechart"}
7 | \Sexpr{gvisChartName <- "gvisPieChart"}}
8 | \usage{
9 | gvisPieChart(data, labelvar = "", numvar = "", options = list(), chartid)
10 | }
11 | \arguments{
12 | \item{data}{a \code{\link{data.frame}} to be displayed as a pie chart}
13 |
14 | \item{labelvar}{Name of the character column which contains the category
15 | labels for the slice labels.}
16 |
17 | \item{numvar}{a vector of column names of the numerical variables of the
18 | slice values.}
19 |
20 | \item{options}{list of configuration options for Google Pie Charts, see:
21 |
22 | % START DYNAMIC CONTENT
23 |
24 | \Sexpr[results=rd]{gsub("CHARTNAME",
25 | googleChartName,
26 | readLines(file.path(".", "inst", "mansections",
27 | "GoogleChartToolsURLConfigOptions.txt")))}
28 |
29 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
30 | "mansections", "gvisOptions.txt")))}}
31 |
32 | \item{chartid}{character. If missing (default) a random chart id will be
33 | generated based on chart type and \code{\link{tempfile}}}
34 | }
35 | \value{
36 | \Sexpr[results=rd]{paste(gvisChartName)} returns list
37 | of \code{\link{class}}
38 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
39 | "mansections", "gvisOutputStructure.txt")))}
40 | }
41 | \description{
42 | The gvisPieChart function reads a data.frame and creates text output
43 | referring to the Google Visualisation API, which can be included into a web
44 | page, or as a stand-alone page. The actual chart is rendered by the web
45 | browser using SVG or VML.
46 | }
47 | \examples{
48 |
49 | ## Please note that by default the googleVis plot command
50 | ## will open a browser window and requires an internet
51 | ## connection to display the visualisation.
52 |
53 | Pie1 <- gvisPieChart(CityPopularity)
54 | plot(Pie1)
55 |
56 | ## Doughnut chart - a pie with a hole
57 | Pie2 <- gvisPieChart(CityPopularity, options=list(
58 | slices="{4: {offset: 0.2}, 0: {offset: 0.3}}",
59 | title='City popularity',
60 | legend='none',
61 | pieSliceText='label',
62 | pieHole=0.5))
63 | plot(Pie2)
64 |
65 |
66 |
67 | }
68 | \references{
69 | Google Chart Tools API:
70 | \Sexpr[results=rd]{gsub("CHARTNAME",
71 | googleChartName,
72 | readLines(file.path(".", "inst", "mansections",
73 | "GoogleChartToolsURL.txt")))}
74 |
75 | % END DYNAMIC CONTENT
76 | }
77 | \seealso{
78 | See also \code{\link{print.gvis}}, \code{\link{plot.gvis}} for
79 | printing and plotting methods
80 | }
81 | \author{
82 | Markus Gesmann \email{markus.gesmann@gmail.com},
83 |
84 | Diego de Castillo \email{decastillo@gmail.com}
85 | }
86 | \keyword{iplot}
87 |
--------------------------------------------------------------------------------
/man/gvisSankey.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gvisSankey.R
3 | \name{gvisSankey}
4 | \alias{gvisSankey}
5 | \title{Google Sankey Chart with R
6 | \Sexpr{googleChartName <- "sankey"}
7 | \Sexpr{gvisChartName <- "gvisSankey"}}
8 | \usage{
9 | gvisSankey(data, from = "", to = "", weight = "", options = list(), chartid)
10 | }
11 | \arguments{
12 | \item{data}{data.frame that contains the data to be visualised}
13 |
14 | \item{from}{a string that refers to the column name in
15 | \code{data} for the source nodes to be used}
16 |
17 | \item{to}{a string that refers to the column name in
18 | \code{data} for the destination nodes to be used}
19 |
20 | \item{weight}{name of the column with the numerical weight of the connections}
21 |
22 | \item{options}{list of configuration options.
23 | The options are documented in detail by Google online:
24 |
25 | % START DYNAMIC CONTENT
26 |
27 | \Sexpr[results=rd]{gsub("CHARTNAME",
28 | googleChartName,
29 | readLines(file.path(".", "inst", "mansections",
30 | "GoogleChartToolsURLConfigOptions.txt")))}
31 |
32 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
33 | "mansections", "gvisOptions.txt")))}}
34 |
35 | \item{chartid}{character. If missing (default) a random chart id will be
36 | generated based on chart type and \code{\link{tempfile}}}
37 | }
38 | \value{
39 | \Sexpr[results=rd]{paste(gvisChartName)} returns list
40 | of \code{\link{class}}
41 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
42 | "mansections", "gvisOutputStructure.txt")))}
43 | }
44 | \description{
45 | A sankey diagram is a visualization used to depict a flow from one set of
46 | values to another. The things being connected are called nodes and the
47 | connections are called links. They're named after Captain Sankey, who created
48 | a diagram of steam engine efficiency that used arrows having widths
49 | proportional to heat loss.
50 | }
51 | \section{Warning}{
52 |
53 | The sankey chart may be undergoing substantial revisions in
54 | future Google Charts releases.
55 | }
56 |
57 | \examples{
58 | dat <- data.frame(From=c(rep("A",3), rep("B", 3)),
59 | To=c(rep(c("X", "Y", "Z"),2)),
60 | Weight=c(5,7,6,2,9,4))
61 |
62 | sk1 <- gvisSankey(dat, from="From", to="To", weight="Weight")
63 | plot(sk1)
64 |
65 | sk2 <- gvisSankey(dat, from="From", to="To", weight="Weight",
66 | options=list(sankey="{link: {color: { fill: '#d799ae' } },
67 | node: { color: { fill: '#a61d4c' },
68 | label: { color: '#871b47' } }}"))
69 | plot(sk2)
70 |
71 | }
72 | \references{
73 | Google Chart Tools API:
74 | \Sexpr[results=rd]{gsub("CHARTNAME",
75 | googleChartName,
76 | readLines(file.path(".", "inst", "mansections",
77 | "GoogleChartToolsURL.txt")))}
78 |
79 | % END DYNAMIC CONTENT
80 | }
81 | \author{
82 | Markus Gesmann \email{markus.gesmann@gmail.com}
83 | }
84 | \keyword{iplot}
85 |
--------------------------------------------------------------------------------
/man/gvisScatterChart.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gvisCoreCharts.R
3 | \name{gvisScatterChart}
4 | \alias{gvisScatterChart}
5 | \title{Google Scatter Chart with R
6 | \Sexpr{googleChartName <- "scatterchart"}
7 | \Sexpr{gvisChartName <- "gvisScatterChart"}}
8 | \usage{
9 | gvisScatterChart(data, options = list(), chartid)
10 | }
11 | \arguments{
12 | \item{data}{a \code{\link{data.frame}} to be displayed as a scatter chart.
13 | Two or more columns are required, all must be numeric. The values in the
14 | first column are used for the X-axis. The values in following columns are
15 | used for the Y-axis. Each column is displayed with a separate color.}
16 |
17 | \item{options}{list of configuration options, see:
18 |
19 | % START DYNAMIC CONTENT
20 |
21 | \Sexpr[results=rd]{gsub("CHARTNAME",
22 | googleChartName,
23 | readLines(file.path(".", "inst", "mansections",
24 | "GoogleChartToolsURLConfigOptions.txt")))}
25 |
26 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
27 | "mansections", "gvisOptions.txt")))}}
28 |
29 | \item{chartid}{character. If missing (default) a random chart id will be
30 | generated based on chart type and \code{\link{tempfile}}}
31 | }
32 | \value{
33 | \Sexpr[results=rd]{paste(gvisChartName)} returns list
34 | of \code{\link{class}}
35 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
36 | "mansections", "gvisOutputStructure.txt")))}
37 | }
38 | \description{
39 | The gvisScatterChart function reads a data.frame and creates text output
40 | referring to the Google Visualisation API, which can be included into a web
41 | page, or as a stand-alone page. The actual chart is rendered by the web
42 | browser using SVG or VML.
43 | }
44 | \examples{
45 |
46 | ## Please note that by default the googleVis plot command
47 | ## will open a browser window and requires an internet
48 | ## connection to display the visualisation.
49 |
50 |
51 | ## Scatter chart
52 | Scatter1 <- gvisScatterChart(women)
53 | plot(Scatter1)
54 |
55 | ## Using optional arguments
56 | Scatter2 <- gvisScatterChart(women, options=list(legend="none",
57 | lineWidth=2, pointSize=2,
58 | title="Women", vAxis="{title:'weight (lbs)'}",
59 | crosshair="{ trigger: 'both' }",
60 | hAxis="{title:'height (in)'}", width=500, height=400))
61 |
62 | plot(Scatter2)
63 |
64 |
65 | df=data.frame(x=sin(1:100/3),
66 | Circle=cos(1:100/3),
67 | Ellipse=cos(1:100/3)*0.5)
68 |
69 | ## Plot several variables as smooth curves
70 | Scatter3 <- gvisScatterChart(df,
71 | options=list(curveType='function',
72 | pointSize=0,
73 | lineWidth=2))
74 | plot(Scatter3)
75 |
76 | ## Two series in the same plot with different
77 | ## x-values
78 | df <- data.frame(x=c(2,2,1,3,4),
79 | y1=c(0,3,NA,NA,NA),
80 | y2=c(NA,NA,0,3,2))
81 | Scatter4 <- gvisScatterChart(df,
82 | options=list(lineWidth=2,
83 | pointSize=2))
84 | plot(Scatter4)
85 |
86 | ## Customize points
87 | M <- matrix(nrow=6,ncol=6)
88 | M[col(M)==row(M)] <- 1:6
89 | dat <- data.frame(X=1:6, M)
90 | SC <- gvisScatterChart(dat,
91 | options=list(
92 | title="Customizing points",
93 | legend="right",
94 | pointSize=30,
95 | series="{
96 | 0: { pointShape: 'circle' },
97 | 1: { pointShape: 'triangle' },
98 | 2: { pointShape: 'square' },
99 | 3: { pointShape: 'diamond' },
100 | 4: { pointShape: 'star' },
101 | 5: { pointShape: 'polygon' }
102 | }"))
103 | plot(SC)
104 |
105 | }
106 | \references{
107 | Google Chart Tools API:
108 | \Sexpr[results=rd]{gsub("CHARTNAME",
109 | googleChartName,
110 | readLines(file.path(".", "inst", "mansections",
111 | "GoogleChartToolsURL.txt")))}
112 |
113 | % END DYNAMIC CONTENT
114 | }
115 | \seealso{
116 | See also \code{\link{print.gvis}}, \code{\link{plot.gvis}} for
117 | printing and plotting methods
118 | }
119 | \author{
120 | Markus Gesmann \email{markus.gesmann@gmail.com},
121 |
122 | Diego de Castillo \email{decastillo@gmail.com}
123 | }
124 | \keyword{iplot}
125 |
--------------------------------------------------------------------------------
/man/gvisSteppedAreaChart.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gvisCoreCharts.R
3 | \name{gvisSteppedAreaChart}
4 | \alias{gvisSteppedAreaChart}
5 | \title{Google Stepped Area Chart with R
6 | \Sexpr{googleChartName <- "steppedarechart"}
7 | \Sexpr{gvisChartName <- "gvisSteppedAreChart"}}
8 | \usage{
9 | gvisSteppedAreaChart(data, xvar = "", yvar = "", options = list(), chartid)
10 | }
11 | \arguments{
12 | \item{data}{a \code{\link{data.frame}} to be displayed as a stepped area
13 | chart.}
14 |
15 | \item{xvar}{name of the character column which contains the category labels
16 | for the x-axes.}
17 |
18 | \item{yvar}{a vector of column names of the numerical variables to be
19 | plotted. Each column is displayed as a separate line.}
20 |
21 | \item{options}{list of configuration options, see:
22 |
23 | % START DYNAMIC CONTENT
24 |
25 | \Sexpr[results=rd]{gsub("CHARTNAME",
26 | googleChartName,
27 | readLines(file.path(".", "inst", "mansections",
28 | "GoogleChartToolsURLConfigOptions.txt")))}
29 |
30 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
31 | "mansections", "gvisOptions.txt")))}}
32 |
33 | \item{chartid}{character. If missing (default) a random chart id will be
34 | generated based on chart type and \code{\link{tempfile}}}
35 | }
36 | \value{
37 | \Sexpr[results=rd]{paste(gvisChartName)} returns list
38 | of \code{\link{class}}
39 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
40 | "mansections", "gvisOutputStructure.txt")))}
41 | }
42 | \description{
43 | The gvisSteppedAreaChart function reads a data.frame and creates text output
44 | referring to the Google Visualisation API, which can be included into a web
45 | page, or as a stand-alone page.
46 | }
47 | \details{
48 | The stepped area chart is rendered within the browser using SVG or VML and
49 | displays tips when hovering over points.
50 | }
51 | \examples{
52 |
53 | ## Please note that by default the googleVis plot command
54 | ## will open a browser window and requires an internet
55 | ## connection to display the visualisation.
56 |
57 | df=data.frame(country=c("US", "GB", "BR"), val1=c(1,3,4), val2=c(23,12,32))
58 |
59 | ## Stepped Area chart
60 | SteppedArea1 <- gvisSteppedAreaChart(df, xvar="country", yvar=c("val1", "val2"))
61 | plot(SteppedArea1)
62 |
63 | ## Stacked chart
64 | SteppedArea2 <- gvisSteppedAreaChart(df, xvar="country", yvar=c("val1", "val2"),
65 | options=list(isStacked=TRUE))
66 | plot(SteppedArea2)
67 |
68 |
69 | ## Add a customised title
70 | SteppedArea3 <- gvisSteppedAreaChart(df, xvar="country", yvar=c("val1", "val2"),
71 | options=list(title="Hello World",
72 | titleTextStyle="{color:'red',fontName:'Courier',fontSize:16}"))
73 | plot(SteppedArea3)
74 |
75 | \dontrun{
76 | ## Change y-axis to percentages
77 | SteppedArea3 <- gvisSteppedAreaChart(df, xvar="country", yvar=c("val1", "val2"),
78 | options=list(vAxis="{format:'#,###\%'}"))
79 | plot(SteppedArea3)
80 | }
81 |
82 | }
83 | \references{
84 | Google Chart Tools API:
85 | \Sexpr[results=rd]{gsub("CHARTNAME",
86 | googleChartName,
87 | readLines(file.path(".", "inst", "mansections",
88 | "GoogleChartToolsURL.txt")))}
89 |
90 | % END DYNAMIC CONTENT
91 | }
92 | \seealso{
93 | See also \code{\link{print.gvis}}, \code{\link{plot.gvis}} for
94 | printing and plotting methods
95 | }
96 | \author{
97 | Markus Gesmann \email{markus.gesmann@gmail.com},
98 |
99 | Diego de Castillo \email{decastillo@gmail.com}
100 | }
101 | \keyword{iplot}
102 |
--------------------------------------------------------------------------------
/man/gvisTable.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gvisTable.R
3 | \name{gvisTable}
4 | \alias{gvisTable}
5 | \title{Google Table Chart with R
6 | \Sexpr{googleChartName <- "table"}
7 | \Sexpr{gvisChartName <- "gvisTable"}}
8 | \usage{
9 | gvisTable(data, options = list(), chartid, formats = NULL)
10 | }
11 | \arguments{
12 | \item{data}{a \code{\link{data.frame}} to be displayed as a table}
13 |
14 | \item{options}{list of configuration options, see:
15 |
16 | % START DYNAMIC CONTENT
17 |
18 | \Sexpr[results=rd]{gsub("CHARTNAME",
19 | googleChartName,
20 | readLines(file.path(".", "inst", "mansections",
21 | "GoogleChartToolsURLConfigOptions.txt")))}
22 |
23 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
24 | "mansections", "gvisOptions.txt")))}}
25 |
26 | \item{chartid}{character. If missing (default) a random chart id will be
27 | generated based on chart type and \code{\link{tempfile}}}
28 |
29 | \item{formats}{named list. If \code{NULL} (default) no specific format will
30 | be used. The named list needs to contain the column names of the data and
31 | the specified format. The format string is a subset of the ICU pattern set.
32 | For instance, \{pattern:'#,###\%'\`\} will result in output values "1,000\%",
33 | "750\%", and "50\%" for values 10, 7.5, and 0.5.}
34 | }
35 | \value{
36 | \Sexpr[results=rd]{paste(gvisChartName)} returns list
37 | of \code{\link{class}}
38 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
39 | "mansections", "gvisOutputStructure.txt")))}
40 | }
41 | \description{
42 | The gvisTable function reads a data.frame and creates text output referring
43 | to the Google Visualisation API, which can be included into a web page, or
44 | as a stand-alone page. The actual chart is rendered by the web browser.
45 | }
46 | \details{
47 | A table that can be sorted and paged. Table cells can be formatted using
48 | format strings, or by directly inserting HTML as cell values. Numeric values
49 | are right-aligned; boolean values are displayed as check marks. Users can
50 | select single rows either with the keyboard or the mouse. Users can sort
51 | rows by clicking on column headers. The header row remains fixed as the user
52 | scrolls. The table fires a number of events corresponding to user
53 | interaction.
54 | }
55 | \examples{
56 |
57 | ## Please note that by default the googleVis plot command
58 | ## will open a browser window and requires Flash and Internet
59 | ## connection to display the visualisation.
60 |
61 | ## Table with links to wikipedia (flags)
62 | tbl1 <- gvisTable(Population)
63 | plot(tbl1)
64 |
65 | ## Table with enabled paging
66 | tbl2 <- gvisTable(Population, options=list(page='enable',
67 | height='automatic',
68 | width='automatic'))
69 |
70 | plot(tbl2)
71 |
72 | ## Table with formating options
73 | tbl3 <- gvisTable(Population, formats=list(Population="#,###"))
74 |
75 | Population[['\% of World Population']] <- Population[['\% of World Population']]/100
76 | tbl4 <- gvisTable(Population, formats=list(Population="#,###",
77 | '\% of World Population'='#.#\%'))
78 | plot(tbl4)
79 |
80 | }
81 | \references{
82 | Google Chart Tools API:
83 | \Sexpr[results=rd]{gsub("CHARTNAME",
84 | googleChartName,
85 | readLines(file.path(".", "inst", "mansections",
86 | "GoogleChartToolsURL.txt")))}
87 |
88 | % END DYNAMIC CONTENT
89 | }
90 | \seealso{
91 | See also \code{\link{print.gvis}}, \code{\link{plot.gvis}} for
92 | printing and plotting methods.
93 | }
94 | \author{
95 | Markus Gesmann \email{markus.gesmann@gmail.com},
96 |
97 | Diego de Castillo \email{decastillo@gmail.com}
98 | }
99 | \keyword{iplot}
100 |
--------------------------------------------------------------------------------
/man/gvisTimeline.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gvisTimeLine.R
3 | \name{gvisTimeline}
4 | \alias{gvisTimeline}
5 | \title{Google Timeline Chart with R
6 | \Sexpr{googleChartName <- "timeline"}
7 | \Sexpr{gvisChartName <- "gvisTimeline"}}
8 | \usage{
9 | gvisTimeline(
10 | data,
11 | rowlabel = "",
12 | barlabel = "",
13 | start = "",
14 | end = "",
15 | options = list(),
16 | chartid
17 | )
18 | }
19 | \arguments{
20 | \item{data}{data.frame that contains the data to be visualised}
21 |
22 | \item{rowlabel}{a string that refers to the column name in
23 | \code{data} for the row labels to be used}
24 |
25 | \item{barlabel}{a string that refers to the column name in
26 | \code{data} for the bar labels to be used}
27 |
28 | \item{start}{number, date or datetime for the start dates}
29 |
30 | \item{end}{number, date or datetime for the end dates}
31 |
32 | \item{options}{list of configuration options.
33 | The options are documented in detail by Google online:
34 |
35 | % START DYNAMIC CONTENT
36 |
37 | \Sexpr[results=rd]{gsub("CHARTNAME",
38 | googleChartName,
39 | readLines(file.path(".", "inst", "mansections",
40 | "GoogleChartToolsURLConfigOptions.txt")))}
41 |
42 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
43 | "mansections", "gvisOptions.txt")))}}
44 |
45 | \item{chartid}{character. If missing (default) a random chart id will be
46 | generated based on chart type and \code{\link{tempfile}}}
47 | }
48 | \value{
49 | \Sexpr[results=rd]{paste(gvisChartName)} returns list
50 | of \code{\link{class}}
51 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
52 | "mansections", "gvisOutputStructure.txt")))}
53 | }
54 | \description{
55 | A timeline is a chart that depicts how a set of resources are used
56 | over time. One popular type of timeline is the Gantt chart.
57 | }
58 | \examples{
59 | dat <- data.frame(Term=c("1","2","3"),
60 | President=c("Whasington", "Adams", "Jefferson"),
61 | start=as.Date(x=c("1789-03-29", "1797-02-03", "1801-02-03")),
62 | end=as.Date(x=c("1797-02-03", "1801-02-03", "1809-02-03")))
63 |
64 | tl <- gvisTimeline(data=dat[,-1], rowlabel="President",
65 | start="start", end="end")
66 | plot(tl)
67 |
68 | tl <- gvisTimeline(data=dat, barlabel="President",
69 | start="start", end="end")
70 | plot(tl)
71 |
72 | tl <- gvisTimeline(data=dat, rowlabel="President",
73 | start="start", end="end",
74 | options=list(timeline="{showRowLabels:false}"))
75 | plot(tl)
76 |
77 | dat <- data.frame(Position=c(rep("President", 3), rep("Vice", 3)),
78 | Name=c("Washington", "Adams", "Jefferson",
79 | "Adams", "Jefferson", "Burr"),
80 | start=as.Date(x=rep(c("1789-03-29", "1797-02-03", "1801-02-03"),2)),
81 | end=as.Date(x=rep(c("1797-02-03", "1801-02-03", "1809-02-03"),2)))
82 |
83 | tl <- gvisTimeline(data=dat, rowlabel="Name",barlabel="Position",
84 | start="start", end="end",
85 | options=list(timeline="{showRowLabels:true}"))
86 | plot(tl)
87 |
88 | tl <- gvisTimeline(data=dat, rowlabel="Name",barlabel="Position",
89 | start="start", end="end",
90 | options=list(timeline="{groupByRowLabel:false}",
91 | backgroundColor='#ffd', height=350,
92 | colors="['#cbb69d', '#603913', '#c69c6e']"))
93 |
94 | plot(tl)
95 |
96 | # Datetime example
97 | dat <- data.frame(Room=c("Room 1","Room 2","Room 3"),
98 | Language=c("English", "German", "French"),
99 | start=as.POSIXct(c("2014-03-14 14:00", "2014-03-14 15:00",
100 | "2014-03-14 14:30")),
101 | end=as.POSIXct(c("2014-03-14 15:00", "2014-03-14 16:00",
102 | "2014-03-14 15:30")))
103 | tl <- gvisTimeline(data=dat, rowlabel="Language",
104 | start="start", end="end")
105 | plot(tl)
106 |
107 | \dontrun{
108 | require(timeline)
109 | data(ww2)
110 | timeline(ww2, ww2.events, event.spots=2, event.label='', event.above=FALSE)
111 | ww2$Person <- gsub("\\\\n" ," ", ww2$Person)
112 | plot(gvisTimeline(ww2, barlabel="Person", rowlabel="Group",
113 | start="StartDate", end="EndDate",
114 | options=list(width=600, height=350))
115 | )
116 | }
117 | }
118 | \references{
119 | Google Chart Tools API:
120 | \Sexpr[results=rd]{gsub("CHARTNAME",
121 | googleChartName,
122 | readLines(file.path(".", "inst", "mansections",
123 | "GoogleChartToolsURL.txt")))}
124 |
125 | % END DYNAMIC CONTENT
126 | }
127 | \author{
128 | Markus Gesmann \email{markus.gesmann@gmail.com}
129 | }
130 | \keyword{iplot}
131 |
--------------------------------------------------------------------------------
/man/gvisWordTree.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gvisWordTree.R
3 | \name{gvisWordTree}
4 | \alias{gvisWordTree}
5 | \title{Google Word Tree with R
6 | \Sexpr{googleChartName <- "wordtree"}
7 | \Sexpr{gvisChartName <- "gvisWordTree"}}
8 | \usage{
9 | gvisWordTree(
10 | data,
11 | textvar = "",
12 | sizevar = "",
13 | stylevar = "",
14 | idvar = "",
15 | parentvar = "",
16 | options = list(),
17 | method = "implicit",
18 | chartid
19 | )
20 | }
21 | \arguments{
22 | \item{data}{\code{data.frame} that contains the data to be visualised}
23 |
24 | \item{textvar}{a string that refers to the column name in \code{data} that
25 | contains the text to be used.}
26 |
27 | \item{sizevar}{a string that refers to the column name in \code{data} that
28 | contains the size of the words in the word tree.}
29 |
30 | \item{stylevar}{a string that refers to the column name in \code{data} that
31 | contains the stlye of the text.
32 | For no warning message in plot, should be called \code{.style}.}
33 |
34 | \item{idvar}{(only when format is explicit) a string that refers to the
35 | column name in \code{data} that contains the unique ID of the text.}
36 |
37 | \item{parentvar}{(only when format is explicit) a string that refers to the
38 | column name in \code{data} that contains the ID of the parent of the text.}
39 |
40 | \item{options}{list of configuration options, see:
41 |
42 | % START DYNAMIC CONTENT
43 |
44 | \Sexpr[results=rd]{gsub("CHARTNAME",
45 | googleChartName,
46 | readLines(file.path(".", "inst", "mansections",
47 | "GoogleChartToolsURLConfigOptions.txt")))}
48 |
49 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
50 | "mansections", "gvisOptions.txt")))}}
51 |
52 | \item{method}{a string to say whether the word tree is either:
53 | \describe{
54 | \item{\code{implicit}}{ - will weight and connect automatically, or}
55 | \item{\code{explicit}}{ - can specify weights and connections}
56 | }}
57 |
58 | \item{chartid}{character. If missing (default) a random chart id will be
59 | generated based on chart type and \code{\link{tempfile}}}
60 | }
61 | \value{
62 | \Sexpr[results=rd]{paste(gvisChartName)} returns list
63 | of \code{\link{class}}
64 | \Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
65 | "mansections", "gvisOutputStructure.txt")))}
66 | }
67 | \description{
68 | A word tree depicts multiple parallel sequences of words. It could be used to
69 | show which words most often follow or precede a target word
70 | (e.g., "Cats are...") or to show a hierarchy of terms (e.g., a decision tree).
71 | }
72 | \section{Warning}{
73 |
74 | The word tree chart may be undergoing substantial revisions in
75 | future Google Charts releases.
76 | }
77 |
78 | \examples{
79 | ## Please note that by default the googleVis plot command
80 | ## will open a browser window and requires Internet
81 | ## connection to display the visualisation.
82 |
83 | wt1 <- gvisWordTree(Cats, textvar = "Phrase")
84 | plot(wt1)
85 |
86 | Cats2 <- Cats
87 | Cats2$Phrase.style <- ifelse(Cats$Sentiment >= 7, "green",
88 | ifelse(Cats$Sentiment <= 3, "red", "black"))
89 |
90 | wt2 <- gvisWordTree(Cats2, textvar = "Phrase", stylevar = "Phrase.style",
91 | options = list(fontName = "Times-Roman",
92 | wordtree = "{word: 'cats'}",
93 | backgroundColor = "#cba"))
94 | plot(wt2)
95 |
96 | # Explicit word tree
97 | exp.data <- data.frame(id = as.numeric(0:9),
98 | label = letters[1:10],
99 | parent = c(-1, 0, 0, 0, 2, 2, 4, 6, 1, 7),
100 | size = c(10, 5, 3, 2, 2, 2, 1, 1, 5, 1),
101 | stringsAsFactors = FALSE)
102 |
103 | wt3 <- gvisWordTree(exp.data, idvar = "id", textvar = "label",
104 | parentvar = "parent", sizevar = "size",
105 | options = list(wordtree = "{format: 'explicit'}"),
106 | method = "explicit")
107 | plot(wt3)
108 |
109 | }
110 | \references{
111 | Google Chart Tools API:
112 | \Sexpr[results=rd]{gsub("CHARTNAME",
113 | googleChartName,
114 | readLines(file.path(".", "inst", "mansections",
115 | "GoogleChartToolsURL.txt")))}
116 |
117 | % END DYNAMIC CONTENT
118 | }
119 | \author{
120 | Ashley Baldry
121 | }
122 | \keyword{iplot}
123 |
--------------------------------------------------------------------------------
/man/renderGvis.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/shiny.R
3 | \name{renderGvis}
4 | \alias{renderGvis}
5 | \title{renderGvis}
6 | \usage{
7 | renderGvis(expr, env = parent.frame(), quoted = FALSE)
8 | }
9 | \arguments{
10 | \item{expr}{An expression that returns a gvis object.}
11 |
12 | \item{env}{The environment in which to evaluate \code{expr}}
13 |
14 | \item{quoted}{Is \code{expr} a quoted expression (with \code{quote()})?
15 | This is useful if you want to save an expression in a variable.}
16 | }
17 | \value{
18 | Returns a function that can be assigned to a Shiny \code{output}
19 | element.
20 | }
21 | \description{
22 | This function lets you use googleVis charts as Shiny output.
23 | Use it to wrap a googleVis-generating function that you assign to an
24 | \code{output} element in \code{server.R}; then create an \code{htmlOutput}
25 | with the same name in \code{ui.R}.
26 | }
27 | \details{
28 | Use a googleVis Chart as Shiny Output
29 | }
30 | \section{Details}{
31 |
32 | More information about shiny is available online:
33 | \url{https://shiny.posit.co/}.
34 | You find further examples with googleVis on shiny on mages' blog:
35 | \url{https://magesblog.com/tags/shiny/}
36 | }
37 |
38 | \examples{
39 |
40 | \dontrun{
41 | # To run this example:
42 | shiny::runApp(system.file("shiny/", package="googleVis"))
43 | # server.R
44 | library(googleVis)
45 |
46 | shinyServer(function(input, output) {
47 | datasetInput <- reactive({
48 | switch(input$dataset,
49 | "rock" = rock,
50 | "pressure" = pressure,
51 | "cars" = cars)
52 | })
53 |
54 | output$view <- renderGvis({
55 | gvisScatterChart(datasetInput(),
56 | options=list(title=paste('Data:',input$dataset)))
57 | })
58 | })
59 |
60 | # ui.R
61 | shinyUI(pageWithSidebar(
62 | headerPanel("googleVis on Shiny"),
63 | sidebarPanel(
64 | selectInput("dataset", "Choose a dataset:",
65 | choices = c("rock", "pressure", "cars"))
66 | ),
67 | mainPanel(
68 | htmlOutput("view")
69 | )
70 | ))
71 | }
72 |
73 |
74 | }
75 | \author{
76 | Joe Cheng, \email{joe@rstudio.com}
77 | }
78 | \keyword{shiny}
79 |
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-120x120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mages/googleVis/00b6a2be6c12082d6cba1e95203e1e17f1bf27c2/pkgdown/favicon/apple-touch-icon-120x120.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-152x152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mages/googleVis/00b6a2be6c12082d6cba1e95203e1e17f1bf27c2/pkgdown/favicon/apple-touch-icon-152x152.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-180x180.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mages/googleVis/00b6a2be6c12082d6cba1e95203e1e17f1bf27c2/pkgdown/favicon/apple-touch-icon-180x180.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-60x60.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mages/googleVis/00b6a2be6c12082d6cba1e95203e1e17f1bf27c2/pkgdown/favicon/apple-touch-icon-60x60.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-76x76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mages/googleVis/00b6a2be6c12082d6cba1e95203e1e17f1bf27c2/pkgdown/favicon/apple-touch-icon-76x76.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mages/googleVis/00b6a2be6c12082d6cba1e95203e1e17f1bf27c2/pkgdown/favicon/apple-touch-icon.png
--------------------------------------------------------------------------------
/pkgdown/favicon/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mages/googleVis/00b6a2be6c12082d6cba1e95203e1e17f1bf27c2/pkgdown/favicon/favicon-16x16.png
--------------------------------------------------------------------------------
/pkgdown/favicon/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mages/googleVis/00b6a2be6c12082d6cba1e95203e1e17f1bf27c2/pkgdown/favicon/favicon-32x32.png
--------------------------------------------------------------------------------
/pkgdown/favicon/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mages/googleVis/00b6a2be6c12082d6cba1e95203e1e17f1bf27c2/pkgdown/favicon/favicon.ico
--------------------------------------------------------------------------------
/vignettes/googleVis_examples.Rmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: "googleVis examples"
3 | author: "Markus Gesmann and Diego de Castillo"
4 | date: "`r Sys.Date()`"
5 | output:
6 | html_document:
7 | toc: true
8 | toc_depth: 2
9 | toc_float:
10 | collapsed: false
11 | smooth_scroll: false
12 | number_sections: true
13 | self_contained: false
14 | ---
15 |
16 |
20 |
21 |
22 | ```{js, echo=FALSE}
23 | $('.title').css('color', 'darkred')
24 | ```
25 |
26 | # Demonstration of googleVis
27 |
28 | It may take a little while to load all charts. Please be patient.
29 | All charts require an Internet connection.
30 |
31 | These examples are taken from the googleVis demo.
32 | You can execute the demo via
33 | ```{r demo, eval=FALSE}
34 | library(googleVis)
35 | demo(googleVis)
36 | ```
37 |
38 | For more details about the charts and further examples see the
39 | help files of the individual googleVis function and review the
40 | [Google Charts API documentation](https://developers.google.com/chart/interactive/docs/gallery) and [Terms of Service](https://developers.google.com/chart/terms).
41 |
42 | ## Line chart
43 | ```{r setOptions, message=FALSE, echo=FALSE}
44 | library(googleVis)
45 | library(knitr)
46 | op <- options(gvis.plot.tag='chart')
47 | read_demo('googleVis', 'googleVis')
48 | ```
49 | ```{r testData, tidy=FALSE}
50 | ```
51 | ```{r LineChart, results='asis', tidy=FALSE}
52 | ```
53 |
54 | ### Line chart with two axis
55 | ```{r TwoAxis, results='asis', tidy=FALSE}
56 | ```
57 |
58 | ## Bar chart
59 | ```{r BarChart, results='asis', tidy=FALSE}
60 | ```
61 |
62 | ## Column chart
63 | ```{r ColumnChart, results='asis', tidy=FALSE}
64 | ```
65 |
66 | ## Area chart
67 | ```{r AreaChart, results='asis', tidy=FALSE}
68 | ```
69 |
70 | ## Stepped Area chart
71 | ```{r SteppedAreaChart, results='asis', tidy=FALSE}
72 | ```
73 |
74 | ## Combo chart
75 | ```{r ComboChart, results='asis', tidy=FALSE}
76 | ```
77 |
78 | ## Scatter chart
79 | ```{r ScatterChart, results='asis', tidy=FALSE}
80 | ```
81 |
82 | ## Bubble chart
83 | ```{r BubbleChart, results='asis', tidy=FALSE}
84 | ```
85 |
86 | ### Customizing Lines
87 | ```{r CustomizingLines, results='asis', tidy=FALSE}
88 | ```
89 |
90 |
91 | ## Customizing points
92 | ```{r ScatterChartPoints, results='asis', tidy=FALSE}
93 | ```
94 |
95 | ### Add edit button for on the fly customisation
96 | ```{r EditButton, results='asis', tidy=FALSE}
97 | ```
98 | The same option is available for all other charts as well.
99 |
100 | ### A chart with many options set
101 | ```{r SettingOptions, results='asis', tidy=FALSE}
102 | ```
103 |
104 | ## Candlestick chart
105 | ```{r CandlestickChart, results='asis', tidy=FALSE}
106 | ```
107 |
108 | ## Pie chart
109 | ```{r PieChart, results='asis', tidy=FALSE}
110 | ```
111 |
112 | ## Gauge
113 | ```{r Gauge, results='asis', tidy=FALSE}
114 | ```
115 |
116 |
117 | ## Geo Chart
118 | ```{r GeoChart, results='asis', tidy=FALSE}
119 | ```
120 |
121 | ### Example showing US data by state
122 | ```{r USStateData, results='asis', tidy=FALSE}
123 | ```
124 |
125 | ### Show Hurricane Andrew (1992) storm track with markers
126 | ```{r GeoChartHurricaneAndrew, results='asis', tidy=FALSE}
127 | ```
128 |
129 | ## Table
130 | ```{r Table, results='asis', tidy=FALSE}
131 | ```
132 | Click on the column header to sort the rows
133 |
134 | ### Table with pages
135 | ```{r TableWithPages, results='asis', tidy=FALSE}
136 | ```
137 |
138 | ## Org chart
139 | ```{r OrgChart, results='asis', tidy=FALSE}
140 | ```
141 | Double click on a parent to collapse all its children.
142 |
143 | ## Tree Map
144 | ```{r TreeMap, results='asis', tidy=FALSE}
145 | ```
146 | Left mouse-click to drill down, right mouse-click to move up a level.
147 |
148 | ## Annotation chart
149 | ```{r AnnotationChart, results='asis', tidy=FALSE}
150 | ```
151 |
152 | ## Sankey chart
153 | ```{r SankeyChart, results='asis', tidy=FALSE}
154 | ```
155 |
156 | ## Histogram
157 | ```{r Histogram, results='asis', tidy=FALSE}
158 | ```
159 |
160 | ## Calendar chart
161 | ```{r CalendarChart, results='asis', tidy=FALSE}
162 | ```
163 |
164 | ## Timeline chart
165 | ```{r Timeline, results='asis', tidy=FALSE}
166 | ```
167 |
168 | ## Gantt chart
169 | ```{r Gantt, results='asis', tidy=FALSE}
170 | ```
171 |
172 |
173 | ## Word tree chart
174 | ```{r WordTree, results='asis', tidy=FALSE}
175 | ```
176 |
177 | ## Merging charts
178 | ```{r gvisMerge, results='asis', tidy=FALSE}
179 | ```
180 |
181 |
--------------------------------------------------------------------------------