In my previous post, we had seen how to customize some aspects of
the bullet graph including the colours of the range values and the
bar (measure value) and the target value (marker). In this post, we
will carry on from there and add conditional formatting based on the data (red or blue).
To duplicate, navigate to the component you are interested in, highlight it and click on the icon to duplicate component as shown below.
I have modified the following values.
These changes are shown below.
Clicking on preview, we can see the following dashboard.
To apply conditional formatting, we need to change in Advanced Properties. Make the following changes in Advanced Properties. Click on values for Extension points
Add the following entry as an additional argument
One of the principles of Information Design is to use colour to
attract attention to something that needs attention. All the other
colours need to be blended so as to not attract attention. I would
like to add the capability that the colour of the bar (measure value)
changes based on which range the value falls in.
Conditional Formatting of a Bullet Graph
Lets start, from the place we left off. Since we have already customized our chart quite a bit, let us duplicate that and start from there.To duplicate, navigate to the component you are interested in, highlight it and click on the icon to duplicate component as shown below.
I have modified the following values.
Parameter | Value | Description |
Name | chtInnovation | Name of the component instance |
Bullet Measures | 69 | The observed measure for this performance indicator |
Title | Innovation/ Technology Investment | A title for all the graphs. In case, the graph is created for multiple categories, one bullet title appears for all the bullet graphs. Usually appears on top of the graph. |
HtmlObject | Panel_3 | Name of the placeholder for the graph. Clicking on backspace in the text input box, displays the list of available html containers. |
These changes are shown below.
Clicking on preview, we can see the following dashboard.
To apply conditional formatting, we need to change in Advanced Properties. Make the following changes in Advanced Properties. Click on values for Extension points
Add the following entry as an additional argument
Argument | Value | Description |
bulletMeasure_fillStyle | function(v,d){var accVar=50;if(d.ranges && d.ranges.length>2){accVar=d.ranges[d.ranges.length-2];} if(v>accVar){return "#43578A";}else{return "#CE2B0F";}} | Adds conditional formatting to the measure bar, that if there are ranges defined in the bullet graph and there are atleast 2 of them, then highlight the fill colour if the measure is less than second last range. |
In the code above, since our measure
value is 69, and the top but one range starts from 75, our graph
should appear in a shade of red rather than the default colour, which
is a shade of blue.
Upon adding, the new argument will look
as following on the Extension points form.
Now saving the graph and previewing it,
we can see the bullet graph colour change when value is less than
second range (75), which means it is a cause for concern, as shown in
the screen below.
In this post, we saw how to add conditional formatting to bullet
graphs so that is there is something that needs to be brought to the
attention of a busy executive, it can be highlighted appropriately
based on relative value of the measure to the ranges.
No comments:
Post a Comment