Jasper Woes

M

muybluie

Hi,

I have just started working with iReport. Everything seemed
straightforwars until I tried to add a simple line graph. I use a csv
file like this:

XAxis,YAxis
1,2
2,4
3,6
4,8

What I expect to get is one graph that plots all 4 points and draws a
line between each two. What I get is 4 seperate graphs with all 4
points with no lines.

I tried playing with grouping to no avail...in short, I tried a whole
bunch of things, but got nowhere.

Below is the JRXML file.

Any tips would be appreciated!
Bluie

<?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="Test2"
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.*" />


<field name="XAxis" class="java.lang.Float"/>
<field name="YAxis" class="java.lang.Float"/>

<background>
<band height="0" isSplitAllowed="true" >
</band>
</background>
<title>
<band height="50" isSplitAllowed="true" >
</band>
</title>
<pageHeader>
<band height="22" isSplitAllowed="true" >
</band>
</pageHeader>
<columnHeader>
<band height="97" isSplitAllowed="true" >
</band>
</columnHeader>
<detail>
<band height="100" isSplitAllowed="false" >
<lineChart>
<chart isShowLegend="false" hyperlinkTarget="Self" >
<reportElement
x="0"
y="0"
width="535"
height="100"
key="element-2"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None"
leftBorderColor="#000000" rightBorder="None"
rightBorderColor="#000000" bottomBorder="None"
bottomBorderColor="#000000"/>
</chart>
<categoryDataset>
<dataset resetType="None" >
</dataset>
<categorySeries>
<seriesExpression><![CDATA[$V{REPORT_COUNT}.toString()]]></
seriesExpression>
<categoryExpression><![CDATA[$F{XAxis}]]></categoryExpression>
<valueExpression><![CDATA[new
java.lang.Float( ($F{XAxis}.floatValue()) +
($F{XAxis}.floatValue()) )]]></valueExpression>
<itemHyperlink >
</itemHyperlink>
</categorySeries>
</categoryDataset>
<linePlot >
<plot />
<categoryAxisFormat>
<axisFormat axisLineColor="#660066" >
</axisFormat>
</categoryAxisFormat>
<valueAxisFormat>
<axisFormat axisLineColor="#66FFCC" >
</axisFormat>
</valueAxisFormat>
</linePlot>
</lineChart>
</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>
 
M

muybluie

Forgot to mention: using iReport 1.3.3

OK, realized I should try creating groups, added a Name column to
group by, and also tried grouping by XAxis. I now get 4 identical
graphs, where each graph is what I want. Progress...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top