Change the Chart Axis Dynamically – Jaspersoft Studio

Home  >>  Jaspersoft Studio  >>  Change the Chart Axis Dynamically – Jaspersoft Studio

Change the Chart Axis Dynamically – Jaspersoft Studio



I created this report to answer the Question from Jaspersoft Community .

1) Create a report with parameters. (I have used P_CITY and P_COUNTRY as parameters and the SQL Code I have used is as below)

SQL Query

SQL Query

2) This Query will take either P_COUNTRY as a parameter input and will display Country level data or P_CITY as parameter value and display city level data.

3) Now create a Variable which will display Country Names when P_COUNTRY is selected as the parameter and will display City names when P_CITY is selected as parameter.


4) Now create a Chart with this newly created variable as Category Field.


5) The Report design of my report looks like this.


6) Now when we preview the report, we needto provide teh parameter value. For teh purpose of this tutorial I added “Rio de Janeiro” as the value for P_CITY Parameter and left P_COUNTRY as Null.


7) The Result is as follows. (Check the X-axis and Y axis carefully)


8) Now P_CITY is kept Null and P_Country is updated as “Brazil”


9) The Result is as follows.


This is one way to Dynamically change the X-Axis values as per the parameter selection.

The above report is free for your download

Hope this helps you all!!!! For more information on Jaspersoft keep loked in 🙂

2 Comments so far:

  1. Saikiran says:

    Thank you so much. Its working for me.


  2. rajeshsirsikar says:

    I am happy that it worked for you and Thanks for the question. It made me think!!!!

Leave a Reply

Your email address will not be published. Required fields are marked *