Jump to content
We've recently updated our Privacy Statement, available here. ×
  • Show labels for the total of each bar for a stacked bar chart with both positive and negative segments


    This article shows a workaround for how to create labels for the total of each bar for a stacked bar chart with both positive and negative segments

    The stacked bar chart in Spotfire lets the user see both the positive and negative segments very clearly. However, when the stacked bar chart has both positive and negative segments it may be harder to judge the total for each bar. In the below screenshot, the top bar chart is not stacked, and it is easy to see that the total value for DIV C is 96. However, in the below bar chart where the bars are stacked this is less obvious, one would have to calculate 147-51 to reach the same conclusion. In some cases, you may want to provide the combined information of both these bar charts in one combined chart. However, Spotfire has no out-of-the-box option for this, so lets instead look at an option for how to acheive this using the Trellis headers.

    example_annotated.thumb.png.96d97410dc97c9daa9d14cb4a8bb151a.png

    The idea is to trellis the visualization by Division, concatenated with the Result. This is easily achieved through the following custom expression on the Trellis by columns axis:

     <[Division] & " - " & Integer(Sum([Result]) OVER ([Division]))>
     

    This then produces the bottom chart in the screenshot below. I have included the top, non-stacked, bar chart as a reference.

    example_with_trellis_annotated.thumb.png.07d8939c6e9a5d295d51f3820a1e3ffc.png

     

    The DXP file used for the screenshots is attached to this article. 

    Hope that this is useful if you encounter this issue in your Spotfire files. Please also note that there is an Idea on the Ideas Portal that suggests to solve this as a label option. The Idea is filed as https://ideas.tibco.com/ideas/SPF-I-5159  Please vote on that Idea if you think it is important, and feel free to suggest a design that you think solves this the best.

    sample_0.zip


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...