Package org.openfaces.component.chart

Examples of org.openfaces.component.chart.GridPointInfo


        }
        return null;
    }

    private static String getDynamicProperties(Chart chart, ChartViewValueExpression view, ChartEntity entity) {
        GridPointInfo info = ChartInfoUtil.getGridPointInfo(entity, chart);
        if (info == null) {
            PieSectorInfo infoPie = ChartInfoUtil.getPieSectorInfo(entity);
            if (infoPie != null) {
                PieChartView pieView = (PieChartView) chart.getChartView();
                pieView.setSector(infoPie);
View Full Code Here


        }
    }

    private void setupGridChartSelection(Plot plot, GridChartView chartView) {
        if (chartView.getPoint() != null) {
            GridPointInfo point = chartView.getPoint();
            final ChartSelection selection = chartView.getChart().getChartSelection();

            final LineStyle lineStyle = selection.getLineStyle();
            Paint outlinePaint = lineStyle.getColor() != null
                    ? lineStyle.getColor()
                    : Color.BLUE;
            final Stroke outlineStroke = lineStyle.getStroke() != null
                    ? lineStyle.getStroke()
                    : new BasicStroke(5.0F, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL);
            final Paint selectionPaint = selection.getFillPaint();

            Object itemRenderer = null;
            if (plot instanceof XYPlot) {
                itemRenderer = ((XYPlot) plot).getRenderer();
            } else if (plot instanceof CategoryPlot) {
                itemRenderer = ((CategoryPlot) plot).getRenderer();
            }

            if (itemRenderer != null && itemRenderer instanceof CustomizedRenderer) {
                if (itemRenderer instanceof BarRenderer) {
                    ((BarRenderer) itemRenderer).setDrawBarOutline(true);
                } else if (itemRenderer instanceof XYBarRenderer) {
                    ((XYBarRenderer) itemRenderer).setDrawBarOutline(true);
                } else if (itemRenderer instanceof XYRendererAdapter) {
                    ((XYRendererAdapter) itemRenderer).setDrawOutlines(true);
                } else if (itemRenderer instanceof XYLineAndShapeRenderer) {
                    ((XYLineAndShapeRenderer) itemRenderer).setDrawOutlines(true);
                }

                final SeriesInfo series = point.getSeries();
                ((CustomizedRenderer) itemRenderer).setItemOutlinePaint(series.getIndex(), point.getIndex(), outlinePaint);
                ((CustomizedRenderer) itemRenderer).setItemOutlineStroke(series.getIndex(), point.getIndex(), outlineStroke);

                ((CustomizedRenderer) itemRenderer).setItemPaint(series.getIndex(), point.getIndex(), selectionPaint);
            }
        }
    }
View Full Code Here

    private static GridPointInfo getGridPointInfo(CategoryItemEntity en, Chart chart) {
        ChartModel model = chart.getModel();
        if (model == null)
            return null;

        GridPointInfo info = new GridPointInfoImpl();
        info.setSeries(new SeriesInfoImpl());
        info.getSeries().setIndex(en.getSeries());

        ModelInfo modelInfo = new ModelInfo(model);

        if (!modelInfo.isDataEmpty()) {
            CategoryDataset ds = ModelConverter.toCategoryDataset(modelInfo);
            Comparable seriesKey = ds.getRowKey(en.getSeries());
            Comparable tupleKey = ds.getColumnKey(en.getCategoryIndex());
            Object tupleValue = ds.getValue(seriesKey, tupleKey);
            info.setIndex(en.getCategoryIndex());
            info.setKey(tupleKey);
            info.setValue(tupleValue);
            info.getSeries().setKey(seriesKey);
        }

        return info;
    }
View Full Code Here

    private static GridPointInfo getGridPointInfo(XYItemEntity en, Chart chart) {
        ChartModel model = chart.getModel();
        if (model == null)
            return null;

        GridPointInfo info = new GridPointInfoImpl();
        info.setSeries(new SeriesInfoImpl());
        info.getSeries().setIndex(en.getSeriesIndex());
        info.setIndex(en.getItem());
        ModelInfo modelInfo = new ModelInfo(model);
        if (!modelInfo.isDataEmpty()) {
            if (modelInfo.getModelType() == ModelType.Date) {
                TimeSeriesCollection ds = ModelConverter.toTimeSeriesCollection(chart, modelInfo);
                Comparable seriesKey = ds.getSeriesKey(en.getSeriesIndex());
                Number tupleKey = ds.getX(en.getSeriesIndex(), en.getItem());
                if (tupleKey instanceof Long) {
                    info.setKey(new Date(tupleKey.longValue()));
                } else {
                    info.setKey(tupleKey);
                }

                Object tupleValue = ds.getY(en.getSeriesIndex(), en.getItem());

                info.setValue(tupleValue);
                info.getSeries().setKey(seriesKey);
            } else {
                XYDataset ds = ModelConverter.toXYSeriesCollection(modelInfo);
                Comparable seriesKey = ds.getSeriesKey(en.getSeriesIndex());
                Number tupleKey = ds.getX(en.getSeriesIndex(), en.getItem());
                info.setKey(tupleKey);

                Object tupleValue = ds.getY(en.getSeriesIndex(), en.getItem());

                info.setValue(tupleValue);
                info.getSeries().setKey(seriesKey);
            }
        }

        return info;
    }
View Full Code Here

    }

    private String getValue(XYDataset xyDataset, int i, int i1) {
        String currentValue = "";
        try {
            GridPointInfo point = new GridPointInfoImpl();
            point.setSeries(new SeriesInfoImpl());

            Object key = xyDataset.getX(i, i1);

            ModelInfo info = view.getChart().getRenderHints().getModelInfo();

            if ((key instanceof Long) && info != null && info.getModelType() == ModelType.Date) {
                key = new Date((Long) key);
            }

            point.setKey(key);
            point.setValue(xyDataset.getY(i, i1));

            point.getSeries().setKey(xyDataset.getSeriesKey(i));

            view.setPoint(point);
            //!
            //Object currentValue = DynamicPropertiesUtils.getDynamicValue("point", point, myDynamicProperty);
            //!
View Full Code Here

    }

    private String getValue(CategoryDataset categoryDataset, int i, int i1) {
        String currentValue = "";
        try {
            GridPointInfo point = new GridPointInfoImpl();
            point.setSeries(new SeriesInfoImpl());
            point.setKey(categoryDataset.getColumnKey(i1));
            point.setValue(categoryDataset.getValue(i, i1));

            point.getSeries().setKey(categoryDataset.getRowKey(i));
            point.getSeries().setIndex(categoryDataset.getRowIndex(categoryDataset.getRowKey(i)));

            view.setPoint(point);
            //!
            //String currentValue = DynamicPropertiesUtils.getDynamicValue("point", point, dynamicProperty);
View Full Code Here

    public String onPointClickAction() {
        return null;
    }

    public String getTooltips() {
        GridPointInfo info = lineView.getPoint();
        Long key = (Long) info.getKey();
        Date d = new Date(key);
        DateFormat df = DateFormat.getDateTimeInstance();
        return df.format(d);
    }
View Full Code Here

                Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
                chart.setEntityIndex(i);

                if (view instanceof GridChartView) {
                    final GridPointInfo pointInfo = ChartInfoUtil.getGridPointInfo(entity, chart);
                    if (pointInfo != null) {
                        Object oldAttributeValue = requestMap.put("point", pointInfo);
                        renderChartPopup(facesContext, view);
                        requestMap.put("point", oldAttributeValue);
                    }
View Full Code Here

TOP

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

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.