Skip to content

Commit

Permalink
BUG: use unique chart div ID for HTML renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
jakevdp committed Dec 27, 2019
1 parent 2daac87 commit 62a5ada
Showing 1 changed file with 2 additions and 3 deletions.
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

0 comments on commit 62a5ada

Please sign in to comment.