Display top five bars in stacked bar chart.

Display top five bars in stacked bar chart.

book

Article ID: KB0081638

calendar_today

Updated On:

Products Versions
Spotfire Analyst ALL

Description

Currently in TIBCO 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.

Issue/Introduction

Display top five bars in stacked bar chart.

Environment

All Supported Operating Systems

Resolution

Follow the steps below to show full top five bars in a stacked bar chart:

SOLUTION 1:

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.

SOLUTION 2:

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)).

Additional Information

Section "Using OVER Expressions in Rules" in "What is Show/Hide Items" in the Help Menu of Spotfire.

Attachments

Display top five bars in stacked bar chart. get_app
Display top five bars in stacked bar chart. get_app