Amazon festival offer

Sunday 9 June 2013

Basic Chart Properties - 2 (Jasperreport charts)

By changing the chart properties, you can present the data in better format and make the chart more visualize. So in this post I will try to change some chart properties of the same chart that I had created in my previous post, these are some basic chart properties:-

               Chart before applying properties                                  Chart after applying properties


  • As you can see in first chart numbers are not there, to see the values of each column uncheck the Show Labels check box and check again after unchecking.
  • To change the colors of bars add the colors in Series Colors properties.
  •  You can also add the Category axis (X-axis) and Value axis (Y- Axis) labels in Category Axis Label Expression and Value Axis Label Expression property.
  •  To move the legends from bottom to top change the Legend Position to Top.
  •  X and Y Offset values are to decrease or increase the 3D effect.
  •   By adding text in to Title Expression, you can add the chart title.
  • To change the background color of chart, go to chart property and add color in Backcolor property and check the Opaque check box.



                                                

Basic Chart Properties - 1 (Jasperreport charts)

Chart properties:-
By changing the chart properties, you can present the data in better format and make the chart more visualise. So in this post I will try to change some chart properties of the same chart that I had created in my previous post, these are some basic chart properties:-

      Rotate category axis(X- axis) label :  -
      To rotate category axis, go to the chart property tab and change the
                  Category Axis Tick Label Rotation / Label rotation to            -50.0
      (You can change it according to your requirement)
       
       
              


        Convert data format in special format in iReport : -
       Sometimes you may need to change the date format to some other date format , in case if you
       are using date column in category axis and you want to show the dates in “MMM-yy” format.
       To change the date format of category axis dates, right click on chart, select chart data tab, and
       add this date format
                                  new SimpleDateFormat("MMM-yy").format($F{DataMonth})
       Where $F{DataMonth} will be date column

        Concatenate two columns in iReport :  
      This show you how to concatenate two data filed in iReport
                                            $F{Firstname} + “ - ” + $F{Lastname}
       However, both data should be same data format like if you want to concatenate string and
       integer data filed then first convert integer field to string function.
      To convert integer field to string field add .toString() function.
                                           $F{MONTH} +"-"+$F{YEAR}.toString()
For example:-

I used this in the Series expression of the chart.