Skip to content

Commit

Permalink
Make it work in Jupyter
Browse files Browse the repository at this point in the history
  • Loading branch information
binste committed Sep 6, 2024
1 parent 7ced613 commit 6ffb538
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion altair/utils/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,10 @@
.catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));
{%- if use_olli %}
olliAdapters.VegaLiteAdapter(spec).then(olliVisSpec => {
const olliRender = olli.olli(olliVisSpec);
// It's a function if it was loaded via maybeLoadScript below.
// If it comes from require, it's a module and we access olli.olli
const olliFunc = typeof olli === 'function' ? olli : olli.olli;
const olliRender = olliFunc(olliVisSpec);
olliDiv.append(olliRender);
});
{%- endif %}
Expand All @@ -183,7 +186,11 @@
.then(() => maybeLoadScript("olli-adapters", "{{olli_adapters_version}}"))
{%- endif %}
.catch(showError)
{%- if use_olli %}
.then(() => displayChart(vegaEmbed, olli, OlliAdapters));
{%- else %}
.then(() => displayChart(vegaEmbed));
{%- endif %}
}
})({{ spec }}, {{ embed_options }});
</script>
Expand Down

0 comments on commit 6ffb538

Please sign in to comment.