Friday, 10 January 2014

Gauge Macro



This is actually another old macro, but one which I never actually published on this blog.  It did however make a guest appearance in the Presidential Election App over on the Alteryx Public Gallery.

What Does it Do?

Well in that App it produces this part of the final report:

Showing the percentage of Republican or Democrat support for a given geographical area.  In general it produces a gauge giving a visual representation of a percentage field.  To use it you just add the macro to your canvas and give it some input data which contains a percentage field between 0 and 100.  For each row of your data it will generate a gauge visually showing the percentage.

You can also choose how big you want the gauge to be and customize the colors.

How Does it Work?

Now how it works it a little more interesting.  Does it use the work Ned has been doing on HTML visualizations? No.  Does it use the Run Command tool to call some external application to draw the gauge?  No.  It doesn't need to; we already have a tool in Alteryx which will let you draw things: The Report Map tool.  That's right the gauge and the arrow are actually a map!  Obviously not a map of anywhere physically, but made up of spatial objects created and manipulated by Alteryx and rendered by the Report Map tool.

Creating the spatial objects is the fun part and called upon some long ago learned trigonometry from my school days.  I'm not going to go into the exact details here, the macro is commented so download it and take a look at the details.

But I think you'll agree this opens up a whole world of creating custom reporting controls.  We are only limited by our spatial skills in Alteryx.


One thing which could be better in the macro is the way you can choose colors.  At the moment you have to enter a hex format like #ff00ff.  Wouldn't it be great if there was a color picker question type that we could use in macros and apps?  How could I tell Alteryx what a great idea I think that would be I hear you ask?

Well that and any other great ideas that you have for product improvements to Alteryx can be submitted to the Alteryx Idea Center over at the Alteryx Community Site. (I would submit the idea myself, but feature requests carry more weight if they come from real customers ;-) )  But there are already some great ideas over there, so go join in the conversation!