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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
this.series1 = new XYSeries("Bathy");
this.essai = new TimeSeries("Temps réel", Second.class);
this.essai.setMaximumItemAge(1800);
this.immer = new TimeSeries("Temps réel imm", Second.class);
this.immer.setMaximumItemAge(1800);
XYSeriesCollection dataset = new XYSeriesCollection();
dataset.addSeries(this.series1);
TimeSeriesCollection dataset1 = new TimeSeriesCollection();
//TimeSeriesCollection dataset2 = new TimeSeriesCollection();
dataset1.addSeries(this.essai);
dataset1.addSeries(this.immer);
//Premier graph
Cel.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12));
Imm.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12));
Cel.setLabelFont(new Font("SansSerif", Font.PLAIN, 14));
Imm.setLabelFont(new Font("SansSerif", Font.PLAIN, 14));
XYItemRenderer renderer = new XYLineAndShapeRenderer(true, true);
renderer.setSeriesPaint(0, Color.black);
renderer.setSeriesShape(0, new Ellipse2D.Double(-3.0, -3.0, 6.0, 6.0));
renderer.setStroke(new BasicStroke(3f, BasicStroke.CAP_BUTT,
BasicStroke.JOIN_BEVEL));
plot = new XYPlot(dataset, Cel, Imm, renderer);
plot.setBackgroundPaint(Color.lightGray);
plot.setDomainGridlinePaint(Color.white);
plot.setRangeGridlinePaint(Color.white);
plot.setOrientation(PlotOrientation.VERTICAL);
plot.setAxisOffset(new RectangleInsets(0.0, 0.0, 0.0, 0.0));
Cel.setRange(1470, 1520);
Cel.setLowerMargin(0.0);
Cel.setUpperMargin(0.0);
Cel.setTickLabelsVisible(true);
Imm.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
Imm.setRange(-300, 0);
JFreeChart chart = new JFreeChart("BATHY",
new Font("SansSerif", Font.BOLD, 24), plot, true);
chart.setBackgroundPaint(Color.white);
//Deuzieme graph
domain.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12));
domain.setLabelFont(new Font("SansSerif", Font.PLAIN, 14));
range.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12));
range.setLabelFont(new Font("SansSerif", Font.PLAIN, 14));
Cim.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12));
Cim.setLabelFont(new Font("SansSerif", Font.PLAIN, 14));
XYItemRenderer renderer1 = new XYLineAndShapeRenderer(true, true);
renderer1.setSeriesPaint(0, Color.red);
renderer1.setSeriesPaint(1, Color.GREEN);
renderer1.setSeriesShape(0, new Ellipse2D.Double(-3.0, -3.0, 6.0, 6.0));
renderer1.setStroke(new BasicStroke(3f, BasicStroke.CAP_BUTT,
BasicStroke.JOIN_BEVEL));
XYPlot plot1 = new XYPlot(dataset1,domain, range , renderer1);
plot1.setRangeAxis(1, Cim);
plot1.setBackgroundPaint(Color.lightGray);
plot1.setDomainGridlinePaint(Color.white);
plot1.setRangeGridlinePaint(Color.white);
plot1.setOrientation(PlotOrientation.VERTICAL);
plot1.setAxisOffset(new RectangleInsets(0, 0, 0, 0));
plot1.mapDatasetToRangeAxis(1, 1);//Attribution axeY / series
range.setRange(1470, 1520);
range.setLowerMargin(0.0);
range.setUpperMargin(0.0);
range.setTickLabelsVisible(true);
Cim.setRange(-300, -20);
Cim.setLowerMargin(0.0);
Cim.setUpperMargin(0.0);
Cim.setTickLabelsVisible(true);
domain.setAutoRange(true);
domain.setLowerMargin(0.0);
domain.setUpperMargin(0.0);
domain.setTickLabelsVisible(true);
JFreeChart chart1 = new JFreeChart("Graph Temps/Céléritée",
new Font("SansSerif", Font.BOLD, 24), plot1, true);
chart1.setBackgroundPaint(Color.white);
//On rajoute au panel
ChartPanel CP = new ChartPanel(chart);
ChartPanel Graph = new ChartPanel(chart1);
jTabbedPane1.addTab("Bathy", CP);
jTabbedPane1.addTab("Graphique", Graph); |
Partager