Jaspersoft Studio 5.6.1 - HTML图表 - 多值参数

时间:2016-09-16 05:26:35

标签: html5 charts jasper-reports

我使用oracle查询设计了HTML图表,该查询传递了单值参数,并且工作正常。我使用了将HTML Chart放在Summary band中并将Evalution time设置为Now的方法,它运行正常。

现在我想使用多值参数显示相同的HTML chart。我想在每个pdf页面中显示每个项目的图表元素。因此,逻辑上我需要将HTML chart放在Detail band而不是Summary band。但现在它没有工作并抛出错误"增加二维数据集"

仅供参考,我使用此图表报告作为另一份主要报告的子报告。

Jaspersoft工作室版本:5.6.1 final

<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="Charts" pageWidth="200" pageHeight="275" orientation="Landscape" columnWidth="200" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="c6523df6-0c5f-4728-87c2-57825f88fca3">
<property name="com.jaspersoft.studio.unit." value="inch" />
<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.data.defaultdataadapter" value="Dev DB Conn" />
<parameter name="param_month" class="java.lang.String" />
<parameter name="param_year" class="java.lang.String" />
<parameter name="param_project" class="java.util.Collection" />
<queryString language="SQL">
    <![CDATA[SELECT
            i.id prid,c.INUSAGE,d.CURRUSAGE
            FROM
            project table i, custom table c
            where i.id = c.id and $X{IN,I.id,param_project}
            ]]>
</queryString>
<field name="prid" class="java.math.BigDecimal" />
<field name="INUSAGE" class="java.math.BigDecimal" />
<field name="CURRUSAGE" class="java.math.BigDecimal" />
<summary>
    <band height="223">
        <componentElement>
            <reportElement positionType="Float" isPrintRepeatedValues="false" x="0" y="3" width="190" height="220" uuid="0a0e6b98-2d59-453a-8642-3a65d4b30bb1">
                <property name="local_mesure_unitwidth" value="inch" />
            </reportElement>
            <hc:chart xmlns:hc="http://jaspersoft.com/highcharts" xsi:schemaLocation="http://jaspersoft.com/highcharts http://jaspersoft.com/schema/highcharts.xsd" type="Column" evaluationGroup="">
                <hc:chartSetting name="default">
                    <hc:chartProperty name="_showDataPoints">
                        <hc:propertyExpression>
                            <![CDATA[Boolean.FALSE]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="_showMeasureNameOnValueAxis">
                        <hc:propertyExpression>
                            <![CDATA[Boolean.FALSE]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="chart.alignTicks">
                        <hc:propertyExpression>
                            <![CDATA[Boolean.FALSE]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="chart.animation">
                        <hc:propertyExpression>
                            <![CDATA[Boolean.TRUE]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="chart.borderRadius">
                        <hc:propertyExpression>
                            <![CDATA[new Integer(0)]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="chart.borderWidth">
                        <hc:propertyExpression>
                            <![CDATA[new Integer(0)]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="chart.ignoreHiddenSeries">
                        <hc:propertyExpression>
                            <![CDATA[Boolean.FALSE]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="chart.selectionMarkerFill">
                        <hc:propertyExpression>
                            <![CDATA[new java.awt.Color(-1)]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="chart.shadow">
                        <hc:propertyExpression>
                            <![CDATA[Boolean.FALSE]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="chart.spacingBottom">
                        <hc:propertyExpression>
                            <![CDATA[new Integer(20)]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="chart.zoomType">
                        <hc:propertyExpression>
                            <![CDATA["none"]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="colors">
                        <hc:propertyExpression>
                            <![CDATA[java.util.Arrays.asList("#779499","#C0D9DE","#8bbc21","#910000","#1aadce","#492970","#f28f43","#77a1e5","#c42525","#a6c96a","#C0D9DE")]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="credits.enabled">
                        <hc:propertyExpression>
                            <![CDATA[false]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="credits.href">
                        <hc:propertyExpression>
                            <![CDATA[""]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="credits.text">
                        <hc:propertyExpression>
                            <![CDATA[""]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="legend.align">
                        <hc:propertyExpression>
                            <![CDATA["center"]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="legend.borderRadius">
                        <hc:propertyExpression>
                            <![CDATA[new Integer(5)]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="legend.enabled">
                        <hc:propertyExpression>
                            <![CDATA[Boolean.TRUE]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="legend.floating">
                        <hc:propertyExpression>
                            <![CDATA[Boolean.FALSE]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="legend.layout">
                        <hc:propertyExpression>
                            <![CDATA["horizontal"]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="legend.lineHeight">
                        <hc:propertyExpression>
                            <![CDATA[new Integer(30)]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="legend.margin">
                        <hc:propertyExpression>
                            <![CDATA[new Integer(15)]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="legend.padding">
                        <hc:propertyExpression>
                            <![CDATA[new Integer(8)]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="legend.symbolPadding">
                        <hc:propertyExpression>
                            <![CDATA[new Integer(5)]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="legend.symbolWidth">
                        <hc:propertyExpression>
                            <![CDATA[new Integer(30)]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="legend.verticalAlign">
                        <hc:propertyExpression>
                            <![CDATA["bottom"]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="legend.x">
                        <hc:propertyExpression>
                            <![CDATA[new Integer(10)]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="legend.y">
                        <hc:propertyExpression>
                            <![CDATA[new Integer(10)]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="legened.itemStyle.fontSize" value="4" />
                    <hc:chartProperty name="plotOptions.series.animation">
                        <hc:propertyExpression>
                            <![CDATA[Boolean.TRUE]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="plotOptions.series.dataLabels.enabled" value="true" />
                    <hc:chartProperty name="plotOptions.series.dataLabels.format" value="{point.y:,.0f}" />
                    <hc:chartProperty name="plotOptions.series.lineWidth">
                        <hc:propertyExpression>
                            <![CDATA[new Integer(2)]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="plotOptions.series.shadow">
                        <hc:propertyExpression>
                            <![CDATA[Boolean.TRUE]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="plotOptions.series.showInLegend">
                        <hc:propertyExpression>
                            <![CDATA[Boolean.TRUE]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="plotOptions.series.visible">
                        <hc:propertyExpression>
                            <![CDATA[Boolean.TRUE]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="title.align">
                        <hc:propertyExpression>
                            <![CDATA["left"]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="title.style.color">
                        <hc:propertyExpression>
                            <![CDATA[new java.awt.Color(-4138530)]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="title.text">
                        <hc:propertyExpression>
                            <![CDATA[""]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="title.verticalAlign">
                        <hc:propertyExpression>
                            <![CDATA["top"]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="tooltip.animation">
                        <hc:propertyExpression>
                            <![CDATA[Boolean.TRUE]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="tooltip.enabled">
                        <hc:propertyExpression>
                            <![CDATA[Boolean.TRUE]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="tooltip.shadow">
                        <hc:propertyExpression>
                            <![CDATA[Boolean.TRUE]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="xAxis.labels.step">
                        <hc:propertyExpression>
                            <![CDATA[new Integer(0)]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="yAxis.gridLineColor" value="'#FFFFFF'" />
                    <hc:chartProperty name="plotOptions.column.marker.enabled">
                        <hc:propertyExpression>
                            <![CDATA[Boolean.FALSE]]>
                        </hc:propertyExpression>
                    </hc:chartProperty>
                    <hc:chartProperty name="yAxis.title.text" value="" />
                </hc:chartSetting>
                <multiAxisData>
                    <multiAxisDataset />
                    <dataAxis axis="Rows">
                        <axisLevel name="InvName">
                            <labelExpression>
                                <![CDATA[]]>
                            </labelExpression>
                            <axisLevelBucket class="java.lang.String">
                                <bucketExpression>
                                    <![CDATA[]]>
                                </bucketExpression>
                            </axisLevelBucket>
                        </axisLevel>
                    </dataAxis>
                    <dataAxis axis="Columns" />
                    <multiAxisMeasure name="Initial Baseline" class="java.lang.Integer" calculation="Highest">
                        <labelExpression>
                            <![CDATA["Initial Baseline"]]>
                        </labelExpression>
                        <valueExpression>
                            <![CDATA[$F{INUSAGE}]]>
                        </valueExpression>
                    </multiAxisMeasure>
                    <multiAxisMeasure name="Current Baseline" class="java.lang.Integer" calculation="Highest">
                        <labelExpression>
                            <![CDATA["Current Baseline"]]>
                        </labelExpression>
                        <valueExpression>
                            <![CDATA[$F{CURRUSAGE}]]>
                        </valueExpression>
                    </multiAxisMeasure>
                </multiAxisData>
                <hc:series name="Current Baseline" />
                <hc:series name="Initial Baseline" />
            </hc:chart>
        </componentElement>
    </band>
</summary>

由于

1 个答案:

答案 0 :(得分:0)

我能够解决这个问题。迭代是由查询问题引起的。为了解决图表问题,我将Chart放在组头中,然后将评估时间更改为Column,然后将图表中的重置类型更改为Page。现在,我可以在每个页面中获取每个项目的图表。希望这会有所帮助。干杯