JasperReports + MultiAxisChart - 图表保持空白

时间:2014-06-12 05:48:44

标签: jasper-reports jfreechart

我有一份使用JasperReports 5.2.2的报告。它包含嵌入式图表 - 折线图,条形图和多轴图表。线条图和条形图都运行良好,但多轴图表只是保持空白,就好像它没有接收到它的数据集一样。该报告是使用Jaspersoft Studio设计的。这三个数据集作为参数传入,并且都包含完全相同的数据(三个具有相同数据的JRBeanCollectionDataSource)。 screenshot of resulting charts

知道我做错了吗?

以下是JRXML文件。

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version last-->
<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="weekly-page1" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="c5b0ee6d-2c48-46e5-92f3-22c62ab9ec53">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
    <subDataset name="Dataset1" uuid="e20e908b-3e00-4dd1-aab2-b194f5a4e4de">
        <queryString language="SQL">
            <![CDATA[]]>
        </queryString>
        <field name="code" class="java.lang.String">
            <fieldDescription><![CDATA[code]]></fieldDescription>
        </field>
        <field name="cumulative" class="java.lang.Integer">
            <fieldDescription><![CDATA[cumulative]]></fieldDescription>
        </field>
        <field name="delays" class="java.lang.Integer">
            <fieldDescription><![CDATA[delays]]></fieldDescription>
        </field>
        <field name="description" class="java.lang.String">
            <fieldDescription><![CDATA[description]]></fieldDescription>
        </field>
        <field name="where" class="java.lang.String">
            <fieldDescription><![CDATA[where]]></fieldDescription>
        </field>
    </subDataset>
    <parameter name="dsControllableDelays" class="net.sf.jasperreports.engine.JRDataSource"/>
    <parameter name="dsControllableDelays2" class="net.sf.jasperreports.engine.JRDataSource"/>
    <parameter name="dsControllableDelays3" class="net.sf.jasperreports.engine.JRDataSource"/>
    <queryString language="SQL">
        <![CDATA[]]>
    </queryString>
    <field name="code" class="java.lang.String">
        <fieldDescription><![CDATA[code]]></fieldDescription>
    </field>
    <field name="cumulative" class="java.lang.Integer">
        <fieldDescription><![CDATA[cumulative]]></fieldDescription>
    </field>
    <field name="delays" class="java.lang.Integer">
        <fieldDescription><![CDATA[delays]]></fieldDescription>
    </field>
    <field name="description" class="java.lang.String">
        <fieldDescription><![CDATA[description]]></fieldDescription>
    </field>
    <field name="where" class="java.lang.String">
        <fieldDescription><![CDATA[where]]></fieldDescription>
    </field>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="554" splitType="Stretch">
            <barChart>
                <chart isShowLegend="false" evaluationTime="Report" customizerClass="net.megabyte.app.diva.rpt.WeeklyControllableDelayCustomiser">
                    <reportElement x="0" y="0" width="390" height="250" uuid="8d6dac50-adea-4b6c-821d-7ef71f22059c"/>
                    <chartTitle/>
                    <chartSubtitle/>
                    <chartLegend/>
                </chart>
                <categoryDataset>
                    <dataset>
                        <datasetRun subDataset="Dataset1" uuid="0f49bb55-5e58-47b4-9111-b0f5bd158c82">
                            <dataSourceExpression><![CDATA[$P{dsControllableDelays}]]></dataSourceExpression>
                        </datasetRun>
                    </dataset>
                    <categorySeries>
                        <seriesExpression><![CDATA["SERIES 1"]]></seriesExpression>
                        <categoryExpression><![CDATA[$F{description}]]></categoryExpression>
                        <valueExpression><![CDATA[$F{cumulative}]]></valueExpression>
                    </categorySeries>
                </categoryDataset>
                <barPlot>
                    <plot/>
                    <itemLabel/>
                    <categoryAxisFormat>
                        <axisFormat/>
                    </categoryAxisFormat>
                    <valueAxisFormat>
                        <axisFormat/>
                    </valueAxisFormat>
                </barPlot>
            </barChart>
            <lineChart>
                <chart evaluationTime="Report">
                    <reportElement x="390" y="0" width="411" height="250" uuid="e2e7debd-0cb8-4ffc-8ac8-dfb7164a6a6d"/>
                    <chartTitle/>
                    <chartSubtitle/>
                    <chartLegend/>
                </chart>
                <categoryDataset>
                    <dataset>
                        <datasetRun subDataset="Dataset1" uuid="8038d4bb-49eb-43da-8bfa-f7b12a46774c">
                            <dataSourceExpression><![CDATA[$P{dsControllableDelays2}]]></dataSourceExpression>
                        </datasetRun>
                    </dataset>
                    <categorySeries>
                        <seriesExpression><![CDATA["SERIES 1"]]></seriesExpression>
                        <categoryExpression><![CDATA[$F{description}]]></categoryExpression>
                        <valueExpression><![CDATA[$F{delays}]]></valueExpression>
                    </categorySeries>
                </categoryDataset>
                <linePlot>
                    <plot/>
                    <categoryAxisFormat>
                        <axisFormat/>
                    </categoryAxisFormat>
                    <valueAxisFormat>
                        <axisFormat/>
                    </valueAxisFormat>
                </linePlot>
            </lineChart>
            <multiAxisChart>
                <chart evaluationTime="Report">
                    <reportElement x="10" y="260" width="780" height="280" uuid="ccdb8264-2808-4f37-8f1c-f4073ff54b8b"/>
                    <chartTitle/>
                    <chartSubtitle/>
                    <chartLegend/>
                </chart>
                <multiAxisPlot>
                    <plot/>
                    <axis>
                        <lineChart>
                            <chart evaluationTime="Report">
                                <reportElement x="0" y="0" width="0" height="0" backcolor="#FFFFFF" uuid="b7f8198f-a799-415c-b96a-c7e1d3f83872"/>
                                <chartTitle color="#000000"/>
                                <chartSubtitle color="#000000"/>
                                <chartLegend textColor="#000000" backgroundColor="#FFFFFF"/>
                            </chart>
                            <categoryDataset>
                                <dataset>
                                    <datasetRun subDataset="Dataset1" uuid="8038d4bb-49eb-43da-8bfa-f7b12a46774c">
                                        <dataSourceExpression><![CDATA[$P{dsControllableDelays3}]]></dataSourceExpression>
                                    </datasetRun>
                                </dataset>
                                <categorySeries>
                                    <seriesExpression><![CDATA["SERIES 1"]]></seriesExpression>
                                    <categoryExpression><![CDATA[$F{description}]]></categoryExpression>
                                    <valueExpression><![CDATA[$F{delays}]]></valueExpression>
                                </categorySeries>
                            </categoryDataset>
                            <linePlot>
                                <plot/>
                                <categoryAxisFormat>
                                    <axisFormat/>
                                </categoryAxisFormat>
                                <valueAxisFormat>
                                    <axisFormat/>
                                </valueAxisFormat>
                            </linePlot>
                        </lineChart>
                    </axis>
                </multiAxisPlot>
            </multiAxisChart>
        </band>
    </title>
    <pageHeader>
        <band splitType="Stretch"/>
    </pageHeader>
    <columnHeader>
        <band splitType="Stretch"/>
    </columnHeader>
    <detail>
        <band splitType="Stretch"/>
    </detail>
    <columnFooter>
        <band splitType="Stretch"/>
    </columnFooter>
    <pageFooter>
        <band splitType="Stretch"/>
    </pageFooter>
    <summary>
        <band splitType="Stretch"/>
    </summary>
</jasperReport>

0 个答案:

没有答案