Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: use unique chart div ID for HTML renderer #1888

Merged
merged 1 commit into from
Dec 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions altair/utils/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import pkgutil
import textwrap
from typing import Callable, Dict
import uuid

from jsonschema import validate

Expand Down Expand Up @@ -150,13 +151,11 @@ class HTMLRenderer(object):
"""Object to render charts as HTML, with a unique output div each time"""
def __init__(self, output_div='altair-viz-{}', **kwargs):
self._output_div = output_div
self._output_count = 0
self.kwargs = kwargs

@property
def output_div(self):
self._output_count += 1
return self._output_div.format(self._output_count)
return self._output_div.format(uuid.uuid4().hex)

def __call__(self, spec, **metadata):
kwargs = self.kwargs.copy()
Expand Down