• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Please send solution to this-jasper to pdf problem

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,
I am stuck up with a problem in iReport 2.0.0. I need to create a 3-D Bar Chart and export it to pdf but what I face is that when only one row is fetched by the query from the database the bar is as big as the chart itself and if the number of rows fetched from the database increase i.e if the number of bars increase then the size of the bars decrease yet the size of chart remains the same.

Its like having a box when there is only one record, two medium sized bars when two records but when there are multiple records you can barely even see them as lines. All we see them as is a dash of color. If the number of rows per chart is decreased or fixed to some particular number then it shows some thin slices for the bars and the rest of the data is not displayed. So suppose i chose to display 5 bars only those 5 bars as thin as slices so as to accommodate within the chart size are displayed. Rest of the bars vanish and are not even seen on subsequent pages as its the only page that is displayed and basically i don't need it that way.

I need all the bars in one chart for comparison with all having same size constantly irrespective of the size of chart.
I cannot manually change the height or hardcode it because it should depend on the number of entries fetched by the query. so a small chart in case of lesser entries and bigger one to accommodate larger data.

the code for your reference is as follows:

<?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="NewContactReport"
columnCount="1"
printOrder="Vertical"
orientation="Portrait"
pageWidth="595"
pageHeight="842"
columnWidth="535"
columnSpacing="0"
leftMargin="30"
rightMargin="30"
topMargin="20"
bottomMargin="20"
whenNoDataType="AllSectionsNoDetail"
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.*" />

<parameter name="fromdate" isForPrompting="true" class="java.sql.Timestamp"/>
<parameter name="todate" isForPrompting="true" class="java.sql.Timestamp"/>
<parameter name="companyid" isForPrompting="true" class="java.lang.Integer"/>
<queryString><![CDATA[SELECT account.AccountName, count(contact.Id)
FROM CONTACT contact
LEFT OUTER JOIN ACCOUNT account on contact.AccountId=account.id
WHERE contact.createddate
BETWEEN $P{fromdate} AND $P{todate}
AND contact.companyid=$P{companyid}
GROUP BY account.AccountName
ORDER BY account.AccountName]]></queryString>

<field name="AccountName" class="java.lang.String"/>
<field name="count(contact.Id)" class="java.lang.Long"/>

<variable name="AccName" class="java.lang.String" resetType="Report" calculation="Nothing">
<variableExpression><![CDATA[$F{AccountName}==null ? "blank":$F{AccountName}]]></variableExpression>
</variable>
<background>
<band height="0" isSplitAllowed="true" >
</band>
</background>
<title>
<band height="0" isSplitAllowed="true" >
</band>
</title>
<pageHeader>
<band height="0" isSplitAllowed="true" >
</band>
</pageHeader>
<columnHeader>
<band height="0" isSplitAllowed="true" >
</band>
</columnHeader>
<detail>
<band height="0" isSplitAllowed="true" >
</band>
</detail>
<columnFooter>
<band height="0" isSplitAllowed="true" >
</band>
</columnFooter>
<pageFooter>
<band height="0" isSplitAllowed="true" >
</band>
</pageFooter>
<lastPageFooter>
<band height="171" isSplitAllowed="true" >
<bar3DChart>
<chart isShowLegend="false" hyperlinkTarget="Self" >
<reportElement
mode="Opaque"
x="125"
y="0"
width="308"
height="171"
key="element-1"
stretchType="RelativeToBandHeight"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<chartTitle color="#000000" >
<titleExpression><![CDATA["Active Contact"]]></titleExpression>
</chartTitle>
</chart>
<categoryDataset>
<dataset resetType="None" >
</dataset>
<categorySeries>
<seriesExpression><![CDATA[$V{AccName}]]></seriesExpression>
<categoryExpression><![CDATA[$V{AccName}]]></categoryExpression>
<valueExpression><![CDATA[$F{count(contact.Id)}]]></valueExpression>
<itemHyperlink >
</itemHyperlink>
</categorySeries>
</categoryDataset>
<bar3DPlot xOffset="20.0" >
<plot backcolor="#FFFFFF" orientation="Horizontal" labelRotation="3.0" >
<seriesColor seriesOrder="0" color="#FF0000"/>
<seriesColor seriesOrder="1" color="#FF0000"/>
<seriesColor seriesOrder="2" color="#FF0000"/>
</plot>
<categoryAxisFormat>
<axisFormat tickLabelColor="#000000" axisLineColor="#FFFFFF" >
</axisFormat>
</categoryAxisFormat>
<valueAxisFormat>
<axisFormat axisLineColor="#000000" >
</axisFormat>
</valueAxisFormat>
</bar3DPlot>
</bar3DChart>
</band>
</lastPageFooter>
<summary>
<band height="0" isSplitAllowed="true" >
</band>
</summary>
</jasperReport>


***************************************************************************

Please help me out.
 
jenita brown
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also its the same if I export it to any other viewer that is the JR Previewer or anything else.. The output is the same as it is in PDF.

Please help me get rid of this issue.
 
What kind of corn soldier are you? And don't say "kernel" - that's only for this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!