I'm designing using JFreeChart to create line graphics, but I'm having a hard time customizing the caption's position. Currently my chart looks like this:
ButIneedthecaptiontobeinthelowerleftcorner.HowcanIcustomize?
//graficodamediadeumperiodopublicJFreeChartgraficoPeriodoDeCrescimento(List<Formulario>lista,Stringtitulo,StringlabelBottom,StringlabelLeft){DefaultCategoryDatasetdataset=newDefaultCategoryDataset();try{for(Formularioformulario:lista){System.out.println("estou percorrendo a lista");
dataset.addValue(formulario.getCrescimento(), "Média", formulario.getDataInicial());
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "deu pau no grafico");
}
graficoDeLinha = ChartFactory.createLineChart(titulo, labelBottom, labelLeft, dataset,
PlotOrientation.VERTICAL, true, true, false);
// fonte
Font fonteNova = new Font("TimesRoman", Font.PLAIN, 18);
CategoryItemRenderer renderer = graficoDeLinha.getCategoryPlot().getRenderer();
CategoryPlot plot = graficoDeLinha.getCategoryPlot();
plot.setBackgroundPaint(Color.WHITE);
plot.setDomainGridlinePaint(Color.GREEN);
plot.setAxisOffset(new RectangleInsets(12.0, 12.0, 5.0, 5.0));
plot.setRangeGridlinePaint(Color.RED);
// cor e linha das séries
renderer.setSeriesPaint(0, Color.BLUE);
renderer.setSeriesStroke(0,
new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.f, dash, 0.0f));
renderer.setSeriesPositiveItemLabelPosition(0,
new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.BASELINE_CENTER));
renderer.setSeriesOutlineStroke(0,
new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.f, dash, 0.0f));
renderer.setSeriesOutlinePaint(0, Color.GREEN);
// legendas
LegendItemCollection legendas = new LegendItemCollection();
LegendItem legenda1 = new LegendItem("Crescimento");
legenda1.setSeriesIndex(0);
legenda1.setFillPaint(Color.BLUE);
legenda1.setLabelPaint(Color.BLUE);
legenda1.setLabelFont(fonteNova);
legendas.add(legenda1);
plot.setFixedLegendItems(legendas);
return graficoDeLinha;
}