Discussions
Categories
Choose a Product
THRUST SERVICES
CORE APPS
CE PRODUCTS
...
Quick Links
POPULAR
HELPFUL TIPS
Groups
My Links
FOR SIGNED IN MEMBERS:
Back to website
Home
Designing Analytics Reports
Stacked bar chart - Displaying total on top
Migrateduser
<p>I want to display totals on the stacked bar chart. Since there is no direct option to set this, I am trying to achieve this by scripting. </p><p> </p><p>I have computed the totals, but stuck in identifying the top stack to the label. How to identify the top stack for each bar?</p><p> </p><p>Here is my code on onRender event:</p><p> </p><p>[color=#000000;][font="consolas;"]<span style="font-size:10pt;">totalsArray = [/color][/font]</span><strong>[color=#7f0055;][font="consolas;"]<span style="font-size:10pt;">new[/color][/font]</span></strong>[color=#000000;][font="consolas;"]<span style="font-size:10pt;"> Array();[/color][/font]</span></p><p> </p><p><strong>[color=#7f0055;][font="consolas;"]<span style="font-size:10pt;">function[/color][/font]</span></strong>[color=#000000;][font="consolas;"]<span style="font-size:10pt;"> afterDataSetFilled(series, dataSet, icsc) {[/color][/font]</span></p><p>[color=#000000;][font="consolas;"]<span style="font-size:10pt;"> // Computed Totals for each bar from dataSet and stored in totalsArray.[/color][/font]</span></p><p>[color=#000000;][font="consolas;"]<span style="font-size:10pt;">}[/color][/font]</span></p><p> </p><p><strong>[color=#7f0055;][font="consolas;"]<span style="font-size:10pt;">function[/color][/font]</span></strong>[color=#000000;][font="consolas;"]<span style="font-size:10pt;"> beforeDrawDataPointLabel(dph, label, icsc) {[/color][/font]</span></p><p>[color=#000000;][font="consolas;"]<span style="font-size:10pt;"> // How to identify the top stack so that I can set the label here?[/color][/font]</span></p><p><strong>[color=#7f0055;][font="consolas;"]<span style="font-size:10pt;"> if[/color][/font]</span></strong>[color=#000000;][font="consolas;"]<span style="font-size:10pt;"> ( ####### top stack ###### ){[/color][/font]</span></p><p>[color=#000000;][font="consolas;"]<span style="font-size:10pt;"> label.getCaption().setValue(totalsArray[dph.getIndex()] );[/color][/font]</span></p><p>[color=#000000;][font="consolas;"]<span style="font-size:10pt;"> label.setVisible([/color][/font]</span><strong>[color=#7f0055;][font="consolas;"]<span style="font-size:10pt;">true[/color][/font]</span></strong>[color=#000000;][font="consolas;"]<span style="font-size:10pt;">);[/color][/font]</span></p><p>[color=#000000;][font="consolas;"]<span style="font-size:10pt;"> } [/color][/font]</span><strong>[color=#7f0055;][font="consolas;"]<span style="font-size:10pt;">else[/color][/font]</span></strong>[color=#000000;][font="consolas;"]<span style="font-size:10pt;">{[/color][/font]</span></p><p>[color=#000000;][font="consolas;"]<span style="font-size:10pt;"> label.getCaption().setValue([/color][/font]</span>[color=#2a00ff;][font="consolas;"]<span style="font-size:10pt;">""[/color][/font]</span>[color=#000000;][font="consolas;"]<span style="font-size:10pt;">);[/color][/font]</span></p><p>[color=#000000;][font="consolas;"]<span style="font-size:10pt;"> }[/color][/font]</span></p><p>[color=#000000;][font="consolas;"]<span style="font-size:10pt;">}[/color][/font]</span></p><p> </p><p> </p>
Find more posts tagged with
Comments
There are no comments yet