图表重复多次

编程入门 行业动态 更新时间:2024-10-24 16:31:49
本文介绍了图表重复多次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经生成了一个报告(使用JasperReport)。我的问题是图表重复,我有一个图表,报告包含22页!有什么问题?

I have generated a report (with JasperReport). My problem that the chart repeats, I have one chart and the report contains 22 pages! What is the problem?

这是我的报告:

<?xml version="1.0" encoding="UTF-8"?> <jasperReport xmlns="jasperreports.sourceforge/jasperreports" xmlns:xsi="www.w3/2001/XMLSchema-instance" xsi:schemaLocation="jasperreports.sourceforge/jasperreports jasperreports.sourceforge/xsd/jasperreport.xsd" name="report2" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="0"/> <subDataset name="New Dataset 1"> <parameter name="SQL" class="java.lang.String"/> <parameter name="Titre" class="java.lang.String"> <defaultValueExpression><![CDATA[]]></defaultValueExpression> </parameter> <queryString> <![CDATA[$P!{SQL}]]> </queryString> <field name="nb" class="java.lang.Long"/> <field name="champ1" class="java.lang.String"/> <field name="champ2" class="java.lang.String"/> </subDataset> <parameter name="SQL" class="java.lang.String"> <defaultValueExpression><![CDATA[]]></defaultValueExpression> </parameter> <parameter name="Titre" class="java.lang.String"/> <queryString> <![CDATA[select id from jiraissue]]> </queryString> <field name="id" class="java.math.BigDecimal"/> <background> <band splitType="Stretch"/> </background> <title> <band height="46" splitType="Stretch"> <textField> <reportElement x="89" y="15" width="180" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$P{Titre}]]></textFieldExpression> </textField> </band> </title> <pageHeader> <band height="35" splitType="Stretch"/> </pageHeader> <columnHeader> <band height="13" splitType="Stretch"/> </columnHeader> <detail> <band height="185" splitType="Stretch"> <stackedBar3DChart> <chart> <reportElement x="57" y="16" width="420" height="165"/> <chartTitle/> <chartSubtitle/> <chartLegend/> </chart> <categoryDataset> <dataset> <datasetRun subDataset="New Dataset 1"> <datasetParameter name="SQL"> <datasetParameterExpression><![CDATA[$P{SQL}]]></datasetParameterExpression> </datasetParameter> <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression> </datasetRun> </dataset> <categorySeries> <seriesExpression><![CDATA[$F{champ2}]]></seriesExpression> <categoryExpression><![CDATA[$F{champ1}]]></categoryExpression> <valueExpression><![CDATA[$F{nb}]]></valueExpression> </categorySeries> </categoryDataset> <bar3DPlot> <plot/> <itemLabel color="#000000" backgroundColor="#FFFFFF"/> <categoryAxisFormat> <axisFormat> <labelFont/> <tickLabelFont/> </axisFormat> </categoryAxisFormat> <valueAxisFormat> <axisFormat> <labelFont/> <tickLabelFont/> </axisFormat> </valueAxisFormat> </bar3DPlot> </stackedBar3DChart> </band> </detail> <columnFooter> <band height="24" splitType="Stretch"/> </columnFooter> <pageFooter> <band height="20" splitType="Stretch"/> </pageFooter> <summary> <band height="22" splitType="Stretch"/> </summary>

更新 我通过将图表移动到摘要部分解决了问题:)

Update I have solved the problem by moving the chart to the summary part :)

推荐答案

在Jasper报告中,您放置在细节带中的所有内容都会重复出现在源中的次数。

In Jasper Report, everything you place in the detail band is repeated number of times it appears in the source.

如果您想只显示一次(不仅是图表),请避开细节带。 例如,您可以将其放在摘要部分。

If you want to show anything (not only chart) just once, avoid the detail band. For example, you can place it in the summary section.

更新:正如其他人指出的那样,我已经扩展了我的答案一点点。

Update: As others pointed, I have extended my answer a little bit.

更多推荐

图表重复多次

本文发布于:2023-11-22 20:56:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1618990.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图表

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!