I used this code to change the color of all my shortcuts:
private void setFontColor(Color fontColor) { JFreeChart chart = getChart(); chart.getTitle().setPaint(fontColor); Plot plot = chart.getPlot(); if (plot instanceof CategoryPlot) { setAxisFontColor(((CategoryPlot) plot).getDomainAxis(), fontColor); setAxisFontColor(((CategoryPlot) plot).getRangeAxis(), fontColor); } else if (plot instanceof XYPlot) { setAxisFontColor(((XYPlot) plot).getDomainAxis(), fontColor); setAxisFontColor(((XYPlot) plot).getRangeAxis(), fontColor); } } private void setAxisFontColor(Axis axis, Color fontColor) { if (!fontColor.equals(axis.getLabelPaint())) axis.setLabelPaint(fontColor); if (!fontColor.equals(axis.getTickLabelPaint())) axis.setTickLabelPaint(fontColor); }
If you use subtitles, you also need to add them.
IvanRF
source share