Jump to content

JasperReports + Bar Chart + JRXML


Recommended Posts

I am trying to dynamically generate bar charts using Scriptlets and JRBeanCollectionDataSource.

TEST_DATA_SOURCE is a java.util.Listhaving objects, populated by the Scriptlet.

Object contains field as defined in the subDataset.

Issue :

List has 3 objects but it is always printing the bar chart by considering only last object values.

First two objects are not at all considered. There might by some issue with the iteration OR may be I am doing the wrong way.

Please help me in overcoming this issue.

JRXML code snippet :

<subDataset name="SubDataset1" scriptletClass="TestScriptlet">

<field name="_time0" class="java.lang.Integer"/>

<field name="_time_1" class="java.lang.Integer"/>

<field name="_val_time0" class="java.lang.Integer"/>

<field name="_val_time1" class="java.lang.Integer"/>

<variable name="TEST_DATA_SOURCE" class="java.util.List" calculation="System"/>




<datasetRun subDataset="SubDataset1">

<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($V{TEST_DATA_SOURCE})]]></dataSourceExpression>




<seriesExpression><![CDATA["# Successful Requests"]]></seriesExpression>





<seriesExpression><![CDATA["# Successful Requests"]]></seriesExpression>





Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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...