use of org.jfree.chart.renderer.xy.XYLineAndShapeRenderer in project n2a by frothga.
the class Plot method createChart.
public JFreeChart createChart(final XYDataset dataset) {
final JFreeChart chart = ChartFactory.createXYLineChart(// chart title
null, // x axis label
null, // y axis label
null, // data
dataset, PlotOrientation.VERTICAL, // include legend
true, // tooltips
true, // urls
false);
LegendTitle legend = chart.getLegend();
legend.setVisible(dataset.getSeriesCount() <= 5);
XYPlot plot = chart.getXYPlot();
plot.setBackgroundPaint(Color.white);
plot.setDomainGridlinePaint(Color.lightGray);
plot.setRangeGridlinePaint(Color.lightGray);
plot.setDomainPannable(true);
plot.setRangePannable(true);
ValueAxis axis = plot.getRangeAxis();
if (axis instanceof NumberAxis)
((NumberAxis) axis).setAutoRangeIncludesZero(false);
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
for (int i = 0; i < dataset.getSeriesCount(); i++) renderer.setSeriesShapesVisible(i, false);
plot.setRenderer(renderer);
return chart;
}
Aggregations