kcsekhar25 Posted June 18, 2012 Share Posted June 18, 2012 Hi all,i have a subdataset which returns empty data to the stackedbar 3d chart and i want to display a custom message " No Data Available when the chart doesnot have data to plot.i am using below customizer class to show custom message for stacked bar charts when there is no data to plot.i am breaking my head on this for a month,please let me know if you jave any solution for this. i am getting a custom message for pie chart and line chart using customizer class.i attached the jars i am using for getting the custom message using jfree chart API.import net.sf.jasperreports.engine.JRChart;import net.sf.jasperreports.engine.JRChartCustomizer;import org.jfree.chart.JFreeChart;import org.jfree.chart.axis.CategoryAxis;import org.jfree.chart.axis.NumberAxis;import org.jfree.chart.plot.CategoryPlot;import org.jfree.chart.plot.Plot;//import org.jfree.chart.renderer.category.BarRenderer;//import org.jfree.chart.renderer.category.CategoryItemRenderer;//import org.jfree.data.category.CategoryDataset; public { {} {CategoryPlot plot1 = chart.getCategoryPlot();Plot plot = chart.getPlot(); class BarchartCustomizer2implements JRChartCustomizerpublic BarchartCustomizer2()public void customize(JFreeChart chart, JRChart jasperChart)//BarRenderer renderer = (BarRenderer) plot.getRenderer(); NumberAxis rangeaxis = (NumberAxis)plot1.getRangeAxis();plot1.getDomainAxis().setMaximumCategoryLabelLines(2); plot.setNoDataMessage(}} "No Data Available");' Link to comment Share on other sites More sharing options...
kcsekhar25 Posted July 13, 2012 Author Share Posted July 13, 2012 hi folks,finally i got the solution using chart customizers.i used setnodatamessage method to ahndle when there is no data to plot Link to comment Share on other sites More sharing options...
subashmy Posted December 10, 2012 Share Posted December 10, 2012 Hey, I am also facing similar kind of issue... Can you please help me out by telling how you have written customized class for bar charts to handle empty dataset !!! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now