MCPcopy Create free account
hub / github.com/alignoth/alignoth / cd

Function cd

resources/vega-lite.min.js:8887–8979  ·  view source on GitHub ↗
(e, t)

Source from the content-addressed store, hash-verified

8885 return e === (n || {})[t];
8886 }
8887 function cd(e, t) {
8888 let n = e.legend(t);
8889 const { markDef: i, encoding: r, config: o } = e,
8890 a = o.legend,
8891 s = new Jf(
8892 {},
8893 (function (e, t) {
8894 const n = e.scaleName(t);
8895 if ("trail" === e.mark) {
8896 if ("color" === t) return { stroke: n };
8897 if ("size" === t) return { strokeWidth: n };
8898 }
8899 return "color" === t
8900 ? e.markDef.filled
8901 ? { fill: n }
8902 : { stroke: n }
8903 : { [t]: n };
8904 })(e, t),
8905 );
8906 !(function (e, t, n) {
8907 const i = e.fieldDef(t)?.field;
8908 for (const r of F(e.component.selection ?? {})) {
8909 const e = r.project.hasField[i] ?? r.project.hasChannel[t];
8910 if (e && Wu.defined(r)) {
8911 const t = n.get("selections") ?? [];
8912 (t.push(r.name), n.set("selections", t, !1), (e.hasLegend = !0));
8913 }
8914 }
8915 })(e, t, s);
8916 const l = void 0 !== n ? !n : a.disable;
8917 if ((s.set("disable", l, void 0 !== n), l)) return s;
8918 n = n || {};
8919 const c = e.getScaleComponent(t).get("type"),
8920 u = ka(r[t]),
8921 f = Zo(u) ? Ii(u.timeUnit)?.unit : void 0,
8922 d = n.orient || o.legend.orient || "right",
8923 m = rd({ legend: n, channel: t, timeUnit: f, scaleType: c }),
8924 p = {
8925 legend: n,
8926 channel: t,
8927 model: e,
8928 markDef: i,
8929 encoding: r,
8930 fieldOrDatumDef: u,
8931 legendConfig: a,
8932 config: o,
8933 scaleType: c,
8934 orient: d,
8935 legendType: m,
8936 direction: od({ legend: n, legendType: m, orient: d, legendConfig: a }),
8937 };
8938 for (const i of Qf) {
8939 if (
8940 ("gradient" === m && i.startsWith("symbol")) ||
8941 ("symbol" === m && i.startsWith("gradient"))
8942 )
8943 continue;
8944 const r = i in id ? id[i](p) : n[i];

Callers 1

sdFunction · 0.70

Calls 15

FFunction · 0.85
ZoFunction · 0.85
legendMethod · 0.80
scaleNameMethod · 0.80
getScaleComponentMethod · 0.80
kaFunction · 0.70
IiFunction · 0.70
rdFunction · 0.70
odFunction · 0.70
ldFunction · 0.70
GfFunction · 0.70
SFunction · 0.70

Tested by

no test coverage detected