Package org.openfaces.component.chart

Examples of org.openfaces.component.chart.BarChartView


    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);
View Full Code Here


        piePlot.setShadowXOffset(pieChartView.getShadowXOffset());
        piePlot.setShadowYOffset(pieChartView.getShadowYOffset());
    }

    public void configure(ChartView view, ConfigurableRenderer renderer) {
        BarChartView chartView = (BarChartView) view;
        if (chartView.isShowShadow()) {
            validateShadowOffsetParameters(chartView);
        }

        if (renderer instanceof BarRenderer || renderer instanceof XYBarRendererAdapter) {
            if (renderer instanceof BarRenderer) {
View Full Code Here

    public BarsPainterConfigurator() {
    }

    public void configure(ChartView view, ConfigurableRenderer renderer) {
        BarChartView chartView = (BarChartView) view;
        Boolean showGradient = chartView.isShowGradient();

        if (renderer instanceof XYBarRenderer) {
            XYBarRenderer xyBarRenderer = (XYBarRenderer) renderer;

            if (showGradient) {
                validateGradientParameters(chartView.getG1WhitePosition(),
                        chartView.getG2FullIntensityPosition(), chartView.getG3LightIntensityPosition());

                GradientXYBarPainterAdapter gradientPainter =
                        new GradientXYBarPainterAdapter(chartView.getG1WhitePosition(),
                                chartView.getG2FullIntensityPosition(), chartView.getG3LightIntensityPosition());

                xyBarRenderer.setBarPainter(gradientPainter);
            } else {
                xyBarRenderer.setBarPainter(new StandardXYBarPainterAdapter());
            }
        } else if (renderer instanceof BarRenderer) {
            BarRenderer barRenderer = (BarRenderer) renderer;
            if (showGradient) {
                validateGradientParameters(chartView.getG1WhitePosition(),
                        chartView.getG2FullIntensityPosition(), chartView.getG3LightIntensityPosition());

                GradientBarPainter gradientPainter = new GradientBarPainter(chartView.getG1WhitePosition(),
                        chartView.getG2FullIntensityPosition(), chartView.getG3LightIntensityPosition());
                barRenderer.setBarPainter(gradientPainter);
            } else {
                barRenderer.setBarPainter(new StandardBarPainter());
            }
        } else {
View Full Code Here

TOP

Related Classes of org.openfaces.component.chart.BarChartView

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.