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
| XYSeries seriesGeo = new XYSeries("Val1");
XYSeries seriesGeo2 = new XYSeries("Val2");
XYSeries seriesGeo3 = new XYSeries("Val3");
for (int i=minimumSize ; i<maximumSize ;i+=19) //20000 // count
{
double val1 = Double.parseDouble(bufferLecture[i]); //String to double
double val2 = Double.parseDouble(bufferLecture[i+1]); //String to double
double test = ( Double.parseDouble(bufferLecture[i-10]) + Double.parseDouble(bufferLecture[i-11])) /2;
if (test == 0) seriesGeo.add(val1, val2);
else if ( test > 0 && test <= 3) seriesGeo2.add(val1, val2);
else seriesGeo3.add(val1, val2);
}
XYDataset xyDatasetGeo = new XYSeriesCollection(seriesGeo);
XYDataset xyDatasetGeo2 = new XYSeriesCollection(seriesGeo2);
XYDataset xyDatasetGeo3 = new XYSeriesCollection(seriesGeo2);
JFreeChart chartGeo = ChartFactory.createScatterPlot
("XYLine Chart using JFreeChart", "Différentes mesures", "Caractéristique",
xyDatasetGeo, PlotOrientation.VERTICAL, true, true, false);
XYPlot plot2=(XYPlot) chartGeo.getPlot();
plot2.setDataset(1, (XYDataset) xyDatasetGeo2);
XYItemRenderer rendu2= new XYLineAndShapeRenderer();
rendu2.setSeriesPaint(0, Color.pink);
plot2.setRenderer(1,rendu2);
XYPlot plot3=(XYPlot) chartGeo.getPlot();
plot3.setDataset(1, (XYDataset) xyDatasetGeo3);
XYItemRenderer rendu3= new XYLineAndShapeRenderer();
rendu3.setSeriesPaint(0, Color.green);
plot3.setRenderer(1,rendu3);
ChartFrame frameGeo=new ChartFrame("XYLine Chart",chartGeo);
frameGeo.setSize(700,500);
frameGeo.setLocation(700,0);
frameGeo.setVisible(true); |
Partager