Tom
Tom

Reputation: 1385

JFreeChart: remove gridlines on CombinedDomainXYPlot with PeriodAxis

Context: Java swing application generating a chart using JFreeChart. The chart is a CombinedDomainXYPlot (using XYBarRenderer) that on the X-axis has a timeline based on PeriodAxis.

Problem: I can't remove the vertical gridlines (not the tickmarks related to the time periods) that separate days. What I tried is: combinedPlot.setDomainGridlinesVisible(false) which doesn't work (see image below).

enter image description here

Any hint would be more than welcome!

Thx, Thomas

Upvotes: 1

Views: 1361

Answers (1)

Tom
Tom

Reputation: 1385

After some additional research I found the mistake: for CombinedDomainXYPlot the setDomainGridlinesVisible(false) needs to be called on the subplots:

List<XYPlot> subplots = (List<XYPlot>) combinedPlots.getSubplots();
for (XYPlot p:subplots) p.setDomainGridlinesVisible(false);

Upvotes: 3

Related Questions