Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
First series in stacked bar chart not labeled if zero
paulk
Is there a way to make the label display for the first series in a stacked bar chart when the value is zero? The second series displays 0 value labels but not the first.
Attached image of example using version 2.3.2.
Thanks.
Find more posts tagged with
Comments
paulk
Anyone?
mwilliams
Sorry for the delay. Let me take a look.
mwilliams
Apparently the 0% showing for the second series in this case was considered the bug, because in 3.7.2, no 0% values show.
sairag
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="98660" data-time="1333662054" data-date="05 April 2012 - 02:40 PM"><p>
Apparently the 0% showing for the second series in this case was considered the bug, because in 3.7.2, no 0% values show.<br /></p></blockquote>
<br />
Hi Jason - Do we can achieve the same using script?<br />
<br />
Thanks<br />
Amar
mwilliams
You want to be able to remove the 0% values? Is this what you're asking?
paulk
I was trying to get the 0% label for the first series to show, not hide the 2nd label. The second series will show 0% but not the first. If I wanted to show both labels I don't think it's possible.<br />
<br />
I came up with a script, when series 1 is 0%, display series 2 label with a 0% label. You can modify it to show any series 1 values above series 2 bar.<br />
<br />
Script:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>function beforeDrawDataPointLabel( dph, label, icsc )
{
//Create labels
perc = Math.round(dph.getPercentileOrthogonalValue()*100,1);
cnt = Math.round(dph.getOrthogonalValue(),0);
tot = Math.round(dph.getOrthogonalValue()/dph.getPercentileOrthogonalValue(),0);
showlabel = false;
//If "Not Completed" series is 100%, compute "Completed" series data and show in second series label
if (perc==100 && dph.getSeriesValue()=='Not Completed')
{
//Create opposite labels
perc = Math.round((1-dph.getPercentileOrthogonalValue())*100,1);
cnt = Math.round(dph.getOrthogonalValue()/dph.getPercentileOrthogonalValue()-dph.getOrthogonalValue(),0);
tot = Math.round(dph.getOrthogonalValue()/dph.getPercentileOrthogonalValue(),0);
showlabel = true;
} else if (dph.getSeriesValue()=='Completed') {
showlabel = true;
}
padding = "??????";
label.getCaption().setValue(perc.toString()+"% ("+cnt.toString()+"/"+tot.toString()+")"+padding);
label.setVisible(showlabel);
}</pre>
<br />
Chart labels without script (notice when series 1 is 0% there is no label):<br />
mwilliams
Sorry Paul. I was asking Amar. I should have specified! Yeah, since the label is not created for a 0% bar, your way is probably the way to go, for your issue. Otherwise, you'd probably have to download the source and edit the chart to display the labels with 0% and then re-build it.
sairag
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="100155" data-time="1336580902" data-date="09 May 2012 - 09:28 AM"><p>
You want to be able to remove the 0% values? Is this what you're asking?<br /></p></blockquote>
<br />
<br />
Hi Williams, sorry for the delay in response.<br />
<br />
I want to show the 0 value in the chart. To get the same I am customising the Y-axis scale and selecting the option "Show the out of range values" and giving "0 for Min "<br />
<br />
Thanks<br />
AR
mwilliams
Can you possibly make an example using the sample database, that shows the issue? Thanks!
birtUser123
<div>Hi, this is not working for me. the label is still not showing when value is zero. It only works on any other value but zero. My x axis is 0-3, labels and bars are appearing when value is anything from 1-3 but not on zero. what am I missing pls? how? thanks</div><div> </div><div>this is the script I used: the less than 2 is showing only on values with 1 but not on zeroes.</div><div> </div><div><div>function beforeDrawDataPointLabel( dph, label, icsc )</div><div>{</div><div> </div><div>if (dph.getOrthogonalValue() <2) {</div><div>label.getCaption().setValue("less than 2");</div><div> <span> </span>label.setVisible(true)</div><div> }</div><div> else</div><div> {</div><div> label.getCaption().setValue("any val");</div><div> <span> </span>label.setVisible(true)</div><div> }</div><div>}</div></div>
mwilliams
<p>Can you attach a sample report? Thanks!
</p>
birtUser123
<blockquote class="ipsBlockquote" data-author="mwilliams" data-cid="122980" data-time="1386978611"><div><p>Can you attach a sample report? Thanks!
</p></div></blockquote><p> </p><p>Hi, pls find attached report. thanks</p>
mwilliams
<p>Could you attach a sample that shows the issue that I can run? Or the data I need to run the above report? Thanks.</p>