Archive for March, 2012

Google visualization donut chart

Published by Ron Keler in Data visualization on March 29th, 2012 | 17 Comments »

While working on an iPad compatible version for our healthcare enrollment dashboard, i wrote about utilizing google visualization API charts. One of the chart types we utilized in Xcelsius was a donut chart, and while the google visualization library doesn’t have a donus chart per se, i was able to produce one using some layering techniques. This nice interactive donut chart will render just as well on any browser or device. You can find the source code below. Enjoy.

 

donut.html src:
<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
       var data = new google.visualization.DataTable();
       data.addColumn('string', 'Task');
       data.addColumn('number', 'Hours per Day');
       data.addRows([
       ['A',    roundNumber(11*Math.random(),2)],
       ['B',      roundNumber(2*Math.random(),2)],
       ['C',  roundNumber(2*Math.random(),2)],
       ['D', roundNumber(2*Math.random(),2)],
       ['E',    roundNumber(7*Math.random(),2)]
       ]);
var options = {
width: 450, height: 300,
colors:['#ECD078','#D95B43','#C02942','#542437','#53777A'],
legend: {position: 'none'},
   animation:{
       duration: 800,
       easing: 'in'
     }
};
var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
function roundNumber(num, dec) {
 var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
 return result;
}
</script>
</head>
<body>
<div id="link_div" style="z-index: 3; position: absolute; left: 180px; top: 30px;">
<a href="javascript:drawChart()">Change Data</a>
</div>
<div id="chart_div" style="z-index: 1; position: absolute; left: 0px; top: 20px;"></div>
<div id="circle_div" style="z-index: 2; position: absolute; left: 180px; top: 127px;">
<img src="circle.png"></div>
</body>
</html>

Xcelsius Flight Seat Order models visualized

Published by Ron Keler in Xcelsius on March 25th, 2012 | No Comments »

On a recent international flight I had a chance to ponder how much the order of seating passengers really impact the amount of time it takes to get all the passengers seated. On one flight, the crew called passengers to board the plane by row number. Starting from the back of the plane and working their way to the front, row by row, passengers were called to board. On another flight, general boarding commenced immediately. Between passengers who do ignore the ground crew directions regarding which rows are boarding, and the many other variables that impact seating airplane passengers, does it really matter that much? While I do not have enough data to make a call either way, I was able to come up with a visualization exercise for this problem that combines several Xcelsius modeling techniques, such as combining the player selector with a history component to get a staggered dynamic visibility effect (the rows appear in order, and stay painted). Enjoy the XLF here.

Randomize seating order

Live poll using Xcelsius

Published by Ron Keler in Uncategorized on March 14th, 2012 | 21 Comments »

Which phone do you like best? iPhone? Android? Blackberry?

The example below integrates several techniques to come up with an interesting concept: an Xcelsius based live poll. This sample integrates Xcelsius with ajax to store your vote in the database table, xml feed to report the results of the current poll, and eic (external interface connection) to fire the xml connection when after firing the vote ajax function. By the way, i voted for the iPhone… (This example was tested on firefox)

Dynamically resizing images in Xcelsius

Published by Ron Keler in Xcelsius on March 8th, 2012 | No Comments »

It is sometime useful o be able to dynamically change an image size in Xcelsius, based on user inputs for example, or on a data variable that changes live, or as a result of user input. Xcelsius components, except for charts, are typically fixed in size and position, and there is no way to move or resize components on the fly. However, using the following technique, you can dynamically change the size of images in your Xcelsius swf to fit your data visualization needs.
To accomplish this effect, i used the slideshow component, and bind it to a url that is constructed dynamically based on the user input in the width or height sliders. The url is pointing to a php file that streams the image and changes it’s size based on the width and height variables supplied over the url (using PHP GD library). You can find all the source files (.php, .xlf) here. Enjoy!

 

Xcelsius bubbles

Published by Ron Keler in Xcelsius on March 1st, 2012 | 2 Comments »

Not much to say about this one, i just really like bubbles… Using bubble charts in Xcelsius can be very appealing.

 

© BI HAPPY
CyberChimps