[#5129] - <xyzDataset> is documented to allow <labelExpression> but fails

Category:
Bug report
Priority:
Normal
Status:
New
Project: Severity:
Minor
Resolution:
Open
Component: Reproducibility:
Always
Assigned to:

I'm calling this a bug as the software doesn't match the documentation, though it could really be a feature request.

This document http://jasperforge.org/uploads/publish/jasperreportswebsite/trunk/sample... indicates that an <xyzDataset> can have a <labelExpression> sub-element, but the schema (http://jasperreports.sourceforge.net/xsd/jasperreport.xsd) says otherwise.

This prevents labelling of data elements in the bubble chart type.

Could <labelExpression> be allowed in <xyzDataset> elements in the schema in order to label these items?

schultcd's picture
315
Joined: Aug 2 2007 - 6:09am
Last seen: 10 years 2 days ago

1 Comment:

#1

For anyone reading this that just wants to label their bubble charts, I was able to do it using a customizer.

For my label, I wanted to use the same as the series label. Simple enough:

import net.sf.jasperreports.engine.JRAbstractChartCustomizer;
import net.sf.jasperreports.engine.JRChart;

import org.jfree.chart.JFreeChart;
import org.jfree.chart.labels.BubbleXYItemLabelGenerator;

import org.jfree.data.xy.XYDataset;

public class BubbleChartLabelCustomizer
extends JRAbstractChartCustomizer
{
public void customize(JFreeChart chart, JRChart jasperChart)
{
chart.getXYPlot().getRenderer().setBaseItemLabelGenerator(new LabelGenerator());
chart.getXYPlot().getRenderer().setBaseItemLabelsVisible(true);
}

class LabelGenerator
extends BubbleXYItemLabelGenerator
{
public String generateLabel(XYDataset dataset, int series, int item)
{
return String.valueOf(dataset.getSeriesKey(series));
}
}
}

Feedback
randomness