Jfreechart - removing spaces in a chart

I am using JFreeChart and I want to remove the left and right spaces in my waterfall diagram.

Here's what my diagram looks like right now with red squiggles to demonstrate the space I want to remove.

Waterfallchart

Any idea how to remove these spaces?

+4
source share
1 answer

Since ChartFactory.createWaterfallChart() creates an instance of CategoryAxis , just set the appropriate fields:

 CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(0); domainAxis.setUpperMargin(0); 
+4
source

Source: https://habr.com/ru/post/1392416/


All Articles