diff --git a/altair/utils/html.py b/altair/utils/html.py
index 48c79af9d..a0aabb121 100644
--- a/altair/utils/html.py
+++ b/altair/utils/html.py
@@ -117,22 +117,12 @@
if (outputDiv.id !== "{{ output_div }}") {
outputDiv = document.getElementById("{{ output_div }}");
}
- {%- if use_olli %}
- const olliDiv = document.createElement("div");
- const vegaDiv = document.createElement("div");
- outputDiv.appendChild(vegaDiv);
- outputDiv.appendChild(olliDiv);
- outputDiv = vegaDiv;
- {%- endif %}
+
const paths = {
"vega": "{{ base_url }}/vega@{{ vega_version }}?noext",
"vega-lib": "{{ base_url }}/vega-lib?noext",
"vega-lite": "{{ base_url }}/vega-lite@{{ vegalite_version }}?noext",
"vega-embed": "{{ base_url }}/vega-embed@{{ vegaembed_version }}?noext",
- {%- if use_olli %}
- "olli": "{{ base_url }}/olli@{{ olli_version }}?noext",
- "olli-adapters": "{{ base_url }}/olli-adapters@{{ olli_adapters_version }}?noext",
- {%- endif %}
};
function maybeLoadScript(lib, version) {
@@ -157,41 +147,21 @@
throw err;
}
- function displayChart(vegaEmbed, olli, olliAdapters) {
+ function displayChart(vegaEmbed) {
vegaEmbed(outputDiv, spec, embedOpt)
.catch(err => showError(`Javascript Error: ${err.message}
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 => {
- // 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 %}
}
if(typeof define === "function" && define.amd) {
requirejs.config({paths});
let deps = ["vega-embed"];
- {%- if use_olli %}
- deps.push("olli", "olli-adapters");
- {%- endif %}
require(deps, displayChart, err => showError(`Error loading script: ${err.message}`));
} else {
maybeLoadScript("vega", "{{vega_version}}")
.then(() => maybeLoadScript("vega-lite", "{{vegalite_version}}"))
.then(() => maybeLoadScript("vega-embed", "{{vegaembed_version}}"))
- {%- if use_olli %}
- .then(() => maybeLoadScript("olli", "{{olli_version}}"))
- .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 }});
@@ -239,11 +209,98 @@
)
+HTML_TEMPLATE_OLLI = jinja2.Template(
+ """
+
+