Jump to content
Changes to the Jaspersoft community edition download ×

mtrbojevic

Members
  • Posts

    2
  • Joined

  • Last visited

mtrbojevic's Achievements

Newbie

Newbie (1/14)

  • First Post Rare
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputation

  1. 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)
  2. 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.
×
×
  • Create New...