HTML5 Chart Fails When Category Entered

0

Hi all,

I'm having a very odd problem with the HTML5 charts.  I have a dataset that returns 6 columns and only 12 rows.  The data consists of monthly averages for disk sizes and is structured as follows:

Disk MonthValue MonthNumber Month Actual Forecast
C:\ 2 2 Feb 88576.93 88147.54
C:\ 3 3 Mar 88508.09 88066.73
C:\ 4 4 Apr null 87985.91
C:\ 5 5 May null 87905.09

There are more rows, but this illustrates what's going on...the answer set is returning data from actual observations and adding a linear regression forecast value which then extends for 6 months beyond the actuals.

When I add either the standard or ChartPro component to my report, they work fine.  However, when I add the HTML5 chart component, the preview fails with a cryptic "error filling print...null"  Followed by the typical list of components...see below:

 Filling report...  Locale: English (United States)  Time zone: Default Error filling print... null
Setting up the file resolver... 
java.lang.NullPointerException 
    at net.sf.jasperreports.crosstabs.fill.calculation.BucketDefinition$Bucket.compareTo(BucketDefinition.java:378) 
    at net.sf.jasperreports.crosstabs.fill.calculation.BucketingService$BucketListMap.collectVals(BucketingService.java:870) 
    at net.sf.jasperreports.crosstabs.fill.calculation.BucketingService$BucketListMap.collectVals(BucketingService.java:900) 
    at net.sf.jasperreports.crosstabs.fill.calculation.BucketingService.computeRowTotals(BucketingService.java:562) 
    at net.sf.jasperreports.crosstabs.fill.calculation.BucketingService.computeTotals(BucketingService.java:510) 
    at net.sf.jasperreports.crosstabs.fill.calculation.BucketingService.computeTotals(BucketingService.java:498) 
    at net.sf.jasperreports.crosstabs.fill.calculation.BucketingService.processData(BucketingService.java:406) 
    at net.sf.jasperreports.engine.analytics.dataset.MultiAxisDataService.createDataSource(MultiAxisDataService.java:383) 
    at net.sf.jasperreports.engine.analytics.dataset.FillMultiAxisDataset.getDataSource(FillMultiAxisDataset.java:106) 
    at net.sf.jasperreports.engine.analytics.dataset.FillMultiAxisData.getDataSource(FillMultiAxisData.java:53) 
    at com.jaspersoft.jasperreports.highcharts.charts.ChartFillComponent.setPrintChartParameters(ChartFillComponent.java:231) 
    at com.jaspersoft.jasperreports.highcharts.charts.ChartFillGenericElement.evaluateDelayedElement(ChartFillGenericElement.java:44) 
    at net.sf.jasperreports.engine.fill.JRFillComponentElement.resolveElement(JRFillComponentElement.java:186) 
    at net.sf.jasperreports.engine.fill.JRFillElement.performDelayedEvaluation(JRFillElement.java:968) 
    at net.sf.jasperreports.engine.fill.JRFillComponentElement.resolveElement(JRFillComponentElement.java:180) 
    at net.sf.jasperreports.engine.fill.ElementEvaluationAction.execute(JRBaseFiller.java:2423) 
    at net.sf.jasperreports.engine.fill.JRBaseFiller.resolveBoundElements(JRBaseFiller.java:1609) 
    at net.sf.jasperreports.engine.fill.JRBaseFiller.resolveReportBoundElements(JRBaseFiller.java:1636) 
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillSummary(JRVerticalFiller.java:1077) 
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportEnd(JRVerticalFiller.java:319) 
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:158) 
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:932) 
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:845) 
    at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:61) 
    at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:446) 
    at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:276) 
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:745) 
    at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:891) 
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572) 
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997) 

Print not filled. Try to use an EmptyDataSource...

As a test, I removed the "Categories" entry and placed a static text string in.  When I run the report, I get single values (as expected since there is no category to spread the values across).  So I know that the report is able to be rendered...doesn't have a property incorrect (ie. evaluation time).  I cannot, for the life of me, figure out why the category section of the HTML5 chart is causing this behaviour.  I have used all of the fields in the above example as potential categories (month, monthvalue, monthnumber)...all with the same results.  Below is the XML code from the report...not much there right now as i'm just trying to get the HTML5 chart to actually render.

<?xml version="1.0" encoding="UTF-8"?>
<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="HTML5 Disk Chart" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" 
              uuid="6e87ff3c-0c4e-4dc8-b061-25e8621a06fd"> 
    <property name="ireport.zoom" value="1.0"/> 
    <property name="ireport.x" value="0"/> 
    <property name="ireport.y" value="0"/> 
        <queryString>  
            <![CDATA[exec rptsp_disk_forecast_raw 'atg-exchange']]> 
        </queryString> 
        <field name="target" class="java.lang.String"/> 
        <field name="Month Value" class="java.lang.Integer"/> 
        <field name="Month Number" class="java.lang.Integer"/> 
        <field name="Month" class="java.lang.String"/> 
        <field name="Actual" class="java.lang.Float"/>
        <field name="forecast" class="java.lang.Float"/>
        <background>
            <band splitType="Stretch"/> 
        </background> 
        <title>  
            <band height="506" splitType="Stretch">   
                <lineChart>
                    <chart evaluationTime="Report">
                        <reportElement uuid="79fc4ae9-7817-4362-b614-83fd343f8190" 
                                       x="38" y="18" width="468" height="144"/>
                        <chartTitle/>
                        <chartSubtitle/>
                        <chartLegend/>
                    </chart>
                    <categoryDataset>     
                        <categorySeries>      
                            <seriesExpression><![CDATA[$F{target}]]></seriesExpression>
                            <categoryExpression><![CDATA[$F{Month}]]></categoryExpression>
                            <valueExpression><![CDATA[$F{Actual}]]></valueExpression>     
                        </categorySeries>
                    </categoryDataset>
                    <linePlot isShowShapes="false">
                        <plot/>
                        <categoryAxisFormat><axisFormat/></categoryAxisFormat>
                        <valueAxisFormat><axisFormat/></valueAxisFormat>
                    </linePlot>
                </lineChart>
                <componentElement>
                    <reportElement uuid="339f574c-e88c-4b0c-a0ce-a3efe3a5c772"
                                   x="38" y="180" width="468" height="144"/>
                    <fc:chart xmlns:fc="http://jaspersoft.com/fusion"
                              xsi:schemaLocation="http://jaspersoft.com/fusion http://jaspersoft.com/schema/fusion.xsd"
                              type="Line" evaluationTime="Report">
                        <fc:chartDataset>
                            <fc:item>
                                <fc:seriesExpression><![CDATA[$F{target}]]></fc:seriesExpression>
                                <fc:labelExpression><![CDATA[$F{Month}]]></fc:labelExpression>
                                <fc:valueExpression><![CDATA[$F{Actual}]]></fc:valueExpression>
                            </fc:item>
                        </fc:chartDataset>
                    </fc:chart>
                </componentElement>
                <componentElement>
                    <reportElement uuid="ed8e8cfe-e829-45d3-8e7d-7d2769dfc4ff" 
                                   x="38" y="341" width="468" height="150"/>
                    <hc:chart xmlns:hc="http://jaspersoft.com/highcharts"
                              xsi:schemaLocation="http://jaspersoft.com/highcharts http://jaspersoft.com/schema/highcharts.xsd"
                              type="StackedLine" evaluationTime="Report">
                        <hc:chartSetting name="default">
                            <hc:chartProperty name="title.text" value=""/>
                            <hc:chartProperty name="credits.text" value=""/>
                            <hc:chartProperty name="credits.enabled" value="false"/>
                            <hc:chartProperty name="credits.href" value=""/>
                            <hc:chartProperty name="yAxis.title.text" value=""/>
                        </hc:chartSetting>
                        <multiAxisData>
                            <multiAxisDataset/>
                            <dataAxis axis="Rows">
                                <axisLevel name="Level1">
                                    <labelExpression><![CDATA["Level1"]]></labelExpression>
                                    <axisLevelBucket order="None" class="java.lang.Comparable">
                                        <bucketExpression><![CDATA[$F{Month}]]></bucketExpression>
                                    </axisLevelBucket>
                                </axisLevel>
                            </dataAxis>
                            <dataAxis axis="Columns">
                                <axisLevel name="Target">
                                    <labelExpression><![CDATA["Target"]]></labelExpression>
                                    <axisLevelBucket order="None" class="java.lang.Comparable">         
                                        <bucketExpression><![CDATA[$F{target}]]></bucketExpression>
                                    </axisLevelBucket>
                                </axisLevel>
                            </dataAxis>
                            <multiAxisMeasure name="Actual" class="java.lang.Number" calculation="Average">
                                <labelExpression><![CDATA["Actual"]]></labelExpression>       
                                <valueExpression><![CDATA[$F{Actual}]]></valueExpression>
                            </multiAxisMeasure>
                        </multiAxisData>
                        <hc:series name="Actual"/>
                    </hc:chart>
                </componentElement>
            </band>
        </title>
        <pageHeader>
            <band height="6" splitType="Stretch"/>
        </pageHeader>
        <columnHeader>  
            <band height="6" splitType="Stretch"/>
        </columnHeader>
        <detail>
            <band height="6" splitType="Stretch"/>
        </detail>
        <columnFooter>
            <band height="8" splitType="Stretch"/>
        </columnFooter>
    <pageFooter>
        <band height="8" splitType="Stretch"/>
    </pageFooter>
    <summary>  
        <band height="6" splitType="Stretch"/> 
    </summary>
</jasperReport>

any help would be greatly appreciated.

Thank you.

tom.beckman's picture
Joined: Feb 28 2014 - 7:39pm
Last seen: 1 year 3 months ago

Here is an update:

The root cause seems to actually be associated to the "Series" definition I have.  I'm not sure why this would cause the chart to toally fail though.

From the above example, all I have for the series expression is the field "Target".  In the real data, there are multiple "targets" presented (C:\, D:\, E:\, etc).

However, when I remove the "series" from the chart, it plots data.

Does anyone know what I might be configuring incorrect on the series?

 

Thank you

tom.beckman - 5 years 2 weeks ago

1 Answer:

0

So after all this time, I finally figured it out.  When entering a series in the HTML5 charts, you have to select a sort order...leaving it to "none" will cause the chart to fail to render...ugh...an ounce of documentation can save over a year of B.S.

tom.beckman's picture
Joined: Feb 28 2014 - 7:39pm
Last seen: 1 year 3 months ago
Feedback