Jump to content
Changes to the Jaspersoft community edition download ×

Need help on JFreeChart


davidj411

Recommended Posts

Hello,

 

I am trying to format a 3d Pie chart using a jrxml file, included below.

 

my sql query is

 

Code:

select reason_desc ,count(*) as count
from reports
where report_call_id = '5B4181F6-E6C7-11DB-A0DC-000C295D208E'
and r_number != ''
group by reason_desc

 

And my report is:

 

Code:
[code]
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Created with iReport - A designer for JasperReports -->
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport
name="chart_Test"
columnCount="1"
printOrder="Vertical"
orientation="Portrait"
pageWidth="595"
pageHeight="842"
columnWidth="535"
columnSpacing="0"
leftMargin="30"
rightMargin="30"
topMargin="20"
bottomMargin="20"
whenNoDataType="NoPages"
isTitleNewPage="false"
isSummaryNewPage="false">
<property name="ireport.scriptlethandling" value="0" />
<property name="ireport.encoding" value="UTF-8" />
<import value="java.util.*" />
<import value="net.sf.jasperreports.engine.*" />
<import value="net.sf.jasperreports.engine.data.*" />

<queryString><![CDATA[select reason_desc ,count(*) as count from reports
where report_call_id = '5B4181F6-E6C7-11DB-A0DC-000C295D208E'
--and reason_desc != null
and p_number != ''
group by reason_desc]]></queryString>

<field name="reason_desc" class="java.lang.String"/>
<field name="count" class="java.lang.Integer"/>

<background>
<band height="0" isSplitAllowed="true" >
</band>
</background>
<title>
<band height="50" isSplitAllowed="true" >
</band>
</title>
<pageHeader>
<band height="50" isSplitAllowed="true" >
</band>
</pageHeader>
<columnHeader>
<band height="30" isSplitAllowed="true" >
</band>
</columnHeader>
<detail>
<band height="296" isSplitAllowed="true" >
<pie3DChart>
<chart hyperlinkTarget="Self" >
<reportElement
x="74"
y="17"
width="363"
height="244"

/>
</chart>
<pieDataset>
<dataset >
</dataset>
<keyExpression><![CDATA[$F{reason_desc}]]></keyExpression>
<valueExpression><![CDATA[$F{count}]]></valueExpression>
<sectionHyperlink >
</sectionHyperlink>
</pieDataset>
<pie3DPlot >
<plot />
</pie3DPlot>
</pie3DChart>
</band>
</detail>
<columnFooter>
<band height="30" isSplitAllowed="true" >
</band>
</columnFooter>
<pageFooter>
<band height="50" isSplitAllowed="true" >
</band>
</pageFooter>
<lastPageFooter>
<band height="50" isSplitAllowed="true" >
</band>
</lastPageFooter>
<summary>
<band height="50" isSplitAllowed="true" >
</band>
</summary>
</jasperReport>

 

 

here is my data

Code:
[code]
reason_desc count
Congestion 101
Unknown reason 41
Accepted 566
Rejected 12
Undecided 108
Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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