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
| // Création du graphique
JFreeChart barChart = ChartFactory.createBarChart3D(
"Nombre d'ouverture manuelle",
"Temps en minutes",
"Valeur",
data,
PlotOrientation.VERTICAL,
true,
true,
false);
// Affichage du graphique
ChartFrame frame1 = new ChartFrame("Statistiques", barChart);
frame1.setVisible(true);
frame1.setSize(1000,800);
// Modification des labels des axes (taille, police)
CategoryPlot plot = barChart.getCategoryPlot();
NumberAxis axe1 = (NumberAxis) plot.getRangeAxis();
axe1.setTickLabelFont(new java.awt.Font("Arial", java.awt.Font.PLAIN, 12));
axe1.setLabelFont(new java.awt.Font("Arial", java.awt.Font.PLAIN, 12));
Axis axe2 = plot.getDomainAxis();
axe2.setTickLabelFont(new java.awt.Font("Arial", java.awt.Font.PLAIN, 10));
axe2.setLabelFont(new java.awt.Font("Arial", java.awt.Font.PLAIN, 10));
// Labels des abcisses à la verticale
CategoryAxis axis = plot.getDomainAxis();
axis.setCategoryMargin(0.2); // Marge entre les catégories
axis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); |
Partager