## Please note that by default the googleVis plot command
## will open a browser window and requires Internet
## connection to display the visualisation.
data(Stock)
Stock
A1 <- gvisAnnotationChart(Stock, datevar="Date",
numvar="Value", idvar="Device",
titlevar="Title", annotationvar="Annotation",
options=list(displayAnnotations=TRUE,
legendPosition='newRow',
width=600, height=350)
)
plot(A1)
## Two Y-axis
A2 <- gvisAnnotationChart(Stock, datevar="Date",
numvar="Value", idvar="Device",
titlevar="Title", annotationvar="Annotation",
options=list(displayAnnotations=TRUE,
width=600, height=350, scaleColumns='[0,1]',
scaleType='allmaximized')
)
plot(A2)
## Colouring the area below the lines to create an area chart
A3 <- gvisAnnotationChart(Stock, datevar="Date",
numvar="Value", idvar="Device",
titlevar="Title", annotationvar="Annotation",
options=list(
width=600, height=350,
fill=10, displayExactValues=TRUE,
colors="['#0000ff','#00ff00']")
)
plot(A3)
## Data with POSIXct datetime variable
A4 <- gvisAnnotationChart(Andrew, datevar="Date/Time UTC",
numvar="Pressure_mb",
options=list(scaleType='maximized')
)
plot(A4)
# Change background to blue
A5 <- gvisAnnotationChart(Stock, datevar="Date",
numvar="Value", idvar="Device",
titlevar="Title", annotationvar="Annotation",
options=list(
displayAnnotations=TRUE,
chart = "{chartArea:{backgroundColor:'#003b70'}}",
legendPosition='newRow',
width=600, height=350))
plot(A5)
Run the code above in your browser using DataLab