Skip to main content link. Accesskey S
  • Anonymous
  • Log on
  • Help
  • IBM logo
  • IBM Mashup Center wiki
  • All Wikis
  • Home
  • Community Articles
  • Product Documentation
  • Learning Center


Search

Advanced Search

Categories

Tag Cloud

  • 2.0
  • 3.0
  • 3.0.0.1
  • action widgets
  • actions
  • admin
  • administering
  • administration
  • administrator
  • adminstering
  • AJAX
  • AJAX proxy
  • annotate function
  • annotator
  • API
  • api reference
  • benchmark testing
  • catalog
  • configuing
  • configuration
  • configure
  • configuring
  • creating
  • creating mashups
  • data
  • data mashup builder
  • data mashups
  • database
  • DB2
  • demo
  • deploy
  • deployment
  • designing applications
  • developer
  • developing
  • developing mashups
  • developing widgets
  • documentation
  • ECM Widgets
  • editing
  • Enterprise Content Management Widgets
  • errors
  • events
  • examples
  • explanations
  • feed
  • feed mashups
  • feeds
  • format
  • functions
  • getting started
  • greenhouse
  • guide
  • IMS database feeds
  • IMS feeds
  • IMS transaction feeds
  • installation
  • installing
  • mashup
  • MashupHub
  • mashuphub examples
  • mashuphub users guide
  • mashups
  • messages
  • migrating
  • objects
  • operators
  • Oracle
  • pages
  • payload types
  • pdf
  • performance
  • performance tuning
  • planning
  • product
  • programming
  • proxy
  • rest services
  • security
  • service
  • spaces
  • themes
  • troubleshooting
  • tutorial
  • tutorials
  • upgrading
  • user
  • users
  • v1.0
  • v1.1
  • v2.0
  • v2.0.0.2
  • v4.5.2.1
  • video
  • WAR
  • widget
  • widgets
  • widgets
  • wire
  • YouTube
InformationInformation
You are currently viewing machine translated content. IBM translation might be available. Click IBM Translated Product Documentation to see what is available.X


Home > Find Out How > Using Google Gauge Visualization
Rate this article 1 starRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

Using Google Gauge Visualization 

expanded Abstract
collapsed Abstract
No abstract provided.

IBM Mashup Center provides many great widgets that you can easily use out of the box. There are other useful visualization widgets provided by 3rd parties that could be integrated with into a IBM Mashup Center page. One way to use custom visualization is to create a new iWidget, which will allow you to fully integrate with other iWidgets. Another alternative that is sufficient in most cases is to keep the visualization in a separate HTML page. We can write a simple JavaScript to parse some parameters from the URL, and then use these values in the visualization. This html page can then be integrated to any Mashup application using the URL customizer + website displayer widget.

For example, the Google Visualization provides a Gauge widget that might come in handle in many dashboard mashups. To use it in a mashup, we can create a separate html page that would setup all the appropriate settings for the Gauge widget. In the html page, we will use a simple JavaScript function to parse the gauge label and values from the URL. At run time, we will be able pass in the label and values dynamically as follow:
http://[web server host]/samplePage.html?Label1=Memory&Value1=98&Label2=CPU&Value2=50&Label3=Disk_Space&Value3=20
The following is the sample html page code:

 
<html
 

<head
 

<script type='text/javascript' src='http://www.google.com/jsapi'
 
</script
 

<script type='text/javascript'
 

google.load('visualization', '1', {packages:['gauge']});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Label');
data.addColumn('number', 'Value');
data.addRows(3);
data.setValue(0, 0, getURLParameterValue('Label1'));
data.setValue(0, 1, parseInt(getURLParameterValue('Value1')));
data.setValue(1, 0, getURLParameterValue('Label2'));
data.setValue(1, 1, parseInt(getURLParameterValue('Value2')));
data.setValue(2, 0, getURLParameterValue('Label3'));
data.setValue(2, 1, parseInt(getURLParameterValue('Value3')));

var chart = new google.visualization.Gauge(document.getElementById('chart_div'));
var options = {width: 400, height: 120, redFrom: 90, redTo: 100,
yellowFrom:75, yellowTo: 90, minorTicks: 5};
chart.draw(data, options);
}
function getURLParameterValue( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}
</script
 

</head
 


<body
 

<div id='chart_div'
 
</div
 

</body
 

</html
 


We can display this visualization with the website displayer. Other widgets can then pass the appropriate values into these gauge widgets through the URL such as the following at run time.
http://[web server host]/samplePage.html?Label1=Memory&Value1=98&Label2=CPU&Value2=50&Label3=Disk_Space&Value3=20



About the author

Ronald Leung is a Web 2.0 Mashup Solutions Architect in the Information Management division of IBM. He is located at the IBM Silicon Valley Lab in California, you can reach him at rcleung@us.ibm.com.

expanded Article information
collapsed Article information
Category:
Find Out How
Tags:
Gauge, widget

This Version: Version 23 February 14, 2010 7:00:20 PM by Louis S Mau  IBMer

expanded Attachments (1)
collapsed Attachments (1)

 


File TypeSizeFile NameCreated On
image/jpeg 26 KB googleGauge.JPG 6/22/09 8:22 PM
expanded Versions (23)
collapsed Versions (23)
Version Comparison     
Version Date Changed by               Summary of changes
This version (23) Feb 14, 2010 7:00:20 PM Louis S Mau  
22 Dec 2, 2009 2:34:59 PM Anna G O'Neal  
21 Aug 12, 2009 8:15:16 AM Anna G O'Neal  
20 Jun 23, 2009 12:49:54 PM Anna G O'Neal  
19 Jun 23, 2009 9:36:19 AM Anna G O'Neal  
18 Jun 22, 2009 9:20:02 PM Ronald C Leung  
17 Jun 22, 2009 9:13:46 PM Ronald C Leung  
16 Jun 22, 2009 8:59:22 PM Ronald C Leung  
15 Jun 22, 2009 8:49:45 PM Ronald C Leung  
14 Jun 22, 2009 8:48:29 PM Ronald C Leung  
13 Jun 22, 2009 8:46:52 PM Ronald C Leung  
12 Jun 22, 2009 8:45:13 PM Ronald C Leung  
11 Jun 22, 2009 8:44:14 PM Ronald C Leung  
10 Jun 22, 2009 8:42:23 PM Ronald C Leung  
9 Jun 22, 2009 8:39:17 PM Ronald C Leung  
8 Jun 22, 2009 8:36:34 PM Ronald C Leung  
7 Jun 22, 2009 8:34:17 PM Ronald C Leung  
6 Jun 22, 2009 8:32:04 PM Ronald C Leung  
5 Jun 22, 2009 8:29:17 PM Ronald C Leung  
4 Jun 22, 2009 8:27:47 PM Ronald C Leung  
3 Jun 22, 2009 8:26:50 PM Ronald C Leung  
2 Jun 22, 2009 8:24:11 PM Ronald C Leung  
1 Jun 22, 2009 8:22:36 PM Ronald C Leung  
expanded Comments (0)
collapsed Comments (0)
Copy and paste this wiki markup to link to this article from another article in this wiki.
Go ElsewhereStay ConnectedSubscribe to RSSHelpAbout
  • All Lotus and WebSphere Portal wikis
  • IBM developerWorks
  • IBM Software support
  • IBM Social Business User Experience Blog
  • IBMSocialBizUX on Twitter
  • IBMSocialBizUX on Facebook
  • Lotus product forums
  • IBM Social Business UX blog
  • IBM Collaboration Solutions
  • Recently added feedRecently added
  • Recently edited feedRecently edited
  • Recently added comments feedRecently Added Comments
  • Wiki Help
  • Forgot user name/password
  • Wiki design feedback
  • Content feedback
  • About the wiki
  • About IBM
  • Privacy
  • Contact IBM
  • IBM Terms of use
  • Wiki terms of use