Rich
Rich

Reputation: 4207

Java Free Chart Question

I'm using JFreeChart to display data in my PC application (Java, Netbeans). I could not find a way to directly configure the horizontal axis to display like I wanted, so I attempted to build the display manually.

I did discover how to disable the display of tick labels (the numbers along the axes), but when I did that, JFreeChart helpfully moved the axes to the edge of the display area leaving me no room to draw my labels. Dang.

What I'm trying to accomplish is to display x-axis values ONLY at the left edge, the center, and the right edge. I'm willing to use whatever tool will get this done, but so far I've had very little success.

If anybody knows how to do this directly with JFreeChart, or how to scootch the X-axis a few pixels up the screen so I can print the labels manually, I would sure appreciate the assistance.

Thank, R.

Upvotes: 1

Views: 1281

Answers (1)

PaulV
PaulV

Reputation: 337

When you create a JFreeChart object, there should be a setPadding() method that allows you to define the space between the chart border and the actual chart area.

For example:

JFreeChart myChart = new ....;
myChart.setPadding(new RectangleInsets(1.0, 1.0, 1.0, 1.0));

Upvotes: 1

Related Questions