Jump to content
Changes to the Jaspersoft community edition download ×

Null 'key' argument - Charts


samhast

Recommended Posts

My reports is working. But at the moment I add a chart.. I always receive following error:

Null 'key' argument

This is since I upgraded frop iReport to Jaspersoft Studio!

full error message:

java.lang.IllegalArgumentException: Null 'key' argument.
at org.jfree.data.DefaultKeyedValues.setValue(DefaultKeyedValues.java:229)
at org.jfree.data.DefaultKeyedValues2D.setValue(DefaultKeyedValues2D.java:337)
at org.jfree.data.DefaultKeyedValues2D.addValue(DefaultKeyedValues2D.java:303)
at org.jfree.data.category.DefaultCategoryDataset.addValue(DefaultCategoryDataset.java:222)
at net.sf.jasperreports.charts.fill.JRFillCategoryDataset.customIncrement(JRFillCategoryDataset.java:143)
at net.sf.jasperreports.engine.fill.JRFillElementDataset.increment(JRFillElementDataset.java:191)
at net.sf.jasperreports.engine.fill.JRCalculator.calculateVariables(JRCalculator.java:183)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:740)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:263)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:123)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:539)
at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:153)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:474)
at com.jaspersoft.studio.utils.ExpressionUtil.initBuiltInParameters(ExpressionUtil.java:339)
at com.jaspersoft.studio.editor.preview.view.control.ReportControler$5.run(ReportControler.java:330)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
 
Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

  • 7 months later...
  • 1 month later...

I'm trying the tutorial at http://community.jaspersoft.com/wiki/creating-charts-and-subreports-jaspersoft-studio and am getting the same error. 

This is using JasperReports 6.2 andjasper studio 6.2.

The graph in that tutorial is also a bar chart.

Are there any tricks for debugging this stuff?  Java stack traces into code you don't have sources to (org.jfree in this case) and exception messages like "null 'key' argument" are pretty useless.

Here's the jrxml generated from the example:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0  -->
<!-- 2016-01-28T16:16:22 -->
<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="GraphReport" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="c029557d-c3bc-47e9-a5ff-f7544e7265cb">
    <property name="com.jaspersoft.studio.data.sql.tables" value=""/>
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="Sample DB"/>
    <queryString>
        <![CDATA[select count(*), SHIPCITY from orders group by SHIPCITY]]>
    </queryString>
    <field name="C1" class="java.lang.Long"/>
    <field name="SHIPCITY" class="java.lang.String"/>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="350" splitType="Stretch">
            <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
            <barChart>
                <chart evaluationTime="Report">
                    <reportElement x="0" y="0" width="555" height="350" uuid="eb78ea14-af53-4212-90f4-0186ec9effcf"/>
                    <chartTitle/>
                    <chartSubtitle/>
                    <chartLegend/>
                </chart>
                <categoryDataset>
                    <categorySeries>
                        <seriesExpression><![CDATA[$F{SHIPCITY}]]></seriesExpression>
                        <valueExpression><![CDATA[$F{C1}]]></valueExpression>
                        <labelExpression><![CDATA[$F{SHIPCITY}]]></labelExpression>
                    </categorySeries>
                </categoryDataset>
                <barPlot>
                    <plot/>
                    <itemLabel/>
                    <categoryAxisLabelExpression><![CDATA[" "]]></categoryAxisLabelExpression>
                    <categoryAxisFormat>
                        <axisFormat/>
                    </categoryAxisFormat>
                    <valueAxisFormat>
                        <axisFormat/>
                    </valueAxisFormat>
                </barPlot>
            </barChart>
        </band>
    </title>
</jasperReport>
 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...