Opened 6 years ago

Closed 6 years ago

#612 closed defect (fixed)

LabEnv overview display shows wrong time offsets when the latest data points are filtered away

Reported by: olle Owned by: olle
Priority: major Milestone: LabEnv v1.2
Component: net.sf.basedb.labenv Keywords:
Cc:

Description

LabEnv overview display shows wrong time offsets when the latest data points are filtered away, e.g. when inspecting data with weekday filter set to "Sat-Sun only" or "Non-workdays". The offset error is increasing linearly with the time related to the data points, and is therefore most noticeable in the right part of the graph.

Change History (6)

comment:1 Changed 6 years ago by olle

Status: newassigned

Ticket accepted.

comment:2 Changed 6 years ago by olle

Traceability note:

  • The lab environment extension was introduced in Ticket #529 (Retrieve and store temperature and humidity measurements).
  • The lab environment extension was updated in Ticket #592 (Lab environment extension improved report routines), specifically regarding graphs of lab environment data for a chosen time interval, new time filters, and improved alarm functionality.

comment:3 Changed 6 years ago by olle

Problem discussion:

The overview display was introduced in change set [2401] and updated with daytime and weekday filters in change set [2465], both in ticket #592 (Lab environment extension improved report routines).

The overview display shows minimum, mean, and maximum values per day of lab environment data over a longer time period, given an optional start date. If no start date is given, the first configured sensor start date is used. The problem occurs as the data points were originally intended to fill up most of the graph space, and the latest shown data point was therefore placed near the right border. The time labels were calculated from the start and end times for the plot, where the end time was set to the current time. When filtering is applied, the latter may not be equal to the time of the latest shown data point. The simplest solution is that the locations of shown data points also are calculated from the end time.

comment:4 Changed 6 years ago by olle

Design update:

  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.

comment:5 Changed 6 years ago by olle

(In [2531]) 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.

comment:6 Changed 6 years ago by olle

Resolution: fixed
Status: assignedclosed

Ticket closed as the added update seems to have fixed the problem.

Note: See TracTickets for help on using tickets.