arby
arby

Reputation: 23

jFreeChart: Vertical Grid Lines in XYPlot?

Right Now I have this chart: https://i.sstatic.net/xyyNX.png

I'd like to get the vertical grid to show. I can't find out how to do it. If possible, I'd like to replace the dashed lines too.

Here's the code I'm using to plot that (ignoring the irrelevant parts like actually creating the chart and adding the data):

XYPlot plot = chart.getXYPlot();
plot.setBackgroundPaint(Color.WHITE);
plot.setDomainGridlinesVisible(true);
plot.setRangeGridlinesVisible(true);
plot.setRangeGridlinePaint(Color.black);
plot.setDomainGridlinePaint(Color.black);

Upvotes: 2

Views: 6436

Answers (1)

trashgod
trashgod

Reputation: 205785

A similar approach works in this JFreeChartDemo. You might compare it to your code. You can change the lines' appearance using setDomainGridlineStroke() and setRangeGridlineStroke().

Upvotes: 3

Related Questions