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
|
CategoryDataset[] dataset = getMultiDataSet(startDate, endDate);
// Creation du chart
JFreeChart chart = ChartFactory.createLineChart(
titreGraphe, // chart title
"Jours", // Label en bas du graphe
"Axe 0", // label sur axe vertical
dataset[0], // donnees
PlotOrientation.VERTICAL, // orientation
true, // include legende en bas
true, // tooltips en mouse over
false // urls
);
chart.setBackgroundPaint(Color.white);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
plot.setBackgroundPaint(Color.lightGray);
plot.setRangeGridlinePaint(Color.white);
// AXE 0
NumberAxis numberAxis0 = (NumberAxis) plot.getRangeAxis();
numberAxis0.setPositiveArrowVisible(true);
numberAxis0.setRange(0, 6000);
numberAxis0.setLabelPaint(Color.black);
numberAxis0.setTickLabelPaint(Color.black);
numberAxis0.setVisible(true); // echelle visible
plot.setRangeAxis(0, numberAxis0);
// AXE 1
NumberAxis numberAxis1 = new NumberAxis("Axe 1");
numberAxis1.setPositiveArrowVisible(true);
numberAxis1.setRange(0, 8000);
numberAxis1.setLabelPaint(Color.blue);
numberAxis1.setTickLabelPaint(Color.blue);
numberAxis1.setVisible(isScaleVisible);
plot.setRangeAxis(1, numberAxis1);
plot.setDataset(1, dataset[1]);
plot.mapDatasetToRangeAxis(1, 1);
// Renderer 0
LineAndShapeRenderer renderer0
= (LineAndShapeRenderer) plot.getRenderer();
renderer0.setSeriesShapesVisible(0, true);
renderer0.setDrawOutlines(true);
renderer0.setUseFillPaint(true);
// ***** Cette couleur est celle de toutes les courbes lorsque j'execute :((
renderer0.setSeriesPaint(0, Color.green);//couleur du trait du graphe
renderer0.setSeriesFillPaint(0, Color.magenta); // couleur du contenu du carre
plot.setRenderer(0, renderer0);
// Renderer 1
LineAndShapeRenderer renderer1
= (LineAndShapeRenderer) plot.getRenderer();
renderer1.setSeriesShapesVisible(0, true);
renderer1.setDrawOutlines(true);
renderer1.setUseFillPaint(true);
renderer1.setSeriesPaint(1, Color.red); // couleur du trait du graphe
renderer1.setSeriesFillPaint(1, Color.yellow); // couleur du contenu du carre
plot.setRenderer(1, renderer1); |
Partager