Jump to content
Changes to the Jaspersoft community edition download ×

Bar chart with group repeats same values on each page


sarah.brock

Recommended Posts

Hi all,

I hope someone can help me with the following error because I've been working on it for hours.

I'm trying to break a bar chart across several pages/charts, as I have too many values for it to still be readable in just one chart.

I have used mainly the following page as instruction:

http://stackoverflow.com/questions/14516654/how-to-split-chart-into-multiple-pages-like-cross-tab-in-jasperreports-server

So what I did is for each of my values (taken from an sql source), I calculated a number "myNr" with the following formula: select ..., ((rownum -1) - mod( (rownum-1),5)) as myNr;
I.e. I want to split the graph every five values.

Part from jrxml file:

 

<group name="Nr_Split" isStartNewPage="true">
<groupExpression><![CDATA[$F{MYNR}]]></groupExpression>
<groupFooter>
<band height="315">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/>
<barChart>
<chart evaluationTime="Report">
<reportElement x="0" y="0" width="802" height="315" uuid="7021535d-e31e-4bc8-bdde-c469cfb7894f"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<categoryDataset>
<dataset resetType="Group" resetGroup="Nr_Split"/>
<categorySeries>
<seriesExpression><![CDATA[$F{DATA_TYPE}]]></seriesExpression>
<categoryExpression><![CDATA[$F{USER_NAME}]]></categoryExpression>
<valueExpression><![CDATA[$F{DATA_VALUE}]]></valueExpression>
<labelExpression><![CDATA[$F{USER_NAME}]]></labelExpression>
</categorySeries>
</categoryDataset>
<barPlot>
<plot/>
<itemLabel/>
<categoryAxisFormat>
<axisFormat labelColor="#000000" tickLabelColor="#000000" axisLineColor="#000000"/>
</categoryAxisFormat>
<valueAxisFormat>
<axisFormat labelColor="#000000" tickLabelColor="#000000" axisLineColor="#000000"/>
</valueAxisFormat>
</barPlot>
</barChart>
</band>
</groupFooter>
</group>
 
In one dataset for example, I have 39 lines, which leads to 8 groups (myNr=0, myNr=5, ... myNr=35). I do end up with 8 pages in the end, however,  on each of the pages, I always only see the values from the first 5 lines, repeated over and over again.

Am I missing something? Is there such a thing as a group break, which I might have to add in each group footer?

Thanks in advance,
Sarah

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