Jaspersoft Studio 5.6.1 - HTML Chart - Multi value

2019-09-16 02:34发布

问题:

I've designed the HTML chart using the oracle query which passes single value parameter and it worked fine. I used the method of placing the HTML Chart in the Summary band and set the Evalution time to Now and it worked fine.

Now I would like to show the same HTML chart using multi value Parameter. I would like to show the chart element for each project in each pdf page. Hence logically I need to place the HTML chart at Detail band rather than the Summary band. But now it doesn't work and throws error "incrementing bidimensional dataset"

FYI, I'm using this Chart report as subreport to another main report.

Jaspersoft studio version: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>

Thanks

回答1:

I was able to solve the issue. The iterations was due to the query issue. To solve the chart issue, I placed the Chart in the group header and then I chnaged the evalution time to Column and then changed the reset type in the chart to Page. Now I could able to get the chart for each project in each page. Hope this helps someone later. Cheers