Jump to content

The Percentages summed up equals 101%


ionutboha

Recommended Posts

101.PNG.d42764c0017462eb5844a7bd28893016.PNGHello,

I am new with the Jasper Studio and maybe i did not covered all aspects but i am stuck with one problem regarding the Percentages from a Pie Chart as if I sum the percentages it equals 101%.

Are 3 percentage value and each of them are rounded up to the higher value thus the incorrect display.

If the Pie would display as default the exact value (EX: 11.34 )retrieved from data base this issue will not ocurr.

Thanks.

 

Below is the code from Source:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.3.1.final using JasperReports Library version 6.3.1  -->
<!-- 2017-01-10T19:38:45 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Blank_A4_1" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="98c71dc8-211c-4539-ac9f-8414de463880">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="Faculty"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<queryString>
<![CDATA[select
(select count(grade)  from catalogue where grade < 10)  * 100 / (select count(*) from catalogue) as Under10Percentage,
(select count(grade) from catalogue where grade >= 10 and grade <= 30)  * 100 / (select count(*) from catalogue) as Between10and30Percentage,
(select count(grade) from catalogue where grade > 30)  * 100 / (select count(*) from catalogue) as bigger30Percentage
from catalogue
where rownum <=1]]>
</queryString>
<field name="UNDER10PERCENTAGE" class="java.math.BigDecimal"/>
<field name="BETWEEN10AND30PERCENTAGE" class="java.math.BigDecimal"/>
<field name="BIGGER30PERCENTAGE" class="java.math.BigDecimal"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch"/>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="61" splitType="Stretch"/>
</columnHeader>
<detail>
<band height="125" splitType="Stretch"/>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="215" splitType="Stretch">
<pieChart>
<chart evaluationTime="Report">
<reportElement x="0" y="0" width="555" height="215" uuid="8e81d6ea-0722-4382-af3f-3c4709f45b36"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<pieDataset>
<pieSeries>
<keyExpression><![CDATA["SERIES 1"]]></keyExpression>
<valueExpression><![CDATA[$F{UNDER10PERCENTAGE}]]></valueExpression>
</pieSeries>
<pieSeries>
<keyExpression><![CDATA["SERIES 2"]]></keyExpression>
<valueExpression><![CDATA[$F{BETWEEN10AND30PERCENTAGE}]]></valueExpression>
</pieSeries>
<pieSeries>
<keyExpression><![CDATA["SERIES 3"]]></keyExpression>
<valueExpression><![CDATA[$F{BIGGER30PERCENTAGE}]]></valueExpression>
</pieSeries>
</pieDataset>
<piePlot labelFormat="{2}" legendLabelFormat="{0}">
<plot/>
<itemLabel/>
</piePlot>
</pieChart>
</band>
</summary>
</jasperReport>
 
Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

So, what's the question?

>Are 3 percentage value and each of them are rounded up to the higher value thus the incorrect display.

You've already found the reason for the wrong total.

>If the Pie would display as default the exact value (EX: 11.34 )retrieved from data base this issue will not ocurr.

You also have found a solution that works.

Link to comment
Share on other sites

Hello,

 

Sorry for not pointing the problem i have more preciselly,  I didn't find how to make the label value to display also the decimals like in the (EX: 11.34).

I found how it can be rounded up, rounded down but to display the exact value with decimals is the problem pointed.

 

Thank you Ozawa.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...