Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9205851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:03:34+00:00 2026-06-18T00:03:34+00:00

I want to split a horizontal Bar chart into multiple pages, as the Category

  • 0

I want to split a horizontal Bar chart into multiple pages, as the Category Expressions dataset is huge around 200, which is resulting the graph to be in an unreadable format.

I want something like, the Category Expression dataset to be distributed in blocks of 15,
as to display first 15 categories in page1, and so on. I was wondering, if its doable in JasperReports Server using iReport Professional 4.5.0.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:03:35+00:00Added an answer on June 18, 2026 at 12:03 am

    You can utilize report groups to achieve this. Open your report in iReport. The report query is the main report query, in my sample I will refer to two fields: cat as category and val as value.

    • in the report inspector right click on the report and select Add Report Group. Follow the wizard, set a name (e.g. splitter) and select Group by the following expression and enter $V{REPORT_COUNT} - 1 - ( ($V{REPORT_COUNT} - 1) % 15 ). Click next and select Add the group footer.
    • Drag and drop a chart element from the Palette into the report designer on the group footer band. Select Bar Chart, follow the wizard:
      • Choose Main report dataset, Click Next.
      • Change series expression to what you need (e.g. "Sample"), Click Next.
      • Set category expression to $F{cat}, value expression to $F{val}. Click Finish. The wizard closes and the chart is now configured in the report.
    • Right click on the chart, click on Chart Data. In the Dataset panel set Reset type to Group, select as Reset Group your group (e.g. splitter). Click close.

    Recommendation 1: Select the chart and scroll in the Properties panel to Range Axis Max Value Expression, set the max value for your chart there. This will ensure that all charts will have the same scale. In the attached sample I have set it statically to 100, it’d be also good to provide the max value via database query.

    Recommendation 2: when you run the report you might notice that the last bar chart might look different as JasperReports/jfreechart scales the width of the bars depending on the number of categories. To have a static width for the bar charts you’d need to create a chart customizer which sets a fixed width to a single bar.

    I have attached a sample output where i set the splitter value to 3 on a sample dataset.
    report output

    I also attach the JRXML for further reference. Difference to the description above is that instead of using a static value I defined a parameter to define the number of elements in a single bar chart.

    <?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="report5" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="271b22ae-bc2f-4da1-a499-e41a8f4252b2">
        <property name="ireport.zoom" value="1.0"/>
        <property name="ireport.x" value="0"/>
        <property name="ireport.y" value="0"/>
        <parameter name="splitBy" class="java.lang.Integer">
            <defaultValueExpression><![CDATA[3]]></defaultValueExpression>
        </parameter>
        <queryString>
            <![CDATA[select val, cat from (
    select 15 as val, "A" as cat
    union select 65 as val, "B" as cat
    union select 34 as val, "C" as cat
    union select 99 as val, "D" as cat
    union select 67 as val, "E" as cat
    union select 23 as val, "F" as cat
    union select 76 as val, "G" as cat
    union select 23 as val, "H" as cat
    union select 56 as val, "I" as cat
    union select 11 as val, "J" as cat
    union select 23 as val, "K" as cat
    union select 5 as val, "L" as cat
    union select 11 as val, "M" as cat
    union select 15 as val, "N" as cat
    union select 12 as val, "O" as cat
    union select 13 as val, "P" as cat
    ) tbl group by cat
    ]]>
        </queryString>
        <field name="val" class="java.lang.Long"/>
        <field name="cat" class="java.lang.String"/>
        <group name="splitter">
            <groupExpression><![CDATA[$V{REPORT_COUNT} - 1 - ( ($V{REPORT_COUNT} - 1) % $P{splitBy} ) ]]></groupExpression>
            <groupFooter>
                <band height="154">
                    <barChart>
                        <chart>
                            <reportElement uuid="e046c83e-11c5-4f3a-adfb-a540024400f5" x="0" y="0" width="555" height="154"/>
                            <chartTitle/>
                            <chartSubtitle/>
                            <chartLegend/>
                        </chart>
                        <categoryDataset>
                            <dataset resetType="Group" resetGroup="splitter"/>
                            <categorySeries>
                                <seriesExpression><![CDATA["Sample"]]></seriesExpression>
                                <categoryExpression><![CDATA[$F{cat}]]></categoryExpression>
                                <valueExpression><![CDATA[$F{val}]]></valueExpression>
                            </categorySeries>
                        </categoryDataset>
                        <barPlot>
                            <plot/>
                            <itemLabel/>
                            <rangeAxisMaxValueExpression><![CDATA[100]]></rangeAxisMaxValueExpression>
                        </barPlot>
                    </barChart>
                </band>
            </groupFooter>
        </group>
    </jasperReport>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We want to split our large asp.net mvc web application into multiple Visual Studio
I want to split the qc column every 255 characters into multiple strings and
I want to split a file(suppose a mp3) into four parts.I have tried this
I want to split a string in Javascript using split function into 2 parts.
I want to split a string like this: abc//def//ghi into a part before and
I want to split a file containg HTTP response into two files: one containing
I have the following array: $array = array(1,0,0,0,1,1,1,1,0,1,1,1,1,0,1,1,0,1,0,0,1,0,1); I want split it up into
I have a ListView in Android that I want to split in pages that
I want split lines into list based on line starter ,am getting exception while
I want split integers into their factors. For example, if the total number of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.