Jump to content
We've recently updated our Privacy Statement, available here ×

Multi-Series Chart in Jaspersoft Studio 6.2.0.final


dzemina

Recommended Posts

Hello,

I am trying to re-create a Microsoft Access report in JasperSoft studio 6.2.0.final. The report that I am attempting to re-create looks as follows:

rep_Ex.PNG.8b9f03fc67ea4dac792a99e485f899bd.PNG

 

I have never used a chart before in Jasper, and can't seem to figure out how to have 3 bars worth of data for each month (Plan, Estimate, Actual) values for each month as above. Is this possible to do in a bar chart in Jasper? I have tried having Plan, Estimate, Actual as different series, but I can only ever show 1 bar worth of data in the "Value" section of the Chart wizard.

 

The way that I have my data setup in the report is 4 fields: MONTH, PLAN, ESTIMATE, ACTUAL. So one set of data (which I want to show as 3 bars for the corresponding month) all comes in as a singular "row" in my data set.

Thanks,

Dave

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0  --><!-- 2017-01-03T12:45:54 --><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="chartd" pageWidth="1200" pageHeight="595" orientation="Landscape" columnWidth="1160" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="8d88c78f-93a4-4c56-8cf1-9bc3dce549ac">    <property name="com.jaspersoft.studio.data.defaultdataadapter" value=""/>    <property name="com.jaspersoft.studio.data.sql.tables" value=""/>    <property name="com.jaspersoft.studio.unit." value="pixel"/>    <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>    <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>    <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>    <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>    <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>    <property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>    <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>    <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>    <queryString>        <![CDATA[select * from dummy]]>    </queryString>    <field name="MONTH" class="java.sql.Timestamp"/>    <field name="ESTIMATE" class="java.math.BigDecimal"/>    <field name="PLAN" class="java.math.BigDecimal"/>    <field name="ACTUAL" class="java.math.BigDecimal"/>    <variable name="PLAN1" class="java.math.BigDecimal" resetType="Column" calculation="Sum">        <variableExpression><![CDATA[$F{PLAN}]]></variableExpression>    </variable>    <background>        <band splitType="Stretch"/>    </background>    <columnHeader>        <band height="20" splitType="Stretch">            <staticText>                <reportElement x="0" y="0" width="80" height="20" uuid="4339a91e-48fb-486a-ace5-10ea8e5b2141"/>                <textElement verticalAlignment="Bottom"/>                <text><![CDATA[MONTH]]></text>            </staticText>            <staticText>                <reportElement x="80" y="0" width="100" height="20" uuid="66cddfa9-41fa-4f2f-a117-22e9ba12a312"/>                <textElement textAlignment="Right" verticalAlignment="Bottom"/>                <text><![CDATA[ESTIMATE]]></text>            </staticText>            <staticText>                <reportElement x="180" y="0" width="100" height="20" uuid="cf8d5d10-e59d-4f33-ba38-6cb3e2319694"/>                <textElement textAlignment="Right" verticalAlignment="Bottom"/>                <text><![CDATA[PLAN]]></text>            </staticText>            <staticText>                <reportElement x="280" y="0" width="100" height="20" uuid="30420eea-a4c8-40a4-bd2e-ef7d332ff7ff"/>                <textElement textAlignment="Right" verticalAlignment="Bottom"/>                <text><![CDATA[ACTUAL]]></text>            </staticText>        </band>    </columnHeader>    <detail>        <band height="20" splitType="Stretch">            <textField pattern="MM/dd/yyyy">                <reportElement x="0" y="0" width="80" height="20" uuid="8e696354-6ab4-4533-b597-2fccb5f4087f"/>                <textElement verticalAlignment="Bottom"/>                <textFieldExpression><![CDATA[$F{MONTH}]]></textFieldExpression>            </textField>            <textField pattern="#,##0.00">                <reportElement x="80" y="0" width="100" height="20" uuid="87811c04-4a78-44ed-963b-952f4c532a8d"/>                <box rightPadding="5"/>                <textElement textAlignment="Right" verticalAlignment="Bottom"/>                <textFieldExpression><![CDATA[$F{ESTIMATE}]]></textFieldExpression>            </textField>            <textField pattern="#,##0.00">                <reportElement x="180" y="0" width="100" height="20" uuid="0f37c778-e18a-4ece-b18e-f0fa16c46baf"/>                <box rightPadding="5"/>                <textElement textAlignment="Right" verticalAlignment="Bottom"/>                <textFieldExpression><![CDATA[$F{PLAN}]]></textFieldExpression>            </textField>            <textField pattern="#,##0.00">                <reportElement x="280" y="0" width="100" height="20" uuid="aaa42169-f38c-4605-b7bb-66e9cd52e1ab"/>                <box rightPadding="5"/>                <textElement textAlignment="Right" verticalAlignment="Bottom"/>                <textFieldExpression><![CDATA[$F{ACTUAL}]]></textFieldExpression>            </textField>        </band>    </detail>    <summary>        <band height="288" splitType="Stretch">            <barChart>                <chart evaluationTime="Report">                    <reportElement x="0" y="0" width="1160" height="288" uuid="e35b93e9-48f6-4eb3-ae13-8af0c2104613"/>                    <chartTitle/>                    <chartSubtitle/>                    <chartLegend/>                </chart>                <categoryDataset>                    <categorySeries>                        <seriesExpression><![CDATA["MONTH-ESTIMATE"]]></seriesExpression>                        <categoryExpression><![CDATA[new SimpleDateFormat("MM/dd/yyyy").format($F{MONTH})]]></categoryExpression>                        <valueExpression><![CDATA[$F{ESTIMATE}]]></valueExpression>                        <labelExpression><![CDATA[$F{ESTIMATE}.toString()]]></labelExpression>                    </categorySeries>                    <categorySeries>                        <seriesExpression><![CDATA["MONTH-PLAN"]]></seriesExpression>                        <categoryExpression><![CDATA[new SimpleDateFormat("MM/dd/yyyy").format($F{MONTH})]]></categoryExpression>                        <valueExpression><![CDATA[$F{PLAN}]]></valueExpression>                        <labelExpression><![CDATA[$F{PLAN}.toString()]]></labelExpression>                    </categorySeries>                    <categorySeries>                        <seriesExpression><![CDATA["MONTH-ACTUAL"]]></seriesExpression>                        <categoryExpression><![CDATA[new SimpleDateFormat("MM/dd/yyyy").format($F{MONTH})]]></categoryExpression>                        <valueExpression><![CDATA[$F{ACTUAL}]]></valueExpression>                        <labelExpression><![CDATA[$F{ACTUAL}.toString()]]></labelExpression>                    </categorySeries>                </categoryDataset>                <barPlot>                    <plot/>                    <itemLabel/>                    <categoryAxisFormat>                        <axisFormat/>                    </categoryAxisFormat>                    <valueAxisFormat>                        <axisFormat/>                    </valueAxisFormat>                </barPlot>            </barChart>        </band>    </summary></jasperReport>[/code]

Use this as a base for your report

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