Reputation: 29
I want to delete the horizontal lines that appear in a chart line as values, but I can´t find the correct option in properties of the chart:
I want the chart to look like this instead:
Upvotes: 1
Views: 378
Reputation: 5103
The JasperReports chart element model does not expose that attribute. You'll need to write a chart customizer (or theme) so set it.
The customizer class would look like this:
package my.code;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.CategoryPlot;
import net.sf.jasperreports.engine.JRAbstractChartCustomizer;
import net.sf.jasperreports.engine.JRChart;
public class LineChartCustomizer extends JRAbstractChartCustomizer
{
@Override
public void customize(JFreeChart chart, JRChart jasperChart)
{
CategoryPlot plot = chart.getCategoryPlot();
plot.setRangeGridlinesVisible(false);
}
}
You would then need to set the customizer class for the chart element:
<lineChart>
<chart customizerClass="my.code.LineChartCustomizer">
...
Upvotes: 2