Jump to content
Changes to the Jaspersoft community edition download ×

  • Giulio Toffoli
    • Product: iReport Designer

    JasperReports supports a large number of built-in charts created using the popular open source library JFreeChart. Chart types include Pie, Bar, Stacked Bar, Line, Area, Bubble, Gantt, Thermometer and Meter.

    In this tutorial we will learn how to add a multi-series chart to a report. We start creating a blank report based on the following SQL query (we use the JasperReports Sample db):

    select count(*) orders, year(ORDERDATE) year, MONTH(ORDERDATE) month
    from orders
    group by year(ORDERDATE), MONTH(ORDERDATE)
    order by year(ORDERDATE), MONTH(ORDERDATE)
    

    The query returns the amount of orders placed in each month in the several years. Open the query dialog, paste the query (be sure the JasperReports Sample db is the active connection) and read the fields from the query.

    From the palette drag the chart element inside the title band and select the Bar 3D chart.

    figure_1.png.3dcde62038c7ad4f3498c5b304241303.png

    Right click the chart and select Chart data. This will pop up the Chart data dialog. Select the tab details and add a new category. Set as Series expression the field Year ($F{YEAR}), as category the Month and as value the number of orders as shown in the following figure.

    figure_2.png.e873a7b1149ea1efbf473e69bde19a15.png

    Run your report. The following picture shows the final result.

    figure_3.png.8429c49d620d6ac61da355bb1ff2dc72.png


    User Feedback

    Recommended Comments

    There are no comments to display.



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