Magazine
 
Quick Review:Ajax
 
Ajax and XML: Five cool Ajax widgets

The SWF/Gauge widget

Another attractive way to present data is as a gauge. Personally, I’m not much on the gauge idea, because it takes up a lot of space to present just a little information. But gauges are a key feature of executive dashboards, so the ability to create them quickly is convenient.

But if the Web doesn’t do simple bar charts very well, it certainly doesn’t do circular gauges well. So, I went back to the same company that created XML/Graph, and wouldn’t you know it? They also have a solution for gauges: ML/Gauge.

I’ll start with the HTML page that embeds the SWF/Gauge widget, as shown in Listing 3.

Listing 3. Gauge_page.html

<html><body>
<object classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase=”http://download.macromedia.com/.../swflash.cab#version=6,0,0,0"
width=”110" height=”55">
<param name=movie VALUE=”gauge.swf?xml_source=gauge_data.xml”>
<embed src=”gauge.swf?xml_source=gauge_data.xml”
width=”110" height=”55" type=”application/x-shockwave-flash”
pluginspace=”http://www.macromedia.com/go/getflashplayer”>
</embed></object>
</body></html>
That gauge.swf movie takes a single argument: the location of the data. In this case, the location is
gauge_data.xml, which is shown in Listing 4 .
Listing 4. Gauge_data.xml
<gauge>
<circle fill_color=”888888" start=”275" fill_alpha=”100"
line_color=”555555" line_thickness=”3" line_alpha=”90"
radius=”50" x=”55" end=”445" y=”55"/>
<circle fill_color=”99bbff” start=”280" fill_alpha=”90"
line_thickness=”4" line_alpha=”20" radius=”45" x=”55"
end=”440" y=”55"/>
<circle fill_color=”666666" start=”317" fill_alpha=”100"
line_color=”333333" line_alpha=”0" radius=”44" x=”55"
end=”322" y=”55"/>
<circle fill_color=”666666" start=”337" fill_alpha=”100"
line_color=”333333" line_alpha=”0" radius=”44" x=”55"
end=”342" y=”55"/>
<circle fill_color=”666666" start=”357" fill_alpha=”100"
line_color=”333333" line_alpha=”0" radius=”44" x=”55"
end=”362" y=”55"/>
<circle fill_color=”666666" start=”377" fill_alpha=”100"

Apr 2008 | Java Jazz Up | 50
 
previous
index
next
 
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,

30
, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53 , 54, 55, 56, 57,

58
, 59, 60, 61, 62, 63 , 64, 65 , 66 , 67 , 68 , 69 , 70, 71, 72, 73, 74, 75, 76, 77, 78,   Download PDF