By Tim Dexter-Oracle on Jun 17, 2008
Some of you may have seen the 'shape' support we have with our RTF templates in the documentation, some of you may have played about a bit with it and thought, 'OK, so what can I do with them from a business perspective?' Some of you may have found uses for them, if you have, please share with it the class!
Since they were introduced as a bit of a side project from Edward (back then 'Mr RTF Template') I have always struggled a little when talking about the shape support, yeah, its cool but what can I use it for. I have written about using them to build a gantt chart and we have seen a few other applications for them - overall they fall into the 'well I cant build what I want in your charting engine so I'll have a stab at shapes!'
This past week Mike, our Product Manager dropped a good one into our respective laps. Do we have the ability to generate this:
I took out the performance measure titles but you get the idea.
There is quite a lot going on here, it was funny to see it, I had just seen something very similar as a requirement from another customer. They had actually abandoned they're visualization because it was too confusing. This one seemed much easier to read although technically a little more complex.
I did not think our current charting engine was up to it, maybe some combination of a couple of charts overlaying each other would get it done but it gets messy very quickly doing that. Shapes was an alternative that might just work, all I would need would be some background table, then a couple of yellow triangles, a black one, a circle and a horizontal line - easy!
Did not have any data to work with so came up with some and made some assumptions:
<NAME>c.Makes the coffee really well</NAME>
Looking at the graphic you can hopfully work out how the data maps to an 'icon'. 'COG' is the 'Center of Gravity', an average of the evaluators scores for a given metric. The horizontal line joins the start and end of the evaluators range.
The RTF template for the chart is pretty simple really.
The for-each field is looping over the PERFORMANCE loop, the shapes are sitting atop each other with the following code:
|Yellow Triangle1||<?shape-offset-x:EVAL_START * 104.7?>|
|Yellow Triangle2||<?shape-offset-x:EVAL_END * 104.7?>|
|Black Triangle||<?shape-offset-x:COG * 104.7?>|
|Circle||<?shape-offset-x:VALUE_SELF * 104.7?>|
|Line||<?shape-offset-x:EVAL_START * 104.7?>|
<?shape-size-x:number(EVAL_END) - number(EVAL_START)?>
Straightforward shape stuff, the shape-offset-x moves the shape along the x (horizontal) axis and the shape-size-x (for the line) extends it. Whats the 104.7 for then? Thats the fun part of shapes, in this case its the multiplier to move the object 'x' pixels - I needed to get the shape to sit on the appropriate vertical line and after a litte trial and error I got to 104.7 pts - its not quite there but a little more tweaking will get it spot on.
Shapes are a little funky, they float around on top of the rest of the layout, so our RTF engine has to find them and pin point their position - its not always spot on so you need to do a little 'noodling', a technical term, to get them to the right position. Thank heavens for the template builder to let me 'noodle - test', 'noodle-test', etc.
Here's the final output in PDF
Its close, I missed the last two columns out, thats just simple conditional formatting - I wanted to concentrate on the shape manipulation functionality.
If you get a tough visualization from your users and think how the heck can I do that? Get on and shape up!