andrey_nado Posted April 28, 2009 Share Posted April 28, 2009 Hi!I've turned on showing labels in my bar chart (<barPlot isShowLabels="true">). Labels are displayed right to bars (my chart is horizontal). It works well but label font is incorrect. Legend, title, axis labels are all dispalyed in proper font - default report font. How can I control font of bar labels?Thank you! Link to comment Share on other sites More sharing options...
lucianc Posted May 5, 2009 Share Posted May 5, 2009 Log this as a bug, somethings seems to be missing here.In the meantime, you can set the bar label font by using a chart customizer as below. Alternatively, you can extend the default chart theme to do the same thing.Regards,LucianCode:package jr;import java.awt.Font;import net.sf.jasperreports.engine.JRChart;import net.sf.jasperreports.engine.JRChartCustomizer;import net.sf.jasperreports.engine.util.JRFontUtil;import org.jfree.chart.JFreeChart;import org.jfree.chart.renderer.category.BarRenderer;public class BarChartCustomizer implements JRChartCustomizer{ public void customize(JFreeChart chart, JRChart jasperChart) { BarRenderer renderer = (BarRenderer) chart.getCategoryPlot().getRenderer(); Font font = JRFontUtil.getAwtFont(jasperChart.getTitleFont(), null); renderer.setBaseItemLabelFont(font); }} 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