Bom dia Javeiros!
Estou com algumas dúvidas no gráfico de linhas…
Estou usando jfreechart e montei o seguinte gráfico com duas linhas:
public class Grafico {
public ChartPanel montaGrafico(ArrayList<Historico> historicos){
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
for (int i = 30; i < historicos.size(); i++) {
if(historicos.get(i).getMediaMovel() == 0)
break;
dataset.addValue(historicos.get(i).getMediaMovel(),"Média Movel",historicos.get(i).getData());
dataset.addValue(historicos.get(i).getValorFechamento(),"Valor Fechamento",historicos.get(i).getData());
}
JFreeChart jfreechart = ChartFactory.createLineChart("Compra e Venda", "Data", "Valor", dataset, PlotOrientation.VERTICAL, true, true, false);
CategoryPlot plot = jfreechart.getCategoryPlot();
final CategoryAxis domainAxis = plot.getDomainAxis();
domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
NumberAxis rangeAxis = (NumberAxis) (jfreechart.getCategoryPlot()).getRangeAxis();
rangeAxis.setAutoRangeIncludesZero(false);
ChartPanel panel = new ChartPanel(jfreechart);
panel.setPreferredSize(new java.awt.Dimension(1250, 800));
return panel;
}
}
Gostaria de acrescentar a linha pontilhada do fundo na vertical tbm, no momento ela só aparece na horizontal…mas não acho a propriedade para fazer isso =/
e outra coisa que gostaria de acrescentar, como são duas linhas, quando elas tiverem o mesmo valor será necessário adicionar um marcador em cima. É possível?
Obrigada!