Skip to content

Commit

Permalink
Handle empty data
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed May 22, 2021
1 parent fc5eaf0 commit af53363
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions hvplot/converter.py
Expand Up @@ -1765,9 +1765,12 @@ def ohlc(self, x=None, y=None, data=None):
if ds.data[x].dtype.kind in 'SUO':
rects = Rectangles(ds, [x, o, x, c])
else:
sampling = np.min(np.diff(ds[x])) * width/2.
ds = ds.transform(lbound=dim(x)-sampling, ubound=dim(x)+sampling)
rects = Rectangles(ds, ['lbound', o, 'ubound', c])
if len(ds):
sampling = np.min(np.diff(ds[x])) * width/2.
ds = ds.transform(lbound=dim(x)-sampling, ubound=dim(x)+sampling)
else:
ds = ds.transform(lbound=dim(x), ubound=dim(x))
rects = Rectangles(ds, ['lbound', o, 'ubound', c])0
segments = Segments(ds, [x, l, x, h])
rect_opts = self._get_opts('Rectangles')
rect_opts.pop('tools')
Expand Down

0 comments on commit af53363

Please sign in to comment.