private ChartModel createDefaultModel() { if (WAFERMAP.equals(getType())) { return new WaferMapModel(100, 100); } final String klass = DEFAULT_MODEL.get(getType()); if (klass != null) { try { return (ChartModel) Classes.newInstanceByThread(klass); } catch (Exception e) { throw UiException.Aide.wrap(e); } } else { throw new UiException("unknown chart type: " + getType()); } }
if (Objects.equals(chart.getType(), _type) && _threeD == chart.isThreeD()) { return _chartImpl; if (Chart.PIE.equals(chart.getType())) _chartImpl = chart.isThreeD() ? new Pie3d() : new Pie(); else if (Chart.RING.equals(chart.getType())) _chartImpl = new Ring(); else if (Chart.BAR.equals(chart.getType())) _chartImpl = chart.isThreeD() ? new Bar3d() : new Bar(); else if (Chart.LINE.equals(chart.getType())) _chartImpl = chart.isThreeD() ? new Line3d() : new Line(); else if (Chart.AREA.equals(chart.getType())) _chartImpl = new AreaImpl(); else if (Chart.STACKED_BAR.equals(chart.getType())) _chartImpl = chart.isThreeD() ? new StackedBar3d() : new StackedBar(); else if (Chart.STACKED_AREA.equals(chart.getType())) _chartImpl = new StackedArea(); else if (Chart.WATERFALL.equals(chart.getType())) _chartImpl = new Waterfall(); else if (Chart.POLAR.equals(chart.getType())) _chartImpl = new Polar();
private void doSmartDraw() { if (Strings.isBlank(getType())) throw new UiException("chart must specify type (pie, bar, line, ...)"); if (_model == null) { _model = createDefaultModel(); } if (Strings.isBlank(getWidth())) throw new UiException("chart must specify width"); if (Strings.isBlank(getHeight())) throw new UiException("chart must specify height"); try { final AImage image = new AImage("chart" + new Date().getTime(), getEngine().drawChart(Chart.this)); setContent(image); } catch (java.io.IOException ex) { throw UiException.Aide.wrap(ex); } finally { _smartDrawChart = false; } }