puneety Posted May 10, 2007 Share Posted May 10, 2007 HiI have drawn a line chart,& I want to show their value along the line(dots) also. I have attached the graph.Plz help me to achieve this. Link to comment Share on other sites More sharing options...
mtrbojevic Posted May 4, 2010 Share Posted May 4, 2010 Here's how it can be done: You should use a customizer class that looks something like this:/** * */package name_of_your_package;import java.text.DecimalFormat;import org.jfree.chart.JFreeChart;import net.sf.jasperreports.engine.JRChart;import net.sf.jasperreports.engine.JRChartCustomizer;import org.jfree.chart.plot.CategoryPlot;import org.jfree.chart.labels.StandardCategoryItemLabelGenerator;import org.jfree.chart.renderer.category.LineAndShapeRenderer;public class LineChartCustomizer implements JRChartCustomizer { public void customize(JFreeChart jFreeChart, JRChart jrChart) { CategoryPlot plot = jFreeChart.getCategoryPlot(); DecimalFormat dfKey = new DecimalFormat("###,###"); StandardCategoryItemLabelGenerator labelGenerator = new StandardCategoryItemLabelGenerator("{2}", dfKey); /* {0} - label would be equal to Series expression, {1} - label would be equal to Category expression, {2} - label would be equal to Value expression*/ LineAndShapeRenderer renderer = new LineAndShapeRenderer(); renderer.setBaseItemLabelsVisible(true); renderer.setBaseItemLabelGenerator(labelGenerator); plot.setRenderer(renderer); }} and write the name of the class in "Customizer class" field of your line chart. 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