1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| public JFreeChart affichageGraphe(int nombrePoints, String[] bufferLecture, double[] bufferClique){
XYSeries seriesGeo = new XYSeries("Parcours");
XYSeries seriesGeo2 = new XYSeries("Points cliqués");
for (int i=13 ; i<nombrePoints ; i+=19)
{
double longitude0 = Double.parseDouble(bufferLecture[i]);
double latitude0 = Double.parseDouble(bufferLecture[i+1]);
seriesGeo.add(longitude0, latitude0);
}
for (int i=0 ; i<NOMBRE_POINTS_POSSIBLES ; i+=2)
{
seriesGeo2.add(bufferClique[i], bufferClique[i+1]);
}
///////////////////////////////////////////////////////////////////////////////////////////////
XYDataset xyDatasetGeo = new XYSeriesCollection(seriesGeo);
XYDataset xyDatasetGeo2 = new XYSeriesCollection(seriesGeo2);
chartGeo = ChartFactory.createScatterPlot("", "", "", xyDatasetGeo, PlotOrientation.VERTICAL, true, true, false);
///////////////////////////////////////////////////////////////////////////////////////////////
//3. Mise en place du nouvelle axe dans le diagramme.
plot2 = (XYPlot) chartGeo.getPlot();
plot2.setDataset(2, (XYDataset) xyDatasetGeo2);
//4.Rendu du tracé
XYItemRenderer rendu2= new XYLineAndShapeRenderer(false,true);
rendu2.setPaint(Color.BLUE);
plot2.setRenderer(2,rendu2);
///////////////////////////////////////////////////////////////////////////////////////////////
return chartGeo;
} |
Partager