如何设置堆积条形图图表"适合页面大小"使用Jaspersoft工作室报道?

时间:2018-04-04 06:49:33

标签: jasper-reports bar-chart

如何设置堆积条形图图表"适合页面大小" (使用Jaspersoft工作室的jasper报告中,图表应覆盖整个页面并根据数据拉伸而不重叠)?

我已经采取了" Chart_elememt"在" Frame_element"。我试过更改Chart_element和Frame_element的外观属性,但没有一个工作。

基本上,我在一个.jrxml中有两个图形创建了xy轴的问题(无法通过" 0" x轴,即从我的页面底部启动两个图形),所以我创建了子报告并将第二张图移入其中。现在我的第一张图表运行正常,但第二张图表(在子报表中)仍然反映了收缩和重叠的数据,尽管我保留了与第一张图表相同的属性。

In sub-report - Shrinked Graph (Data overlapping and is not Fit-to-page)

In main report - Expected Graph

调用子报告的主要报告源代码:

         <subreport>
            <reportElement stretchType="RelativeToTallestObject" x="0" y="1002" width="1088" height="20">
                <property name="local_mesure_unitx" value="pixel"/>
                <property name="com.jaspersoft.studio.unit.x" value="px"/>
                <property name="local_mesure_unity" value="pixel"/>
                <property name="com.jaspersoft.studio.unit.y" value="px"/>
                <property name="local_mesure_unitheight" value="pixel"/>
                <property name="com.jaspersoft.studio.unit.height" value="px"/>
            </reportElement>
            <subreportParameter name="start">
                <subreportParameterExpression><![CDATA[$P{start}]]></subreportParameterExpression>
            </subreportParameter>
            <subreportParameter name="end">
                <subreportParameterExpression><![CDATA[$P{end}]]></subreportParameterExpression>
            </subreportParameter>
            <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
            <subreportExpression><![CDATA["QuantitéRelancesCause_subreport.jasper"]]></subreportExpression>
        </subreport>

子报告源代码:

<title>
    <band height="1051">
        <staticText>
            <reportElement mode="Transparent" x="410" y="10" width="250" height="40">
                <property name="local_mesure_unity" value="pixel"/>
                <property name="com.jaspersoft.studio.unit.y" value="px"/>
            </reportElement>
            <textElement textAlignment="Center">
                <font size="20"/>
                <paragraph lineSpacing="Single"/>
            </textElement>
            <text><![CDATA[Quantité relances/cause]]></text>
        </staticText>
        <frame>
            <reportElement positionType="FixRelativeToBottom" stretchType="RelativeToBandHeight" mode="Transparent" x="0" y="80" width="1090" height="904" isRemoveLineWhenBlank="true">
                <property name="local_mesure_unitheight" value="pixel"/>
                <property name="com.jaspersoft.studio.unit.height" value="px"/>
                <property name="local_mesure_unity" value="pixel"/>
                <property name="com.jaspersoft.studio.unit.y" value="px"/>
                <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
                <property name="local_mesure_unitwidth" value="pixel"/>
                <property name="com.jaspersoft.studio.unit.width" value="px"/>
                <property name="local_mesure_unitx" value="pixel"/>
                <property name="com.jaspersoft.studio.unit.x" value="px"/>
            </reportElement>
            <stackedBarChart>
                <chart isShowLegend="false" evaluationTime="Report">
                    <reportElement positionType="Float" stretchType="RelativeToBandHeight" mode="Transparent" x="0" y="80" width="1080" height="824">
                        <property name="net.sf.jasperreports.chart.range.axis.tick.interval" value="1"/>
                        <property name="local_mesure_unitx" value="pixel"/>
                        <property name="com.jaspersoft.studio.unit.x" value="px"/>
                        <property name="local_mesure_unity" value="pixel"/>
                        <property name="com.jaspersoft.studio.unit.y" value="px"/>
                        <property name="local_mesure_unitwidth" value="pixel"/>
                        <property name="com.jaspersoft.studio.unit.width" value="px"/>
                        <property name="local_mesure_unitheight" value="pixel"/>
                        <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    </reportElement>
                    <chartTitle/>
                    <chartSubtitle/>
                    <chartLegend/>
                </chart>
                <categoryDataset>
                    <categorySeries>
                        <seriesExpression><![CDATA[$F{DESCRIPTION}]]></seriesExpression>
                        <categoryExpression><![CDATA[$F{DESCRIPTION}]]></categoryExpression>
                        <valueExpression><![CDATA[$F{COUNT(DISTINCT(PIECE_ID))}]]></valueExpression>
                    </categorySeries>
                </categoryDataset>
                <barPlot isShowLabels="true" isShowTickLabels="true" isShowTickMarks="true">
                    <plot labelRotation="-45.0"/>
                    <itemLabel/>
                    <categoryAxisFormat labelRotation="-45.0">
                        <axisFormat/>
                    </categoryAxisFormat>
                    <valueAxisFormat>
                        <axisFormat/>
                    </valueAxisFormat>
                </barPlot>
            </stackedBarChart>
        </frame>
    </band>
</title>

0 个答案:

没有答案