Search code examples
javajfreecharttimeserieschart

JFreeChart's plot doesn't intersect with the axes


I'm currently using JFreeChart, but the the end of my plot doesn't intersect with the axes, plz have a look at my pic.

How could I get rid of that problem?enter image description here


Solution

  • You can set the margins on your domain axis to zero:

    ValueAxis axis = plot.getDomainAxis();
    axis.setLowerMargin(0);
    axis.setUpperMargin(0);