Debrandano
Debrandano

Reputation: 21

How to decrease the size of horizontal bar at report?

I'm creating a Jasper report with horizontal bar, and I have a problem with one of my bars from the chart; the last one is very much bigger than the others, and it is cutting in half of the value of the label.

How can I adjust to not surpass a specific value of the chart?

Upvotes: 1

Views: 349

Answers (1)

Debrandano
Debrandano

Reputation: 21

Thanks @trashgod for your help, with the setUpperMargin() method it worked to decrease the size of the horizontal bar.

To anyone with the same problem as I was having, my code to fix it is below:

public void customize(JFreeChart chart, JRChart jasperChart) {
  NumberAxis numAxis =  (NumberAxis) chart.getCategoryPlot().getRangeAxis();
  numAxis.setUpperMargin(0.25);
}

Documentation: ValueAxis - JFreeChart

Upvotes: 1

Related Questions