Using Toggles without Script Controls


There have been quite a few tips already about the power of using both Property Controls and Script Controls.  However, there are a lot of authors who either do not have access to Script Controls or who do not want to use them.  There are still some very important tasks you can accomplish with just Property Controls. One such task is a toggle which updates whether or not certain ‘axis are on or off’.


For example, you may want to have a user decide whether or not to use the color by axis on a plot, or the shape, size, or trellis axis.

To do this, we first create a Drop-down list Property Control. This should be attached to a string property. The property value option should be set to ‘Fixed values’, and there should be 2 values: one with a display name of ‘Yes’ and the value set to <Region> (or the name of your column you wish to use here inside the brackets), and the other with a display name of ‘No’ and the value set to <>.
 

Note that if you want to have coloring be continuous, just remove the brackets (<>) from the values.

Once we have our Drop-down list setup, we then need to attach the property to the desired axis. In our example, let’s say we want to use the property control to toggle on and off the color by axis. When its set to ‘No’ there is no column expression used in the Color by axis, and when its set to ‘Yes’ there is a pre-defined column or expression which will be used.

To use this property in the Color by axis, right click on the Color axis selector and select ‘Custom Expression…’


 

 

In the expression we want to insert the colorToggle property we just created.
 

 

If you wish to extend this so that you give the users a choice of what column to use, in addition to the choice to  use no columns, you can do that as well.