Jump to content
We've recently updated our Privacy Statement, available here ×

alouloubrand

Members
  • Posts

    1
  • Joined

  • Last visited

alouloubrand's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. Hi everyone, I've been struggling with this for so long and I really need help... I am trying to create a piechart using a Java collection. The java collection is a collection of "StatsRegles" objects, that contains two attributes: id (Integer) and triggerNumber (Integer) Cuurent Problem: The piechart appears in the report as an empty picture (no chart, no errors displayed, nothing, just a frame with an invisible content) I am first creating the JRBeanCollectionDatasource: JRBeanCollectionDataSource statsReglesDataSource = new JRBeanCollectionDataSource(statsRegles); (statsRegles is of type ArrayList<StatsRegle>)ClientReportInput.setStatsReglesDataSource(statsReglesDataSource); then I am adding it to the parameters hashmap, used to generate the report: parameters.put("statsReglesDataSource", getStatsReglesDataSource()); As for the ClientReport.jxml file, here is the parameter declaration: <parameter name="statsReglesDataSource" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/> here is the subdataset declaration <subDataset name="StatsRegleDataSet" uuid="ac90ea90-c198-4832-984f-e11509730f69"> <queryString> <![CDATA[]]> </queryString> <field name="id" class="java.lang.Integer"/> <field name="triggerNumber" class="java.lang.Integer"/> <sortField name="id"/></subDataset> and here is the interesting part, the piechart implementation: <pieChart> <chart evaluationTime="Report"> <reportElement x="150" y="10" width="220" height="200" uuid="ac8924b1-92f8-45f4-aaa7-52fe05a0d403"/> <chartTitle/> <chartSubtitle/> <chartLegend/> </chart> <pieDataset maxCount="10"> <dataset resetType="Report"> <datasetRun subDataset="StatsRegleDataSet" uuid="4e4e4127-1b96-4155-8be6-2f644f8a9c4b"> <dataSourceExpression><![CDATA[$P{statsReglesDataSource}]]></dataSourceExpression> </datasetRun> </dataset> <keyExpression><![CDATA[$F{triggerNumber}]]></keyExpression> <valueExpression><![CDATA[$F{triggerNumber}]]></valueExpression> <labelExpression><![CDATA["Regle "+$F{id}.toString()]]></labelExpression> </pieDataset> <piePlot> <plot/> <itemLabel/> </piePlot></pieChart>
×
×
  • Create New...