public Plot configurePlot(Chart chart, ModelInfo info) {
return createPlot(chart, info);
}
private Plot createPlot(Chart chart, ModelInfo info) {
final BarChartView chartView = (BarChartView) chart.getChartView();
if (info.getModelType().equals(ModelType.Number)) {
XYDataset ds = ModelConverter.toXYSeriesCollection(info);
XYBarRenderer renderer = new XYBarRendererAdapter();
ConfigurableRenderer configurableRenderer = (ConfigurableRenderer) renderer;
int seriesCount = ds != null ? ds.getSeriesCount() : 0;
configure(chartView, configurableRenderer, seriesCount);
final GridXYPlotAdapter xyPlotAdapter = new GridXYPlotAdapter(ds, renderer, chartView);
initMarkers(chart, xyPlotAdapter);
return xyPlotAdapter;
}
if (info.getModelType().equals(ModelType.Date)) {
TimeSeriesCollection ds = ModelConverter.toTimeSeriesCollection(chart, info);
XYBarRenderer renderer = new XYBarRendererAdapter();
ConfigurableRenderer configurableRenderer = (ConfigurableRenderer) renderer;
int seriesCount = ds != null ? ds.getSeriesCount() : 0;
configure(chartView, configurableRenderer, seriesCount);
final GridDatePlotAdapter datePlotAdapter = new GridDatePlotAdapter(ds, renderer, chartView);
initMarkers(chart, datePlotAdapter);
return datePlotAdapter;
}
CategoryDataset ds = ModelConverter.toCategoryDataset(info);
int rowCount = ds != null ? ds.getRowCount() : 0;
BarRenderer renderer = chartView.isEnable3D()
? new BarRenderer3DAdapter()
: new BarRendererAdapter();
ConfigurableRenderer configurableRenderer = (ConfigurableRenderer) renderer;
configure(chartView, configurableRenderer, rowCount);
if (chartView.isEnable3D() && renderer instanceof BarRenderer3DAdapter) {
((BarRenderer3DAdapter) renderer).setWallPaint(chartView.getWallColor());
}
final GridCategoryPlotAdapter gridCategoryPlot = new GridCategoryPlotAdapter(ds, renderer, chartView);
initMarkers(chart, gridCategoryPlot);