Jump to content

How to Handle Empty Dataset in bar,bar3D and Stacked Bar,bar3D charts


kcsekhar25

Recommended Posts

 

 

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

  • 4 weeks later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

  • 4 months later...

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