`,
      o = `
${n} `, a = window.open(""); (a.document.write(i + e + o), (a.document.title = `${mn[r]} JSON Source`)); } function On(e) { return !(!e || !("load" in e)); } function An(e) { return On(e) ? e : dn.loader(e); } async function In(t, n, r = {}) { let i, o; e.isString(n) ? ((o = An(r.loader)), (i = JSON.parse(await o.load(n)))) : (i = n); const a = (function (t) { const n = t.usermeta?.embedOptions ?? {}; return (e.isString(n.defaultStyle) && (n.defaultStyle = !1), n); })(i), s = a.loader; (o && !s) || (o = An(r.loader ?? s)); const l = await xn(a, o), c = await xn(r, o), f = { ...ln(c, l), config: e.mergeConfig(c.config ?? {}, l.config ?? {}), }; return await (async function (t, n, r = {}, i) { const o = r.theme ? e.mergeConfig(Wt[r.theme], r.config ?? {}) : r.config, a = e.isBoolean(r.actions) ? r.actions : ln({}, hn, r.actions ?? {}), s = { ...gn, ...r.i18n }, l = r.renderer ?? "canvas", c = r.logLevel ?? dn.Warn, f = r.downloadFileName ?? "visualization", d = "string" == typeof t ? document.querySelector(t) : t; if (!d) throw new Error(`${t} does not exist`); if (!1 !== r.defaultStyle) { const e = "vega-embed-style", { root: t, rootContainer: n } = (function (e) { const t = e.getRootNode ? e.getRootNode() : document; return t instanceof ShadowRoot ? { root: t, rootContainer: t } : { root: document, rootContainer: document.head ?? document.body, }; })(d); if (!t.getElementById(e)) { const t = document.createElement("style"); ((t.id = e), (t.innerHTML = void 0 === r.defaultStyle || !0 === r.defaultStyle ? sn.toString() : r.defaultStyle), n.appendChild(t)); } } const p = (function (e, t) { if (e.$schema) { const n = je(e.$schema); t && t !== n.library && console.warn( `The given visualization spec is written in ${mn[n.library]}, but mode argument sets ${mn[t] ?? t}.`, ); const r = n.library; return ( $e(En[r], `^${n.version.slice(1)}`) || console.warn( `The input spec uses ${mn[r]} ${n.version}, but the current version of ${mn[r]} is v${En[r]}.`, ), r ); } return "mark" in e || "encoding" in e || "layer" in e || "hconcat" in e || "vconcat" in e || "facet" in e || "repeat" in e ? "vega-lite" : "marks" in e || "signals" in e || "scales" in e || "axes" in e ? "vega" : (t ?? "vega"); })(n, r.mode); let u = vn[p](n, o); if ("vega-lite" === p && u.$schema) { const e = je(u.$schema); $e(En.vega, `^${e.version.slice(1)}`) || console.warn( `The compiled spec uses Vega ${e.version}, but current version is v${En.vega}.`, ); } (d.classList.add("vega-embed"), a && d.classList.add("has-actions")); d.innerHTML = ""; let h = d; if (a) { const e = document.createElement("div"); (e.classList.add(yn), d.appendChild(e), (h = e)); } const g = r.patch; g && (u = g instanceof Function ? g(u) : A(u, g, !0, !1).newDocument); r.formatLocale && dn.formatLocale(r.formatLocale); r.timeFormatLocale && dn.timeFormatLocale(r.timeFormatLocale); if (r.expressionFunctions) for (const e in r.expressionFunctions) { const t = r.expressionFunctions[e]; "fn" in t ? dn.expressionFunction(e, t.fn, t.visitor) : t instanceof Function && dn.expressionFunction(e, t); } const { ast: m } = r, E = dn.parse(u, "vega-lite" === p ? {} : o, { ast: m }), v = new (r.viewClass || dn.View)(E, { loader: i, logLevel: c, renderer: l, ...(m ? { expr: dn.expressionInterpreter ?? r.expr ?? ze } : {}), }); if ( (v.addSignalListener("autosize", (e, t) => { const { type: n } = t; "fit-x" == n ? (h.classList.add("fit-x"), h.classList.remove("fit-y")) : "fit-y" == n ? (h.classList.remove("fit-x"), h.classList.add("fit-y")) : "fit" == n ? h.classList.add("fit-x", "fit-y") : h.classList.remove("fit-x", "fit-y"); }), !1 !== r.tooltip) ) { const { loader: e, tooltip: t } = r, n = e && !On(e) ? e?.baseURL : void 0, i = "function" == typeof t ? t : new an({ baseURL: n, ...(!0 === t ? {} : t) }).call; v.tooltip(i); } let b, { hover: y } = r; void 0 === y && (y = "vega" === p); if (y) { const { hoverSet: e, updateSet: t } = "boolean" == typeof y ? {} : y; v.hover(e, t); } r && (null != r.width && v.width(r.width), null != r.height && v.height(r.height), null != r.padding && v.padding(r.padding)); if ((await v.initialize(h, r.bind).runAsync(), !1 !== a)) { let t = d; if (!1 !== r.defaultStyle || r.forceActionsMenu) { const e = document.createElement("details"); ((e.title = s.CLICK_TO_VIEW_ACTIONS), d.append(e), (t = e)); const n = document.createElement("summary"); ((n.innerHTML = bn), e.append(n), (b = (t) => { e.contains(t.target) || e.removeAttribute("open"); }), document.addEventListener("click", b)); } const i = document.createElement("div"); if ( (t.append(i), i.classList.add("vega-actions"), !0 === a || !1 !== a.export) ) for (const t of ["svg", "png"]) if (!0 === a || !0 === a.export || a.export[t]) { const n = s[`${t.toUpperCase()}_ACTION`], o = document.createElement("a"), a = e.isObject(r.scaleFactor) ? r.scaleFactor[t] : r.scaleFactor; ((o.text = n), (o.href = "#"), (o.target = "_blank"), (o.download = `${f}.${t}`), o.addEventListener("mousedown", async function (e) { e.preventDefault(); const n = await v.toImageURL(t, a); this.href = n; }), i.append(o)); } if (!0 === a || !1 !== a.source) { const e = document.createElement("a"); ((e.text = s.SOURCE_ACTION), (e.href = "#"), e.addEventListener("click", function (e) { (wn(k(n), r.sourceHeader ?? "", r.sourceFooter ?? "", p), e.preventDefault()); }), i.append(e)); } if ("vega-lite" === p && (!0 === a || !1 !== a.compiled)) { const e = document.createElement("a"); ((e.text = s.COMPILED_ACTION), (e.href = "#"), e.addEventListener("click", function (e) { (wn(k(u), r.sourceHeader ?? "", r.sourceFooter ?? "", "vega"), e.preventDefault()); }), i.append(e)); } if (!0 === a || !1 !== a.editor) { const e = r.editorUrl ?? "https://vega.github.io/editor/", t = document.createElement("a"); ((t.text = s.EDITOR_ACTION), (t.href = "#"), t.addEventListener("click", function (t) { (!(function (e, t, n) { const r = e.open(t), { origin: i } = new URL(t); let o = 40; (e.addEventListener( "message", function t(n) { n.source === r && ((o = 0), e.removeEventListener("message", t, !1)); }, !1, ), setTimeout(function e() { o <= 0 || (r.postMessage(n, i), setTimeout(e, 250), (o -= 1)); }, 250)); })(window, e, { config: o, mode: g ? "vega" : p, renderer: l, spec: k(g ? u : n), }), t.preventDefault()); }), i.append(t)); } } function w() { (b && document.removeEventListener("click", b), v.finalize()); } return { view: v, spec: n, vgSpec: u, finalize: w, embedOptions: r }; })(t, i, f, o); } async function xn(t, n) { const r = e.isString(t.config) ? JSON.parse(await n.load(t.config)) : (t.config ?? {}), i = e.isString(t.patch) ? JSON.parse(await n.load(t.patch)) : t.patch; return { ...t, ...(i ? { patch: i } : {}), ...(r ? { config: r } : {}) }; } async function Ln(e, t = {}) { const n = document.createElement("div"); n.classList.add("vega-embed-wrapper"); const r = document.createElement("div"); n.appendChild(r); const i = !0 === t.actions || !1 === t.actions ? t.actions : { export: !0, source: !1, compiled: !0, editor: !0, ...t.actions }, o = await In(r, e, { actions: i, ...t }); return ((n.value = o.view), n); } const Nn = (...t) => { return t.length > 1 && ((e.isString(t[0]) && !( (n = t[0]).startsWith("http://") || n.startsWith("https://") || n.startsWith("//") )) || t[0] instanceof HTMLElement || 3 === t.length) ? In(t[0], t[1], t[2]) : Ln(t[0], t[1]); var n; }; return ( (Nn.vegaLite = pn), (Nn.vl = pn), (Nn.container = Ln), (Nn.embed = In), (Nn.vega = dn), (Nn.default = In), (Nn.version = fn), Nn ); });
Plot manual
NamePositionFlags
Click a read