Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2007

Tip: Looking for answers? Try searching our database.

Jasper Woes

Thread view: 
muybluie@hotmail.com - 23 Oct 2007 10:11 GMT
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>
muybluie@hotmail.com - 23 Oct 2007 10:13 GMT
Forgot to mention: using iReport 1.3.3
muybluie@hotmail.com - 23 Oct 2007 11:06 GMT
On Oct 23, 5:13 am, muybl...@hotmail.com wrote:
> 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...


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.