Package org.openfaces.component.chart

Examples of org.openfaces.component.chart.LineChartView


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


        return gridCategoryPlot;
    }

    private AbstractXYItemRenderer createRenderer(Chart chart, XYDataset ds) {
        final LineChartView chartView = (LineChartView) chart.getChartView();
        AbstractXYItemRenderer renderer;

        if (chartView.getLineAreaFill() != null) {
            renderer = new XYLineFillRenderer();
        } else {
            renderer = chartView.isEnable3D()
                    ? new XYLineRenderer3DAdapter()
                    : new XYLineRendererAdapter();
        }

        if (chart.getChartSelection() != null && !chartView.isShapesVisible()) {
            throw new IllegalStateException("Chart selection is unsupported with disabled shapes.");
        }

        int seriesCount = ds != null ? ds.getSeriesCount() : 0;
        ConfigurableRenderer configurableRenderer = (ConfigurableRenderer) renderer;
View Full Code Here

    public Dataset getDataSet() {
        return dataSet;
    }

    public void configure(ChartView view, ConfigurableRenderer renderer) {
        LineChartView lineChartView = (LineChartView) view;

        java.util.List<LineProperties> linePropertiesList = lineChartView.getLinePropertiesList();
        if (linePropertiesList == null)
            return;

        for (LineProperties lineProperties : linePropertiesList) {
            if (renderer instanceof XYRendererAdapter && dataSet instanceof XYDataset) {
View Full Code Here

    public FillPaintConfigurator(int seriesCount) {
        this.seriesCount = seriesCount;
    }

    public void configure(ChartView view, ConfigurableRenderer configurableRenderer) {
        LineChartView chartView = (LineChartView) view;
        final boolean fillPaintsSpecified = chartView.getFillPaints() != null && !chartView.getFillPaints().isEmpty();
        AbstractRenderer renderer = (AbstractRenderer) configurableRenderer;

        if (chartView.getDefaultFillColor() != null || fillPaintsSpecified) {
            if (renderer instanceof XYRendererAdapter) {
                ((XYRendererAdapter) renderer).setUseFillPaint(true);
            } else if (renderer instanceof LineAndShapeRenderer) {
                ((LineAndShapeRenderer) renderer).setUseFillPaint(true);
            }
        }

        if (chartView.getDefaultFillColor() != null && !fillPaintsSpecified) {
            renderer.setBaseFillPaint(chartView.getDefaultFillColor());
            for (int seriesIndex = 0; seriesIndex < seriesCount; seriesIndex++) {
                renderer.setSeriesFillPaint(seriesIndex, chartView.getDefaultFillColor());
            }
        } else if (fillPaintsSpecified) {
            final Iterator fillPaintsIterator = chartView.getFillPaints().iterator();
            for (int seriesIndex = 0; seriesIndex < seriesCount; seriesIndex++) {
                if (fillPaintsIterator.hasNext()) {
                    final Paint paint = (Paint) fillPaintsIterator.next();
                    renderer.setSeriesFillPaint(seriesIndex, paint);
                }
View Full Code Here

    public LineStrokeConfigurator(int seriesCount) {
        this.seriesCount = seriesCount;
    }

    public void configure(ChartView view, ConfigurableRenderer configurableRenderer) {
        LineChartView chartView = (LineChartView) view;

        final boolean lineStylesSpecified = chartView.getLineStyles() != null && !chartView.getLineStyles().isEmpty();
        AbstractRenderer renderer = (AbstractRenderer) configurableRenderer;

        if (renderer instanceof XYRendererAdapter) {
            ((XYRendererAdapter) renderer).setBaseShapesVisible(chartView.isShapesVisible());
        } else if (renderer instanceof LineAndShapeRenderer) {
            ((LineAndShapeRenderer) renderer).setBaseShapesVisible(chartView.isShapesVisible());
        }

        if (chartView.getDefaultLineStyle() != null && !lineStylesSpecified) {
            renderer.setBaseStroke(chartView.getDefaultLineStyle().getStroke());
            for (int seriesIndex = 0; seriesIndex < seriesCount; seriesIndex++) {
                renderer.setSeriesStroke(seriesIndex, chartView.getDefaultLineStyle().getStroke());
            }
        } else if (lineStylesSpecified) {
            final Iterator strokesIterator = chartView.getLineStyles().iterator();
            for (int seriesIndex = 0; seriesIndex < seriesCount; seriesIndex++) {
                if (strokesIterator.hasNext()) {
                    final LineStyle lineStyle = (LineStyle) strokesIterator.next();
                    renderer.setSeriesStroke(seriesIndex, lineStyle.getStroke());
                }
View Full Code Here

    public AreaFillConfigurator() {
    }

    public void configure(ChartView view, ConfigurableRenderer renderer) {
        if (renderer instanceof AreaFillRenderer) {
            LineChartView chartView = (LineChartView) view;
            AreaFillRenderer areaFillRenderer = (AreaFillRenderer) renderer;
            areaFillRenderer.setBackgroundPaint(chartView.getBackgroundPaint());
            areaFillRenderer.setLineAreaFill(chartView.getLineAreaFill());
        }
    }
View Full Code Here

TOP

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

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.