En-Gauging Output

One of the lesser known and probably even lesser used features we have provided is to support MSWord shape and clipart support ... you know those shapes you use mainly in Powerpoint but sometimes where a simple diagram is needed in Word or you want a goofy piece of clipart in your document.
Its a cool feature but how can you use it in a reporting context? Well the extension of the simple shape support is the ability to manipulate the shapes, you can dulplicate along x and y axes, stretch, skew, rotate, shrink and stretch them ... so what? Well you could think about building your own data visualizations using shapes to build up a 'chart' to represent the data. As an example I have picked on the 'hot' gauge or speedometer ... admittedly more of a BI type object but its a good illustration and will hopefully spark your interest to think of others.


Heres a fairly common sight in reports these days.


Gauge1:


Normally requiring a charting engine to render this output ... you can use your RTF template ... you could even develop a set of objects that could be re-used across the organization.  


Getting in Shape


Apologies, a poor pun ... but you just need to put together a set of MSWord shapes, data enable them and bind them together as a 'group'. At runtime the shapes are then driven by the incoming data in the case of the gauge the amount of rotation of the arrow and the upper, middle and lower measures. In the attached RTF you can see the gauge object, just ungroup it to see how its made up. The only shapes that are manipulated are the arrow and the text areas for the measures and the grouped shape. We manipulate them by putting the controls into the Web tab of the image properties.

We're using the following XML for demo purposes here:

<speeds>
<speed>0</speed>
<speed>20</speed>
<speed>40</speed>
<speed>60</speed>
<speed>80</speed>
<speed>100</speed>
</speeds>
These are pretty well documented in the user guide but I'll explain as I go.



  1. Background 'ring', this is made up of 3 'donut' rings where I have reduced the angle using the yellow carat in MSWord and then colored and rotated them as appropriate to create the desired layout. You could of course play with this and used graduated shading from red to yellow to green or even just use a single half ring and shade it. No controls here, its just a static object.
  2. The arrow, this is an arrow drawn from the bottom center of the ring - this is important because we are going to rotate it and the engine needs to know about which point to rotate the image ie center- bottom. The code to drive the amount of rotation:

    <?shape-rotate:number(.) * 1.8;'c/b'?> 
     - shape-rotate is strangely enough the command to rotate the shape
     - number(.) * 1.8 - this the calculation to work out the rotation in degrees. You can see there is no element name '.' refers to the current element. 
    - c/b - is the shortened version of center/bottom ie the rotation point. Now you see how important it is to start the arrow from the bottom.
  3. The text boxes have some sample test but it is replaced at runtime with a minimum, mid and maximum value for the gauge.

    <?shape-text:$lowVal?>
    <?shape-text:$midVal?>
    <?shape-text:$highVal?>
     - low, mid and highVal variables are calculated earlier in the template to minimize processing
  4. Finally we have the command to repeat the entire shape down the page for as many members of the XML as are available ie 6. This command is added to the grouped properties, you need to group the members of the gauge, right click, Format Object.
    <?for-each@shape:speed?>
    <?shape-offset-y:(position()-1)*150?>
    <?end for-each?>

    <?for-each@shape:speed?>
    The for-each should be familiar, the at shape just tells the engine we're dealing with shapes and looping over the 'speed' group.
    <?shape-offset-y:(position()-1)*150?>
     - this offsets the shape along the y-axis ie down the page. The sneaky bit to ensure that we get a gauge at the position we placed it on the page is yo use the position()-1 expression. Position() returns the record number we are at, first record is 1 and so on. Without the '-1', setting the value to '0' we would not get the gauge showing in the position we initially set it on the template, it would immediately be offset by 150 pixels.

So thats the gauge, not that tough to do and with a little time you can build a much better looking gauge than I did but you get the idea. You could even just put in a background image of your choice so you get something more realistic.


Gauge2:


Heres the sample and Happy Driving !

Comments:

hi, Can i user this Speedometer chart in oracle forms. pl reply me.

Posted by Rajendran on December 07, 2009 at 06:02 PM MST #

You made some good points there. I did a search on the topic and found most people will agree with your blog.

Posted by Ernie Schindele on January 09, 2010 at 02:03 AM MST #

Really good post, this will help me a lot to get comments in my blog. Now I know why people do not comment in my blog.

Posted by Dary Hall on April 27, 2010 at 01:33 PM MDT #

Well the dentist probably knows that we most likely don't brush our teeth for 2 minutes. 2 minutes everytime u brush is the reccomended time to REALLY prevent cavities. Most people only brush for 1 minute but that's not enough.

Posted by Kenneth Waisman on September 25, 2010 at 09:20 PM MDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Follow bipublisher on Twitter Find Us on Facebook BI Publisher Youtube ChannelDiscussion Forum

Join our BI Publisher community to get the most and keep updated with the latest news, How-to, Solutions! Share your feedback and let us hear your voice @bipublisher on Twitter, on our official Facebook page, and Youtube!

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
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
   
       
Today