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
| private void createChart(XYSeriesCollection dataset) {
chart = ChartFactory.createXYLineChart("", // Title
"nm", // x-axis Label
"E", // y-axis Label
dataset, // Dataset
org.jfree.chart.plot.PlotOrientation.VERTICAL, // Plot Orientation
true, // Show Legend
true, // Use tooltips
false // Configure chart to generate URLs?
);
chart.setBackgroundPaint(Color.white);
// get a reference to the plot for further customisation...
plot = (XYPlot) chart.getPlot();
plot.setBackgroundPaint(Color.white);
plot.setAxisOffset(new RectangleInsets(1.0, 1.0, 1.0, 1.0));
plot.setDomainGridlinePaint(Color.GRAY);
plot.setRangeGridlinePaint(Color.GRAY);
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer)plot.getRenderer();
// change the auto tick unit selection to integer units only...
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
} |
Partager