bezel-charts 1.2.0 → 1.3.0
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/README.md +31 -5
- package/dist/bezel-charts.iife.js +9 -9
- package/dist/bezel-charts.js +926 -886
- package/dist/bezel-charts.min.js +9 -9
- package/dist/charts/bars.js +4 -0
- package/dist/charts/donut.js +2 -0
- package/dist/charts/gauge.js +3 -0
- package/dist/charts/heatmap.js +2 -0
- package/dist/charts/line.js +3 -0
- package/dist/charts/progress.js +2 -0
- package/dist/charts/ring.js +2 -0
- package/dist/charts/scatter.js +5 -0
- package/dist/charts/shared-L67BQ555.js +2 -0
- package/dist/charts/shared-PCFIMFLL.js +2 -0
- package/dist/charts/spark.js +2 -0
- package/package.json +10 -1
- package/src/charts/bars.js +2 -1
- package/src/charts/line.js +2 -1
- package/src/charts/scatter.js +2 -1
- package/src/core/series.js +85 -0
- package/src/core/util.js +0 -83
- package/src/element.js +13 -0
- package/src/entries/bars.js +10 -0
- package/src/entries/donut.js +10 -0
- package/src/entries/gauge.js +10 -0
- package/src/entries/heatmap.js +10 -0
- package/src/entries/line.js +10 -0
- package/src/entries/progress.js +10 -0
- package/src/entries/ring.js +10 -0
- package/src/entries/scatter.js +10 -0
- package/src/entries/spark.js +10 -0
- package/src/index.js +13 -17
- package/src/render.js +13 -12
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Bezel Charts is a set of free, open-source web components: ten chart tiles drawn
|
|
|
20
20
|
- **Made for READMEs.** Every chart exports as a clean static SVG, so a GitHub README can show a real chart.
|
|
21
21
|
- **Data science friendly.** Scatter plots with a least-squares trend line and Pearson's r, grouped series, goal lines and notes on key points.
|
|
22
22
|
- **Speaks your language.** Numbers and dates follow any locale, including Persian.
|
|
23
|
-
- **Light.** About 16 kB gzipped for all ten charts,
|
|
23
|
+
- **Light.** About 16 kB gzipped for all ten charts, or 7 to 10 kB for a page that loads just one. No dependencies and no build step.
|
|
24
24
|
- **Accessible.** Tab to any chart and step through its values with the arrow keys. Screen readers hear each value and get a hidden table of the data. Dashes, shapes and patterns tell series apart without relying on colour, and animation respects reduced-motion settings.
|
|
25
25
|
- **Python too.** `pip install bezel-charts` draws the same charts straight from a pandas DataFrame, for notebooks, reports and READMEs.
|
|
26
26
|
|
|
@@ -29,6 +29,7 @@ A sibling of [Bezel](https://github.com/ShazMoghaddam/bezel), the clock, calenda
|
|
|
29
29
|
## Contents
|
|
30
30
|
|
|
31
31
|
- [Quick start](#quick-start)
|
|
32
|
+
- [Load only the charts you use](#load-only-the-charts-you-use)
|
|
32
33
|
- [The Studio](#the-studio)
|
|
33
34
|
- [The charts](#the-charts)
|
|
34
35
|
- [Options for every chart](#options-for-every-chart)
|
|
@@ -48,7 +49,7 @@ A sibling of [Bezel](https://github.com/ShazMoghaddam/bezel), the clock, calenda
|
|
|
48
49
|
<bezel-bars heading="Commits this week" values="4,9,6,3,8,5,3" labels="M,T,W,T,F,S,S" stat="total"></bezel-bars>
|
|
49
50
|
```
|
|
50
51
|
|
|
51
|
-
`@1` always loads the latest 1.x release, so you get fixes without changing anything. To pin an exact version, use `@v1.
|
|
52
|
+
`@1` always loads the latest 1.x release, so you get fixes without changing anything. To pin an exact version, use `@v1.3.0` instead.
|
|
52
53
|
|
|
53
54
|
That's all. Charts fill the width of whatever they sit in and redraw when it changes, so they work in a sidebar, a card grid or a full-width section without extra CSS.
|
|
54
55
|
|
|
@@ -65,6 +66,30 @@ import 'bezel-charts'; // registers every element
|
|
|
65
66
|
import { render, toSVG } from 'bezel-charts'; // draw charts as SVG strings, even in Node
|
|
66
67
|
```
|
|
67
68
|
|
|
69
|
+
## Load only the charts you use
|
|
70
|
+
|
|
71
|
+
Each chart also comes as its own file, so a page with a single chart loads less than half the full bundle. The files share their common code, so a page with two or three charts downloads that part once.
|
|
72
|
+
|
|
73
|
+
```html
|
|
74
|
+
<script type="module" src="https://cdn.jsdelivr.net/gh/ShazMoghaddam/bezel-charts@1/dist/charts/line.js"></script>
|
|
75
|
+
<script type="module" src="https://cdn.jsdelivr.net/gh/ShazMoghaddam/bezel-charts@1/dist/charts/bars.js"></script>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```js
|
|
79
|
+
import 'bezel-charts/line';
|
|
80
|
+
import 'bezel-charts/bars';
|
|
81
|
+
import { toSVG } from 'bezel-charts/line'; // render and toSVG work for every chart loaded so far
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
| Page | Gzipped |
|
|
85
|
+
| --- | --- |
|
|
86
|
+
| One sparkline, ring, donut, gauge, progress bar or heatmap | 7.2 to 7.4 kB |
|
|
87
|
+
| One line, scatter or bar chart | 9.2 to 10.1 kB |
|
|
88
|
+
| A line and a bar chart | 12.0 kB |
|
|
89
|
+
| Every chart: the full bundle | 15.9 kB |
|
|
90
|
+
|
|
91
|
+
Once a page needs four or five different charts, load the full bundle instead. `<bezel-chart type="…">` works with whichever charts are loaded, and tells you which file to add if its type isn't one of them. The classic `iife.js` script always has every chart, because a classic script can't load the shared file.
|
|
92
|
+
|
|
68
93
|
## The Studio
|
|
69
94
|
|
|
70
95
|
The [Studio](https://shazmoghaddam.github.io/bezel-charts/site/#studio) is the easiest way to make a chart. No data to hand? Press one of the three sample files under **Import a file** to see a finished chart straight away, or download them from [`site/samples`](site/samples). Then pick a chart type then work through the tabs while the preview updates beside them:
|
|
@@ -433,17 +458,18 @@ npm run test:browser # click through every Studio control in a real browser (nee
|
|
|
433
458
|
|
|
434
459
|
```
|
|
435
460
|
src/
|
|
436
|
-
core/ shared helpers, the bezel frame and the colour themes
|
|
461
|
+
core/ shared helpers, the bezel frame and the colour themes; series.js has the extras for line, bars and scatter
|
|
437
462
|
charts/ one file per chart type: options in, SVG string out
|
|
438
463
|
render.js picks the chart and returns its SVG
|
|
439
|
-
element.js the custom element: sizing, theme, tooltips and export
|
|
464
|
+
element.js the custom element: sizing, theme, tooltips, keyboard and export
|
|
465
|
+
entries/ one file per chart that registers it and defines its tag, for per-chart imports
|
|
440
466
|
site/ the website and Studio, with sample files in site/samples
|
|
441
467
|
python/ the Python package, with parity tests against the JavaScript
|
|
442
468
|
docs/ the README image and social preview, with the pages that render them
|
|
443
469
|
test/ node:test suites, plus a Playwright browser test
|
|
444
470
|
```
|
|
445
471
|
|
|
446
|
-
Each chart is a pure function that takes its options and a theme and returns an SVG string, which keeps them easy to test and lets the same code run in Node. The bundle has a
|
|
472
|
+
Each chart is a pure function that takes its options and a theme and returns an SVG string, which keeps them easy to test and lets the same code run in Node. The full bundle has a 20 kB gzip budget and each chart file its own, checked in CI by `npm run size`. See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
447
473
|
|
|
448
474
|
## Security
|
|
449
475
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/*! Bezel Charts v1.
|
|
2
|
-
var BezelCharts=(()=>{var Se=Object.defineProperty;var tr=Object.getOwnPropertyDescriptor;var er=Object.getOwnPropertyNames;var rr=Object.prototype.hasOwnProperty;var ar=(t,e)=>{for(var r in e)Se(t,r,{get:e[r],enumerable:!0})},nr=(t,e,r,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of er(e))!rr.call(t,i)&&i!==r&&Se(t,i,{get:()=>e[i],enumerable:!(l=tr(e,i))||l.enumerable});return t};var ir=t=>nr(Se({},"__esModule",{value:!0}),t);var vr={};ar(vr,{BezelChart:()=>Jt,render:()=>Qt,themes:()=>Gt,toSVG:()=>We,types:()=>_e,version:()=>gr});var Gt={dark:{tile:"#15151d",bezel:"#000000",fg:"#f2f1f7",muted:"#8c8aa0",grid:"#2a2935",up:"#5EE6C8",down:"#F675A8",palette:["#9FA1FF","#F675A8","#5EE6C8","#FFC857","#7CC4FF","#FF8A5B"]},light:{tile:"#ffffff",bezel:"#000000",fg:"#17161f",muted:"#6b6980",grid:"#e8e6ef",up:"#12a383",down:"#d63f7c",palette:["#6E70F0","#E2508C","#16A884","#D99A0E","#2F8FE0","#EE6431"]}};var it="ui-sans-serif,system-ui,-apple-system,'Segoe UI',Roboto,Helvetica,Arial,sans-serif",dt="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace",lr=0;function Ht(t){return"bzc"+t+(++lr).toString(36)+Math.random().toString(36).slice(2,6)}function at(t){return String(t??"").replace(/[&<>"']/g,function(e){return{"&":"&","<":"<",">":">",'"':""","'":"'"}[e]})}function a(t){return Math.round(t*100)/100}function _(t,e,r){return Math.max(e,Math.min(r,t))}function I(t,e){var r=parseFloat(t);return isFinite(r)?r:e}function v(t){return t!=null&&t!==""}function K(t){return Array.isArray(t)?t.map(function(e){var r=+e;return isFinite(r)?r:0}):v(t)?String(t).split(/[\s,;]+/).filter(Boolean).map(function(e){var r=+e;return isFinite(r)?r:0}):[]}function U(t){return Array.isArray(t)?t.map(String):v(t)?String(t).split(",").map(function(e){return e.trim()}):[]}function Et(t){return Array.isArray(t)?Array.isArray(t[0])?t.map(K):[K(t)]:v(t)?String(t).split("|").map(K).filter(function(e){return e.length}):[]}function zt(t){return t.reduce(function(e,r){return e+r},0)}function bt(t,e,r){return String(t).length*e*(r?.6:.56)}function Bt(t,e){return t=String(t),t.length>e?t.slice(0,Math.max(1,e-1))+"\u2026":t}function j(t){return t===!0||t===""||t==="true"||t==="1"}function h(t,e,r){if(!isFinite(t))return"\u2013";var l=Math.abs(t),i;v(e.decimals)?i=_(parseInt(e.decimals,10)||0,0,6):i=t%1===0?0:l<10?2:l<100?1:0;var n={maximumFractionDigits:i,minimumFractionDigits:v(e.decimals)?i:0};(j(e.compact)||r)&&l>=1e4&&(n={notation:"compact",maximumFractionDigits:1});var s;try{s=new Intl.NumberFormat(e.lang||"en-GB",n).format(l)}catch{s=String(a(l))}return(t<0?"\u2212":"")+(e.prefix||"")+s+(e.suffix||"")}function ae(t,e,r){if(t===e)if(t===0)e=1;else{var l=Math.abs(t)*.1;t-=l,e+=l}for(var i=(e-t)/(r||4),n=Math.pow(10,Math.floor(Math.log10(i))),s=i/n,o=(s<=1?1:s<=2?2:s<=5?5:10)*n,c=Math.floor(t/o)*o,x=Math.ceil(e/o)*o,g=[],d=c;d<=x+o/2;d+=o)g.push(+d.toFixed(10));return{lo:c,hi:x,ticks:g}}function ie(t,e){if(!t.length)return"";for(var r="M"+a(t[0][0])+","+a(t[0][1]),l=1;l<t.length;l++){var i=t[l-1],n=t[l];if(e)r+="L"+a(n[0])+","+a(n[1]);else{var s=(i[0]+n[0])/2;r+="C"+a(s)+","+a(i[1])+" "+a(s)+","+a(n[1])+" "+a(n[0])+","+a(n[1])}}return r}function S(t,e,r,l){return'<text x="'+a(t)+'" y="'+a(e)+'" '+(l||"")+">"+at(r)+"</text>"}function G(t,e,r,l){return'fill="'+(l||t.muted)+'" font-family="'+dt+'" font-size="'+(e||10)+'"'+(r?" "+r:"")}function vt(t,e,r,l,i){return'<rect class="bzc-hit" x="'+a(t)+'" y="'+a(e)+'" width="'+a(Math.max(1,r))+'" height="'+a(Math.max(1,l))+'" fill="#000" fill-opacity="0" data-tip="'+at(i)+'"/>'}function lt(t,e,r){return t.animate?' class="'+e+'"'+(r?' style="animation-delay:'+a(r)+'s"':""):""}function ut(t,e){var r=U(t.color).filter(Boolean);return r.length?r:e.palette}function ht(t,e,r,l,i){return S(e+l/2,r+i/2+4,"No data yet",'text-anchor="middle" fill="'+t.muted+'" font-family="'+it+'" font-size="13"')}function Xt(t,e){return v(t.notes)?String(t.notes).split(";").map(function(r){var l=r.indexOf(":");if(l<0)return null;var i=r.slice(0,l).trim(),n=r.slice(l+1).trim(),s=e.map(String).indexOf(i);return s<0&&String(parseInt(i,10))===i&&(s=parseInt(i,10)),s>=0&&n?{i:s,text:n}:null}).filter(Boolean):[]}function Dt(t,e,r,l,i){var n=(v(t.goalLabel)?t.goalLabel:"Goal")+" "+h(I(t.goal,0),t);return'<line x1="'+a(r)+'" x2="'+a(l)+'" y1="'+a(i)+'" y2="'+a(i)+'" stroke="'+e.fg+'" stroke-opacity=".55" stroke-width="1.25" stroke-dasharray="4 4"/>'+S(l,i-5,n,G(e,10,'text-anchor="end"'))}function kt(t,e,r){var l=String(v(e.stat)?e.stat:r||"").toLowerCase();if(!l||l==="none"||!t.length)return null;var i=zt(t),n={last:t[t.length-1],total:i,sum:i,average:i/t.length,avg:i/t.length,max:Math.max.apply(null,t),min:Math.min.apply(null,t)};if(!(l in n))return null;var s=null;return l==="last"&&t.length>1&&e.delta!=="none"&&(s=t[t.length-1]-t[0]),{val:n[l],delta:s}}function Ut(t,e,r,l,i,n,s,o){var c=l,x=i,g="",d=o||13;return t.forEach(function(f,C){var E=d+bt(f,12)+16;c>l&&c+E-16>l+n&&(c=l,x+=20),g+=(s?s(C,c,x):'<circle cx="'+a(c+4)+'" cy="'+a(x+6)+'" r="4" fill="'+e[C%e.length]+'"/>')+S(c+d,x+10,f,'fill="'+r.fg+'" font-family="'+it+'" font-size="12"'),c+=E}),{svg:g,height:x-i+24}}var le={solid:"",dashed:"7 5",dotted:"1 5",dashdot:"9 4 1 4"},oe=["circle","square","triangle","diamond"],De=["solid","stripes","dots","grid"];function Vt(t,e,r){if(t==null||t===!1||t==="none"||t==="false")return null;var l=t===!0||t===""||t==="auto"?e:U(t).map(function(i){return e.indexOf(i)<0?r:i});return l.length?function(i){return l[i%l.length]}:null}function _t(t,e,r,l,i){var n=l*1.15,s=l*.85;return t==="square"?'<rect x="'+a(e-s)+'" y="'+a(r-s)+'" width="'+a(2*s)+'" height="'+a(2*s)+'" rx="1"'+i+"/>":t==="triangle"?'<path d="M'+a(e)+","+a(r-n)+"L"+a(e+n)+","+a(r+s)+"L"+a(e-n)+","+a(r+s)+'Z"'+i+"/>":t==="diamond"?'<path d="M'+a(e)+","+a(r-n*1.1)+"L"+a(e+n)+","+a(r)+"L"+a(e)+","+a(r+n*1.1)+"L"+a(e-n)+","+a(r)+'Z"'+i+"/>":'<circle cx="'+a(e)+'" cy="'+a(r)+'" r="'+a(l)+'"'+i+"/>"}function Pe(t,e,r,l){var i=' stroke="'+l+'" stroke-opacity=".55" stroke-width="1.5"';return'<pattern id="'+t+'" width="6" height="6" patternUnits="userSpaceOnUse"'+(e==="dots"?"":' patternTransform="rotate(45)"')+'><rect width="6" height="6" fill="'+r+'"/>'+(e==="dots"?'<circle cx="3" cy="3" r="1.3" fill="'+l+'" fill-opacity=".55"/>':'<path d="M3,0V6'+(e==="grid"?"M0,3H6":"")+'"'+i+"/>")+"</pattern>"}function $e(t){return Math.max.apply(null,t.map(function(e){return bt(e,10,!0)}))+10}function se(t,e){for(var r=Et(t.values),l=U(t.series),i=U(t.labels),n=[],s=Math.max.apply(null,[0].concat(r.map(function(d){return d.length}))),o=0;o<s;o++){var c=[i[o]||"#"+(o+1)],x=0;r.forEach(function(d){c.push(o<d.length?h(d[o],t):""),x+=o<d.length?d[o]:0}),e&&c.push(h(x,t)),n.push(c)}var g=r.length>1||l.length?r.map(function(d,f){return l[f]||"Series "+(f+1)}):["Value"];return{head:["Label"].concat(g,e?["Total"]:[]),rows:n}}function It(t){var e=Math.round(_(I(t.width,360),160,2400)),r=t.frame==="none"?0:4,l=t.frame==="none"?8:20;return{W:e,b:r,P:l,w:e-2*(r+l)}}var or=".bzc-a{animation:bzc-in .6s ease both}.bzc-d{animation:bzc-draw 1.1s cubic-bezier(.3,.7,.2,1) both}.bzc-g{transform-box:fill-box;transform-origin:50% 100%;animation:bzc-grow .7s cubic-bezier(.2,.8,.2,1) both}.bzc-gn{transform-box:fill-box;transform-origin:50% 0;animation:bzc-grow .7s cubic-bezier(.2,.8,.2,1) both}.bzc-gx{transform-box:fill-box;transform-origin:0 50%;animation:bzc-growx .8s cubic-bezier(.2,.8,.2,1) both}.bzc-s{animation:bzc-sweep 1.1s cubic-bezier(.2,.8,.2,1) both}@keyframes bzc-in{from{opacity:0}}@keyframes bzc-draw{from{stroke-dashoffset:1}}@keyframes bzc-grow{from{transform:scaleY(0)}}@keyframes bzc-growx{from{transform:scaleX(0)}}@keyframes bzc-sweep{from{stroke-dasharray:0 100}}@media (prefers-reduced-motion:reduce){[class^=bzc-]{animation:none!important}}";function mt(t,e,r,l,i){var n=It(t),s=n.W,o=n.b,c=n.P,x=n.w,g=_(I(t.corners,22),0,60),d=o+c,f="";v(t.heading)&&(f+=S(o+c,d+10,String(t.heading).toUpperCase(),G(e,11,'font-weight="600" letter-spacing="1.3"')),d+=24);var C=i&&i.stat;if(C){if(f+=S(o+c,d+30,h(C.val,t),'fill="'+e.fg+'" font-family="'+it+'" font-size="32" font-weight="800" letter-spacing="-0.5"'),C.delta!=null){var E=C.delta>0,R=C.delta===0,F=t.delta==="inverse"?!E:E,y=R?e.muted:F?e.up:e.down,L=(R?"\u25CF ":E?"\u25B2 ":"\u25BC ")+h(Math.abs(C.delta),t)+" "+(v(t.deltaLabel)?t.deltaLabel:"since start");f+=S(o+c+x,d+28,L,'text-anchor="end" fill="'+y+'" font-family="'+dt+'" font-size="11" font-weight="600"')}d+=44}var m=l(o+c,d,x,r),A=Math.round(d+r+c+o),z="";t.frame!=="none"?z='<rect width="'+s+'" height="'+A+'" rx="'+g+'" fill="'+e.bezel+'"/><rect x="'+o+'" y="'+o+'" width="'+(s-2*o)+'" height="'+(A-2*o)+'" rx="'+Math.max(0,g-o)+'" fill="'+(t.background||e.tile)+'"/>':v(t.background)&&(z='<rect width="'+s+'" height="'+A+'" rx="'+g+'" fill="'+t.background+'"/>');var b=(v(t.heading)?t.heading+": ":"")+(i&&i.summary||"chart");return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 '+s+" "+A+'" width="'+s+'" height="'+A+'" role="img" aria-label="'+at(b)+'"><title>'+at(b)+"</title>"+(t.animate?"<style>"+or+"</style>":"")+z+f+m+"</svg>"}function fe(t,e){var r=K(t.values),l=ut(t,e)[0],i=I(t.height,64),n=U(t.labels),s=Xt(t,n),o=kt(r,t,"last");return mt(t,e,i,function(c,x,g,d){if(!r.length)return ht(e,c,x,g,d);var f=r.length===1?[r[0],r[0]]:r,C=Math.min.apply(null,f),E=Math.max.apply(null,f);v(t.goal)&&(C=Math.min(C,+t.goal),E=Math.max(E,+t.goal));var R=(E-C||Math.abs(E)||1)*.12;C-=R,E+=R;var F=function(k){return c+k*g/(f.length-1)},y=function(k){return x+d-(k-C)/(E-C)*d},L=f.map(function(k,p){return[F(p),y(k)]}),m=ie(L,j(t.straight)),A=Ht("g"),z=L[L.length-1],b='<defs><linearGradient id="'+A+'" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="'+l+'" stop-opacity=".32"/><stop offset="1" stop-color="'+l+'" stop-opacity="0"/></linearGradient></defs>';[1/3,2/3].forEach(function(k){b+='<line x1="'+c+'" x2="'+(c+g)+'" y1="'+a(x+d*k)+'" y2="'+a(x+d*k)+'" stroke="'+e.grid+'" stroke-dasharray="2 4"/>'}),b+='<path d="'+m+"L"+a(z[0])+","+(x+d)+"L"+c+","+(x+d)+'Z" fill="url(#'+A+')"'+lt(t,"bzc-a")+"/>",b+='<path d="'+m+'" fill="none" stroke="'+l+'" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" pathLength="1" style="stroke-dasharray:1"'+lt(t,"bzc-d")+"/>",v(t.goal)&&(b+=Dt(t,e,c,c+g,y(+t.goal))),s.forEach(function(k){if(!(k.i>=r.length)){var p=L[k.i];b+='<circle cx="'+a(p[0])+'" cy="'+a(p[1])+'" r="3.5" fill="'+e.fg+'"/>'+S(_(p[0],c+30,c+g-30),p[1]-9,k.text,G(e,10,'text-anchor="middle"',e.fg))}}),b+='<circle cx="'+a(z[0])+'" cy="'+a(z[1])+'" r="9" fill="'+l+'" fill-opacity=".25"/><circle cx="'+a(z[0])+'" cy="'+a(z[1])+'" r="4.5" fill="'+l+'"/>',j(t.showValues)&&L.forEach(function(k,p){p<r.length&&(b+=S(k[0],k[1]-8,h(r[p],t,!0),G(e,9,'text-anchor="middle"')))});var O=r.length>1?g/(r.length-1):g;return r.forEach(function(k,p){b+=vt(F(p)-O/2,x-6,O,d+12,(n[p]||"#"+(p+1))+": "+h(k,t))}),b},{stat:o,summary:r.length?"latest "+h(r[r.length-1],t):"no data"})}fe.table=function(t){var e=U(t.labels);return{head:["Label","Value"],rows:K(t.values).map(function(r,l){return[e[l]||"#"+(l+1),h(r,t)]})}};function ce(t,e){var r=Et(t.values),l=U(t.series),i=U(t.labels),n=ut(t,e),s=I(t.height,170),o=Math.max.apply(null,[0].concat(r.map(function(R){return R.length}))),c=Xt(t,i),x=r.length>1||l.length>0,g=kt(r[0]||[],t,""),d=Vt(t.dash,Object.keys(le),"solid"),f=Vt(t.markers,oe,"none"),C=t.background||e.tile,E=(d||f)&&function(R,F,y){var L=n[R%n.length],m=d?le[d(R)]:"",A=f?f(R):"none";return'<line x1="'+a(F)+'" x2="'+a(F+18)+'" y1="'+a(y+6)+'" y2="'+a(y+6)+'" stroke="'+L+'" stroke-width="2.5" stroke-linecap="round"'+(m?' stroke-dasharray="'+m+'"':"")+"/>"+(A!=="none"?_t(A,F+9,y+6,3.5,' fill="'+L+'" stroke="'+C+'" stroke-width="1.5"'):"")};return mt(t,e,s,function(R,F,y,L){if(!o)return ht(e,R,F,y,L);var m="",A=F;if(x){var z=Ut(r.map(function(D,u){return l[u]||"Series "+(u+1)}),n,e,R,A,y,E,E&&24);m+=z.svg,A+=z.height}var b=[].concat.apply([],r),O=Math.min.apply(null,b),k=Math.max.apply(null,b);v(t.goal)&&(O=Math.min(O,+t.goal),k=Math.max(k,+t.goal)),j(t.zero)&&(O=Math.min(0,O),k=Math.max(0,k));var p=ae(O,k,4),B=p.ticks.map(function(D){return h(D,t,!0)}),M=Math.max.apply(null,B.map(function(D){return bt(D,10,!0)}))+10,w=i.length?20:4,T=R+M,V=y-M,Y=L-(A-F)-w,tt=function(D){return o===1?T+V/2:T+D*V/(o-1)},Q=function(D){return A+Y-(D-p.lo)/(p.hi-p.lo)*Y};if(p.ticks.forEach(function(D,u){var H=Q(D);m+='<line x1="'+a(T)+'" x2="'+a(T+V)+'" y1="'+a(H)+'" y2="'+a(H)+'" stroke="'+e.grid+'"'+(D===0?"":' stroke-dasharray="2 4"')+"/>"+S(T-8,H+3.5,B[u],G(e,10,'text-anchor="end"'))}),i.length){for(var ot=Math.max(1,Math.ceil(o*(Math.max.apply(null,i.map(function(D){return bt(D,10,!0)}))+10)/V)),q=0;q<o;q+=ot)if(i[q]!=null){var J=o>1&&q===0?"start":o>1&&q===o-1?"end":"middle";m+=S(tt(q),A+Y+15,i[q],G(e,10,'text-anchor="'+J+'"'))}}c.forEach(function(D){if(!(D.i>=o)){var u=tt(D.i);m+='<line x1="'+a(u)+'" x2="'+a(u)+'" y1="'+a(A+12)+'" y2="'+a(A+Y)+'" stroke="'+e.fg+'" stroke-opacity=".4" stroke-dasharray="3 3"/>'+S(_(u,T+30,T+V-30),A+8,D.text,G(e,10,'text-anchor="middle"',e.fg))}}),r.forEach(function(D,u){var H=n[u%n.length],N=D.map(function(X,ft){return[tt(ft),Q(X)]});N.length===1&&(N=[[T,N[0][1]],[T+V,N[0][1]]]);var et=ie(N,j(t.straight));if(u===0){var W=Ht("g"),gt=N[N.length-1];m+='<defs><linearGradient id="'+W+'" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="'+H+'" stop-opacity=".26"/><stop offset="1" stop-color="'+H+'" stop-opacity="0"/></linearGradient></defs><path d="'+et+"L"+a(gt[0])+","+a(A+Y)+"L"+a(N[0][0])+","+a(A+Y)+'Z" fill="url(#'+W+')"'+lt(t,"bzc-a")+"/>"}var xt=d?le[d(u)]:"",Mt=f?f(u):"none";if(m+=xt?'<path d="'+et+'" fill="none" stroke="'+H+'" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="'+xt+'"'+lt(t,"bzc-a",u*.15)+"/>":'<path d="'+et+'" fill="none" stroke="'+H+'" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" pathLength="1" style="stroke-dasharray:1'+(t.animate?";animation-delay:"+u*.15+"s":"")+'"'+(t.animate?' class="bzc-d"':"")+"/>",Mt!=="none"){var P=Math.ceil(D.length/40);D.forEach(function(X,ft){(ft%P===0||ft===D.length-1)&&(m+=_t(Mt,tt(ft),Q(X),3.5,' fill="'+H+'" stroke="'+C+'" stroke-width="1.5"'+lt(t,"bzc-a",.6+u*.15)))})}else{var Z=N[N.length-1];m+='<circle cx="'+a(Z[0])+'" cy="'+a(Z[1])+'" r="4" fill="'+H+'" stroke="'+C+'" stroke-width="2"/>'}j(t.showValues)&&D.forEach(function(X,ft){m+=S(tt(ft),Q(X)-8,h(X,t,!0),G(e,9,'text-anchor="middle"'))})}),v(t.goal)&&(m+=Dt(t,e,T,T+V,Q(+t.goal)));for(var Lt=o>1?V/(o-1):V,st=0;st<o;st++){var pt=i[st]||"#"+(st+1);r.forEach(function(D,u){st<D.length&&(pt+=`
|
|
3
|
-
`+(x?(l[u]||"Series "+(u+1))+": ":"")+h(
|
|
4
|
-
`+
|
|
5
|
-
Total: `+h(R[u],t):""):V(u)+": "+h(f[u],t)},tt=It(t),Q=c||l.length?Ut(r.map(function(u,H){return z(H)}),n,e,0,0,tt.w,w,w&&15).height:0,ot=g?1:s,q=c&&!g,J=q?10:14,Lt=3,st=x?ot*J+(ot-1)*Lt+(q?14:16):0,pt=x?Q+Math.max(1,o)*st-6:I(t.height,140)+Q,D=f.indexOf(Math.max.apply(null,f.length?f:[0]));return mt(t,e,pt,function(u,H,N,et){if(!o)return ht(e,u,H,N,et);var W=O?"<defs>"+O+"</defs>":"",gt=H;Q&&(W+=Ut(r.map(function($,rt){return z(rt)}),n,e,u,H,N,w,w&&15).svg,gt+=Q);var xt=Math.min(0,Math.min.apply(null,m)),Mt=Math.max(0,A);if(v(t.goal)&&(xt=Math.min(xt,+t.goal),Mt=Math.max(Mt,+t.goal)),Mt===xt&&(Mt=xt+1),x){for(var P=i.length?Math.min(N*.4,Math.max.apply(null,i.map(function($){return bt($,12)}))+10):0,Z=g?[R.map(function($){return h($,t)})]:r.map(function($){return $.map(function(rt){return h(rt,t)})}),X=Math.max.apply(null,[].concat.apply([],Z).map(function($){return bt($,q?10:11,!0)}))+10,ft=u+P,St=N-P-X,Rt=Math.max(Mt,0)||1,nt=0;nt<o;nt++){var At=gt+nt*st;i[nt]!=null&&(W+=S(u,At+(st-6)/2+4,Bt(i[nt],Math.floor(P/6.7)),'fill="'+e.fg+'" font-family="'+it+'" font-size="12"')),g?(W+=Ze(nt,ft,At+5,St,Rt),W+=S(u+N,At+5+J/2+3.8,Z[0][nt],'text-anchor="end" fill="'+e.fg+'" font-family="'+dt+'" font-size="11" font-weight="600"')):r.forEach(function($,rt){if(!(nt>=$.length)){var ct=$[nt],wt=At+(c?2:5)+rt*(J+Lt),Tt=Math.max(0,ct)/Rt*St;c||(W+='<rect x="'+a(ft)+'" y="'+a(wt)+'" width="'+a(St)+'" height="'+J+'" rx="'+J/2+'" fill="'+e.grid+'" fill-opacity=".6"/>'),Tt>0&&(W+='<rect x="'+a(ft)+'" y="'+a(wt)+'" width="'+a(Math.max(J,Tt))+'" height="'+J+'" rx="'+J/2+'" fill="'+M(rt,nt)+'" fill-opacity="'+T(ct)+'"'+lt(t,"bzc-gx",nt*.06+rt*.03)+"/>"),W+=S(u+N,wt+J/2+3.8,Z[rt][nt],'text-anchor="end" fill="'+e.fg+'" font-family="'+dt+'" font-size="'+(c?10:11)+'" font-weight="600"')}}),W+=vt(u,At,N,st-6,Y(nt))}if(v(t.goal)&&+t.goal>0){var Le=ft+ +t.goal/Rt*St;W+='<line x1="'+a(Le)+'" x2="'+a(Le)+'" y1="'+a(gt-2)+'" y2="'+a(H+et+2)+'" stroke="'+e.fg+'" stroke-opacity=".55" stroke-dasharray="3 3"/>'}return W}function Ze($,rt,ct,wt,Tt){var Ct='<rect x="'+a(rt)+'" y="'+a(ct)+'" width="'+a(wt)+'" height="'+J+'" rx="'+J/2+'" fill="'+e.grid+'" fill-opacity=".6"/>',qt=0;return r.forEach(function(ee,Ft){var Wt=$<ee.length?ee[$]:0,Nt=Math.max(0,Wt)/Tt*wt;if(!(Nt<=0)){var $t=qt>0?1.5:0;Ct+='<rect x="'+a(rt+qt+$t)+'" y="'+a(ct)+'" width="'+a(Math.max(2,Nt-$t))+'" height="'+J+'" rx="'+a(Math.min(3,Nt/2))+'" fill="'+M(Ft,$)+'"'+lt(t,"bzc-gx",$*.06+Ft*.03)+"/>",qt+=Nt}}),Ct}var Ae=i.length?Math.max.apply(null,i.map(function($){return bt($,10,!0)})):0,xe=i.length?Math.max(1,Math.ceil(o*(Ae+8)/N)):1,Kt=j(t.angleLabels)&&xe>1,Oe=Ge*Math.PI/180,Te=function($){return Kt?Bt($,Be):$};if(Kt){var Qe=N/o,Yt=0;i.forEach(function($,rt){Yt=Math.max(Yt,Math.cos(Oe)*bt(Te($),10,!0)+4-(rt+.5)*Qe)}),Yt=Math.min(Yt,N*.25),u+=Yt,N-=Yt,xe=1}var Ce=j(t.showValues)&&xt<0?14:0,Je=Kt?Math.ceil(Math.sin(Oe)*Math.min(Ae,bt("x".repeat(Be),10,!0)))+18:20,Ke=(i.length?Je:2)+Ce,Fe=j(t.showValues)?16:4,ye=et-(gt-H)-Ke-Fe,Ne=gt+Fe,Ot=function($){return Ne+ye-($-xt)/(Mt-xt)*ye},jt=N/o,te=Math.min(jt*(q?.78:.62),q?s*30:56),Re=q?Math.min(3,te/s*.15):0,Pt=g?te:(te-Re*(s-1))/s,ne=Ot(0);W+='<line x1="'+u+'" x2="'+(u+N)+'" y1="'+a(ne)+'" y2="'+a(ne)+'" stroke="'+e.grid+'"/>';for(var yt=0;yt<o;yt++){var be=u+yt*jt+(jt-te)/2;if(g?W+=je(yt,be):r.forEach(function($,rt){if(!(yt>=$.length)){var ct=$[yt],wt=be+rt*(Pt+Re),Tt=Math.min(Ot(ct),ne),Ct=Math.abs(Ot(ct)-ne);Ct>.5&&(W+='<rect x="'+a(wt)+'" y="'+a(Tt)+'" width="'+a(Pt)+'" height="'+a(Ct)+'" rx="'+a(Math.min(6,Pt/2,Ct/2))+'" fill="'+M(rt,yt)+'" fill-opacity="'+T(ct)+'"'+lt(t,ct<0?"bzc-gn":"bzc-g",yt*.05+rt*.03)+"/>"),j(t.showValues)&&(W+=S(wt+Pt/2,ct<0?Ot(ct)+12:Ot(ct)-5,h(ct,t,!0),'text-anchor="middle" fill="'+e.fg+'" font-family="'+dt+'" font-size="'+(c?9:10)+'" font-weight="600"'))}}),i[yt]!=null&&yt%xe===0){var ke=be+te/2,Me=Ne+ye+Ce+(Kt?12:15);W+=Kt?S(ke,Me,Te(i[yt]),G(e,10,'text-anchor="end" transform="rotate(-'+Ge+" "+a(ke)+" "+a(Me)+')"')):S(ke,Me,i[yt],G(e,10,'text-anchor="middle"'))}W+=vt(u+yt*jt,gt,jt,et-(gt-H),Y(yt))}return v(t.goal)&&(W+=Dt(t,e,u,u+N,Ot(+t.goal))),W;function je($,rt){var ct="",wt=0,Tt=0;if(r.forEach(function(qt,ee){var Ft=$<qt.length?qt[$]:0;if(Ft){var Wt=Ft>0?wt:Tt,Nt=Wt+Ft;Ft>0?wt=Nt:Tt=Nt;var $t=Ot(Math.max(Wt,Nt)),we=Ot(Math.min(Wt,Nt)),re=we-$t,He=Wt!==0?Math.min(1.5,re/2):0;Ft>0?we-=He:$t+=He,re=we-$t,re>.5&&(ct+='<rect x="'+a(rt)+'" y="'+a($t)+'" width="'+a(Pt)+'" height="'+a(re)+'" rx="'+a(Math.min(3,Pt/2,re/2))+'" fill="'+M(ee,$)+'"'+lt(t,Ft<0?"bzc-gn":"bzc-g",$*.05+ee*.03)+"/>")}}),j(t.showValues)){var Ct=R[$];ct+=S(rt+Pt/2,Ct<0?Ot(y[$])+12:Ot(F[$])-5,h(Ct,t,!0),'text-anchor="middle" fill="'+e.fg+'" font-family="'+dt+'" font-size="10" font-weight="600"')}return ct}},{stat:kt(f,t,""),summary:o?g?s+" series stacked across "+o+" groups":c?s+" series across "+o+" groups":"highest "+(i[D]||"")+" "+h(f[D],t):"no data"})}ue.table=function(t){return se(t,Et(t.values).length>1&&j(t.stacked))};function he(t,e){var r=K(t.values),l=U(t.labels),i=ut(t,e),n=I(t.max,100)||100,s=I(t.height,140),o=!v(t.prefix)&&!v(t.suffix)&&n===100,c=function(g){return h(g,t)+(o?"%":"")},x=kt(r,t,"");return mt(t,e,s,function(g,d,f,C){if(!r.length)return ht(e,g,d,f,C);var E="",R=r.length===1,F=Math.min(C,R?f:f*.55),y=R?g+f/2:g+F/2,L=d+C/2,m=R?F*.12:_(F*.42/(r.length*1.35),5,16),A=m*.38;if(r.forEach(function(k,p){var B=F/2-m/2-p*(m+A);if(!(B<=m/2)){var M=_(k/n*100,0,100),w=i[p%i.length];E+='<circle cx="'+a(y)+'" cy="'+a(L)+'" r="'+a(B)+'" fill="none" stroke="'+w+'" stroke-opacity=".16" stroke-width="'+a(m)+'"/>',M>0&&(E+='<circle cx="'+a(y)+'" cy="'+a(L)+'" r="'+a(B)+'" fill="none" stroke="'+w+'" stroke-width="'+a(m)+'" stroke-linecap="round" pathLength="100" transform="rotate(-90 '+a(y)+" "+a(L)+')" style="stroke-dasharray:'+a(M)+" 100"+(t.animate?";animation-delay:"+p*.12+"s":"")+'"'+(t.animate?' class="bzc-s"':"")+"/>"),E+='<circle cx="'+a(y)+'" cy="'+a(L)+'" r="'+a(B+m/2)+'" fill="#000" fill-opacity="0" class="bzc-hit" data-tip="'+at((l[p]||"#"+(p+1))+": "+c(k)+(o?"":" of "+h(n,t)))+'"/>'}}),R)E+=S(y,L+F*.08,c(r[0]),'text-anchor="middle" fill="'+e.fg+'" font-family="'+it+'" font-size="'+a(F*.22)+'" font-weight="800"'),l[0]&&(E+=S(y,L+F*.08+16,l[0],G(e,10,'text-anchor="middle"')));else{var z=g+F+22,b=Math.min(26,C/r.length),O=L-b*r.length/2;r.forEach(function(k,p){var B=O+p*b+b/2;E+='<circle cx="'+a(z+4)+'" cy="'+a(B)+'" r="4" fill="'+i[p%i.length]+'"/>'+S(z+14,B+4,Bt(l[p]||"#"+(p+1),Math.floor((g+f-z-60)/6.7)),'fill="'+e.fg+'" font-family="'+it+'" font-size="12"')+S(g+f,B+4,c(k),'text-anchor="end" fill="'+e.fg+'" font-family="'+dt+'" font-size="11" font-weight="600"')})}return E},{stat:x,summary:r.map(function(g,d){return(l[d]?l[d]+" ":"")+c(g)}).join(", ")})}he.table=function(t){var e=U(t.labels),r=I(t.max,100)||100,l=!v(t.prefix)&&!v(t.suffix)&&r===100;return{head:["Label","Value"],rows:K(t.values).map(function(i,n){return[e[n]||"#"+(n+1),h(i,t)+(l?"%":" of "+h(r,t))]})}};function me(t,e){var r=K(t.values).map(function(f){return Math.max(0,f)}),l=U(t.labels),i=ut(t,e),n=r.slice(),s=l.slice();if(n.length>6){var o=n.map(function(f,C){return C}).sort(function(f,C){return r[C]-r[f]}),c=o.slice(0,5).sort(function(f,C){return f-C});n=c.map(function(f){return r[f]}),s=c.map(function(f){return l[f]||"#"+(f+1)}),n.push(zt(o.slice(5).map(function(f){return r[f]}))),s.push("Other")}var x=zt(n),g=I(t.height,150),d=kt(n,t,"");return mt(t,e,g,function(f,C,E,R){if(!x)return ht(e,f,C,E,R);var F="",y=Math.min(R,E*.5),L=f+y/2,m=C+R/2,A=y*.16,z=(y-A)/2,b=0,O=n.filter(Boolean).length>1?.9:0;n.forEach(function(M,w){var T=M/x*100;if(!(T<=0)){var V=Math.max(.01,T-O);F+='<circle cx="'+a(L)+'" cy="'+a(m)+'" r="'+a(z)+'" fill="none" stroke="'+i[w%i.length]+'" stroke-width="'+a(A)+'" pathLength="100" stroke-dasharray="'+a(V)+" "+a(100-V)+'" stroke-dashoffset="'+a(-b)+'" transform="rotate(-90 '+a(L)+" "+a(m)+')"'+lt(t,"bzc-a",w*.08)+"/>",b+=T}}),F+=S(L,m+2,h(x,t,!0),'text-anchor="middle" fill="'+e.fg+'" font-family="'+it+'" font-size="'+a(y*.17)+'" font-weight="800"'),F+=S(L,m+2+14,(v(t.centerLabel)?t.centerLabel:"Total").toUpperCase(),G(e,9,'text-anchor="middle" letter-spacing="1"'));var k=f+y+22,p=Math.min(24,R/n.length),B=m-p*n.length/2;return n.forEach(function(M,w){var T=B+w*p+p/2,V=Math.round(M/x*100),Y=(s[w]||"#"+(w+1))+": "+h(M,t)+" ("+V+"%)";F+='<circle cx="'+a(k+4)+'" cy="'+a(T)+'" r="4" fill="'+i[w%i.length]+'"/>'+S(k+14,T+4,Bt(s[w]||"#"+(w+1),Math.floor((f+E-k-50)/6.7)),'fill="'+e.fg+'" font-family="'+it+'" font-size="12"')+S(f+E,T+4,V+"%",'text-anchor="end" fill="'+e.muted+'" font-family="'+dt+'" font-size="11" font-weight="600"')+vt(k,T-p/2,f+E-k,p,Y)}),b=0,n.forEach(function(M,w){var T=M/x*100;T<=0||(F+='<circle cx="'+a(L)+'" cy="'+a(m)+'" r="'+a(z)+'" fill="none" stroke="#000" stroke-opacity="0" stroke-width="'+a(A)+'" pathLength="100" stroke-dasharray="'+a(T)+" "+a(100-T)+'" stroke-dashoffset="'+a(-b)+'" transform="rotate(-90 '+a(L)+" "+a(m)+')" class="bzc-hit" data-skip="" data-tip="'+at((s[w]||"#"+(w+1))+": "+h(M,t)+" ("+Math.round(T)+"%)")+'"/>',b+=T)}),F},{stat:d,summary:"total "+h(x,t)+" across "+n.length+" parts"})}me.table=function(t){var e=K(t.values).map(function(i){return Math.max(0,i)}),r=U(t.labels),l=zt(e);return{head:["Label","Value","Share"],rows:e.map(function(i,n){return[r[n]||"#"+(n+1),h(i,t),(l?Math.round(i/l*100):0)+"%"]})}};function pe(t,e){var r=K(t.values),l=r.length?r[0]:I(t.value,NaN),i=U(t.labels),n=I(t.min,0),s=I(t.max,100),o=I(t.height,130);s===n&&(s=n+1);var c=K(t.zones),x=ut(t,e),g=U(t.color).filter(Boolean).length>1?x:[e.up,e.palette[3],e.down],d=x[0];if(c.length&&isFinite(l)){for(var f=0;f<c.length&&l>=c[f];)f++;d=g[Math.min(f,g.length-1)]}var C=!v(t.prefix)&&!v(t.suffix)&&n===0&&s===100,E=function(R){return h(R,t)+(C?"%":"")};return mt(t,e,o,function(R,F,y,L){if(!isFinite(l))return ht(e,R,F,y,L);var m=Math.min(y/2,L-22),A=m*.16,z=m-A/2,b=R+y/2,O=F+m,k=_((l-n)/(s-n),0,1),p=function(tt,Q){var ot=Math.PI*(1-tt);return[b+Q*Math.cos(ot),O-Q*Math.sin(ot)]},B="M"+a(b-z)+","+a(O)+"A"+a(z)+","+a(z)+" 0 0 1 "+a(b+z)+","+a(O),M='<path d="'+B+'" fill="none" stroke="'+d+'" stroke-opacity=".16" stroke-width="'+a(A)+'" stroke-linecap="round"/>';c.length&&c.forEach(function(tt){var Q=_((tt-n)/(s-n),0,1),ot=p(Q,z-A/2-3),q=p(Q,z-A/2-8);M+='<line x1="'+a(ot[0])+'" y1="'+a(ot[1])+'" x2="'+a(q[0])+'" y2="'+a(q[1])+'" stroke="'+e.muted+'" stroke-width="1.5"/>'}),k>0&&(M+='<path d="'+B+'" fill="none" stroke="'+d+'" stroke-width="'+a(A)+'" stroke-linecap="round" pathLength="100" style="stroke-dasharray:'+a(k*100)+' 100"'+lt(t,"bzc-s")+"/>");var w=p(k,z);if(M+='<circle cx="'+a(w[0])+'" cy="'+a(w[1])+'" r="'+a(A*.26)+'" fill="'+(t.background||e.tile)+'"'+lt(t,"bzc-a",.9)+"/>",v(t.goal)){var T=_((+t.goal-n)/(s-n),0,1),V=p(T,z+A/2+4),Y=p(T,z-A/2-4);M+='<line x1="'+a(V[0])+'" y1="'+a(V[1])+'" x2="'+a(Y[0])+'" y2="'+a(Y[1])+'" stroke="'+e.fg+'" stroke-width="2" stroke-linecap="round"/>'}return M+=S(b,O-m*.12,E(l),'text-anchor="middle" fill="'+e.fg+'" font-family="'+it+'" font-size="'+a(m*.34)+'" font-weight="800"'),i[0]&&(M+=S(b,O-m*.12+16,i[0],G(e,10,'text-anchor="middle"'))),M+=S(b-z,O+18,h(n,t,!0),G(e,10,'text-anchor="middle"'))+S(b+z,O+18,h(s,t,!0),G(e,10,'text-anchor="middle"')),M+=vt(b-m,O-m,m*2,m,(i[0]?i[0]+": ":"")+E(l)+" (range "+h(n,t)+" to "+h(s,t)+")"+(v(t.goal)?`
|
|
6
|
-
|
|
7
|
-
`:
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
/*! Bezel Charts v1.3.0 | MIT | github.com/ShazMoghaddam/bezel-charts */
|
|
2
|
+
var BezelCharts=(()=>{var Ae=Object.defineProperty;var rr=Object.getOwnPropertyDescriptor;var ar=Object.getOwnPropertyNames;var nr=Object.prototype.hasOwnProperty;var ir=(t,e)=>{for(var r in e)Ae(t,r,{get:e[r],enumerable:!0})},lr=(t,e,r,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ar(e))!nr.call(t,i)&&i!==r&&Ae(t,i,{get:()=>e[i],enumerable:!(l=rr(e,i))||l.enumerable});return t};var or=t=>lr(Ae({},"__esModule",{value:!0}),t);var yr={};ir(yr,{BezelChart:()=>Mt,render:()=>kt,themes:()=>Wt,toSVG:()=>Ct,types:()=>br,version:()=>xr});var at="ui-sans-serif,system-ui,-apple-system,'Segoe UI',Roboto,Helvetica,Arial,sans-serif",vt="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace",sr=0;function Dt(t){return"bzc"+t+(++sr).toString(36)+Math.random().toString(36).slice(2,6)}function nt(t){return String(t??"").replace(/[&<>"']/g,function(e){return{"&":"&","<":"<",">":">",'"':""","'":"'"}[e]})}function a(t){return Math.round(t*100)/100}function _(t,e,r){return Math.max(e,Math.min(r,t))}function I(t,e){var r=parseFloat(t);return isFinite(r)?r:e}function v(t){return t!=null&&t!==""}function K(t){return Array.isArray(t)?t.map(function(e){var r=+e;return isFinite(r)?r:0}):v(t)?String(t).split(/[\s,;]+/).filter(Boolean).map(function(e){var r=+e;return isFinite(r)?r:0}):[]}function P(t){return Array.isArray(t)?t.map(String):v(t)?String(t).split(",").map(function(e){return e.trim()}):[]}function At(t){return Array.isArray(t)?Array.isArray(t[0])?t.map(K):[K(t)]:v(t)?String(t).split("|").map(K).filter(function(e){return e.length}):[]}function Tt(t){return t.reduce(function(e,r){return e+r},0)}function bt(t,e,r){return String(t).length*e*(r?.6:.56)}function qt(t,e){return t=String(t),t.length>e?t.slice(0,Math.max(1,e-1))+"\u2026":t}function j(t){return t===!0||t===""||t==="true"||t==="1"}function h(t,e,r){if(!isFinite(t))return"\u2013";var l=Math.abs(t),i;v(e.decimals)?i=_(parseInt(e.decimals,10)||0,0,6):i=t%1===0?0:l<10?2:l<100?1:0;var n={maximumFractionDigits:i,minimumFractionDigits:v(e.decimals)?i:0};(j(e.compact)||r)&&l>=1e4&&(n={notation:"compact",maximumFractionDigits:1});var s;try{s=new Intl.NumberFormat(e.lang||"en-GB",n).format(l)}catch{s=String(a(l))}return(t<0?"\u2212":"")+(e.prefix||"")+s+(e.suffix||"")}function oe(t,e){if(!t.length)return"";for(var r="M"+a(t[0][0])+","+a(t[0][1]),l=1;l<t.length;l++){var i=t[l-1],n=t[l];if(e)r+="L"+a(n[0])+","+a(n[1]);else{var s=(i[0]+n[0])/2;r+="C"+a(s)+","+a(i[1])+" "+a(s)+","+a(n[1])+" "+a(n[0])+","+a(n[1])}}return r}function S(t,e,r,l){return'<text x="'+a(t)+'" y="'+a(e)+'" '+(l||"")+">"+nt(r)+"</text>"}function $(t,e,r,l){return'fill="'+(l||t.muted)+'" font-family="'+vt+'" font-size="'+(e||10)+'"'+(r?" "+r:"")}function yt(t,e,r,l,i){return'<rect class="bzc-hit" x="'+a(t)+'" y="'+a(e)+'" width="'+a(Math.max(1,r))+'" height="'+a(Math.max(1,l))+'" fill="#000" fill-opacity="0" data-tip="'+nt(i)+'"/>'}function lt(t,e,r){return t.animate?' class="'+e+'"'+(r?' style="animation-delay:'+a(r)+'s"':""):""}function ut(t,e){var r=P(t.color).filter(Boolean);return r.length?r:e.palette}function ht(t,e,r,l,i){return S(e+l/2,r+i/2+4,"No data yet",'text-anchor="middle" fill="'+t.muted+'" font-family="'+at+'" font-size="13"')}function Kt(t,e){return v(t.notes)?String(t.notes).split(";").map(function(r){var l=r.indexOf(":");if(l<0)return null;var i=r.slice(0,l).trim(),n=r.slice(l+1).trim(),s=e.map(String).indexOf(i);return s<0&&String(parseInt(i,10))===i&&(s=parseInt(i,10)),s>=0&&n?{i:s,text:n}:null}).filter(Boolean):[]}function Pt(t,e,r,l,i){var n=(v(t.goalLabel)?t.goalLabel:"Goal")+" "+h(I(t.goal,0),t);return'<line x1="'+a(r)+'" x2="'+a(l)+'" y1="'+a(i)+'" y2="'+a(i)+'" stroke="'+e.fg+'" stroke-opacity=".55" stroke-width="1.25" stroke-dasharray="4 4"/>'+S(l,i-5,n,$(e,10,'text-anchor="end"'))}function zt(t,e,r){var l=String(v(e.stat)?e.stat:r||"").toLowerCase();if(!l||l==="none"||!t.length)return null;var i=Tt(t),n={last:t[t.length-1],total:i,sum:i,average:i/t.length,avg:i/t.length,max:Math.max.apply(null,t),min:Math.min.apply(null,t)};if(!(l in n))return null;var s=null;return l==="last"&&t.length>1&&e.delta!=="none"&&(s=t[t.length-1]-t[0]),{val:n[l],delta:s}}function Yt(t){var e=Math.round(_(I(t.width,360),160,2400)),r=t.frame==="none"?0:4,l=t.frame==="none"?8:20;return{W:e,b:r,P:l,w:e-2*(r+l)}}var fr=".bzc-a{animation:bzc-in .6s ease both}.bzc-d{animation:bzc-draw 1.1s cubic-bezier(.3,.7,.2,1) both}.bzc-g{transform-box:fill-box;transform-origin:50% 100%;animation:bzc-grow .7s cubic-bezier(.2,.8,.2,1) both}.bzc-gn{transform-box:fill-box;transform-origin:50% 0;animation:bzc-grow .7s cubic-bezier(.2,.8,.2,1) both}.bzc-gx{transform-box:fill-box;transform-origin:0 50%;animation:bzc-growx .8s cubic-bezier(.2,.8,.2,1) both}.bzc-s{animation:bzc-sweep 1.1s cubic-bezier(.2,.8,.2,1) both}@keyframes bzc-in{from{opacity:0}}@keyframes bzc-draw{from{stroke-dashoffset:1}}@keyframes bzc-grow{from{transform:scaleY(0)}}@keyframes bzc-growx{from{transform:scaleX(0)}}@keyframes bzc-sweep{from{stroke-dasharray:0 100}}@media (prefers-reduced-motion:reduce){[class^=bzc-]{animation:none!important}}";function mt(t,e,r,l,i){var n=Yt(t),s=n.W,o=n.b,c=n.P,x=n.w,g=_(I(t.corners,22),0,60),d=o+c,f="";v(t.heading)&&(f+=S(o+c,d+10,String(t.heading).toUpperCase(),$(e,11,'font-weight="600" letter-spacing="1.3"')),d+=24);var C=i&&i.stat;if(C){if(f+=S(o+c,d+30,h(C.val,t),'fill="'+e.fg+'" font-family="'+at+'" font-size="32" font-weight="800" letter-spacing="-0.5"'),C.delta!=null){var z=C.delta>0,B=C.delta===0,F=t.delta==="inverse"?!z:z,b=B?e.muted:F?e.up:e.down,L=(B?"\u25CF ":z?"\u25B2 ":"\u25BC ")+h(Math.abs(C.delta),t)+" "+(v(t.deltaLabel)?t.deltaLabel:"since start");f+=S(o+c+x,d+28,L,'text-anchor="end" fill="'+b+'" font-family="'+vt+'" font-size="11" font-weight="600"')}d+=44}var m=l(o+c,d,x,r),A=Math.round(d+r+c+o),E="";t.frame!=="none"?E='<rect width="'+s+'" height="'+A+'" rx="'+g+'" fill="'+e.bezel+'"/><rect x="'+o+'" y="'+o+'" width="'+(s-2*o)+'" height="'+(A-2*o)+'" rx="'+Math.max(0,g-o)+'" fill="'+(t.background||e.tile)+'"/>':v(t.background)&&(E='<rect width="'+s+'" height="'+A+'" rx="'+g+'" fill="'+t.background+'"/>');var y=(v(t.heading)?t.heading+": ":"")+(i&&i.summary||"chart");return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 '+s+" "+A+'" width="'+s+'" height="'+A+'" role="img" aria-label="'+nt(y)+'"><title>'+nt(y)+"</title>"+(t.animate?"<style>"+fr+"</style>":"")+E+f+m+"</svg>"}function se(t,e){var r=K(t.values),l=ut(t,e)[0],i=I(t.height,64),n=P(t.labels),s=Kt(t,n),o=zt(r,t,"last");return mt(t,e,i,function(c,x,g,d){if(!r.length)return ht(e,c,x,g,d);var f=r.length===1?[r[0],r[0]]:r,C=Math.min.apply(null,f),z=Math.max.apply(null,f);v(t.goal)&&(C=Math.min(C,+t.goal),z=Math.max(z,+t.goal));var B=(z-C||Math.abs(z)||1)*.12;C-=B,z+=B;var F=function(k){return c+k*g/(f.length-1)},b=function(k){return x+d-(k-C)/(z-C)*d},L=f.map(function(k,p){return[F(p),b(k)]}),m=oe(L,j(t.straight)),A=Dt("g"),E=L[L.length-1],y='<defs><linearGradient id="'+A+'" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="'+l+'" stop-opacity=".32"/><stop offset="1" stop-color="'+l+'" stop-opacity="0"/></linearGradient></defs>';[1/3,2/3].forEach(function(k){y+='<line x1="'+c+'" x2="'+(c+g)+'" y1="'+a(x+d*k)+'" y2="'+a(x+d*k)+'" stroke="'+e.grid+'" stroke-dasharray="2 4"/>'}),y+='<path d="'+m+"L"+a(E[0])+","+(x+d)+"L"+c+","+(x+d)+'Z" fill="url(#'+A+')"'+lt(t,"bzc-a")+"/>",y+='<path d="'+m+'" fill="none" stroke="'+l+'" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" pathLength="1" style="stroke-dasharray:1"'+lt(t,"bzc-d")+"/>",v(t.goal)&&(y+=Pt(t,e,c,c+g,b(+t.goal))),s.forEach(function(k){if(!(k.i>=r.length)){var p=L[k.i];y+='<circle cx="'+a(p[0])+'" cy="'+a(p[1])+'" r="3.5" fill="'+e.fg+'"/>'+S(_(p[0],c+30,c+g-30),p[1]-9,k.text,$(e,10,'text-anchor="middle"',e.fg))}}),y+='<circle cx="'+a(E[0])+'" cy="'+a(E[1])+'" r="9" fill="'+l+'" fill-opacity=".25"/><circle cx="'+a(E[0])+'" cy="'+a(E[1])+'" r="4.5" fill="'+l+'"/>',j(t.showValues)&&L.forEach(function(k,p){p<r.length&&(y+=S(k[0],k[1]-8,h(r[p],t,!0),$(e,9,'text-anchor="middle"')))});var O=r.length>1?g/(r.length-1):g;return r.forEach(function(k,p){y+=yt(F(p)-O/2,x-6,O,d+12,(n[p]||"#"+(p+1))+": "+h(k,t))}),y},{stat:o,summary:r.length?"latest "+h(r[r.length-1],t):"no data"})}se.table=function(t){var e=P(t.labels);return{head:["Label","Value"],rows:K(t.values).map(function(r,l){return[e[l]||"#"+(l+1),h(r,t)]})}};var Wt={dark:{tile:"#15151d",bezel:"#000000",fg:"#f2f1f7",muted:"#8c8aa0",grid:"#2a2935",up:"#5EE6C8",down:"#F675A8",palette:["#9FA1FF","#F675A8","#5EE6C8","#FFC857","#7CC4FF","#FF8A5B"]},light:{tile:"#ffffff",bezel:"#000000",fg:"#17161f",muted:"#6b6980",grid:"#e8e6ef",up:"#12a383",down:"#d63f7c",palette:["#6E70F0","#E2508C","#16A884","#D99A0E","#2F8FE0","#EE6431"]}};var fe=["spark","line","bars","scatter","ring","donut","gauge","progress","heatmap"],ce={};function pt(t,e){ce[t]=e}var cr=t=>t.replace(/-([a-z])/g,(e,r)=>r.toUpperCase());function De(t,e){if(!ce[t])throw new Error(fe.includes(t)?`Bezel Charts: the ${t} chart isn't loaded. Add import 'bezel-charts/${t}', or load dist/charts/${t}.js.`:`Bezel Charts: unknown chart type "${t}". Choose one of: ${fe.join(", ")}.`);let r={};for(let[l,i]of Object.entries(e))r[cr(l)]=i;return r}function kt(t,e={}){let r=De(t,e);r.animate=j(r.animate),r.frame=r.frame==="none"?"none":"bezel";let l=r.theme==="light"||r.theme==="dark"?r.theme:r.autoTheme||"dark";return ce[t](r,Wt[l])}function Pe(t,e={}){return ce[t].table(De(t,e))}function Oe(t){return t.replace(/<rect class="bzc-hit"[^>]*\/>/g,"").replace(/<circle[^>]* class="bzc-hit"[^>]*\/>/g,"").replace(/ data-tip="[^"]*"/g,"")}function Ct(t,e={}){return Oe(kt(t,{...e,animate:!1}))}var Ue=["type","values","labels","series","heading","prefix","suffix","decimals","compact","color","theme","frame","width","height","goal","goal-label","notes","show-values","stat","delta","delta-label","max","min","value","zones","horizontal","straight","zero","start","lang","corners","background","center-label","highlight","x","y","x-label","y-label","trend","static","no-tooltips","stacked","angle-labels","dash","markers","patterns"],ur=`:host{display:block;position:relative;max-width:100%}:host([hidden]){display:none}svg{display:block;max-width:100%;height:auto;overflow:visible}.tip{position:absolute;left:0;top:0;pointer-events:none;background:#0b0b10;color:#f2f1f7;font:600 12px/1.5 ${vt};padding:7px 10px;border-radius:10px;white-space:pre;opacity:0;transform:translate(-50%,calc(-100% - 12px));transition:opacity .12s;z-index:3;border:1px solid #2a2935;box-shadow:0 8px 24px rgba(0,0,0,.35)}.tip.on{opacity:1}.c{outline:none}.c:focus-visible{outline:2px solid #fff;outline-offset:3px;box-shadow:0 0 0 7px #000}.k{stroke:currentColor;stroke-width:2;stroke-opacity:1}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}@media (forced-colors:active){.c:focus-visible{outline-color:Highlight}}`,hr={ArrowLeft:-1,ArrowUp:-1,ArrowRight:1,ArrowDown:1},mr=()=>typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):null,pr=()=>{let t=typeof document<"u"&&document.documentElement?.getAttribute?.("data-theme");return t==="light"||t==="dark"?t:null},Te=new Set;typeof MutationObserver=="function"&&typeof document<"u"&&document.documentElement&&new MutationObserver(()=>Te.forEach(t=>t.refresh())).observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});var dr=typeof HTMLElement>"u"?class{}:HTMLElement,Mt=class extends dr{static get observedAttributes(){return Ue}static get themes(){return Wt}get resolvedTheme(){let e=this.getAttribute("theme");return e==="light"||e==="dark"?e:this.options.autoTheme}get chartType(){return this.getAttribute("type")||"spark"}connectedCallback(){this.shadowRoot||(this.attachShadow({mode:"open"}).innerHTML=`<style>${ur}</style><div class="c" role="group" aria-roledescription="chart"></div><p class="sr" id="h">Use the arrow keys to step through the values.</p><div class="tip" aria-hidden="true"></div><div class="sr" aria-live="polite"></div><div class="sr"></div>`,[,this.#t,,this.#r,this.#o,this.#c]=this.shadowRoot.children,this.shadowRoot.addEventListener("pointermove",e=>this.#h(e)),this.shadowRoot.addEventListener("pointerdown",e=>this.#h(e)),this.addEventListener("pointerleave",()=>this.#r.classList.remove("on")),this.#t.addEventListener("keydown",e=>this.#v(e)),this.#t.addEventListener("blur",()=>this.#g())),Te.add(this),this.#a=mr(),this.#a?.addEventListener?.("change",this.#u),typeof ResizeObserver=="function"?(this.#l=new ResizeObserver(([e])=>{let r=Math.round(e.contentRect.width);(!this.#n||!this.hasAttribute("width")&&r>0&&Math.abs(r-this.#s)>1)&&this.#i()}),this.#l.observe(this)):this.#i()}disconnectedCallback(){Te.delete(this),this.#l?.disconnect(),this.#a?.removeEventListener?.("change",this.#u)}attributeChangedCallback(){!this.#n||this.#f||(this.#f=!0,queueMicrotask(()=>{this.#f=!1,this.#i()}))}get options(){let e={};for(let r of Ue)this.hasAttribute(r)&&(e[r]=this.getAttribute(r));return e.width||(e.width=this.#s||360),e.autoTheme=pr()||(this.#a?this.#a.matches?"dark":"light":"dark"),e}refresh(){this.#n&&this.#i()}toSVG(e={}){return Oe(kt(this.chartType,{...this.options,...e,animate:!1}))}download(e){let r=URL.createObjectURL(new Blob([this.toSVG()],{type:"image/svg+xml"})),l=Object.assign(document.createElement("a"),{href:r,download:`${(e||this.getAttribute("heading")||this.chartType).replace(/[^\w-]+/g,"-").toLowerCase()}.svg`});document.body.append(l),l.click(),l.remove(),setTimeout(()=>URL.revokeObjectURL(r),1e3)}#l=null;#t=null;#r=null;#o=null;#c=null;#e=-1;#a=null;#s=0;#n=!1;#f=!1;#u=()=>{let e=this.getAttribute("theme");(!e||e==="auto")&&this.refresh()};#i(){if(!this.shadowRoot)return;let e=Math.round(this.getBoundingClientRect?.().width||0);this.#s=e>0?e:360;let r=this.options;r.animate=!this.#n&&!this.hasAttribute("static");let l,i=null;try{l=kt(this.chartType,r),i=Pe(this.chartType,r)}catch(c){l=`<p style="font:13px ${at};color:#d63f7c">${nt(c.message)}</p>`}let n=this.#t;n.innerHTML=l.replace(/<title>[\s\S]*?<\/title>/,"");let s=n.querySelector("svg");s?(n.setAttribute("aria-label",s.getAttribute("aria-label")),s.removeAttribute("role"),s.removeAttribute("aria-label"),s.setAttribute("aria-hidden","true")):n.removeAttribute("aria-label");let o=!!s&&!this.hasAttribute("no-tooltips");o?(n.setAttribute("tabindex","0"),n.setAttribute("aria-describedby","h")):(n.removeAttribute("tabindex"),n.removeAttribute("aria-describedby")),n.style.color=Wt[r.theme==="light"||r.theme==="dark"?r.theme:r.autoTheme].fg,n.style.borderRadius=`${r.frame==="none"?4:_(+r.corners||22,0,60)}px`,this.#c.innerHTML=i&&i.rows.length?gr(r.heading,i):"",this.#e>=0&&o&&this.shadowRoot.activeElement===n?this.#d(this.#e):this.#e=-1,this.#n=!0,this.dispatchEvent(new CustomEvent("bezel-render",{bubbles:!0}))}#h(e){if(this.hasAttribute("no-tooltips"))return;let r=e.target?.closest?.("[data-tip]");if(!r){this.#r.classList.remove("on");return}this.#m(r,e.clientX,e.clientY)}#m(e,r,l){let i=this.#r;i.textContent=e.getAttribute("data-tip");let n=this.getBoundingClientRect?.()||{left:0,top:0,width:0},s=i.offsetWidth/2;i.style.left=`${_(r-n.left,s,Math.max(s,n.width-s))}px`,i.style.top=`${l-n.top}px`,i.classList.add("on")}#p(){return[...this.#t.querySelectorAll("[data-tip]:not([data-skip])")]}#v(e){let r=this.#p(),l=r.length;if(!l)return;let i=this.#e,n=hr[e.key];if(n)this.chartType==="heatmap"&&/Left|Right/.test(e.key)&&(n*=7),i=i<0?n>0?0:l-1:_(i+n,0,l-1);else if(e.key==="Home"||e.key==="End")i=e.key==="Home"?0:l-1;else{e.key==="Escape"&&this.#g();return}e.preventDefault(),this.#d(i,!0)}#d(e,r){let l=this.#p();if(!l.length)return;e=_(e,0,l.length-1),this.#t.querySelector(".k")?.classList.remove("k");let i=l[e],n=i.getBoundingClientRect?.()||{left:0,top:0,width:0};i.classList.add("k"),this.#e=e,this.#m(i,n.left+n.width/2,n.top),r&&(this.#o.textContent=`${i.getAttribute("data-tip").replace(/\n/g,", ")}. ${e+1} of ${l.length}`)}#g(){this.#t.querySelector(".k")?.classList.remove("k"),this.#r.classList.remove("on"),this.#o.textContent="",this.#e=-1}};function gr(t,{head:e,rows:r}){let l=i=>i.map((n,s)=>s?`<td>${nt(n)}</td>`:`<th scope="row">${nt(n)}</th>`).join("");return`<table><caption>${nt(t||"Chart data")}</caption><thead><tr>${e.map(i=>`<th scope="col">${nt(i)}</th>`).join("")}</tr></thead><tbody>${r.map(i=>`<tr>${l(i)}</tr>`).join("")}</tbody></table>`}function dt(t){typeof customElements>"u"||typeof HTMLElement>"u"||(customElements.get(`bezel-${t}`)||customElements.define(`bezel-${t}`,class extends Mt{get chartType(){return t}}),customElements.get("bezel-chart")||customElements.define("bezel-chart",class extends Mt{}))}pt("spark",se);dt("spark");function ie(t,e,r){if(t===e)if(t===0)e=1;else{var l=Math.abs(t)*.1;t-=l,e+=l}for(var i=(e-t)/(r||4),n=Math.pow(10,Math.floor(Math.log10(i))),s=i/n,o=(s<=1?1:s<=2?2:s<=5?5:10)*n,c=Math.floor(t/o)*o,x=Math.ceil(e/o)*o,g=[],d=c;d<=x+o/2;d+=o)g.push(+d.toFixed(10));return{lo:c,hi:x,ticks:g}}function Xt(t,e,r,l,i,n,s,o){var c=l,x=i,g="",d=o||13;return t.forEach(function(f,C){var z=d+bt(f,12)+16;c>l&&c+z-16>l+n&&(c=l,x+=20),g+=(s?s(C,c,x):'<circle cx="'+a(c+4)+'" cy="'+a(x+6)+'" r="4" fill="'+e[C%e.length]+'"/>')+S(c+d,x+10,f,'fill="'+r.fg+'" font-family="'+at+'" font-size="12"'),c+=z}),{svg:g,height:x-i+24}}var ue={solid:"",dashed:"7 5",dotted:"1 5",dashdot:"9 4 1 4"},he=["circle","square","triangle","diamond"],Ie=["solid","stripes","dots","grid"];function _t(t,e,r){if(t==null||t===!1||t==="none"||t==="false")return null;var l=t===!0||t===""||t==="auto"?e:P(t).map(function(i){return e.indexOf(i)<0?r:i});return l.length?function(i){return l[i%l.length]}:null}function jt(t,e,r,l,i){var n=l*1.15,s=l*.85;return t==="square"?'<rect x="'+a(e-s)+'" y="'+a(r-s)+'" width="'+a(2*s)+'" height="'+a(2*s)+'" rx="1"'+i+"/>":t==="triangle"?'<path d="M'+a(e)+","+a(r-n)+"L"+a(e+n)+","+a(r+s)+"L"+a(e-n)+","+a(r+s)+'Z"'+i+"/>":t==="diamond"?'<path d="M'+a(e)+","+a(r-n*1.1)+"L"+a(e+n)+","+a(r)+"L"+a(e)+","+a(r+n*1.1)+"L"+a(e-n)+","+a(r)+'Z"'+i+"/>":'<circle cx="'+a(e)+'" cy="'+a(r)+'" r="'+a(l)+'"'+i+"/>"}function qe(t,e,r,l){var i=' stroke="'+l+'" stroke-opacity=".55" stroke-width="1.5"';return'<pattern id="'+t+'" width="6" height="6" patternUnits="userSpaceOnUse"'+(e==="dots"?"":' patternTransform="rotate(45)"')+'><rect width="6" height="6" fill="'+r+'"/>'+(e==="dots"?'<circle cx="3" cy="3" r="1.3" fill="'+l+'" fill-opacity=".55"/>':'<path d="M3,0V6'+(e==="grid"?"M0,3H6":"")+'"'+i+"/>")+"</pattern>"}function Ye(t){return Math.max.apply(null,t.map(function(e){return bt(e,10,!0)}))+10}function me(t,e){for(var r=At(t.values),l=P(t.series),i=P(t.labels),n=[],s=Math.max.apply(null,[0].concat(r.map(function(d){return d.length}))),o=0;o<s;o++){var c=[i[o]||"#"+(o+1)],x=0;r.forEach(function(d){c.push(o<d.length?h(d[o],t):""),x+=o<d.length?d[o]:0}),e&&c.push(h(x,t)),n.push(c)}var g=r.length>1||l.length?r.map(function(d,f){return l[f]||"Series "+(f+1)}):["Value"];return{head:["Label"].concat(g,e?["Total"]:[]),rows:n}}function pe(t,e){var r=At(t.values),l=P(t.series),i=P(t.labels),n=ut(t,e),s=I(t.height,170),o=Math.max.apply(null,[0].concat(r.map(function(B){return B.length}))),c=Kt(t,i),x=r.length>1||l.length>0,g=zt(r[0]||[],t,""),d=_t(t.dash,Object.keys(ue),"solid"),f=_t(t.markers,he,"none"),C=t.background||e.tile,z=(d||f)&&function(B,F,b){var L=n[B%n.length],m=d?ue[d(B)]:"",A=f?f(B):"none";return'<line x1="'+a(F)+'" x2="'+a(F+18)+'" y1="'+a(b+6)+'" y2="'+a(b+6)+'" stroke="'+L+'" stroke-width="2.5" stroke-linecap="round"'+(m?' stroke-dasharray="'+m+'"':"")+"/>"+(A!=="none"?jt(A,F+9,b+6,3.5,' fill="'+L+'" stroke="'+C+'" stroke-width="1.5"'):"")};return mt(t,e,s,function(B,F,b,L){if(!o)return ht(e,B,F,b,L);var m="",A=F;if(x){var E=Xt(r.map(function(R,u){return l[u]||"Series "+(u+1)}),n,e,B,A,b,z,z&&24);m+=E.svg,A+=E.height}var y=[].concat.apply([],r),O=Math.min.apply(null,y),k=Math.max.apply(null,y);v(t.goal)&&(O=Math.min(O,+t.goal),k=Math.max(k,+t.goal)),j(t.zero)&&(O=Math.min(0,O),k=Math.max(0,k));var p=ie(O,k,4),D=p.ticks.map(function(R){return h(R,t,!0)}),M=Math.max.apply(null,D.map(function(R){return bt(R,10,!0)}))+10,w=i.length?20:4,T=B+M,U=b-M,q=L-(A-F)-w,tt=function(R){return o===1?T+U/2:T+R*U/(o-1)},Q=function(R){return A+q-(R-p.lo)/(p.hi-p.lo)*q};if(p.ticks.forEach(function(R,u){var G=Q(R);m+='<line x1="'+a(T)+'" x2="'+a(T+U)+'" y1="'+a(G)+'" y2="'+a(G)+'" stroke="'+e.grid+'"'+(R===0?"":' stroke-dasharray="2 4"')+"/>"+S(T-8,G+3.5,D[u],$(e,10,'text-anchor="end"'))}),i.length){for(var ot=Math.max(1,Math.ceil(o*(Math.max.apply(null,i.map(function(R){return bt(R,10,!0)}))+10)/U)),Y=0;Y<o;Y+=ot)if(i[Y]!=null){var J=o>1&&Y===0?"start":o>1&&Y===o-1?"end":"middle";m+=S(tt(Y),A+q+15,i[Y],$(e,10,'text-anchor="'+J+'"'))}}c.forEach(function(R){if(!(R.i>=o)){var u=tt(R.i);m+='<line x1="'+a(u)+'" x2="'+a(u)+'" y1="'+a(A+12)+'" y2="'+a(A+q)+'" stroke="'+e.fg+'" stroke-opacity=".4" stroke-dasharray="3 3"/>'+S(_(u,T+30,T+U-30),A+8,R.text,$(e,10,'text-anchor="middle"',e.fg))}}),r.forEach(function(R,u){var G=n[u%n.length],N=R.map(function(X,ft){return[tt(ft),Q(X)]});N.length===1&&(N=[[T,N[0][1]],[T+U,N[0][1]]]);var et=oe(N,j(t.straight));if(u===0){var W=Dt("g"),xt=N[N.length-1];m+='<defs><linearGradient id="'+W+'" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="'+G+'" stop-opacity=".26"/><stop offset="1" stop-color="'+G+'" stop-opacity="0"/></linearGradient></defs><path d="'+et+"L"+a(xt[0])+","+a(A+q)+"L"+a(N[0][0])+","+a(A+q)+'Z" fill="url(#'+W+')"'+lt(t,"bzc-a")+"/>"}var wt=d?ue[d(u)]:"",Et=f?f(u):"none";if(m+=wt?'<path d="'+et+'" fill="none" stroke="'+G+'" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="'+wt+'"'+lt(t,"bzc-a",u*.15)+"/>":'<path d="'+et+'" fill="none" stroke="'+G+'" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" pathLength="1" style="stroke-dasharray:1'+(t.animate?";animation-delay:"+u*.15+"s":"")+'"'+(t.animate?' class="bzc-d"':"")+"/>",Et!=="none"){var V=Math.ceil(R.length/40);R.forEach(function(X,ft){(ft%V===0||ft===R.length-1)&&(m+=jt(Et,tt(ft),Q(X),3.5,' fill="'+G+'" stroke="'+C+'" stroke-width="1.5"'+lt(t,"bzc-a",.6+u*.15)))})}else{var Z=N[N.length-1];m+='<circle cx="'+a(Z[0])+'" cy="'+a(Z[1])+'" r="4" fill="'+G+'" stroke="'+C+'" stroke-width="2"/>'}j(t.showValues)&&R.forEach(function(X,ft){m+=S(tt(ft),Q(X)-8,h(X,t,!0),$(e,9,'text-anchor="middle"'))})}),v(t.goal)&&(m+=Pt(t,e,T,T+U,Q(+t.goal)));for(var Ft=o>1?U/(o-1):U,st=0;st<o;st++){var gt=i[st]||"#"+(st+1);r.forEach(function(R,u){st<R.length&&(gt+=`
|
|
3
|
+
`+(x?(l[u]||"Series "+(u+1))+": ":"")+h(R[st],t))}),m+=yt(tt(st)-Ft/2,A,Ft,q,gt)}return m},{stat:g,summary:r.length+" series over "+o+" points"})}pe.table=function(t){return me(t)};pt("line",pe);dt("line");var We=40,Xe=24;function de(t,e){for(var r=At(t.values),l=P(t.series),i=P(t.labels),n=ut(t,e),s=r.length,o=Math.max.apply(null,[0].concat(r.map(function(u){return u.length}))),c=s>1,x=j(t.horizontal),g=c&&j(t.stacked),d=!c&&P(t.color).filter(Boolean).length>1,f=r[0]||[],C=[].concat.apply([],r),z=function(u,G){return r.reduce(function(N,et){return u<et.length&&et[u]*G>0?N+et[u]:N},0)},B=[],F=[],b=[],L=0;g&&L<o;L++)F.push(z(L,1)),b.push(z(L,-1)),B.push(F[L]+b[L]);for(var m=g?F.concat(b):C,A=m.length?Math.max.apply(null,m):0,E=function(u){return l[u]||"Series "+(u+1)},y=c?_t(t.patterns,Ie,"solid"):null,O="",k=[],p=0;y&&p<s;p++)if(y(p)!=="solid"){var D=Dt("g");O+=qe(D,y(p),n[p%n.length],t.background||e.tile),k[p]="url(#"+D+")"}var M=function(u,G){return c?k[u]||n[u%n.length]:d?n[G%n.length]:n[0]},w=y&&function(u,G,N){return'<rect x="'+a(G)+'" y="'+a(N+1)+'" width="10" height="10" rx="2" fill="'+M(u)+'"/>'},T=function(u){return c||d||t.highlight==="none"||u===A?1:.5},U=function(u){return i[u]||"#"+(u+1)},q=function(u){return c?U(u)+r.map(function(G,N){return u<G.length?`
|
|
4
|
+
`+E(N)+": "+h(G[u],t):""}).join("")+(g?`
|
|
5
|
+
Total: `+h(B[u],t):""):U(u)+": "+h(f[u],t)},tt=Yt(t),Q=c||l.length?Xt(r.map(function(u,G){return E(G)}),n,e,0,0,tt.w,w,w&&15).height:0,ot=g?1:s,Y=c&&!g,J=Y?10:14,Ft=3,st=x?ot*J+(ot-1)*Ft+(Y?14:16):0,gt=x?Q+Math.max(1,o)*st-6:I(t.height,140)+Q,R=f.indexOf(Math.max.apply(null,f.length?f:[0]));return mt(t,e,gt,function(u,G,N,et){if(!o)return ht(e,u,G,N,et);var W=O?"<defs>"+O+"</defs>":"",xt=G;Q&&(W+=Xt(r.map(function(H,rt){return E(rt)}),n,e,u,G,N,w,w&&15).svg,xt+=Q);var wt=Math.min(0,Math.min.apply(null,m)),Et=Math.max(0,A);if(v(t.goal)&&(wt=Math.min(wt,+t.goal),Et=Math.max(Et,+t.goal)),Et===wt&&(Et=wt+1),x){for(var V=i.length?Math.min(N*.4,Math.max.apply(null,i.map(function(H){return bt(H,12)}))+10):0,Z=g?[B.map(function(H){return h(H,t)})]:r.map(function(H){return H.map(function(rt){return h(rt,t)})}),X=Math.max.apply(null,[].concat.apply([],Z).map(function(H){return bt(H,Y?10:11,!0)}))+10,ft=u+V,Ot=N-V-X,$t=Math.max(Et,0)||1,it=0;it<o;it++){var Nt=xt+it*st;i[it]!=null&&(W+=S(u,Nt+(st-6)/2+4,qt(i[it],Math.floor(V/6.7)),'fill="'+e.fg+'" font-family="'+at+'" font-size="12"')),g?(W+=Je(it,ft,Nt+5,Ot,$t),W+=S(u+N,Nt+5+J/2+3.8,Z[0][it],'text-anchor="end" fill="'+e.fg+'" font-family="'+vt+'" font-size="11" font-weight="600"')):r.forEach(function(H,rt){if(!(it>=H.length)){var ct=H[it],Lt=Nt+(c?2:5)+rt*(J+Ft),Gt=Math.max(0,ct)/$t*Ot;c||(W+='<rect x="'+a(ft)+'" y="'+a(Lt)+'" width="'+a(Ot)+'" height="'+J+'" rx="'+J/2+'" fill="'+e.grid+'" fill-opacity=".6"/>'),Gt>0&&(W+='<rect x="'+a(ft)+'" y="'+a(Lt)+'" width="'+a(Math.max(J,Gt))+'" height="'+J+'" rx="'+J/2+'" fill="'+M(rt,it)+'" fill-opacity="'+T(ct)+'"'+lt(t,"bzc-gx",it*.06+rt*.03)+"/>"),W+=S(u+N,Lt+J/2+3.8,Z[rt][it],'text-anchor="end" fill="'+e.fg+'" font-family="'+vt+'" font-size="'+(c?10:11)+'" font-weight="600"')}}),W+=yt(u,Nt,N,st-6,q(it))}if(v(t.goal)&&+t.goal>0){var Ce=ft+ +t.goal/$t*Ot;W+='<line x1="'+a(Ce)+'" x2="'+a(Ce)+'" y1="'+a(xt-2)+'" y2="'+a(G+et+2)+'" stroke="'+e.fg+'" stroke-opacity=".55" stroke-dasharray="3 3"/>'}return W}function Je(H,rt,ct,Lt,Gt){var Rt='<rect x="'+a(rt)+'" y="'+a(ct)+'" width="'+a(Lt)+'" height="'+J+'" rx="'+J/2+'" fill="'+e.grid+'" fill-opacity=".6"/>',Qt=0;return r.forEach(function(ae,Vt){var Jt=H<ae.length?ae[H]:0,Ht=Math.max(0,Jt)/Gt*Lt;if(!(Ht<=0)){var It=Qt>0?1.5:0;Rt+='<rect x="'+a(rt+Qt+It)+'" y="'+a(ct)+'" width="'+a(Math.max(2,Ht-It))+'" height="'+J+'" rx="'+a(Math.min(3,Ht/2))+'" fill="'+M(Vt,H)+'"'+lt(t,"bzc-gx",H*.06+Vt*.03)+"/>",Qt+=Ht}}),Rt}var Fe=i.length?Math.max.apply(null,i.map(function(H){return bt(H,10,!0)})):0,Me=i.length?Math.max(1,Math.ceil(o*(Fe+8)/N)):1,te=j(t.angleLabels)&&Me>1,Ne=We*Math.PI/180,Be=function(H){return te?qt(H,Xe):H};if(te){var Ke=N/o,Zt=0;i.forEach(function(H,rt){Zt=Math.max(Zt,Math.cos(Ne)*bt(Be(H),10,!0)+4-(rt+.5)*Ke)}),Zt=Math.min(Zt,N*.25),u+=Zt,N-=Zt,Me=1}var Ge=j(t.showValues)&&wt<0?14:0,je=te?Math.ceil(Math.sin(Ne)*Math.min(Fe,bt("x".repeat(Xe),10,!0)))+18:20,tr=(i.length?je:2)+Ge,Re=j(t.showValues)?16:4,we=et-(xt-G)-tr-Re,Ve=xt+Re,Bt=function(H){return Ve+we-(H-wt)/(Et-wt)*we},ee=N/o,re=Math.min(ee*(Y?.78:.62),Y?s*30:56),He=Y?Math.min(3,re/s*.15):0,Ut=g?re:(re-He*(s-1))/s,le=Bt(0);W+='<line x1="'+u+'" x2="'+(u+N)+'" y1="'+a(le)+'" y2="'+a(le)+'" stroke="'+e.grid+'"/>';for(var St=0;St<o;St++){var Se=u+St*ee+(ee-re)/2;if(g?W+=er(St,Se):r.forEach(function(H,rt){if(!(St>=H.length)){var ct=H[St],Lt=Se+rt*(Ut+He),Gt=Math.min(Bt(ct),le),Rt=Math.abs(Bt(ct)-le);Rt>.5&&(W+='<rect x="'+a(Lt)+'" y="'+a(Gt)+'" width="'+a(Ut)+'" height="'+a(Rt)+'" rx="'+a(Math.min(6,Ut/2,Rt/2))+'" fill="'+M(rt,St)+'" fill-opacity="'+T(ct)+'"'+lt(t,ct<0?"bzc-gn":"bzc-g",St*.05+rt*.03)+"/>"),j(t.showValues)&&(W+=S(Lt+Ut/2,ct<0?Bt(ct)+12:Bt(ct)-5,h(ct,t,!0),'text-anchor="middle" fill="'+e.fg+'" font-family="'+vt+'" font-size="'+(c?9:10)+'" font-weight="600"'))}}),i[St]!=null&&St%Me===0){var ze=Se+re/2,Ee=Ve+we+Ge+(te?12:15);W+=te?S(ze,Ee,Be(i[St]),$(e,10,'text-anchor="end" transform="rotate(-'+We+" "+a(ze)+" "+a(Ee)+')"')):S(ze,Ee,i[St],$(e,10,'text-anchor="middle"'))}W+=yt(u+St*ee,xt,ee,et-(xt-G),q(St))}return v(t.goal)&&(W+=Pt(t,e,u,u+N,Bt(+t.goal))),W;function er(H,rt){var ct="",Lt=0,Gt=0;if(r.forEach(function(Qt,ae){var Vt=H<Qt.length?Qt[H]:0;if(Vt){var Jt=Vt>0?Lt:Gt,Ht=Jt+Vt;Vt>0?Lt=Ht:Gt=Ht;var It=Bt(Math.max(Jt,Ht)),Le=Bt(Math.min(Jt,Ht)),ne=Le-It,$e=Jt!==0?Math.min(1.5,ne/2):0;Vt>0?Le-=$e:It+=$e,ne=Le-It,ne>.5&&(ct+='<rect x="'+a(rt)+'" y="'+a(It)+'" width="'+a(Ut)+'" height="'+a(ne)+'" rx="'+a(Math.min(3,Ut/2,ne/2))+'" fill="'+M(ae,H)+'"'+lt(t,Vt<0?"bzc-gn":"bzc-g",H*.05+ae*.03)+"/>")}}),j(t.showValues)){var Rt=B[H];ct+=S(rt+Ut/2,Rt<0?Bt(b[H])+12:Bt(F[H])-5,h(Rt,t,!0),'text-anchor="middle" fill="'+e.fg+'" font-family="'+vt+'" font-size="10" font-weight="600"')}return ct}},{stat:zt(f,t,""),summary:o?g?s+" series stacked across "+o+" groups":c?s+" series across "+o+" groups":"highest "+(i[R]||"")+" "+h(f[R],t):"no data"})}de.table=function(t){return me(t,At(t.values).length>1&&j(t.stacked))};pt("bars",de);dt("bars");function vr(t,e){var r=Math.min(t.length,e.length);if(r<2)return null;var l=0,i=0,n;for(n=0;n<r;n++)l+=t[n],i+=e[n];l/=r,i/=r;var s=0,o=0,c=0;for(n=0;n<r;n++)s+=(t[n]-l)*(t[n]-l),o+=(e[n]-i)*(e[n]-i),c+=(t[n]-l)*(e[n]-i);if(!s)return null;var x=c/s;return{slope:x,intercept:i-x*l,r:o?c/Math.sqrt(s*o):0}}function ge(t,e){for(var r=At(t.x),l=At(t.y),i=P(t.series),n=P(t.labels),s=ut(t,e),o=[],c=0;c<Math.max(r.length,l.length);c++){var x=r[c]||[],g=l[c]||[],d=Math.min(x.length,g.length);o.push({xs:x.slice(0,d),ys:g.slice(0,d)})}o=o.filter(function(O){return O.xs.length});var f=o.reduce(function(O,k){return O+k.xs.length},0),C=I(t.height,210),z=o.length>1||i.length>0,B=j(t.trend),F=function(O){return i[O]||"Group "+(O+1)},b={decimals:t.decimals,compact:t.compact,lang:t.lang},L=Kt(t,n),m=_t(t.markers,he,"circle"),A=t.background||e.tile,E=function(O){var k=m?m(O):"circle";return k==="none"?"circle":k},y=m&&function(O,k,p){return jt(E(O),k+4,p+6,4,' fill="'+s[O%s.length]+'"')};return mt(t,e,C,function(O,k,p,D){if(!f)return ht(e,O,k,p,D);var M="",w=k;if(z){var T=Xt(o.map(function(V,Z){return F(Z)}),s,e,O,w,p,y);M+=T.svg,w+=T.height}var U=[].concat.apply([],o.map(function(V){return V.xs})),q=[].concat.apply([],o.map(function(V){return V.ys})),tt=Math.min.apply(null,q),Q=Math.max.apply(null,q);v(t.goal)&&(tt=Math.min(tt,+t.goal),Q=Math.max(Q,+t.goal)),j(t.zero)&&(tt=Math.min(0,tt),Q=Math.max(0,Q));var ot=ie(tt,Q,4),Y=ie(Math.min.apply(null,U),Math.max.apply(null,U),5),J=ot.ticks.map(function(V){return h(V,t,!0)}),Ft=Ye(J)+(v(t.yLabel)?14:0),st=20+(v(t.xLabel)?16:0),gt=O+Ft,R=p-Ft,u=D-(w-k)-st,G=function(V){return gt+6+(V-Y.lo)/(Y.hi-Y.lo)*(R-12)},N=function(V){return w+6+u-6-(V-ot.lo)/(ot.hi-ot.lo)*(u-6)};ot.ticks.forEach(function(V,Z){var X=N(V);M+='<line x1="'+a(gt)+'" x2="'+a(gt+R)+'" y1="'+a(X)+'" y2="'+a(X)+'" stroke="'+e.grid+'" stroke-dasharray="2 4"/>'+S(gt-8,X+3.5,J[Z],$(e,10,'text-anchor="end"'))});var et=Math.max(1,Math.ceil(Y.ticks.length*44/R));if(Y.ticks.forEach(function(V,Z){if(!(Z%et)){var X=G(V);M+='<line x1="'+a(X)+'" x2="'+a(X)+'" y1="'+a(w)+'" y2="'+a(w+u)+'" stroke="'+e.grid+'" stroke-dasharray="2 4"/>'+S(X,w+u+15,h(V,b,!0),$(e,10,'text-anchor="middle"'))}}),v(t.xLabel)&&(M+=S(gt+R/2,w+u+32,t.xLabel,$(e,10,'text-anchor="middle" font-weight="600"'))),v(t.yLabel)){var W=w+u/2;M+='<text x="'+a(O+4)+'" y="'+a(W)+'" transform="rotate(-90 '+a(O+4)+" "+a(W)+')" text-anchor="middle" '+$(e,10,'font-weight="600"')+' dominant-baseline="hanging">'+String(t.yLabel).replace(/[&<>"]/g,function(V){return{"&":"&","<":"<",">":">",'"':"""}[V]})+"</text>"}v(t.goal)&&(M+=Pt(t,e,gt,gt+R,N(+t.goal))),B&&o.forEach(function(V,Z){var X=vr(V.xs,V.ys);if(X){var ft=Math.min.apply(null,V.xs),Ot=Math.max.apply(null,V.xs),$t=X.slope*ft+X.intercept,it=X.slope*Ot+X.intercept,Nt=s[Z%s.length];M+='<line x1="'+a(G(ft))+'" y1="'+a(_(N($t),w,w+u))+'" x2="'+a(G(Ot))+'" y2="'+a(_(N(it),w,w+u))+'" stroke="'+Nt+'" stroke-width="2" stroke-dasharray="6 4" stroke-linecap="round" stroke-opacity=".9"/>',M+=S(Math.min(G(Ot),gt+R)-2,_(N(it),w+10,w+u)-7,"r = "+X.r.toFixed(2),$(e,10,'text-anchor="end" font-weight="600"',Nt))}});var xt=0,wt=f>150?3:4.5;o.forEach(function(V,Z){var X=s[Z%s.length];V.xs.forEach(function(ft,Ot){var $t=G(ft),it=N(V.ys[Ot]),Nt=(n[xt]?n[xt]+`
|
|
6
|
+
`:z?F(Z)+`
|
|
7
|
+
`:"")+(v(t.xLabel)?t.xLabel:"x")+": "+h(ft,b)+`
|
|
8
|
+
`+(v(t.yLabel)?t.yLabel:"y")+": "+h(V.ys[Ot],t);M+=jt(E(Z),$t,it,wt,' fill="'+X+'" fill-opacity=".85" stroke="'+A+'" stroke-width="1.5"'+(t.animate?' class="bzc-a" style="animation-delay:'+a(Math.min(.8,xt*.012))+'s"':"")),M+=yt($t-8,it-8,16,16,Nt),xt++})});var Et=[];return o.forEach(function(V){V.xs.forEach(function(Z,X){Et.push([G(Z),N(V.ys[X])])})}),L.forEach(function(V){var Z=Et[V.i];Z&&(M+='<circle cx="'+a(Z[0])+'" cy="'+a(Z[1])+'" r="'+(wt+4)+'" fill="none" stroke="'+e.fg+'" stroke-width="1.5"/>'+S(_(Z[0],gt+30,gt+R-30),Z[1]-wt-9,V.text,$(e,10,'text-anchor="middle"',e.fg)))}),M},{summary:f+" points"+(z?" in "+o.length+" groups":"")})}ge.table=function(t){var e=At(t.x),r=At(t.y),l=P(t.series),i=P(t.labels),n=e.length>1||l.length>0,s={decimals:t.decimals,compact:t.compact,lang:t.lang},o=[],c=0;return e.forEach(function(x,g){for(var d=r[g]||[],f=0;f<Math.min(x.length,d.length);f++,c++)o.push([i[c]||"#"+(c+1)].concat(n?[l[g]||"Group "+(g+1)]:[],[h(x[f],s),h(d[f],t)]))}),{head:["Point"].concat(n?["Group"]:[],[v(t.xLabel)?t.xLabel:"x",v(t.yLabel)?t.yLabel:"y"]),rows:o}};pt("scatter",ge);dt("scatter");function ve(t,e){var r=K(t.values),l=P(t.labels),i=ut(t,e),n=I(t.max,100)||100,s=I(t.height,140),o=!v(t.prefix)&&!v(t.suffix)&&n===100,c=function(g){return h(g,t)+(o?"%":"")},x=zt(r,t,"");return mt(t,e,s,function(g,d,f,C){if(!r.length)return ht(e,g,d,f,C);var z="",B=r.length===1,F=Math.min(C,B?f:f*.55),b=B?g+f/2:g+F/2,L=d+C/2,m=B?F*.12:_(F*.42/(r.length*1.35),5,16),A=m*.38;if(r.forEach(function(k,p){var D=F/2-m/2-p*(m+A);if(!(D<=m/2)){var M=_(k/n*100,0,100),w=i[p%i.length];z+='<circle cx="'+a(b)+'" cy="'+a(L)+'" r="'+a(D)+'" fill="none" stroke="'+w+'" stroke-opacity=".16" stroke-width="'+a(m)+'"/>',M>0&&(z+='<circle cx="'+a(b)+'" cy="'+a(L)+'" r="'+a(D)+'" fill="none" stroke="'+w+'" stroke-width="'+a(m)+'" stroke-linecap="round" pathLength="100" transform="rotate(-90 '+a(b)+" "+a(L)+')" style="stroke-dasharray:'+a(M)+" 100"+(t.animate?";animation-delay:"+p*.12+"s":"")+'"'+(t.animate?' class="bzc-s"':"")+"/>"),z+='<circle cx="'+a(b)+'" cy="'+a(L)+'" r="'+a(D+m/2)+'" fill="#000" fill-opacity="0" class="bzc-hit" data-tip="'+nt((l[p]||"#"+(p+1))+": "+c(k)+(o?"":" of "+h(n,t)))+'"/>'}}),B)z+=S(b,L+F*.08,c(r[0]),'text-anchor="middle" fill="'+e.fg+'" font-family="'+at+'" font-size="'+a(F*.22)+'" font-weight="800"'),l[0]&&(z+=S(b,L+F*.08+16,l[0],$(e,10,'text-anchor="middle"')));else{var E=g+F+22,y=Math.min(26,C/r.length),O=L-y*r.length/2;r.forEach(function(k,p){var D=O+p*y+y/2;z+='<circle cx="'+a(E+4)+'" cy="'+a(D)+'" r="4" fill="'+i[p%i.length]+'"/>'+S(E+14,D+4,qt(l[p]||"#"+(p+1),Math.floor((g+f-E-60)/6.7)),'fill="'+e.fg+'" font-family="'+at+'" font-size="12"')+S(g+f,D+4,c(k),'text-anchor="end" fill="'+e.fg+'" font-family="'+vt+'" font-size="11" font-weight="600"')})}return z},{stat:x,summary:r.map(function(g,d){return(l[d]?l[d]+" ":"")+c(g)}).join(", ")})}ve.table=function(t){var e=P(t.labels),r=I(t.max,100)||100,l=!v(t.prefix)&&!v(t.suffix)&&r===100;return{head:["Label","Value"],rows:K(t.values).map(function(i,n){return[e[n]||"#"+(n+1),h(i,t)+(l?"%":" of "+h(r,t))]})}};pt("ring",ve);dt("ring");function xe(t,e){var r=K(t.values).map(function(f){return Math.max(0,f)}),l=P(t.labels),i=ut(t,e),n=r.slice(),s=l.slice();if(n.length>6){var o=n.map(function(f,C){return C}).sort(function(f,C){return r[C]-r[f]}),c=o.slice(0,5).sort(function(f,C){return f-C});n=c.map(function(f){return r[f]}),s=c.map(function(f){return l[f]||"#"+(f+1)}),n.push(Tt(o.slice(5).map(function(f){return r[f]}))),s.push("Other")}var x=Tt(n),g=I(t.height,150),d=zt(n,t,"");return mt(t,e,g,function(f,C,z,B){if(!x)return ht(e,f,C,z,B);var F="",b=Math.min(B,z*.5),L=f+b/2,m=C+B/2,A=b*.16,E=(b-A)/2,y=0,O=n.filter(Boolean).length>1?.9:0;n.forEach(function(M,w){var T=M/x*100;if(!(T<=0)){var U=Math.max(.01,T-O);F+='<circle cx="'+a(L)+'" cy="'+a(m)+'" r="'+a(E)+'" fill="none" stroke="'+i[w%i.length]+'" stroke-width="'+a(A)+'" pathLength="100" stroke-dasharray="'+a(U)+" "+a(100-U)+'" stroke-dashoffset="'+a(-y)+'" transform="rotate(-90 '+a(L)+" "+a(m)+')"'+lt(t,"bzc-a",w*.08)+"/>",y+=T}}),F+=S(L,m+2,h(x,t,!0),'text-anchor="middle" fill="'+e.fg+'" font-family="'+at+'" font-size="'+a(b*.17)+'" font-weight="800"'),F+=S(L,m+2+14,(v(t.centerLabel)?t.centerLabel:"Total").toUpperCase(),$(e,9,'text-anchor="middle" letter-spacing="1"'));var k=f+b+22,p=Math.min(24,B/n.length),D=m-p*n.length/2;return n.forEach(function(M,w){var T=D+w*p+p/2,U=Math.round(M/x*100),q=(s[w]||"#"+(w+1))+": "+h(M,t)+" ("+U+"%)";F+='<circle cx="'+a(k+4)+'" cy="'+a(T)+'" r="4" fill="'+i[w%i.length]+'"/>'+S(k+14,T+4,qt(s[w]||"#"+(w+1),Math.floor((f+z-k-50)/6.7)),'fill="'+e.fg+'" font-family="'+at+'" font-size="12"')+S(f+z,T+4,U+"%",'text-anchor="end" fill="'+e.muted+'" font-family="'+vt+'" font-size="11" font-weight="600"')+yt(k,T-p/2,f+z-k,p,q)}),y=0,n.forEach(function(M,w){var T=M/x*100;T<=0||(F+='<circle cx="'+a(L)+'" cy="'+a(m)+'" r="'+a(E)+'" fill="none" stroke="#000" stroke-opacity="0" stroke-width="'+a(A)+'" pathLength="100" stroke-dasharray="'+a(T)+" "+a(100-T)+'" stroke-dashoffset="'+a(-y)+'" transform="rotate(-90 '+a(L)+" "+a(m)+')" class="bzc-hit" data-skip="" data-tip="'+nt((s[w]||"#"+(w+1))+": "+h(M,t)+" ("+Math.round(T)+"%)")+'"/>',y+=T)}),F},{stat:d,summary:"total "+h(x,t)+" across "+n.length+" parts"})}xe.table=function(t){var e=K(t.values).map(function(i){return Math.max(0,i)}),r=P(t.labels),l=Tt(e);return{head:["Label","Value","Share"],rows:e.map(function(i,n){return[r[n]||"#"+(n+1),h(i,t),(l?Math.round(i/l*100):0)+"%"]})}};pt("donut",xe);dt("donut");function be(t,e){var r=K(t.values),l=r.length?r[0]:I(t.value,NaN),i=P(t.labels),n=I(t.min,0),s=I(t.max,100),o=I(t.height,130);s===n&&(s=n+1);var c=K(t.zones),x=ut(t,e),g=P(t.color).filter(Boolean).length>1?x:[e.up,e.palette[3],e.down],d=x[0];if(c.length&&isFinite(l)){for(var f=0;f<c.length&&l>=c[f];)f++;d=g[Math.min(f,g.length-1)]}var C=!v(t.prefix)&&!v(t.suffix)&&n===0&&s===100,z=function(B){return h(B,t)+(C?"%":"")};return mt(t,e,o,function(B,F,b,L){if(!isFinite(l))return ht(e,B,F,b,L);var m=Math.min(b/2,L-22),A=m*.16,E=m-A/2,y=B+b/2,O=F+m,k=_((l-n)/(s-n),0,1),p=function(tt,Q){var ot=Math.PI*(1-tt);return[y+Q*Math.cos(ot),O-Q*Math.sin(ot)]},D="M"+a(y-E)+","+a(O)+"A"+a(E)+","+a(E)+" 0 0 1 "+a(y+E)+","+a(O),M='<path d="'+D+'" fill="none" stroke="'+d+'" stroke-opacity=".16" stroke-width="'+a(A)+'" stroke-linecap="round"/>';c.length&&c.forEach(function(tt){var Q=_((tt-n)/(s-n),0,1),ot=p(Q,E-A/2-3),Y=p(Q,E-A/2-8);M+='<line x1="'+a(ot[0])+'" y1="'+a(ot[1])+'" x2="'+a(Y[0])+'" y2="'+a(Y[1])+'" stroke="'+e.muted+'" stroke-width="1.5"/>'}),k>0&&(M+='<path d="'+D+'" fill="none" stroke="'+d+'" stroke-width="'+a(A)+'" stroke-linecap="round" pathLength="100" style="stroke-dasharray:'+a(k*100)+' 100"'+lt(t,"bzc-s")+"/>");var w=p(k,E);if(M+='<circle cx="'+a(w[0])+'" cy="'+a(w[1])+'" r="'+a(A*.26)+'" fill="'+(t.background||e.tile)+'"'+lt(t,"bzc-a",.9)+"/>",v(t.goal)){var T=_((+t.goal-n)/(s-n),0,1),U=p(T,E+A/2+4),q=p(T,E-A/2-4);M+='<line x1="'+a(U[0])+'" y1="'+a(U[1])+'" x2="'+a(q[0])+'" y2="'+a(q[1])+'" stroke="'+e.fg+'" stroke-width="2" stroke-linecap="round"/>'}return M+=S(y,O-m*.12,z(l),'text-anchor="middle" fill="'+e.fg+'" font-family="'+at+'" font-size="'+a(m*.34)+'" font-weight="800"'),i[0]&&(M+=S(y,O-m*.12+16,i[0],$(e,10,'text-anchor="middle"'))),M+=S(y-E,O+18,h(n,t,!0),$(e,10,'text-anchor="middle"'))+S(y+E,O+18,h(s,t,!0),$(e,10,'text-anchor="middle"')),M+=yt(y-m,O-m,m*2,m,(i[0]?i[0]+": ":"")+z(l)+" (range "+h(n,t)+" to "+h(s,t)+")"+(v(t.goal)?`
|
|
9
|
+
Goal: `+h(+t.goal,t):"")),M},{summary:isFinite(l)?z(l)+" on a scale of "+h(n,t)+" to "+h(s,t):"no data"})}be.table=function(t){var e=K(t.values),r=e.length?e[0]:I(t.value,NaN),l=P(t.labels),i=I(t.min,0),n=I(t.max,100),s=!v(t.prefix)&&!v(t.suffix)&&i===0&&n===100;return isFinite(r)?{head:["Label","Value"],rows:[[l[0]||"Reading",h(r,t)+(s?"%":"")],["Lowest",h(i,t)],["Highest",h(n,t)]].concat(v(t.goal)?[["Goal",h(+t.goal,t)]]:[])}:{head:["Label","Value"],rows:[]}};pt("gauge",be);dt("gauge");function ye(t,e){var r=K(t.values).map(function(b){return Math.max(0,b)}),l=P(t.labels),i=ut(t,e),n=r.length===1,s=Tt(r),o=v(t.max)?I(t.max,100):n?100:s;o>0||(o=1);var c=!v(t.prefix)&&!v(t.suffix)&&o===100&&n,x=function(b){return h(b,t)+(c?"%":"")},g=Yt(t),d=g.w,f=0,C=[];if(!n&&r.length){var z=0;f=1,r.forEach(function(b,L){var m=l[L]||"#"+(L+1),A=14+bt(m,12)+6+bt(h(b,t),11,!0)+18;z>0&&z+A>d&&(z=0,f++),C.push({x:z,row:f-1,l:m}),z+=A})}var B=36+(f?12+f*20:0),F=zt(r,t,"");return mt(t,e,B,function(b,L,m,A){if(!r.length)return ht(e,b,L,m,A);var E="",y=L+22,O=Dt("c"),k=n?x(r[0])+(c?"":" of "+h(o,t)):h(s,t)+" of "+h(o,t);n&&l[0]&&(E+=S(b,L+11,l[0],'fill="'+e.fg+'" font-family="'+at+'" font-size="12"')),E+=S(b+m,L+11,k,'text-anchor="end" fill="'+e.fg+'" font-family="'+vt+'" font-size="11" font-weight="600"'),E+='<rect x="'+b+'" y="'+y+'" width="'+m+'" height="14" rx="7" fill="'+e.grid+'" fill-opacity=".7"/>',E+='<clipPath id="'+O+'"><rect x="'+b+'" y="'+y+'" width="'+m+'" height="14" rx="7"/></clipPath><g clip-path="url(#'+O+')"><g'+lt(t,"bzc-gx")+">";var p=0;if(r.forEach(function(M,w){var T=Math.min(M,Math.max(0,o-p))/o*m;T>0&&(E+='<rect x="'+a(b+p/o*m)+'" y="'+y+'" width="'+a(T)+'" height="14" fill="'+i[w%i.length]+'"/>'),w>0&&T>0&&(E+='<rect x="'+a(b+p/o*m-1)+'" y="'+y+'" width="2" height="14" fill="'+(t.background||e.tile)+'"/>'),p+=M}),E+="</g></g>",v(t.goal)){var D=b+_(+t.goal/o,0,1)*m;E+='<line x1="'+a(D)+'" x2="'+a(D)+'" y1="'+(y-4)+'" y2="'+(y+18)+'" stroke="'+e.fg+'" stroke-width="2" stroke-linecap="round"/>'}return p=0,r.forEach(function(M,w){var T=Math.min(M,Math.max(0,o-p))/o*m;T>0&&(E+=yt(b+p/o*m,y-4,T,22,(l[w]||(n?"Progress":"#"+(w+1)))+": "+x(M)+(n?"":" ("+Math.round(M/o*100)+"%)"))),p+=M}),C.forEach(function(M,w){var T=b+M.x,U=y+14+12+M.row*20+8;E+='<circle cx="'+a(T+4)+'" cy="'+a(U)+'" r="4" fill="'+i[w%i.length]+'"/><text x="'+a(T+14)+'" y="'+a(U+4)+'" fill="'+e.fg+'" font-family="'+at+'" font-size="12">'+nt(M.l)+'<tspan dx="6" fill="'+e.muted+'" font-family="'+vt+'" font-size="11">'+nt(h(r[w],t))+"</tspan></text>"}),E},{stat:F,summary:n?x(r[0])+(c?"":" of "+h(o,t)):h(s,t)+" of "+h(o,t)})}ye.table=function(t){var e=K(t.values).map(function(s){return Math.max(0,s)}),r=P(t.labels),l=e.length===1,i=v(t.max)?I(t.max,100):l?100:Tt(e);i>0||(i=1);var n=!v(t.prefix)&&!v(t.suffix)&&i===100&&l;return l?{head:["Label","Value"],rows:[[r[0]||"Progress",h(e[0],t)+(n?"%":" of "+h(i,t))]]}:{head:["Label","Value","Share"],rows:e.map(function(s,o){return[r[o]||"#"+(o+1),h(s,t),Math.round(s/i*100)+"%"]})}};pt("progress",ye);dt("progress");var _e={weekday:"short",day:"numeric",month:"short",year:"numeric"};function Ze(t,e){if(v(t.start)&&/^\d{4}-\d{2}-\d{2}$/.test(String(t.start)))return new Date(String(t.start)+"T00:00:00Z");var r=new Date;return new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate())-Math.max(0,e-1)*864e5)}function Qe(t,e){try{return new Intl.DateTimeFormat(t,Object.assign({timeZone:"UTC"},e))}catch{return new Intl.DateTimeFormat("en-GB",Object.assign({timeZone:"UTC"},e))}}function ke(t,e){var r=K(t.values),l=ut(t,e)[0],i=t.lang||"en-GB",n=Ze(t,r.length),s=(n.getUTCDay()+6)%7,o=Math.max(1,Math.ceil((s+r.length)/7)),c=Yt(t),x=28,g=Math.max(1,Math.floor((c.w-x)/10));if(o>g){var d=(o-g)*7-s;r=r.slice(d),n=new Date(n.getTime()+d*864e5),s=0,o=g}var f=Math.min(18,(c.w-x)/o),C=f<8?1:3,z=f-C,B=16+7*f+26,F=r.length?Math.max.apply(null,r):0,b=function(y){return Qe(i,y)},L=b({month:"short"}),m=b({weekday:"short"}),A=b(_e),E=zt(r,t,"");return mt(t,e,B,function(y,O,k,p){if(!r.length)return ht(e,y,O,k,p);var D="",M=y+x,w=O+16,T=-99,U=[.28,.5,.75,1];f>=9&&[0,2,4].forEach(function(W){var xt=new Date(Date.UTC(2024,0,1+W));D+=S(y,w+W*f+z/2+3.5,m.format(xt),$(e,9))});for(var q=0;q<r.length;q++){var tt=s+q,Q=Math.floor(tt/7),ot=tt%7,Y=new Date(n.getTime()+q*864e5),J=M+Q*f,Ft=w+ot*f;(Y.getUTCDate()===1||q===0)&&J-T>30&&(D+=S(J,O+9,L.format(Y),$(e,9)),T=J);var st=r[q]<=0||!F?0:Math.ceil(r[q]/F*4),gt=st?l:e.grid,R=st?U[st-1]:.7;D+='<rect x="'+a(J)+'" y="'+a(Ft)+'" width="'+a(z)+'" height="'+a(z)+'" rx="'+a(z*.24)+'" fill="'+gt+'" fill-opacity="'+R+'"'+(t.animate?' class="bzc-a" style="animation-delay:'+a(Q*.012)+'s"':"")+' data-tip="'+nt(A.format(Y)+": "+h(r[q],t))+'"/>'}var u=w+7*f+14,G=10,N=y+k-5*(G+3)-30;D+=S(y,u+8,h(Tt(r),t,!0)+" in "+r.length+" days",$(e,10)),D+=S(N-6,u+8,"Less",$(e,9,'text-anchor="end"'));for(var et=0;et<5;et++)D+='<rect x="'+a(N+et*(G+3))+'" y="'+u+'" width="'+G+'" height="'+G+'" rx="2.5" fill="'+(et?l:e.grid)+'" fill-opacity="'+(et?U[et-1]:.7)+'"/>';return D+=S(N+5*(G+3)+3,u+8,"More",$(e,9)),D},{stat:E,summary:h(Tt(r),t)+" across "+r.length+" days"})}ke.table=function(t){var e=K(t.values),r=Ze(t,e.length),l=Qe(t.lang||"en-GB",_e);return{head:["Date","Value"],rows:e.map(function(i,n){return[l.format(new Date(r.getTime()+n*864e5)),h(i,t)]})}};pt("heatmap",ke);dt("heatmap");var xr="1.3.0",br=fe.slice();return or(yr);})();
|