Package org.projectforge.statistics

Examples of org.projectforge.statistics.TimesheetDisciplineChartBuilder


    final EmployeeDO employee = employeeDao.getByUserId(PFUserContext.getUserId());
    double workingHoursPerDay = 8;
    if (employee != null && NumberHelper.isGreaterZero(employee.getWeeklyWorkingHours()) == true) {
      workingHoursPerDay = employee.getWeeklyWorkingHours().doubleValue() / 5;
    }
    final TimesheetDisciplineChartBuilder chartBuilder = new TimesheetDisciplineChartBuilder();
    final JFreeChart chart1 = chartBuilder.create(timesheetDao, getUser().getId(), workingHoursPerDay, LAST_N_DAYS, true);
    JFreeChartImage image = new JFreeChartImage("timesheetStatisticsImage1", chart1, IMAGE_WIDTH, IMAGE_HEIGHT);
    image.add(AttributeModifier.replace("width", String.valueOf(IMAGE_WIDTH)));
    image.add(AttributeModifier.replace("height", String.valueOf(IMAGE_HEIGHT)));
    body.add(image);
    final NumberFormat format = NumberFormat.getNumberInstance(PFUserContext.getLocale());
    final String planHours = "<span style=\"color: #DE1821; font-weight: bold;\">"
        + format.format(chartBuilder.getPlanWorkingHours())
        + "</span>";
    final String actualHours = "<span style=\"color: #40A93B; font-weight: bold;\">"
        + format.format(chartBuilder.getActualWorkingHours())
        + "</span>";
    final String numberOfDays = String.valueOf(LAST_N_DAYS);
    final Label timesheetDisciplineChart1Legend = new Label("timesheetDisciplineChart1Legend", getLocalizedMessage(
        "personal.statistics.timesheetDisciplineChart1.legend", numberOfDays, planHours, actualHours));
    timesheetDisciplineChart1Legend.setEscapeModelStrings(false);
    body.add(timesheetDisciplineChart1Legend);

    final JFreeChart chart2 = chartBuilder.create(timesheetDao, getUser().getId(), LAST_N_DAYS, true);
    image = new JFreeChartImage("timesheetStatisticsImage2", chart2, IMAGE_WIDTH, IMAGE_HEIGHT);
    image.add(AttributeModifier.replace("width", String.valueOf(IMAGE_WIDTH)));
    image.add(AttributeModifier.replace("height", String.valueOf(IMAGE_HEIGHT)));
    body.add(image);
    final String averageDifference = "<span style=\"color: #DE1821; font-weight: bold;\">"
        + format.format(chartBuilder.getAverageDifferenceBetweenTimesheetAndBooking())
        + "</span>";
    final String plannedDifference = "<span style=\"color: #40A93B; font-weight: bold;\">"
        + format.format(chartBuilder.getPlannedAverageDifferenceBetweenTimesheetAndBooking())
        + "</span>";
    final Label timesheetDisciplineChart2Legend = new Label("timesheetDisciplineChart2Legend", getLocalizedMessage(
        "personal.statistics.timesheetDisciplineChart2.legend", numberOfDays, plannedDifference, averageDifference));
    timesheetDisciplineChart2Legend.setEscapeModelStrings(false);
    body.add(timesheetDisciplineChart2Legend);
View Full Code Here

TOP

Related Classes of org.projectforge.statistics.TimesheetDisciplineChartBuilder

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.