Reputation: 4000
I'm sorry I don't know what it is so I may have asked an unclear question but I hope the attached images explains it. I circled the areas I need to remove. I simply need the whole background to have one continuous color whether it's gray or anything else.
Here is the piece of code I use to generate the chart:
final JFreeChart chart = ChartFactory.createTimeSeriesChart(generateTitle(title, resultsCount), xAxis, yAxis,
(XYDataset) paramCategoryDataset, true, false, false);
final XYPlot plot = chart.getXYPlot();
plot.setNoDataMessage(MSG_NO_DATA);
plot.setBackgroundPaint(Color.LIGHT_GRAY); //I need the BG to be plain gray.
SymbolAxis localSymbolAxis1 = new SymbolAxis("Domain", new String[] { "Failure", "Success", "Failure", "Success", "Failure", "Success" });
plot.setRangeAxis(localSymbolAxis1);
XYStepRenderer localXYStepRenderer = new XYStepRenderer();
localXYStepRenderer.setBaseFillPaint(Color.white);
localXYStepRenderer.setUseFillPaint(true);
localXYStepRenderer.setBaseShape(ShapeUtilities.createDiamond(2f));
localXYStepRenderer.setAutoPopulateSeriesShape(false);
localXYStepRenderer.setAutoPopulateSeriesStroke(false);
localXYStepRenderer.setDataBoundsIncludesVisibleSeriesOnly(false);
plot.setRenderer(localXYStepRenderer);
And here is the image showing what I need to remove within in curved rectangles:
But let me ask another greedy question. Is there a way to have my step graph line right in one of those hilighted areas instead of having half of it in the dark part and the other half in the lighter part ?
Upvotes: 1
Views: 2360
Reputation: 205785
To get a continuous background color, you can set the gridlines' visibility to false
.
plot.setDomainGridlinesVisible(false);
plot.setRangeGridlinesVisible(false);
Alternatively, you can set the plot's background color to match the gridlines.
Addendum: I meant the light and dark areas in the background.
Ah, you want the alternating light- and medium-gray areas to be a single shade of gray. Try this:
symbolAxis.setGridBandsVisible(false);
Upvotes: 2