Package org.zkoss.zul

Examples of org.zkoss.zul.SimpleXYModel


    @Override
    public XYModel getAccumulatedHoursChartData(
            IStretchesFunctionModel stretchesFunctionModel) {
        List<Stretch> stretches = stretchesFunctionModel.getStretchesPlusConsolidated();
        if (stretches.isEmpty()) {
            return new SimpleXYModel();
        }
        return getAccumulatedHoursChartData(stretches,
                stretchesFunctionModel.getResourceAllocation(), new BigDecimal(
                        stretchesFunctionModel.getAllocationHours()));
    }
View Full Code Here


    public XYModel getDedicationChart(
            IStretchesFunctionModel stretchesFunctionModel) {
        List<Stretch> stretches = stretchesFunctionModel
                .getStretchesPlusConsolidated();
        if (stretches.isEmpty()) {
            return new SimpleXYModel();
        }
        return getDedicationChart(stretches,
                stretchesFunctionModel.getResourceAllocation(), new BigDecimal(
                        stretchesFunctionModel.getAllocationHours()),
                stretchesFunctionModel.getTaskCalendar());
View Full Code Here

        }

        @Override
        public XYModel getAccumulatedHoursChartData(List<Stretch> stretches,
                ResourceAllocation<?> allocation, BigDecimal taskHours) {
            XYModel xymodel = new SimpleXYModel();

            String title = "percentage";

            xymodel.addValue(title, allocation.getStartDate()
                    .toDateTimeAtStartOfDay().getMillis(), 0);

            for (Stretch stretch : stretches) {
                BigDecimal amountWork = stretch.getAmountWorkPercentage()
                        .multiply(taskHours);

                xymodel.addValue(title, stretch.getDateIn(allocation)
                        .toDateTimeAtStartOfDay().getMillis(), amountWork);
            }

            return xymodel;
        }
View Full Code Here

        }

        protected XYModel getDedicationChart(List<Stretch> stretches,
                ResourceAllocation<?> allocation, BigDecimal taskHours,
                BaseCalendar calendar){
            XYModel xymodel = new SimpleXYModel();
            String title = "hours";

            LocalDate previousDate = allocation.getStartDate();
            BigDecimal previousPercentage = BigDecimal.ZERO;
            xymodel.addValue(title, previousDate.toDateTimeAtStartOfDay()
                    .getMillis(), 0);

            for (Stretch stretch : stretches) {
                BigDecimal amountWork = stretch.getAmountWorkPercentage()
                        .subtract(previousPercentage).multiply(taskHours);
                LocalDate endDate = stretch.getDateIn(allocation);
                Integer days = Days.daysBetween(previousDate, endDate)
                        .getDays();

                if (calendar != null) {
                    days -= calendar.getNonWorkableDays(previousDate,
                            endDate.minusDays(1)).size();
                }

                BigDecimal hoursPerDay = BigDecimal.ZERO;
                if (days > 0) {
                    hoursPerDay = amountWork.divide(new BigDecimal(days),
                            RoundingMode.DOWN);
                }

                xymodel.addValue(title, previousDate.toDateTimeAtStartOfDay()
                        .getMillis(), hoursPerDay);
                if (days > 0) {
                    xymodel.addValue(title, endDate.toDateTimeAtStartOfDay()
                            .getMillis() - 1, hoursPerDay);
                }

                previousDate = endDate;
                previousPercentage = stretch.getAmountWorkPercentage();
            }

            xymodel.addValue(title, previousDate.toDateTimeAtStartOfDay()
                    .getMillis() + 1, 0);

            return xymodel;
        }
View Full Code Here

        @Override
        protected XYModel getAccumulatedHoursChartData(List<Stretch> stretches,
                ResourceAllocation<?> allocation, BigDecimal taskHours) {
            if (!canComputeChartFrom(stretches)) {
                return new SimpleXYModel();
            }
            int[] hoursForEachDayUsingSplines = hoursForEachDayInterpolatedUsingSplines(
                    stretches, allocation, taskHours);
            return createModelFrom(allocation.getStartDate(),
                    accumulatedFrom(hoursForEachDayUsingSplines));
View Full Code Here

        @Override
        protected XYModel getDedicationChart(List<Stretch> stretches,
                ResourceAllocation<?> allocation, BigDecimal totalHours,
                BaseCalendar taskCalendar) {
            if (!canComputeChartFrom(stretches)) {
                return new SimpleXYModel();
            }
            int[] dataForChart = hoursForEachDayInterpolatedUsingSplines(
                    stretches, allocation, totalHours);
            return createModelFrom(allocation.getStartDate(), dataForChart);
        }
View Full Code Here

            return result;
        }

        private XYModel createModelFrom(LocalDate startDate,
                int[] hoursForEachDay) {
            SimpleXYModel result = new SimpleXYModel();
            for (int i = 0; i < hoursForEachDay.length; i++) {
                result.addValue("series",
                        asMilliseconds(startDate.plusDays(i)),
                        hoursForEachDay[i]);
            }
            return result;
        }
View Full Code Here

    }

    @Override
    @Transactional(readOnly = true)
    public XYModel getChartData(Set<AdvanceAssignment> selectedAdvances) {
        XYModel xymodel = new SimpleXYModel();

        for (AdvanceAssignment each : selectedAdvances) {
            DirectAdvanceAssignment directAdvanceAssignment;
            if (each instanceof DirectAdvanceAssignment) {
                directAdvanceAssignment = (DirectAdvanceAssignment) each;
            } else {
                directAdvanceAssignment = calculateFakeDirectAdvanceAssignment((IndirectAdvanceAssignment) each);
            }
            if (directAdvanceAssignment != null) {
                String title = getInfoAdvanceAssignment(directAdvanceAssignment);
                SortedSet<AdvanceMeasurement> listAdvanceMeasurements = directAdvanceAssignment
                        .getAdvanceMeasurements();
                if (listAdvanceMeasurements.size() > 1) {
                    for (AdvanceMeasurement advanceMeasurement : listAdvanceMeasurements) {
                        BigDecimal value = advanceMeasurement.getValue();
                        if ((selectedAdvances.size() > 1) && (value != null) && (value.compareTo(BigDecimal.ZERO) > 0)) {
                            BigDecimal maxValue = directAdvanceAssignment
                                    .getMaxValue();
                            value = value.setScale(2).divide(maxValue,
                                    RoundingMode.DOWN);
                        }
                        LocalDate date = advanceMeasurement.getDate();
                        if ((value != null) && (date != null)) {
                            xymodel.addValue(title, Long.valueOf(date
                                    .toDateTimeAtStartOfDay().getMillis()),
                                    value);
                        }
                    }
                }
View Full Code Here

TOP

Related Classes of org.zkoss.zul.SimpleXYModel

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.