Example usage for org.jfree.chart.plot CombinedDomainCategoryPlotEx CombinedDomainCategoryPlotEx

List of usage examples for org.jfree.chart.plot CombinedDomainCategoryPlotEx CombinedDomainCategoryPlotEx

Introduction

In this page you can find the example usage for org.jfree.chart.plot CombinedDomainCategoryPlotEx CombinedDomainCategoryPlotEx.

Prototype

public CombinedDomainCategoryPlotEx(CategoryAxis domainAxis) 

Source Link

Usage

From source file:org.toobsframework.pres.chart.ChartBuilder.java

private Plot configurePlot(IRequest componentRequest, String id,
        org.toobsframework.pres.chart.config.Plot plotDef, Map params) throws ChartException {

    Plot plot = null;//from   www. j  a va  2s  . co  m
    if (plotDef.getSubPlotCount() > 0) {
        boolean is3D = (ParameterUtil.resolveParam(componentRequest, plotDef.getIs3D(), params, "false")[0]
                .equals("false") ? false : true);
        int plotType = ChartUtil.getSupportedPlots().get(
                ParameterUtil.resolveParam(componentRequest, plotDef.getType(), params, "multiCategory")[0]);
        PlotOrientation orientation = (ParameterUtil.resolveParam(componentRequest, plotDef.getOrientation(),
                params, "vertical")[0].equals("horizontal") ? PlotOrientation.HORIZONTAL
                        : PlotOrientation.VERTICAL);
        switch (plotType) {
        case ChartUtil.PLOT_MULTICATEGORY_TYPE:
            plot = new MultiCategoryPlot();
            for (int p = 0; p < plotDef.getSubPlotCount(); p++) {
                ((MultiCategoryPlot) plot).add((CategoryPlot) this.configurePlot(componentRequest, id,
                        plotDef.getSubPlot(p), params, true, plotType, plotDef));
            }
            ((MultiCategoryPlot) plot).setOrientation(orientation);
            ((MultiCategoryPlot) plot).setGap(plotDef.getGap());
            if (plotDef.getInsets() != null) {
                plot.setInsets(ChartUtil.getRectangle(componentRequest, plotDef.getInsets(), params));
            }
            break;
        case ChartUtil.PLOT_COMBINEDDOMAINCATEGORY_TYPE:
            CategoryAxis domainAxis = ChartUtil.createCategoryAxis(componentRequest, plotDef.getDomainAxisDef(),
                    params, is3D);
            plot = new CombinedDomainCategoryPlotEx(domainAxis);
            for (int p = 0; p < plotDef.getSubPlotCount(); p++) {
                ((CombinedDomainCategoryPlotEx) plot).add((CategoryPlot) this.configurePlot(componentRequest,
                        id, plotDef.getSubPlot(p), params, true, plotType, plotDef));
            }
            ((CombinedDomainCategoryPlotEx) plot).setOrientation(orientation);
            ((CombinedDomainCategoryPlotEx) plot).setGap(plotDef.getGap());
            if (plotDef.getInsets() != null) {
                plot.setInsets(ChartUtil.getRectangle(componentRequest, plotDef.getInsets(), params));
            }
            break;
        case ChartUtil.PLOT_COMBINEDRANGECATEGORY_TYPE:
            ValueAxis rangeAxis = createValueAxis(componentRequest, plotDef.getRangeAxisDef(), params, is3D);
            plot = new CombinedRangeCategoryPlotEx(rangeAxis);
            for (int p = 0; p < plotDef.getSubPlotCount(); p++) {
                ((CombinedRangeCategoryPlotEx) plot).add((CategoryPlot) this.configurePlot(componentRequest, id,
                        plotDef.getSubPlot(p), params, true, plotType, plotDef));
            }
            ((CombinedRangeCategoryPlotEx) plot).setOrientation(orientation);
            if (plotDef.getInsets() != null) {
                plot.setInsets(ChartUtil.getRectangle(componentRequest, plotDef.getInsets(), params));
            }
            break;
        }
    } else {
        plot = this.configurePlot(componentRequest, id, plotDef, params, false, -1, null);
    }

    return plot;
}