@xiee/utils 1.14.85 → 1.14.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/lt-plot.css +5 -3
- package/css/lt-plot.min.css +1 -1
- package/css/lt-plot.min.css.map +1 -1
- package/js/lt-plot.js +65 -37
- package/js/lt-plot.min.js +1 -1
- package/js/lt-plot.min.js.map +1 -1
- package/package.json +1 -1
package/css/lt-plot.css
CHANGED
|
@@ -14,8 +14,10 @@
|
|
|
14
14
|
.lt-eb {
|
|
15
15
|
position: relative;
|
|
16
16
|
vertical-align: middle;
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
/* default only series without a per-series stroke=/fill= attribute, so that
|
|
18
|
+
attribute still shows; override either via that attr or a `.lt-eb` rule */
|
|
19
|
+
line:not([stroke]):not(.lt-eb-ref) { stroke: #888; }
|
|
20
|
+
circle:not([fill]) { fill: #333; }
|
|
19
21
|
.lt-eb-ref { stroke: #ccc; }
|
|
20
22
|
}
|
|
21
23
|
.lt-eb-axis {
|
|
@@ -39,7 +41,7 @@
|
|
|
39
41
|
attribute still shows; override either via `color` or `.lt-dot circle` */
|
|
40
42
|
circle:not([fill]) { fill: currentColor; }
|
|
41
43
|
}
|
|
42
|
-
.lt-
|
|
44
|
+
.lt-plot-legend {
|
|
43
45
|
margin-top: 3px; /* small gap below the axis, since the cell has no padding */
|
|
44
46
|
font-size: 11px;
|
|
45
47
|
color: #666;
|
package/css/lt-plot.min.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.lt-table{& .lt-eb-cell{text-align:left;padding:0;position:relative}& .lt-eb-grid-bg{position:absolute;top:0;left:0;& line{stroke:#eee}}& .lt-eb{vertical-align:middle;position:relative;& line{stroke:#888}& circle{fill:#333}& .lt-eb-ref{stroke:#ccc}}& .lt-eb-axis{margin-top:3px;display:block;& line{stroke:#888}& text{fill:#666;font-size:11px}& .lt-eb-axis-label{fill:#333;font-size:12px}}& .lt-spark{vertical-align:middle;color:#4682b4;& .lt-spark-line{fill:none;stroke:currentColor;stroke-width:1px}& .lt-spark-bar{fill:currentColor}}& .lt-dot{vertical-align:middle;color:#333;position:relative;& circle:not([fill]){fill:currentColor}}& .lt-
|
|
1
|
+
.lt-table{& .lt-eb-cell{text-align:left;padding:0;position:relative}& .lt-eb-grid-bg{position:absolute;top:0;left:0;& line{stroke:#eee}}& .lt-eb{vertical-align:middle;position:relative;& line:not([stroke]):not(.lt-eb-ref){stroke:#888}& circle:not([fill]){fill:#333}& .lt-eb-ref{stroke:#ccc}}& .lt-eb-axis{margin-top:3px;display:block;& line{stroke:#888}& text{fill:#666;font-size:11px}& .lt-eb-axis-label{fill:#333;font-size:12px}}& .lt-spark{vertical-align:middle;color:#4682b4;& .lt-spark-line{fill:none;stroke:currentColor;stroke-width:1px}& .lt-spark-bar{fill:currentColor}}& .lt-dot{vertical-align:middle;color:#333;position:relative;& circle:not([fill]){fill:currentColor}}& .lt-plot-legend{color:#666;margin-top:3px;font-size:11px;& i{vertical-align:middle;border-radius:50%;width:8px;height:8px;margin-right:2px;display:inline-block}& span{white-space:nowrap;margin-right:6px}}}
|
|
2
2
|
/*# sourceMappingURL=lt-plot.min.css.map */
|
package/css/lt-plot.min.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"AACA,UACE,0DAKA,gDAIE,oBAEF,
|
|
1
|
+
{"version":3,"mappings":"AACA,UACE,0DAKA,gDAIE,oBAEF,iDAKE,iDACA,+BACA,0BAEF,2CAGE,mBACA,gCACA,8CAEF,gDAGE,gEACA,mCAEF,6DAME,wCAEF,2DAIE,uGAQA","sources":["lt-plot.css"],"sourcesContent":["/* lt-plot.css — styles for inline graphics cells (see lt-plot.js). */\n.lt-table {\n .lt-eb-cell {\n position: relative;\n padding: 0; /* so the gridline background fills the whole cell */\n text-align: left; /* keep the plot flush left, aligned with the gridlines */\n }\n .lt-eb-grid-bg {\n position: absolute;\n left: 0;\n top: 0;\n line { stroke: #eee; }\n }\n .lt-eb {\n position: relative;\n vertical-align: middle;\n /* default only series without a per-series stroke=/fill= attribute, so that\n attribute still shows; override either via that attr or a `.lt-eb` rule */\n line:not([stroke]):not(.lt-eb-ref) { stroke: #888; }\n circle:not([fill]) { fill: #333; }\n .lt-eb-ref { stroke: #ccc; }\n }\n .lt-eb-axis {\n display: block;\n margin-top: 3px; /* small gap below the body, since the cell has no padding */\n line { stroke: #888; }\n text { fill: #666; font-size: 11px; }\n .lt-eb-axis-label { fill: #333; font-size: 12px; }\n }\n .lt-spark {\n vertical-align: middle;\n color: #4682b4; /* line/bars inherit this via currentColor; override inline */\n .lt-spark-line { fill: none; stroke: currentColor; stroke-width: 1; }\n .lt-spark-bar { fill: currentColor; }\n }\n .lt-dot {\n position: relative; /* paint above the absolutely-positioned gridlines */\n vertical-align: middle;\n color: #333;\n /* default only the dots without a per-column fill= attribute, so that\n attribute still shows; override either via `color` or `.lt-dot circle` */\n circle:not([fill]) { fill: currentColor; }\n }\n .lt-plot-legend {\n margin-top: 3px; /* small gap below the axis, since the cell has no padding */\n font-size: 11px;\n color: #666;\n i {\n display: inline-block;\n width: 8px;\n height: 8px;\n margin-right: 2px;\n border-radius: 50%;\n vertical-align: middle;\n }\n span { margin-right: 6px; white-space: nowrap; }\n }\n}\n"],"names":[]}
|
package/js/lt-plot.js
CHANGED
|
@@ -54,32 +54,52 @@
|
|
|
54
54
|
return Math.round(Math.max(EB_PAD, Math.min(eb.width - EB_PAD, p)) * 10) / 10;
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
//
|
|
57
|
+
// y pixel of series i of n within a cell of height H: a lone series on the
|
|
58
|
+
// mid-line, else evenly spaced tracks so stacked points/bars do not overlap.
|
|
59
|
+
// Shared by the stacked error bar and the staggered dot plot.
|
|
60
|
+
const stackY = (i, n, H) => n <= 1 ? H / 2 : Math.round((i + 1) / (n + 1) * H);
|
|
61
|
+
|
|
62
|
+
// Inline SVG for an error-bar cell: one series per triple (value, lower,
|
|
63
|
+
// upper) — a point at the estimate and a horizontal bar (with end caps) from
|
|
64
|
+
// the lower to the upper bound, on the column's shared [min,max] scale. A
|
|
65
|
+
// single series sits on the mid-line; several series stack at evenly spaced
|
|
66
|
+
// rows, each optionally colored (see the footer legend). Only the numbers are
|
|
67
|
+
// shipped in the spec; the SVG is built here at render time, so an
|
|
68
|
+
// interactive table (which rebuilds <tbody> from spec._viewRows) draws it
|
|
69
|
+
// only for the rows on the current page. `u` carries the core helpers
|
|
70
|
+
// (esc/isNum/str) passed in by lt.js.
|
|
63
71
|
function svgErrorbar(eb, data, r, u) {
|
|
64
72
|
const num = k => { const v = data[k]?.[r - 1]; return u.isNum(v) ? v : null; };
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
cap = Math.min(4, (H - 1) / 2); // half-height of the end caps
|
|
73
|
+
const H = eb.height, n = eb.cols.length, x = v => ebX(eb, v),
|
|
74
|
+
yOf = i => stackY(i, n, H), // one track per series, stacked
|
|
75
|
+
cap = Math.min(4, (H / n - 1) / 2); // half-height of the end caps
|
|
69
76
|
let s = `<svg class="lt-eb" width="${eb.width}" height="${H}">`;
|
|
70
77
|
if (eb.ref != null)
|
|
71
78
|
s += `<line class="lt-eb-ref" x1="${x(eb.ref)}" y1="0" x2="${x(eb.ref)}" y2="${H}"/>`;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
const titles = [];
|
|
80
|
+
eb.cols.forEach((c, i) => {
|
|
81
|
+
const est = num(c), lo = num(eb.los[i]), hi = num(eb.his[i]);
|
|
82
|
+
if (est == null && lo == null && hi == null) return;
|
|
83
|
+
const y = yOf(i), col = eb.colors?.[i],
|
|
84
|
+
// per-series color via stroke=/fill= attributes; the stylesheet only
|
|
85
|
+
// defaults series that lack them (:not([stroke])/:not([fill])), so a
|
|
86
|
+
// color shows but a user CSS rule can still override it
|
|
87
|
+
st = col ? ` stroke="${u.esc(col)}"` : "",
|
|
88
|
+
fl = col ? ` fill="${u.esc(col)}"` : "";
|
|
89
|
+
if (lo != null && hi != null) {
|
|
90
|
+
// horizontal bar plus short vertical end caps at both ends
|
|
91
|
+
const xl = x(lo), xh = x(hi);
|
|
92
|
+
s += `<line${st} x1="${xl}" y1="${y}" x2="${xh}" y2="${y}"/>` +
|
|
93
|
+
`<line${st} x1="${xl}" y1="${y - cap}" x2="${xl}" y2="${y + cap}"/>` +
|
|
94
|
+
`<line${st} x1="${xh}" y1="${y - cap}" x2="${xh}" y2="${y + cap}"/>`;
|
|
95
|
+
}
|
|
96
|
+
if (est != null) s += `<circle${fl} cx="${x(est)}" cy="${y}" r="3"/>`;
|
|
97
|
+
const ci = lo != null && hi != null ? ` (${u.str(lo)}, ${u.str(hi)})` : "";
|
|
98
|
+
titles.push((eb.labels?.[i] ? eb.labels[i] + ": " : "") +
|
|
99
|
+
(est != null ? u.str(est) : "") + ci);
|
|
100
|
+
});
|
|
101
|
+
if (!titles.length) return "";
|
|
102
|
+
return s + `<title>${u.esc(titles.join("\n"))}</title></svg>`;
|
|
83
103
|
}
|
|
84
104
|
|
|
85
105
|
// Full-cell background layer of faint vertical gridlines at the shared tick
|
|
@@ -123,10 +143,12 @@
|
|
|
123
143
|
// r, u) -> body-cell HTML; foot(cfg, u) -> footer (axis) HTML or "".
|
|
124
144
|
cells.errorbar = {
|
|
125
145
|
resolve(op) {
|
|
126
|
-
const
|
|
146
|
+
const cols = op.columns || [], v = cols[0];
|
|
127
147
|
if (!v) return {};
|
|
128
148
|
const eb = {
|
|
129
|
-
col: v,
|
|
149
|
+
col: v, cols, los: op.lowers || [], his: op.uppers || [],
|
|
150
|
+
colors: op.colors, labels: op.labels,
|
|
151
|
+
min: op.min, max: op.max, ref: op.ref, axis: op.axis,
|
|
130
152
|
axisLabel: op.axis_label, width: op.width || 160, height: op.height || 16
|
|
131
153
|
};
|
|
132
154
|
// When an axis is requested, the same nice ticks drive both the footer
|
|
@@ -139,7 +161,7 @@
|
|
|
139
161
|
// background can run unbroken from one row to the next.
|
|
140
162
|
cellClass: eb => eb.ticks ? "lt-eb-cell" : "",
|
|
141
163
|
cell: (eb, data, r, u) => (eb.ticks ? svgGrid(eb) : "") + svgErrorbar(eb, data, r, u),
|
|
142
|
-
foot: (eb, u) => eb.
|
|
164
|
+
foot: (eb, u) => (eb.ticks ? svgAxis(eb, u) : "") + legend(eb, u)
|
|
143
165
|
};
|
|
144
166
|
|
|
145
167
|
// Padding (px) inside a sparkline SVG, so the line/bars never touch the edge.
|
|
@@ -216,10 +238,14 @@
|
|
|
216
238
|
// Inline SVG dot plot for a cell: one dot per column, each at its value on the
|
|
217
239
|
// column group's shared [min,max] scale, so a row with N columns shows N dots
|
|
218
240
|
// laid out horizontally on one baseline. When colors are given, each dot takes
|
|
219
|
-
// its column's color (see
|
|
241
|
+
// its column's color (see legend() for the key). Non-finite values draw no
|
|
220
242
|
// dot. Reuses the error-bar scale (ebX) and padding.
|
|
221
243
|
function svgDotplot(dp, data, r, u) {
|
|
222
|
-
const H = dp.height,
|
|
244
|
+
const H = dp.height, n = dp.cols.length, x = v => ebX(dp, v),
|
|
245
|
+
// all dots on the mid-line by default; stagger puts each column on its
|
|
246
|
+
// own track (like the stacked error bar) so near-equal values do not
|
|
247
|
+
// overlap — the vertical position is cosmetic, only x carries a value
|
|
248
|
+
yOf = i => dp.stagger ? stackY(i, n, H) : H / 2;
|
|
223
249
|
let s = `<svg class="lt-dot" width="${dp.width}" height="${H}">`;
|
|
224
250
|
const titles = [];
|
|
225
251
|
dp.cols.forEach((c, i) => {
|
|
@@ -229,20 +255,22 @@
|
|
|
229
255
|
// only defaults dots that lack it (:not([fill])), so this color shows but
|
|
230
256
|
// user CSS (a stylesheet rule) can still override it
|
|
231
257
|
const col = dp.colors?.[i], fl = col ? ` fill="${u.esc(col)}"` : "";
|
|
232
|
-
s += `<circle${fl} cx="${x(v)}" cy="${
|
|
258
|
+
s += `<circle${fl} cx="${x(v)}" cy="${yOf(i)}" r="3"/>`;
|
|
233
259
|
titles.push((dp.labels?.[i] ? dp.labels[i] + ": " : "") + u.str(v));
|
|
234
260
|
});
|
|
235
261
|
return s + `<title>${u.esc(titles.join("\n"))}</title></svg>`;
|
|
236
262
|
}
|
|
237
263
|
|
|
238
|
-
// Color key for a colored dot plot, drawn once in the footer under
|
|
239
|
-
// swatch + label per
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
264
|
+
// Color key for a colored dot/error-bar plot, drawn once in the footer under
|
|
265
|
+
// the axis: a swatch + label per series. "" when the plot is monochrome (no
|
|
266
|
+
// colors). Shared by the dot-plot and error-bar renderers (cfg.cols/colors/
|
|
267
|
+
// labels have the same shape in both).
|
|
268
|
+
function legend(cfg, u) {
|
|
269
|
+
if (!cfg.colors) return "";
|
|
270
|
+
const items = cfg.cols.map((c, i) =>
|
|
271
|
+
`<span><i style="background:${u.esc(cfg.colors[i])}"></i>` +
|
|
272
|
+
`${u.esc(cfg.labels?.[i] ?? c)}</span>`).join("");
|
|
273
|
+
return `<div class="lt-plot-legend">${items}</div>`;
|
|
246
274
|
}
|
|
247
275
|
|
|
248
276
|
// Dot-plot cell renderer. columns = the value columns (one dot each); the plot
|
|
@@ -253,7 +281,7 @@
|
|
|
253
281
|
const cols = op.columns || [], v = cols[0];
|
|
254
282
|
if (!v) return {};
|
|
255
283
|
const dp = {
|
|
256
|
-
col: v, cols, colors: op.colors, labels: op.labels,
|
|
284
|
+
col: v, cols, colors: op.colors, labels: op.labels, stagger: op.stagger,
|
|
257
285
|
min: op.min, max: op.max, axisLabel: op.axis_label,
|
|
258
286
|
width: op.width || 160, height: op.height || 16
|
|
259
287
|
};
|
|
@@ -262,7 +290,7 @@
|
|
|
262
290
|
},
|
|
263
291
|
cellClass: dp => dp.ticks ? "lt-eb-cell" : "",
|
|
264
292
|
cell: (dp, data, r, u) => (dp.ticks ? svgGrid(dp) : "") + svgDotplot(dp, data, r, u),
|
|
265
|
-
foot: (dp, u) => (dp.ticks ? svgAxis(dp, u) : "") +
|
|
293
|
+
foot: (dp, u) => (dp.ticks ? svgAxis(dp, u) : "") + legend(dp, u)
|
|
266
294
|
};
|
|
267
295
|
|
|
268
296
|
// If core already built a table before this module loaded (a doc where an
|
package/js/lt-plot.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(t=>{"use strict";const l=t.LT||(t.LT={}),
|
|
1
|
+
(t=>{"use strict";const l=t.LT||(t.LT={}),s=l.cells||(l.cells={});if(s.errorbar)return;function e(t,l,s=5){if(!(l>t))return[t];const e=(t,l)=>{const s=Math.floor(Math.log10(t)),e=t/10**s;return(l?e<1.5?1:e<3?2:e<7?5:10:e<=1?1:e<=2?2:e<=5?5:10)*10**s},n=e(e(l-t,!1)/(s-1),!0),i=Math.max(0,-Math.floor(Math.log10(n))),o=[];for(let s=Math.ceil(t/n)*n;s<=l+n/2;s+=n)o.push(+s.toFixed(i));return o}function n(t){const l=t.width-8,s=11*Math.max(String(t.min).length,String(t.max).length)*.6+11;return Math.max(2,Math.min(8,Math.floor(l/s)+1))}const i=(t,l)=>{const s=t.width-8,e=t.max-t.min,n=e>0?4+(l-t.min)/e*s:t.width/2;return Math.round(10*Math.max(4,Math.min(t.width-4,n)))/10},o=(t,l,s)=>l<=1?s/2:Math.round((t+1)/(l+1)*s);function r(t,l,s,e){const n=t=>{const n=l[t]?.[s-1];return e.isNum(n)?n:null},r=t.height,c=t.cols.length,a=l=>i(t,l),h=Math.min(4,(r/c-1)/2);let u=`<svg class="lt-eb" width="${t.width}" height="${r}">`;null!=t.ref&&(u+=`<line class="lt-eb-ref" x1="${a(t.ref)}" y1="0" x2="${a(t.ref)}" y2="${r}"/>`);const $=[];return t.cols.forEach((l,s)=>{const i=n(l),x=n(t.los[s]),m=n(t.his[s]);if(null==i&&null==x&&null==m)return;const f=(t=>o(t,c,r))(s),g=t.colors?.[s],d=g?` stroke="${e.esc(g)}"`:"",b=g?` fill="${e.esc(g)}"`:"";if(null!=x&&null!=m){const t=a(x),l=a(m);u+=`<line${d} x1="${t}" y1="${f}" x2="${l}" y2="${f}"/><line${d} x1="${t}" y1="${f-h}" x2="${t}" y2="${f+h}"/><line${d} x1="${l}" y1="${f-h}" x2="${l}" y2="${f+h}"/>`}null!=i&&(u+=`<circle${b} cx="${a(i)}" cy="${f}" r="3"/>`);const w=null!=x&&null!=m?` (${e.str(x)}, ${e.str(m)})`:"";$.push((t.labels?.[s]?t.labels[s]+": ":"")+(null!=i?e.str(i):"")+w)}),$.length?u+`<title>${e.esc($.join("\n"))}</title></svg>`:""}function c(t){let l=`<svg class="lt-eb-grid-bg" width="${t.width}" height="100%" viewBox="0 0 ${t.width} 10" preserveAspectRatio="none">`;for(const s of t.ticks)l+=`<line x1="${i(t,s)}" y1="0" x2="${i(t,s)}" y2="10"/>`;return l+"</svg>"}function a(t,l){const s=t.width,e=t.axisLabel,n=e?32:18,o=l=>i(t,l);let r=`<svg class="lt-eb-axis" width="${s}" height="${n}" overflow="visible"><line x1="4" y1="1" x2="${s-4}" y2="1"/>`;for(const e of t.ticks||[]){const t=o(e);r+=`<line x1="${t}" y1="0" x2="${t}" y2="4"/><text x="${t}" y="15" text-anchor="${t<=4?"start":t>=s-4?"end":"middle"}">${l.esc(l.str(e))}</text>`}return e&&(r+=`<text class="lt-eb-axis-label" x="${s/2}" y="${n-4}" text-anchor="middle">${l.esc(e)}</text>`),r+"</svg>"}s.errorbar={resolve(t){const l=t.columns||[],s=l[0];if(!s)return{};const i={col:s,cols:l,los:t.lowers||[],his:t.uppers||[],colors:t.colors,labels:t.labels,min:t.min,max:t.max,ref:t.ref,axis:t.axis,axisLabel:t.axis_label,width:t.width||160,height:t.height||16};return t.axis&&(i.ticks=e(i.min,i.max,n(i))),{[s]:i}},cellClass:t=>t.ticks?"lt-eb-cell":"",cell:(t,l,s,e)=>(t.ticks?c(t):"")+r(t,l,s,e),foot:(t,l)=>(t.ticks?a(t,l):"")+m(t,l)};const h=t=>Math.round(10*t)/10,u=t=>`"${t}"`;function $(t,l,s,e){const n=function(t,l,s,e){const n=l[t.cols[0]]?.[s-1];return(1===t.cols.length&&Array.isArray(n)?n:t.cols.map(t=>l[t]?.[s-1])).map(t=>e.isNum(t)?+t:null)}(t,l,s,e),i=n.filter(t=>null!=t);if(!i.length)return"";const o=t.width,r=t.height,c=n.length,a=null!=t.min?t.min:Math.min(...i),$=null!=t.max?t.max:Math.max(...i),x=t=>h($>a?r-2-(t-a)/($-a)*(r-4):r/2),m=t.color?` style="color:${e.esc(t.color)}"`:"";let f;if("bar"===t.kind){const t=(o-4)/c,l=h(Math.max(1,.8*t)),s=x(a<0&&$>0?0:a);f=n.map((e,n)=>{if(null==e)return"";const i=x(e),o=h(2+n*t+(t-l)/2);return`<rect class="lt-spark-bar" x=${u(o)} y=${u(Math.min(i,s))} width=${u(l)} height=${u(Math.max(1,Math.abs(s-i)))}/>`}).join("")}else{let t="",l=!1;n.forEach((s,e)=>{null!=s?(t+=`${l?"L":"M"}${(t=>h(c>1?2+t/(c-1)*(o-4):o/2))(e)} ${x(s)}`,l=!0):l=!1}),f=`<path class="lt-spark-line" d="${t}"/>`}return`<svg class="lt-spark" width="${o}" height="${r}"${m}>${f}<title>${e.esc(i.map(e.str).join(", "))}</title></svg>`}function x(t,l,s,e){const n=t.height,r=t.cols.length;let c=`<svg class="lt-dot" width="${t.width}" height="${n}">`;const a=[];return t.cols.forEach((h,u)=>{const $=l[h]?.[s-1];if(!e.isNum($))return;const x=t.colors?.[u],m=x?` fill="${e.esc(x)}"`:"";c+=`<circle${m} cx="${(l=>i(t,l))($)}" cy="${(l=>t.stagger?o(l,r,n):n/2)(u)}" r="3"/>`,a.push((t.labels?.[u]?t.labels[u]+": ":"")+e.str($))}),c+`<title>${e.esc(a.join("\n"))}</title></svg>`}function m(t,l){if(!t.colors)return"";return`<div class="lt-plot-legend">${t.cols.map((s,e)=>`<span><i style="background:${l.esc(t.colors[e])}"></i>${l.esc(t.labels?.[e]??s)}</span>`).join("")}</div>`}s.sparkline={resolve(t){const l=t.columns||[],s=l[0];return s?{[s]:{col:s,cols:l,kind:t.kind,min:t.min,max:t.max,color:t.color,width:t.width||120,height:t.height||20}}:{}},cell:(t,l,s,e)=>$(t,l,s,e)},s.dotplot={resolve(t){const l=t.columns||[],s=l[0];if(!s)return{};const i={col:s,cols:l,colors:t.colors,labels:t.labels,stagger:t.stagger,min:t.min,max:t.max,axisLabel:t.axis_label,width:t.width||160,height:t.height||16};return t.axis&&(i.ticks=e(i.min,i.max,n(i))),{[s]:i}},cellClass:t=>t.ticks?"lt-eb-cell":"",cell:(t,l,s,e)=>(t.ticks?c(t):"")+x(t,l,s,e),foot:(t,l)=>(t.ticks?a(t,l):"")+m(t,l)};const f=t.document;if(f)for(const t of f.querySelectorAll(".lt-table"))(t._ltSpec?.ops||[]).some(t=>s[t.type])&&l.refresh?.(t)})(window);
|
|
2
2
|
//# sourceMappingURL=lt-plot.min.js.map
|
package/js/lt-plot.min.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["root","LT","cells","errorbar","niceTicks","lo","hi","n","niceNum","x","round","e","Math","floor","log10","f","d","dec","max","ticks","v","ceil","push","toFixed","nAxisTicks","eb","inner","width","per","String","min","length","ebX","span","p","
|
|
1
|
+
{"version":3,"names":["root","LT","cells","errorbar","niceTicks","lo","hi","n","niceNum","x","round","e","Math","floor","log10","f","d","dec","max","ticks","v","ceil","push","toFixed","nAxisTicks","eb","inner","width","per","String","min","length","ebX","span","p","stackY","i","H","svgErrorbar","data","r","u","num","k","isNum","height","cols","cap","s","ref","titles","forEach","c","est","los","his","y","yOf","col","colors","st","esc","fl","xl","xh","ci","str","labels","join","svgGrid","t","svgAxis","W","lbl","axisLabel","xt","resolve","op","columns","lowers","uppers","axis","axis_label","cellClass","cell","foot","legend","round1","q","svgSparkline","sp","vals","Array","isArray","map","spSeries","fin","filter","yAt","style","color","body","kind","slot","bw","base","yv","abs","pen","xAt","svgDotplot","dp","stagger","cfg","sparkline","dotplot","doc","document","tbl","querySelectorAll","_ltSpec","ops","some","o","type","refresh","window"],"sources":["lt-plot.js"],"mappings":"AAQA,CAACA,IACC,aACA,MAAMC,EAAKD,EAAKC,KAAOD,EAAKC,GAAK,CAAC,GAC5BC,EAAQD,EAAGC,QAAUD,EAAGC,MAAQ,CAAC,GACvC,GAAIA,EAAMC,SAAU,OAYpB,SAASC,EAAUC,EAAIC,EAAIC,EAAI,GAC7B,KAAMD,EAAKD,GAAK,MAAO,CAACA,GACxB,MAAMG,EAAU,CAACC,EAAGC,KAClB,MAAMC,EAAIC,KAAKC,MAAMD,KAAKE,MAAML,IAAKM,EAAIN,EAAI,IAAME,EAGnD,OAFWD,EAASK,EAAI,IAAM,EAAIA,EAAI,EAAI,EAAIA,EAAI,EAAI,EAAI,GACtCA,GAAK,EAAI,EAAIA,GAAK,EAAI,EAAIA,GAAK,EAAI,EAAI,IAC/C,IAAMJ,GAEdK,EAAIR,EAAQA,EAAQF,EAAKD,GAAI,IAAUE,EAAI,IAAI,GAC/CU,EAAML,KAAKM,IAAI,GAAIN,KAAKC,MAAMD,KAAKE,MAAME,KAAMG,EAAQ,GAC7D,IAAK,IAAIC,EAAIR,KAAKS,KAAKhB,EAAKW,GAAKA,EAAGI,GAAKd,EAAKU,EAAI,EAAGI,GAAKJ,EACxDG,EAAMG,MAAMF,EAAEG,QAAQN,IACxB,OAAOE,CACT,CAIA,SAASK,EAAWC,GAClB,MAAMC,EAAQD,EAAGE,MAAQ,EAEnBC,EAzBa,GAwBLhB,KAAKM,IAAIW,OAAOJ,EAAGK,KAAKC,OAAQF,OAAOJ,EAAGP,KAAKa,QAC1B,GAzBhB,GA0BnB,OAAOnB,KAAKM,IAAI,EAAGN,KA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