--// Install the package (You must connect before as Administrator)
install.packages("googleVis")
--// Connect the library
library(googleVis)
--// Add data to the chart
df <- data.frame(dataframe)
--//Set up the chart (
gvisBarChart(df, yvar="Total",xvar="Country")
--// Add for horizontal chart
Bar1 <- gvisBarChart(df, yvar="Total",xvar="Country")
--// Add for vertical chart
Column <- gvisColumnChart(df, yvar="Total",xvar="Country")
--// Add for line chart
Line <- gvisLineChart(df, yvar="Total",xvar="Country")
--//Show up horizontal chart
plot(Bar1)
--//Show up vertical chart
plot(Column)
--// Add for pie chart
dataframe <- sqlQuery(channel, "select top 5 chCountryCode as Country, count(iCompanyId) as Total from vCompany group by chCountryCode order by 2 desc")
Pie <- gvisPieChart(dataframe)
plot(Pie)
--//Set up the title, size and area
Bar1 <- gvisBarChart(df, yvar="Total",xvar="Country", options=list(
chartArea="{left:250,top:50,width:\"100%\",height:\"300%\"}",
legend="bottom",
title="Top 10 Countries"))