Skip to content

Commit

Permalink
Various fixes for bokeh datetime handling (#3005)
Browse files Browse the repository at this point in the history
# Conflicts:
#	holoviews/plotting/bokeh/path.py
#	holoviews/plotting/plot.py
#	holoviews/plotting/util.py
#	tests/plotting/bokeh/testpathplot.py
#	tests/plotting/bokeh/testpointplot.py
#	tests/plotting/bokeh/testspikesplot.py
  • Loading branch information
philippjfr committed Oct 25, 2018
1 parent 2112551 commit 264c831
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 10 deletions.
6 changes: 2 additions & 4 deletions holoviews/plotting/bokeh/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ def get_extents(self, element, ranges):
return l, b, r, t

def get_data(self, element, ranges, style):
dims = element.dimensions(label=True)
dims = element.dimensions()

data = {}
pos = self.position
Expand All @@ -626,9 +626,7 @@ def get_data(self, element, ranges, style):
mapping['color'] = {'field': cdim.name,
'transform': cmapper}

if 'hover' in self.handles and not self.static_source:
for d in dims:
data[dimension_sanitizer(d)] = element.dimension_values(d)
self._get_hover_data(data, element)

return data, mapping, style

Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/bokeh/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def _get_hover_data(self, data, element, dimensions=None):
dim = util.dimension_sanitizer(d.name)
if dim not in data:
data[dim] = element.dimension_values(d)
elif isinstance(data[dim], np.ndarray) and data[dim].dtype.kind == 'M':
if isinstance(data[dim], np.ndarray) and data[dim].dtype.kind == 'M':
data[dim+'_dt_strings'] = [d.pprint_value(v) for v in data[dim]]

for k, v in self.overlay_dims.items():
Expand Down
1 change: 0 additions & 1 deletion holoviews/plotting/bokeh/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def _get_hover_data(self, data, element):

def get_data(self, element, ranges, style):
cdim = element.get_dimension(self.color_index)
if cdim: cidx = element.get_dimension_index(cdim)
inds = (1, 0) if self.invert_axes else (0, 1)
mapping = dict(self._mapping)
if not cdim:
Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/bokeh/tabular.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def _get_columns(self, element, data):
formatter = NumberFormatter(format='0,0.0[00000]')
editor = NumberEditor()
elif kind == 'M' or (kind == 'O' and len(data[col]) and type(data[col][0]) in datetime_types):
dimtype = element.get_dimension_type(0)
dimtype = element.get_dimension_type(col)
dformat = Dimension.type_formatters.get(dimtype, '%Y-%m-%d %H:%M:%S')
formatter = DateFormatter(format=dformat)
editor = DateEditor()
Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from ..core.options import Cycle
from ..core.spaces import get_nested_streams
from ..core.util import (match_spec, wrap_tuple, basestring, get_overlay_spec,
unique_iterator, closest_match)
unique_iterator, closest_match, is_number)
from ..streams import LinkedStream

def displayable(obj):
Expand Down
4 changes: 3 additions & 1 deletion tests/plotting/bokeh/testpathplot.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numpy as np
import datetime as dt

import numpy as np
from holoviews.core import NdOverlay
from holoviews.core.options import Cycle
from holoviews.element import Path, Polygons, Contours
Expand Down Expand Up @@ -58,6 +59,7 @@ def test_empty_path_plot(self):




class TestPolygonPlot(TestBokehPlot):

def test_polygons_overlay_hover(self):
Expand Down
1 change: 1 addition & 0 deletions tests/plotting/bokeh/testpointplot.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import datetime as dt
from unittest import SkipTest

import numpy as np
Expand Down
3 changes: 2 additions & 1 deletion tests/plotting/bokeh/testspikesplot.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numpy as np
import datetime as dt

import numpy as np
from holoviews.core import NdOverlay
from holoviews.element import Spikes

Expand Down

0 comments on commit 264c831

Please sign in to comment.