Package com.invient.vaadin.charts.widgetset.client.ui.GwtInvientChartsConfig.GwtAxisBaseOptions

Examples of com.invient.vaadin.charts.widgetset.client.ui.GwtInvientChartsConfig.GwtAxisBaseOptions.GwtPlotBands


                .createArray().cast();
        int numOfChartAxisPlotBands = chartAxisPlotBands.length();
        int numOfUIDLAxisPlotBands = uidlAxisPlotBands.length();
        boolean updatedAxisPlotBands = false;
        for (int indOuter = 0; indOuter < numOfChartAxisPlotBands; indOuter++) {
            GwtPlotBands chartPlotBand = chartAxisPlotBands.get(indOuter);
            String plotBandId = chartPlotBand.getId();
            boolean found = false;
            for (int indInner = 0; indInner < numOfUIDLAxisPlotBands; indInner++) {
                GwtPlotBands uidlPlotBand = uidlAxisPlotBands.get(indInner);
                if (uidlPlotBand != null
                        && uidlPlotBand.getId().equals(plotBandId)) {
                    if (chartPlotBand.getFrom() == uidlPlotBand.getFrom()
                            && chartPlotBand.getTo() == uidlPlotBand.getTo()) {
                        VConsole.log("Plotband id "
                                + plotBandId
                                + " exists in chart as well as in UIDL from the server.");
                        // PlotBand exists and from/to values are same so
                        // nothing to be done.
                        // The UIDL plotband is set to null so that remaining
                        // plotbands
                        // can be safely added to the chart
                        uidlAxisPlotBands.set(indInner, null);
                        updatedChartAxisPlotBands.push(chartPlotBand);
                        VConsole.log("Plotband id " + plotBandId
                                + " exists in both.");
                        found = true;
                    }
                    break;
                }
            }
            if (!found) {
                // remove plot band as it is not found in UIDL received from the
                // server
                VConsole.log("Plotband id " + plotBandId + " removed.");
                updatedAxisPlotBands = true;
                chartAxis.removePlotBand(plotBandId);
            }
        }
        // Add all remaining plot bands in UIDL to the chart
        for (int ind = 0; ind < numOfUIDLAxisPlotBands; ind++) {
            GwtPlotBands uidlPlotBand = uidlAxisPlotBands.get(ind);
            if (uidlPlotBand != null) {
                updatedAxisPlotBands = true;
                VConsole.log("Plotband id " + uidlPlotBand.getId()
                        + " added with from : " + uidlPlotBand.getFrom()
                        + " and to: " + uidlPlotBand.getTo());
                chartAxis.addPlotBand(uidlPlotBand);
                updatedChartAxisPlotBands.push(uidlPlotBand);
            }
        }
View Full Code Here


            UIDL plotBandUIDL = plotBandsUIDL.getChildUIDL(cnt);
            if (plotBandUIDL.getAttributeNames().size() == 0
                    && plotBandUIDL.getChildCount() == 0) {
                continue;
            }
            GwtPlotBands plotBands = GwtPlotBands.create();
            if (plotBandUIDL.hasAttribute("color")) {
                plotBands.setColor(plotBandUIDL.getStringAttribute("color"));
            }
            if (plotBandUIDL.hasAttribute("id")) {
                plotBands.setId(plotBandUIDL.getStringAttribute("id"));
            }
            if (plotBandUIDL.hasAttribute("zIndex")) {
                plotBands.setZIndex(plotBandUIDL.getIntAttribute("zIndex"));
            }
            // label
            GwtPlotLabel label = getPlotLabel(plotBandUIDL.getChildUIDL(0));
            if (label != null) {
                plotBands.setLabel(label);
            }
            // from/to value
            UIDL valueUIDL = plotBandUIDL.getChildUIDL(1);
            if (valueUIDL.hasAttribute("valueType")) {
                String valueType = valueUIDL.getStringAttribute("valueType");
                if (valueType.equals("number")) {
                    plotBands.setFrom(valueUIDL.getDoubleAttribute("from"));
                    plotBands.setTo(valueUIDL.getDoubleAttribute("to"));
                } else { // date
                    // from
                    UIDL fromUIDL = valueUIDL.getChildUIDL(0);
                    int fromYear = fromUIDL.getIntAttribute("year");
                    int fromMonth = fromUIDL.getIntAttribute("month");
                    int fromDay = fromUIDL.getIntAttribute("day");
                    plotBands.setFrom("Date.UTC(" + fromYear + ", " + fromMonth
                            + "," + fromDay + ")");
                    // to
                    UIDL toUIDL = valueUIDL.getChildUIDL(1);
                    int toYear = toUIDL.getIntAttribute("year");
                    int toMonth = toUIDL.getIntAttribute("month");
                    int toDay = toUIDL.getIntAttribute("day");
                    plotBands.setTo("Date.UTC(" + toYear + ", " + toMonth + ","
                            + toDay + ")");
                }
            }
            //
            plotBandsArr.push(plotBands);
View Full Code Here

TOP

Related Classes of com.invient.vaadin.charts.widgetset.client.ui.GwtInvientChartsConfig.GwtAxisBaseOptions.GwtPlotBands

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.