Product: TIBCO Spotfire®
Display top five bars in stacked bar chart.
Currently in Spotfire, when applying Show/Hide rules, it is always the smallest items in the visualization that you are working with. This means that in a stacked bar chart, it is the bar segments that will be shown or hidden when using a basic rule and not the entire bar. When applying a rule to show the top five bars in bar charts, it shows the top five segments in the bar chart and not the whole top five stacked bars.
Follow the steps below to show full top five bars in a stacked bar chart:
1). In the Show/Hide rule type, use the following custom expression.
DenseRank(SUM([YAxisColumn]) over (All([Axis.Color])),"desc")<= N ( change N to value the number of bars you want to show ).
2). Select Rule type as Boolean expression and values must be set to [Axis.Value]. See the attached screenshot (Filename: TopNRule.PNG).
For example, for a bar chart with Sum(Sales) on the Y-axis, custom expression "DenseRank(Sum([Sales]) over (All([Axis.Color])),"desc")<=5" in Show/Hide rule and rule type as Boolean and rule value as [Axis.Value] can be used to show the top five complete bars.
1). Create a calculated column for calculating Dense Rank such as :DenseRank = DenseRank(Count([Yaxiscolumn]) over ([XAxisColumn]),"desc").
2). In the Show/Hide Column, use a custom expression : Avg([DenseRank]).
3). In Rule type select : "Less then or equal to".
4). In Value, enter the value you want to show the number of bars, e.g., 5 . See the attached screenshot (Filename(TopNRuleCalculatedColumn.PNG)).
Section "Using OVER Expressions in Rules" in "What is Show/Hide Items" in the Help Menu of Spotfire.
top 5 bars, top N bars, top 5, bar chart, visualization, stacked bar chart, custom expression, OVER, DenseRank, rule type, Show/Hide rule type, Sum, Al