We can’t display percentages in 
middle of the bars in cognos 10.2, 100% stacked bar chart. But the same 
has been fixed in Cognos 10.2.1.
We can do the same thing using Java Script. just follow the below steps..
Suppose we have the following columns in List Report..
1) Take the columns Region, Actual, and budget into List Report
2) Goto Query Explorer
3) Open Query1
4) Add Data Item, enter the following expression to calculate Actual percentage over total of actual and budget
[actual]/([actual]+[Budget])* 100
[actual]/([actual]+[Budget])* 100
5) Name this data Item in properties as “actp’
6) Add another Data Item to calculate Budget percentage and enter the below expression
[Budget]/([actual]+[Budget])* 100
[Budget]/([actual]+[Budget])* 100
7) Name this data Item in properties as “budp’
8) Goto Page explorer and select Page1 to see the list report
9) Drag one HTML item and drop between the columns Actual and Budget as a column
10) Click LOCK icon in tool bar to unlock
11) Add 4 more HTML items next to previously added HTML item, so you should have 5 HTML items
12) double click First HTML item and add the following script
Note: This chart does not show percentage on bar if percentage < 20 as the width bar is very low so we can’t show text on it.
Please note that, we can do the same 
thing using Micro Chart, but we will get extra space around the bar 
therefore, the lines appear with unnecessary space that we can’t avoid
 
No comments:
Post a Comment