Package org.openfaces.component.chart.impl.generators

Examples of org.openfaces.component.chart.impl.generators.DynamicPieGenerator


                public AttributedString generateAttributedSectionLabel(PieDataset dataset, Comparable key) {
                    return null;
                }
            });
        } else if (labels.getDynamicText() != null) {
            plot.setLegendLabelGenerator(new DynamicPieGenerator(chartView, labels.getDynamicText()));
        } else {
            plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator());
        }

    }
View Full Code Here


    private void setupPieLabelGenerator(PiePlot plot, PieChartView chartView) {
        if (chartView.isLabelsVisible()) {
            ChartLabels labels = chartView.getLabels();
            if (labels != null && labels.getDynamicText() != null)
                plot.setLabelGenerator(new DynamicPieGenerator(chartView, labels.getDynamicText()));
            else
                plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
            //TODO: move to style helper
            if (labels != null) {
                StyleObjectModel cssLabelsModel = labels.getStyleObjectModel();
View Full Code Here

                public String generateToolTip(PieDataset pieDataset, Comparable comparable) {
                    return chartView.getTooltip();
                }
            });
        } else if (chartView.getDynamicTooltip() != null) {
            plot.setToolTipGenerator(new DynamicPieGenerator(chartView, chartView.getDynamicTooltip()));
        }

        if (chartView.getUrl() != null) {
            plot.setURLGenerator(new PieURLGenerator() {
                public String generateURL(PieDataset pieDataset, Comparable comparable, int i) {
                    return chartView.getUrl();
                }
            });
        } else if (chartView.getDynamicUrl() != null) {
            plot.setURLGenerator(new DynamicPieGenerator(chartView, chartView.getDynamicUrl()));
        }

    }
View Full Code Here

        java.util.List<PieSectorProperties> sectors = chartView.getSectors();
        if (sectors == null || sectors.size() == 0)
            return;

        for (PieSectorProperties sector : sectors) {
            DynamicPieGenerator generator = new DynamicPieGenerator(chartView, null);

            int index = -1;

            Float sectorPulled = sector.getPulled();
            if (dataset instanceof CategoryToPieDataset) {
                CategoryToPieDataset cds = (CategoryToPieDataset) dataset;
                int count = getIterationCount(cds);
                for (int q = 0; q < count; q++) {
                    CategoryToPieDataset currPieDataset = new CategoryToPieDataset(categoryDataset, order, q);
                    java.util.List keys = currPieDataset.getKeys();
                    index = -1;
                    for (int j = 0; j < keys.size(); j++) {
                        index++;

                        boolean conditionValue = generator.getConditionValue(sector, q, currPieDataset, currPieDataset.getKey(j));
                        if (!conditionValue)
                            continue;

                        if (sectorPulled != null && sectorPulled > 0) {
                            plot.setExplodePercent(index, (double) sectorPulled);
                        }

                        StyleObjectModel cssSectorModel = sector.getStyleObjectModel();
                        if (cssSectorModel != null && cssSectorModel.getBorder() != null) {
                            StyleBorderModel border = cssSectorModel.getBorder();
                            Color borderColor = border.getColor();
                            if (borderColor != null) {
                                plot.setSectionOutlinePaint(index, borderColor);
                                plot.setSectionOutlineStroke(index, PropertiesConverter.toStroke(border));
                            }

                            Color sectorModelColor = cssSectorModel.getColor();
                            if (sectorModelColor != null) {
                                plot.setSectionPaint(index, sectorModelColor);
                            }
                        }
                    }
                }
            } else {
                if (dataset == null || dataset.getKeys() == null)
                    continue;

                for (int j = 0; j < dataset.getKeys().size(); j++) {
                    index++;

                    boolean conditionValue = generator.getConditionValue(sector, 0, dataset, dataset.getKey(j));
                    if (!conditionValue)
                        continue;

                    if (sectorPulled != null && sectorPulled > 0) {
                        plot.setExplodePercent(index, (double) sectorPulled);
View Full Code Here

                public AttributedString generateAttributedSectionLabel(PieDataset dataset, Comparable key) {
                    return null;
                }
            });
        } else if (labels.getDynamicText() != null) {
            plot.setLegendLabelGenerator(new DynamicPieGenerator(chartView, labels.getDynamicText()));
        } else {
            plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator());
        }

    }
View Full Code Here

    private void setupPieLabelGenerator(PiePlot plot, PieChartView chartView) {
        if (chartView.isLabelsVisible()) {
            ChartLabels labels = chartView.getLabels();
            if (labels != null && labels.getDynamicText() != null)
                plot.setLabelGenerator(new DynamicPieGenerator(chartView, labels.getDynamicText()));
            else
                plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
            //TODO: move to style helper
            if (labels != null) {
                StyleObjectModel cssLabelsModel = labels.getStyleObjectModel();
View Full Code Here

                public String generateToolTip(PieDataset pieDataset, Comparable comparable) {
                    return chartView.getTooltip();
                }
            });
        } else if (chartView.getDynamicTooltip() != null) {
            plot.setToolTipGenerator(new DynamicPieGenerator(chartView, chartView.getDynamicTooltip()));
        }

        if (chartView.getUrl() != null) {
            plot.setURLGenerator(new PieURLGenerator() {
                public String generateURL(PieDataset pieDataset, Comparable comparable, int i) {
                    return chartView.getUrl();
                }
            });
        } else if (chartView.getDynamicUrl() != null) {
            plot.setURLGenerator(new DynamicPieGenerator(chartView, chartView.getDynamicUrl()));
        }

    }
View Full Code Here

        List<PieSectorProperties> sectors = chartView.getSectors();
        if (sectors == null || sectors.size() == 0)
            return;

        for (PieSectorProperties sector : sectors) {
            DynamicPieGenerator generator = new DynamicPieGenerator(chartView, null);

            int index = -1;

            Float sectorPulled = sector.getPulled();
            if (dataset instanceof CategoryToPieDataset) {
                CategoryToPieDataset cds = (CategoryToPieDataset) dataset;
                int count = getIterationCount(cds);
                for (int q = 0; q < count; q++) {
                    CategoryToPieDataset currPieDataset = new CategoryToPieDataset(categoryDataset, order, q);
                    List keys = currPieDataset.getKeys();
                    index = -1;
                    for (int j = 0; j < keys.size(); j++) {
                        index++;

                        boolean conditionValue = generator.getConditionValue(sector, q, currPieDataset, currPieDataset.getKey(j));
                        if (!conditionValue)
                            continue;

                        if (sectorPulled != null && sectorPulled > 0) {
                            plot.setExplodePercent(index, (double) sectorPulled);
                        }

                        StyleObjectModel cssSectorModel = sector.getStyleObjectModel();
                        if (cssSectorModel != null && cssSectorModel.getBorder() != null) {
                            StyleBorderModel border = cssSectorModel.getBorder();
                            Color borderColor = border.getColor();
                            if (borderColor != null) {
                                plot.setSectionOutlinePaint(index, borderColor);
                                plot.setSectionOutlineStroke(index, PropertiesConverter.toStroke(border));
                            }

                            Color sectorModelColor = cssSectorModel.getColor();
                            if (sectorModelColor != null) {
                                plot.setSectionPaint(index, sectorModelColor);
                            }
                        }
                    }
                }
            } else {
                if (dataset == null || dataset.getKeys() == null)
                    continue;

                for (int j = 0; j < dataset.getKeys().size(); j++) {
                    index++;

                    boolean conditionValue = generator.getConditionValue(sector, 0, dataset, dataset.getKey(j));
                    if (!conditionValue)
                        continue;

                    if (sectorPulled != null && sectorPulled > 0) {
                        plot.setExplodePercent(index, (double) sectorPulled);
View Full Code Here

TOP

Related Classes of org.openfaces.component.chart.impl.generators.DynamicPieGenerator

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.