Skip to content
This repository has been archived by the owner on Jun 3, 2020. It is now read-only.

Commit

Permalink
Fix display when data is reduced to one value
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Mercier committed Jul 11, 2019
1 parent 8e0dc41 commit 3dbc28f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions qgeologis/log_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ def _add_column(self, log_item, legend_item):
def _fit_to_max_depth(self):
self._min_z = min([i.min_depth() for i, _ in self.__columns if i.min_depth() is not None])
self._max_z = max([i.max_depth() for i, _ in self.__columns if i.max_depth() is not None])
# if we have only one value, center it on a 2 meters range
if self._min_z == self._max_z:
self._min_z -= 1.0
self._max_z += 1.0

def _update_column_depths(self):
for item, _ in self.__columns:
Expand Down
8 changes: 8 additions & 0 deletions qgeologis/timeseries_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ def _add_row(self, log_item, legend_item):
def _fit_to_max_depth(self):
self._min_x = min([i.min_depth() for i, _ in self.__rows if i.min_depth() is not None])
self._max_x = max([i.max_depth() for i, _ in self.__rows if i.max_depth() is not None])
# if we have only one value, center it on a 2 minutes range
if self._min_x == self._max_x:
self._min_x -= 60
self._max_x += 60

def _update_row_depths(self):
for item, _ in self.__rows:
Expand Down Expand Up @@ -253,6 +257,10 @@ def add_data_row(self, data, title, uom, station_name = None):

if self._min_x is None:
self._min_x, self._max_x = data.get_x_min(), data.get_x_max()
# if we have only one value, center it on a 2 minutes range
if self._min_x == self._max_x:
self._min_x -= 60
self._max_x += 60
self.add_time_scale()

self.__data2logitems[data] = (plot_item, legend_item)
Expand Down

0 comments on commit 3dbc28f

Please sign in to comment.