public Plot configurePlot(Chart chart, ModelInfo info) {
return createPlot(chart, info);
}
private Plot createPlot(Chart chart, ModelInfo info) {
final LineChartView chartView = (LineChartView) chart.getChartView();
if (info.getModelType().equals(ModelType.Number)) {
XYDataset ds = ModelConverter.toXYSeriesCollection(info);
AbstractXYItemRenderer renderer = createRenderer(chart, ds);
final GridXYPlotAdapter xyPlot = new GridXYPlotAdapter(ds, renderer, chartView);
initMarkers(chart, xyPlot);
return xyPlot;
}
if (info.getModelType().equals(ModelType.Date)) {
TimeSeriesCollection ds = ModelConverter.toTimeSeriesCollection(chart, info);
AbstractXYItemRenderer renderer = createRenderer(chart, ds);
final GridDatePlotAdapter xyPlot = new GridDatePlotAdapter(ds, renderer, chartView);
initMarkers(chart, xyPlot);
return xyPlot;
}
CategoryDataset ds = ModelConverter.toCategoryDataset(info);
LineAndShapeRenderer renderer;
if (chartView.getLineAreaFill() != null) {
renderer = new LineFillRenderer();
} else {
renderer = chartView.isEnable3D()
? new LineRenderer3DAdapter()
: new LineRendererAdapter();
}
if (chart.getChartSelection() != null && !chartView.isShapesVisible()) {
throw new IllegalStateException("Chart selection is unsupported with disabled shapes.");
}
int rowCount = ds != null ? ds.getRowCount() : 0;
ConfigurableRenderer configurableRenderer = (ConfigurableRenderer) renderer;