Home » Posts tagged 'Chart'
Tag Archives: Chart
Google Visualization Tools Can Help You Build a Personal Dashboard
The Google Visualization API is a great way for people to make dashboards with slick graphics based on data without getting into the fine print of the scripting language itself. It utilizes the same tools as Google itself does, and makes visualizing data using API calls to the Visualization API. Thus a real-time customizable dashboard that is publishable to the internet can be created within minutes, and more importantly insights can be much more easily drawn from graphs than from looking at rows of tables and numbers.
- There are 41 gadgets (including made by both Google and third-party developers ) available in the Gadget Gallery ( https://developers.google.com/chart/interactive/docs/gadgetgallery)
- There are 12 kinds of charts available in the Chart Gallery (https://developers.google.com/chart/interactive/docs/gallery) .
- However there 26 additional charts in the charts page at https://developers.google.com/chart/interactive/docs/more_charts )
Building and embedding charts is simplified to a few steps
- Load the AJAX API
- Load the Visualization API and the appropriate package (like piechart or barchart from the kinds of chart)
- Set a callback to run when the Google Visualization API is loaded
- Within the Callback – It creates and populates a data table, instantiates the particular chart type chosen, passes in the data and draws it.
- Create the data table with appropriately named columns and data rows.
- Set chart options with Title, Width and Height
- Instantiate and draw the chart, passing in some options including the name and id
- Finally write the HTML/ Div that will hold the chart
You can simply copy and paste the code directly from https://developers.google.com/chart/interactive/docs/quick_start without getting into any details, and tweak them according to your data, chart preference and voila your web dashboard is ready!
That is the beauty of working with API- you can create and display genius ideas without messing with the scripting languages and code (too much). If you like to dive deeper into the API, you can look at the various objects at https://developers.google.com/chart/interactive/docs/reference
First launched in Mar 2008, Google Visualization API has indeed come a long way in making dashboards easier to build for people wanting to utilize advanced data visualization . It came about directly as a result of Google’s 2007 acquisition of GapMinder (of Hans Rosling fame).
As invariably and inevitably computing shifts to the cloud, visualization APIs will be very useful. Tableau Software has been a pioneer in selling data visualizing to the lucrative business intelligence and business dashboards community (you can see the Tableau Software API at http://onlinehelp.tableausoftware.com/v7.0/server/en-us/embed_api.htm ), and Google Visualization can do the same and capture business dashboard and visualization market , if there is more focus on integrating it from Google in it’s multiple and often confusing API offerings.
However as of now, this is quite simply the easiest way to create a web dashboard for your personal needs. Google guarantees 3 years of backward compatibility with this API and it is completely free.
JMP 10 released
JMP , the visual data exploration, statistical quality control software from SAS Institute launched version 10 of its software today.
Source-http://jmp.com/about/events/webcasts/jmp_webcast.shtml?name=jmp10
JMP 10 includes:
Numerous enhancements to the drag-and-drop Graph Builder, including a new iPad application.
A cutting-edge Control Chart Builder to create process control charts with drag-and-drop ease.
New reliability capabilities, including growth and forecast models.
Additions and improvements for sorting and filtering data, design of experiments, statistical modeling, scripting, add-in and application development, script debugging and more.
From JohnSall’s blog post at http://blogs.sas.com/content/jmp/2012/03/20/discover-more-with-jmp-10/
Much of the development centered on four focus areas:
1. Graph Builder everywhere. The Graph Builder platform itself has new features like Heatmap and Treemap, an elements palette and properties panel, making the choices more visible. But Graph Builder also has some descendents now, including the new Control Chart Builder, which makes creating control charts an interactive process. In addition, some of the drag-and-drop features that are used to change columns in Graph Builder are also available in Distribution, Fit Y by X, and a few other places. Finally, Graph Builder has been ported to the iPad. For the first time, you can use JMP for exploration and presentation on a mobile device for free. So just think of Graph Builder as gradually taking over in lots of places.
2. Expert-driven design.reliability, measurement systems, and partial least squares analyses.
3. Performance. this release has the most new multithreading so far
4. Application development
You can read more here -http://jmp.com/about/events/webcasts/jmpwebcast_detail.shtml?reglink=70130000001r9IP
Interview Kelci Miclaus, SAS Institute Using #rstats with JMP
Here is an interview with Kelci Miclaus, a researcher working with the JMP division of the SAS Institute, in which she demonstrates examples of how the R programming language is a great hit with JMP customers who like to be flexible.
Ajay- How has JMP been using integration with R? What has been the feedback from customers so far? Is there a single case study you can point out where the combination of JMP and R was better than any one of them alone?
Kelci- Feedback from customers has been very positive. Some customers are using JMP to foster collaboration between SAS and R modelers within their organizations. Many are using JMP’s interactive visualization to complement their use of R. Many SAS and JMP users are using JMP’s integration with R to experiment with more bleeding-edge methods not yet available in commercial software. It can be used simply to smooth the transition with regard to sending data between the two tools, or used to build complete custom applications that take advantage of both JMP and R.
One customer has been using JMP and R together for Bayesian analysis. He uses R to create MCMC chains and has found that JMP is a great tool for preparing the data for analysis, as well as displaying the results of the MCMC simulation. For example, the Control Chart platform and the Bubble Plot platform in JMP can be used to quickly verify convergence of the algorithm. The use of both tools together can increase productivity since the results of an analysis can be achieved faster than through scripting and static graphics alone.
I, along with a few other JMP developers, have written applications that use JMP scripting to call out to R packages and perform analyses like multidimensional scaling, bootstrapping, support vector machines, and modern variable selection methods. These really show the benefit of interactive visual analysis of coupled with modern statistical algorithms. We’ve packaged these scripts as JMP add-ins and made them freely available on our JMP User Community file exchange. Customers can download them and now employ these methods as they would a regular JMP platform. We hope that our customers familiar with scripting will also begin to contribute their own add-ins so a wider audience can take advantage of these new tools.
(see http://www.decisionstats.com/jmp-and-r-rstats/)
Ajay- Are there plans to extend JMP integration with other languages like Python?
Kelci- We do have plans to integrate with other languages and are considering integrating with more based on customer requests. Python has certainly come up and we are looking into possibilities there.
Ajay- How is R a complimentary fit to JMP’s technical capabilities?
Kelci- R has an incredible breadth of capabilities. JMP has extensive interactive, dynamic visualization intrinsic to its largely visual analysis paradigm, in addition to a strong core of statistical platforms. Since our brains are designed to visually process pictures and animated graphs more efficiently than numbers and text, this environment is all about supporting faster discovery. Of course, JMP also has a scripting language (JSL) allowing you to incorporate SAS code, R code, build analytical applications for others to leverage SAS, R and other applications for users who don’t code or who don’t want to code.
JSL is a powerful scripting language on its own. It can be used for dialog creation, automation of JMP statistical platforms, and custom graphic scripting. In other ways, JSL is very similar to the R language. It can also be used for data and matrix manipulation and to create new analysis functions. With the scripting capabilities of JMP, you can create custom applications that provide both a user interface and an interactive visual back-end to R functionality. Alternatively, you could create a dashboard using statistical and/or graphical platforms in JMP to explore the data and with the click of a button, send a portion of the data to R for further analysis.
Another JMP feature that complements R is the add-in architecture, which is similar to how R packages work. If you’ve written a cool script or analysis workflow, you can package it into a JMP add-in file and send it to your colleagues so they can easily use it.
Ajay- What is the official view on R from your organization? Do you think it is a threat, or a complimentary product or another statistical platform that coexists with your offerings?
Kelci- Most definitely, we view R as complimentary. R contributors are providing a tremendous service to practitioners, allowing them to try a wide variety of methods in the pursuit of more insight and better results. The R community as a whole is providing a valued role to the greater analytical community by focusing attention on newer methods that hold the most promise in so many application areas. Data analysts should be encouraged to use the tools available to them in order to drive discovery and JMP can help with that by providing an analytic hub that supports both SAS and R integration.
Ajay- While you do use R, are there any plans to give back something to the R community in terms of your involvement and participation (say at useR events) or sponsoring contests.
Kelci- We are certainly open to participating in useR groups. At Predictive Analytics World in NY last October, they didn’t have a local useR group, but they did have a Predictive Analytics Meet-up group comprised of many R users. We were happy to sponsor this. Some of us within the JMP division have joined local R user groups, myself included. Given that some local R user groups have entertained topics like Excel and R, Python and R, databases and R, we would be happy to participate more fully here. I also hope to attend the useR! annual meeting later this year to gain more insight on how we can continue to provide tools to help both the JMP and R communities with their work.
We are also exploring options to sponsor contests and would invite participants to use their favorite tools, languages, etc. in pursuit of the best model. Statistics is about learning from data and this is how we make the world a better place.
About- Kelci Miclaus
Kelci is a research statistician developer for JMP Life Sciences at SAS Institute. She has a PhD in Statistics from North Carolina State University and has been using SAS products and R for several years. In addition to research interests in statistical genetics, clinical trials analysis, and multivariate analysis/visualization methods, Kelci works extensively with JMP, SAS, and R integration.
.
Top 5 XKCD on Data Visualization
By request, an analysis of Top 5 XKCDs on data visualization. Statisticians and Data Scientists to note-
1) DOT PLOT

2) LINE PLOTS


3) FLOW CHARTS

4) PIE CHARTS and 5) BAR GRAPHS

I am not going into the big big graphs of course like the Star Wars Plot data visualization at
http://xkcd.com/657/ or the Money Chart at http://xkcd.com/980/ because I dont believe in data visualization to show off, but to keep it simple simply
Now I gotta find me a software that can write my blog for me
Using Google Fusion Tables from #rstats
But after all that- I was quite happy to see Google Fusion Tables within Google Docs. Databases as a service ? Not quite but still quite good, and lets see how it goes.
https://www.google.com/fusiontables/DataSource?dsrcid=implicit&hl=en_US&pli=1
http://googlesystem.blogspot.com/2011/09/fusion-tables-new-google-docs-app.html
But what interests me more is
http://code.google.com/apis/fusiontables/docs/developers_guide.html
The Google Fusion Tables API is a set of statements that you can use to search for and retrieve Google Fusion Tables data, insert new data, update existing data, and delete data. The API statements are sent to the Google Fusion Tables server using HTTP GET requests (for queries) and POST requests (for inserts, updates, and deletes) from a Web client application. The API is language agnostic: you can write your program in any language you prefer, as long as it provides some way to embed the API calls in HTTP requests.
The Google Fusion Tables API does not provide the mechanism for submitting the GET and POST requests. Typically, you will use an existing code library that provides such functionality; for example, the code libraries that have been developed for the Google GData API. You can also write your own code to implement GET and POST requests.
Also see http://code.google.com/apis/fusiontables/docs/sample_code.html
Google Fusion Tables API Sample Code
Libraries
SQL API
| Language | Library | Public repository | Samples |
|---|---|---|---|
| Python | Fusion Tables Python Client Library | fusion-tables-client-python/ | Samples |
| PHP | Fusion Tables PHP Client Library | fusion-tables-client-php/ | Samples |
Featured Samples
An easy way to learn how to use an API can be to look at sample code. The table above provides links to some basic samples for each of the languages shown. This section highlights particularly interesting samples for the Fusion Tables API.
SQL API
| Language | Featured samples | API version |
|---|---|---|
| cURL |
|
SQL API |
| Google Apps Script |
|
SQL API |
| Java |
|
SQL API |
| Python |
|
Docs List API |
| Android (Java) |
|
SQL API |
| JavaScript – FusionTablesLayer | Using the FusionTablesLayer, you can display data on a Google Map
Also check out FusionTablesLayer Builder, which generates all the code necessary to include a Google Map with a Fusion Table Layer on your own website. |
FusionTablesLayer, Google Maps API |
| JavaScript – Google Chart Tools | Using the Google Chart Tools, you can request data from Fusion Tables to use in visualizations or to display directly in an HTML page. Note: responses are limited to 500 rows of data. | Google Chart Tools |
External Resources
Google Fusion Tables is dedicated to providing code examples that illustrate typical uses, best practices, and really cool tricks. If you do something with the Google Fusion Tables API that you think would be interesting to others, please contact us at googletables-feedback@google.com about adding your code to our Examples page.
- Shape EscapeA tool for uploading shape files to Fusion Tables.
- GDALOGR Simple Feature Library has incorporated Fusion Tables as a supported format.
- Arc2CloudArc2Earth has included support for upload to Fusion Tables via Arc2Cloud.
- Java and Google App EngineODK Aggregate is an AppEngine application by the Open Data Kit team, uses Google Fusion Tables to store survey data that is collected through input forms on Android mobile phones. Notable code:
- Create a Fusion Table - FusionTableServlet.java
- Insert data into a Fusion Table - SubmissionFusionTable.java
- R packageAndrei Lopatenko has written an R interface to Fusion Tables so Fusion Tables can be used as the data store for R.
- RubySimon Tokumine has written a Ruby gem for access to Fusion Tables from Ruby.
Updated-You can use Google Fusion Tables from within R from http://andrei.lopatenko.com/rstat/fusion-tables.R
ft.connect <- function(username, password) {
url = "https://www.google.com/accounts/ClientLogin";
params = list(Email = username, Passwd = password, accountType="GOOGLE", service= "fusiontables", source = "R_client_API")
connection = postForm(uri = url, .params = params)
if (length(grep("error", connection, ignore.case = TRUE))) {
stop("The wrong username or password")
return ("")
}
authn = strsplit(connection, "\nAuth=")[[c(1,2)]]
auth = strsplit(authn, "\n")[[c(1,1)]]
return (auth)
}
ft.disconnect <- function(connection) {
}
ft.executestatement <- function(auth, statement) {
url = "http://tables.googlelabs.com/api/query"
params = list( sql = statement)
connection.string = paste("GoogleLogin auth=", auth, sep="")
opts = list( httpheader = c("Authorization" = connection.string))
result = postForm(uri = url, .params = params, .opts = opts)
if (length(grep("<HTML>\n<HEAD>\n<TITLE>Parse error", result, ignore.case = TRUE))) {
stop(paste("incorrect sql statement:", statement))
}
return (result)
}
ft.showtables <- function(auth) {
url = "http://tables.googlelabs.com/api/query"
params = list( sql = "SHOW TABLES")
connection.string = paste("GoogleLogin auth=", auth, sep="")
opts = list( httpheader = c("Authorization" = connection.string))
result = getForm(uri = url, .params = params, .opts = opts)
tables = strsplit(result, "\n")
tableid = c()
tablename = c()
for (i in 2:length(tables[[1]])) {
str = tables[[c(1,i)]]
tnames = strsplit(str,",")
tableid[i-1] = tnames[[c(1,1)]]
tablename[i-1] = tnames[[c(1,2)]]
}
tables = data.frame( ids = tableid, names = tablename)
return (tables)
}
ft.describetablebyid <- function(auth, tid) {
url = "http://tables.googlelabs.com/api/query"
params = list( sql = paste("DESCRIBE", tid))
connection.string = paste("GoogleLogin auth=", auth, sep="")
opts = list( httpheader = c("Authorization" = connection.string))
result = getForm(uri = url, .params = params, .opts = opts)
columns = strsplit(result,"\n")
colid = c()
colname = c()
coltype = c()
for (i in 2:length(columns[[1]])) {
str = columns[[c(1,i)]]
cnames = strsplit(str,",")
colid[i-1] = cnames[[c(1,1)]]
colname[i-1] = cnames[[c(1,2)]]
coltype[i-1] = cnames[[c(1,3)]]
}
cols = data.frame(ids = colid, names = colname, types = coltype)
return (cols)
}
ft.describetable <- function (auth, table_name) {
table_id = ft.idfromtablename(auth, table_name)
result = ft.describetablebyid(auth, table_id)
return (result)
}
ft.idfromtablename <- function(auth, table_name) {
tables = ft.showtables(auth)
tableid = tables$ids[tables$names == table_name]
return (tableid)
}
ft.importdata <- function(auth, table_name) {
tableid = ft.idfromtablename(auth, table_name)
columns = ft.describetablebyid(auth, tableid)
column_spec = ""
for (i in 1:length(columns)) {
column_spec = paste(column_spec, columns[i, 2])
if (i < length(columns)) {
column_spec = paste(column_spec, ",", sep="")
}
}
mdata = matrix(columns$names,
nrow = 1, ncol = length(columns),
dimnames(list(c("dummy"), columns$names)), byrow=TRUE)
select = paste("SELECT", column_spec)
select = paste(select, "FROM")
select = paste(select, tableid)
result = ft.executestatement(auth, select)
numcols = length(columns)
rows = strsplit(result, "\n")
for (i in 3:length(rows[[1]])) {
row = strsplit(rows[[c(1,i)]], ",")
mdata = rbind(mdata, row[[1]])
}
output.frame = data.frame(mdata[2:length(mdata[,1]), 1])
for (i in 2:ncol(mdata)) {
output.frame = cbind(output.frame, mdata[2:length(mdata[,i]),i])
}
colnames(output.frame) = columns$names
return (output.frame)
}
quote_value <- function(value, to_quote = FALSE, quote = "'") {
ret_value = ""
if (to_quote) {
ret_value = paste(quote, paste(value, quote, sep=""), sep="")
} else {
ret_value = value
}
return (ret_value)
}
converttostring <- function(arr, separator = ", ", column_types) {
con_string = ""
for (i in 1:(length(arr) - 1)) {
value = quote_value(arr[i], column_types[i] != "number")
con_string = paste(con_string, value)
con_string = paste(con_string, separator, sep="")
}
if (length(arr) >= 1) {
value = quote_value(arr[length(arr)], column_types[length(arr)] != "NUMBER")
con_string = paste(con_string, value)
}
}
ft.exportdata <- function(auth, input_frame, table_name, create_table) {
if (create_table) {
create.table = "CREATE TABLE "
create.table = paste(create.table, table_name)
create.table = paste(create.table, "(")
cnames = colnames(input_frame)
for (columnname in cnames) {
create.table = paste(create.table, columnname)
create.table = paste(create.table, ":string", sep="")
if (columnname != cnames[length(cnames)]){
create.table = paste(create.table, ",", sep="")
}
}
create.table = paste(create.table, ")")
result = ft.executestatement(auth, create.table)
}
if (length(input_frame[,1]) > 0) {
tableid = ft.idfromtablename(auth, table_name)
columns = ft.describetablebyid(auth, tableid)
column_spec = ""
for (i in 1:length(columns$names)) {
column_spec = paste(column_spec, columns[i, 2])
if (i < length(columns$names)) {
column_spec = paste(column_spec, ",", sep="")
}
}
insert_prefix = "INSERT INTO "
insert_prefix = paste(insert_prefix, tableid)
insert_prefix = paste(insert_prefix, "(")
insert_prefix = paste(insert_prefix, column_spec)
insert_prefix = paste(insert_prefix, ") values (")
insert_suffix = ");"
insert_sql_big = ""
for (i in 1:length(input_frame[,1])) {
data = unlist(input_frame[i,])
values = converttostring(data, column_types = columns$types)
insert_sql = paste(insert_prefix, values)
insert_sql = paste(insert_sql, insert_suffix) ;
insert_sql_big = paste(insert_sql_big, insert_sql)
if (i %% 500 == 0) {
ft.executestatement(auth, insert_sql_big)
insert_sql_big = ""
}
}
ft.executestatement(auth, insert_sql_big)
}
}



