Skip to content

Commit

Permalink
Move DynamicMap unbounded error onto Renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed May 28, 2018
1 parent d3ea332 commit d9dfeb8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 0 additions & 8 deletions holoviews/ipython/display_hooks.py
Expand Up @@ -191,14 +191,6 @@ def element_display(element, max_frames):
@display_hook
def map_display(vmap, max_frames):
if not isinstance(vmap, (HoloMap, DynamicMap)): return None
if isinstance(vmap, DynamicMap) and vmap.unbounded:
dims = ', '.join('%r' % dim for dim in vmap.unbounded)
msg = ('DynamicMap cannot be displayed without explicit indexing '
'as {dims} dimension(s) are unbounded. '
'\nSet dimensions bounds with the DynamicMap redim.range '
'or redim.values methods.')
sys.stderr.write(msg.format(dims=dims))
return None

if len(vmap) == 0 and not isinstance(vmap, DynamicMap):
return None
Expand Down
12 changes: 10 additions & 2 deletions holoviews/plotting/renderer.py
Expand Up @@ -12,7 +12,7 @@
from ..core.io import Exporter
from ..core.options import Store, StoreOptions, SkipRendering, Compositor
from ..core.util import find_file, unicode, unbound_dimensions, basestring
from .. import Layout, HoloMap, AdjointLayout
from .. import Layout, HoloMap, AdjointLayout, DynamicMap
from .widgets import NdWidget, ScrubberWidget, SelectionWidget

from . import Plot
Expand Down Expand Up @@ -183,6 +183,14 @@ def get_plot(self_or_cls, obj, renderer=None):
"""
Given a HoloViews Viewable return a corresponding plot instance.
"""
if isinstance(obj, DynamicMap) and obj.unbounded:
dims = ', '.join('%r' % dim for dim in obj.unbounded)
msg = ('DynamicMap cannot be displayed without explicit indexing '
'as {dims} dimension(s) are unbounded. '
'\nSet dimensions bounds with the DynamicMap redim.range '
'or redim.values methods.')
raise SkipRendering(msg.format(dims=dims))

# Initialize DynamicMaps with first data item
initialize_dynamic(obj)

Expand Down Expand Up @@ -484,7 +492,7 @@ def open_and_read(path, f):
if extras:
dependencies.update(cls.extra_dependencies)
for backend in backends:
dependencies['backend'] = Store.renderers[backend].backend_dependencies
dependencies[backend] = Store.renderers[backend].backend_dependencies

js_html, css_html = '', ''
for _, dep in sorted(dependencies.items(), key=lambda x: x[0]):
Expand Down

0 comments on commit d9dfeb8

Please sign in to comment.