Monday 15 July 2013

JFree Meter chart customization in Jasper iReport-- Removing values from the meter...

Hi..
This artical will teach you how to write custom code for meter chart to remove the values over the meter.
You need to see the text(theroy) part of the post below mentioned before you start trying this

http://jasper-bi-suite.blogspot.in/2013/06/jfree-bar-chart-customization-in.html

For this artical the output would looks some thing like this.


See there are no values over the meter chart... That you achive using the code below.


package com.sadakar.meter.chart.customizer;
import org.jfree.chart.plot.MeterPlot;

public class MeterChartCustomizer implements  net.sf.jasperreports.engine.JRChartCustomizer{

  @Override
    public void customize(org.jfree.chart.JFreeChart chart, net.sf.jasperreports.engine.JRChart jasperChart) 
    {    
       MeterPlot plot = (MeterPlot) chart.getPlot();
       
        for(int i=0; i< plot.getIntervals().size(); i++)
        {
                if(i >0 && i < plot.getIntervals().size()-1)
                    plot.setTickLabelsVisible(false);
        }     
       
         
    }
}

Thanks for reading this artical..

Other useful blog:

http://passionfordata.blogspot.in/




No comments:

Post a Comment