Changeset 2531


Ignore:
Timestamp:
Jun 26, 2014, 12:11:36 PM (9 years ago)
Author:
olle
Message:

Refs #612. Lab environment extension updated to fix problem with overview display showing wrong time offsets when the latest data points are filtered away:

  1. Class/file LabEnvironmentDisplayServlet.java in src/net/sf/basedb/labenv/servlet/ updated in private method JSONObject createJsonOverviewPlot(String chartVariant, List<LabEnvironmentData> lthdList, Date startDate, Date endDate, String viewType, String chartSite, String variableType, String weekdayFilter, String daytimeFilterFromTime, String daytimeFilterToTime) to calculate the end date as date for next midnight, get the period string for that time, and then the corresponding period name (which for an overview plot is the number of minutes since midnight of the first day). The latter is added to the jsonPlot JSONObject for key "latestPeriodName".
  2. Javascript boxplot.js in resources/reports/ updated in function createGraphPlot(boxPlotJsonObject, canvas, draw_area_wdt, draw_area_hgt, draw_scale_factor, viewType, storageIntervalInSeconds) for an overview plot to get the number of minutes since first midnight from the JSON data for key "latestPeriodName", instead of from the name of the last shown data point.
Location:
extensions/net.sf.basedb.labenv/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.labenv/trunk/resources/reports/boxplot.js

    r2401 r2531  
    147147      {
    148148        // Name of last data point is number of minutes since midnight of day for first point
    149         var num_minutes_since_first_midnight = boxPlotJsonObject.percentileData[num_data_points - 1].name;
     149        var num_minutes_since_first_midnight = boxPlotJsonObject.latestPeriodName;
    150150        var num_full_days_since_first_midnight = Math.floor(num_minutes_since_first_midnight/(24*60));
    151151        var days_to_add = 1;
  • extensions/net.sf.basedb.labenv/trunk/src/net/sf/basedb/labenv/servlet/LabEnvironmentDisplayServlet.java

    r2465 r2531  
    11011101    jsonPlot.put("valueGuideLinesY", jsonPercentilesArray);
    11021102    log.debug("jsonPeriodPercentilesArray = " + jsonPeriodPercentilesArray.toJSONString());
     1103    // Get end date as date for next midnight
     1104    Calendar calEnd = GregorianCalendar.getInstance();
     1105    // Get current date-time, reset to midnight, then add one day
     1106    calEnd.setTime(new Date());
     1107    calEnd.set(Calendar.HOUR_OF_DAY, 0);
     1108    calEnd.set(Calendar.MINUTE, 0);
     1109    calEnd.set(Calendar.SECOND, 0);
     1110    calEnd.set(Calendar.MILLISECOND, 0);
     1111    calEnd.add(Calendar.DATE, 1);
     1112    Date dateEnd = calEnd.getTime();
     1113    String latestPeriod = tableUtil.getCurrentPeriod(dateEnd, viewType);
     1114    String latestPeriodName = fetchPeriodNameForPlot(latestPeriod, viewType, startDate);
    11031115    // For overview display, add extra JSON data with text for day markers in graph
    11041116    if (viewType != null && viewType.equals("overviewDisplay"))
    11051117    {
    1106       // Get end date as date for next midnight
    1107       Calendar calEnd = GregorianCalendar.getInstance();
    1108       // Get current date-time, reset to midnight, then add one day
    1109       calEnd.setTime(new Date());
    1110       calEnd.set(Calendar.HOUR_OF_DAY, 0);
    1111       calEnd.set(Calendar.MINUTE, 0);
    1112       calEnd.set(Calendar.SECOND, 0);
    1113       calEnd.set(Calendar.MILLISECOND, 0);
    1114       calEnd.add(Calendar.DATE, 1);
    1115       Date dateEnd = calEnd.getTime();
    1116       //
    11171118      Calendar cal = GregorianCalendar.getInstance();
    11181119      cal.setTime(startDate);
     
    12041205      jsonDayInWeekString.put("numMarkers", numRawMarkers);
    12051206      jsonPlot.put("dayInWeekString", jsonDayInWeekString);
     1207      jsonPlot.put("latestPeriodName", latestPeriodName);
    12061208    }
    12071209    return jsonPlot;
Note: See TracChangeset for help on using the changeset viewer.