mtrbojevic
-
Posts
2 -
Joined
-
Last visited
Content Type
Profiles
Forum
Events
Featured Visualizations
Knowledge Base
Documentation (PDF Downloads)
Blog
Documentation (Test Area)
Documentation
Dr. Jaspersoft Webinar Series
Downloads
Posts posted by mtrbojevic
-
-
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.
display value beside each point on a line graph
in Products
Posted
You could write a customizer class to achieve this. See this thread for a sample code of such a class:
jasperforge.org/plugins/espforum/view.php
(http://jasperforge.org/plugins/espforum/view.php?group_id=83&forumid=101&topicid=25074)