## Summary Step 3 of the analytics plan: three more views on the **Analyse** page, plus a **fix for a bug in `main`** where changing the year filter stopped the page from updating. ### Fix: year filter navigation loop Choosing a year in "Von" or "Bis" started an endless navigation loop: one click caused about 2,700 navigations in 3 seconds. The page never updated, and because the browser then throttled navigation, the Monat / Quartal / Jahr buttons stopped working too. **Cause:** `FluentSelect` reports its selected value again on every re-render. The handler compared it with the year on the page, which only changes once a navigation has finished, so every re-render started another navigation to the same URL and cancelled the previous one. **Fix:** `OnFromChanged` / `OnToChanged` take over the chosen year immediately, so a repeated report of the same value does nothing. The bug came in with #4. ### New views - **Zusammensetzung (treemap):** the children of the current level as areas, with their own children nested inside (e.g. subclass → accounts, account → booking texts). The colours are the same as in the bar chart and list. Clicking an area drills into it; clicking a nested tile goes straight to that deeper level. Refunds (negative amounts) are left out, since an area can't be negative. - **Jahresvergleich:** one line per year over Jan–Dez, switchable between *Monatlich* and *Kumuliert* (default). The latest year is a thick blue line, the year before orange, and older years fading grey. The running year stops at the last month with data. - **Jahre im Vergleich:** categories × years, with a total column and a total row. - Cells are shaded by **monthly average**, so the running year compares fairly. - Each cell shows the change versus the previous year over the **same months**: the running year is marked `2026*` with a footnote. - Rows drill down when clicked, and zero cells show "–". - This one view replaces both the heatmap and the table from the plan, which would have shown the same numbers twice. ### Other changes - **Chart.js has no sunburst**, so the composition view is a treemap. It uses `chartjs-chart-treemap` **4.2.2** (MIT, by a Chart.js maintainer), vendored in `wwwroot/lib/chartjs-chart-treemap` with its licence and checked against the npm registry checksum. It is loaded only when the treemap is first used. - **`ExpenseAnalysis`** also returns the year profiles, the category × year table and the two-level composition. - **`StackedBarChart` became a generic `ChartJsChart`**: `Kind` = stackedBar / line / treemap, and new `Data` updates the chart in place. `charts.js` has one `createChart` entry point. - **Click hints only appear when something can be drilled into.** At the account level they were shown before even though booking texts can't be opened (already the case in #4). The treemap only shows a hand cursor over clickable tiles. ## Test plan - [x] `dotnet build`: no warnings - [x] `dotnet test`: 81/81 pass, including 6 new `ExpenseAnalysisTestShould` tests (year profiles with empty future months, category × year values and same-months change, no previous year, nested composition, single-level composition for an account, negative amounts left out) - [x] On a copy of the real data in headless Chrome: all three new charts render without console errors; table year totals match the verified per-year totals (2022: 190'724 … 2026: 77'006); the treemap for 2022 adds up to that year's total - [x] Interactions: treemap area and nested-tile clicks, table row links, Monatlich/Kumuliert switch - [x] Year filter fix: Von 2025 → Jahr → Bis 2025 → Quartal → Alle Jahre → back make exactly one navigation each, and charts, tiles and table update every time - [ ] Narrow-screen layout checked by hand 🤖 Generated with [Claude Code](https://claude.com/claude-code) Reviewed-on: #5 Co-authored-by: Claudio Schaad <c.schaad@pog.ch> Co-committed-by: Claudio Schaad <c.schaad@pog.ch>
8 lines
16 KiB
JavaScript
8 lines
16 KiB
JavaScript
/*!
|
|
* chartjs-chart-treemap v0.0.0-development
|
|
* https://chartjs-chart-treemap.pages.dev/
|
|
* (c) 2026 Jukka Kurkela
|
|
* Released under the MIT license
|
|
*/
|
|
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("chart.js"),require("chart.js/helpers")):"function"==typeof define&&define.amd?define(["exports","chart.js","chart.js/helpers"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["chartjs-chart-treemap"]={},t.Chart,t.Chart.helpers)}(this,function(t,e,n){"use strict";function i(t,e,n,i){const r=2*i,o=e.getPixelForValue(t.x),s=n.getPixelForValue(t.y),a=e.getPixelForValue(t.x+t.w)-o,h=n.getPixelForValue(t.y+t.h)-s;return{height:h-r,hidden:r>a||r>h,width:a-r,x:o+i,y:s+i}}function r(t,e){let n,i;if(!t||!e)return!0;if(t===e)return!1;if(t.length!==e.length)return!0;for(n=0,i=t.length;n<i;++n)if(t[n]!==e[n])return!0;return!1}function o(t,e,n){return Math.max(Math.min(t,n),e)}function s(t,e,i){const r=n.toTRBL(t);return{b:o(r.bottom,0,i),l:o(r.left,0,e),r:o(r.right,0,e),t:o(r.top,0,i)}}function a(t,e,n,i){const r=t._normalized,o=e*r/n,s=Math.sqrt(r*o),a=r/s;return{d1:s,d2:a,h:"_ix"===i?a:s,w:"_ix"===i?s:a}}const h=(t,e)=>t.rtl?t.x+t.iw-e:t.x+t._ix;function l(t,e,n,i){const r={_data:e._data,a:e._normalized,h:n.h,s:i,v:e.value,vs:e.values,w:n.w,x:h(t,n.w),y:t.y+t._iy};return e.group&&(r.g=e.group,r.l=e.level,r.gs=e.groupSum),r}class u{get area(){return this.w*this.h}get iw(){return this.w-this._ix}get ih(){return this.h-this._iy}get dir(){const t=this.ih;return t<=this.iw&&t>0?"y":"x"}get side(){return"x"===this.dir?this.iw:this.ih}map(t){const{dir:e,side:n}=this,i="x"===e?"_ix":"_iy",r=t.nsum,o=t.get(),s=n*n,h=r*r,u=[];let c=0,d=0;for(const e of o){const n=a(e,s,h,i);d+=n.d1,c=Math.max(c,n.d2),u.push(l(this,e,n,t.sum)),this[i]+=n.d1}return this["x"===e?"_iy":"_ix"]+=c,this[i]-=d,u}constructor(t){t=t||{h:1,w:1},this.rtl=!!t.rtl,this.unsorted=!!t.unsorted,this.x=t.x||t.left||0,this.y=t.y||t.top||0,this._ix=0,this._iy=0,this.w=t.w||t.width||t.right-t.left,this.h=t.h||t.height||t.bottom-t.top}}const c=Math.min,d=Math.max;function f(t,e){const n=+e[t.key],i=n*t.ratio;return e._normalized=i,{max:d(t.max,n),min:c(t.min,n),nmax:d(t.nmax,i),nmin:c(t.nmin,i),nsum:t.nsum+i,sum:t.sum+n}}function p(t,e,n){t._arr.push(e),function(t,e){Object.assign(t,e)}(t,n)}class g{get length(){return this._arr.length}reset(){this._arr=[],this._hist=[],this.sum=0,this.nsum=0,this.min=1/0,this.max=-1/0,this.nmin=1/0,this.nmax=-1/0}push(t){p(this,t,f(this,t))}pushIf(t,e,...n){const i=f(this,t);if(!e((r=this,{max:r.max,min:r.min,nmax:r.nmax,nmin:r.nmin,nsum:r.nsum,sum:r.sum}),i,n))return t;var r;p(this,t,i)}get(){return this._arr}constructor(t,e){this._arr=[],this._hist=[],this.sum=0,this.nsum=0,this.min=1/0,this.max=-1/0,this.nmin=1/0,this.nmax=-1/0,this.key=t,this.ratio=e,this.reset()}}const m=(t,e)=>e>t||t.length>e.length&&t.startsWith(e),x=t=>String(t),y=t=>null!=t&&""!==t;function b(t,e,i,r=[],o=0,s=[]){const a=o-1;if(t[0]in i&&o>0){const n=r.reduce((t,e,n)=>(n!==a&&(t[x(n)]=e),t),{});n[e]=r[a],t.forEach(t=>{n[t]=i[t]}),s.push(n)}else for(const a of Object.keys(i)){const h=i[a];n.isObject(h)&&(r.push(a),b(t,e,h,r,o+1,s))}return r.splice(a,1),s}function v(t,e,n){const i=b(t,e,n);if(!i.length)return i;const r=i.reduce((t,e)=>{const n=Object.keys(e).length-2;return Math.max(t,n)},0);return i.forEach(t=>{for(let e=0;e<r;e++){const n=x(e);t[n]||(t[n]="")}}),i}function w(t){const e=[...t],n=[];for(;e.length;){const t=e.pop();Array.isArray(t)?e.push(...t):n.push(t)}return n.reverse()}function _(t,e,n){const i=[];for(const n of t){const t=e[n];y(t)&&i.push(t)}return i.length?i.join("."):n}function M(t,e,n,i){for(let e=i;e<n.length;e++){const i=x(n[e]);if(y(t[i]))return{group:i,groupIndex:e,value:t[i]}}if(y(t[e]))return{group:e,groupIndex:i,value:t[e]}}function C(t,e,n,i){if(n in t)return;t[n]={value:0};const r=t[n];i.forEach(t=>{r[t]=0}),e[n]=[]}function k(t,e,n,i,r,o,s=[],a=s,h=s.length-1){const l=n[0],u=n.slice(1),c=Object.create(null),d=Object.create(null),f=[],p=a.length?a:[e],g=a.length?h:0;let m,x;for(m=0,x=t.length;m<x;++m){const e=t[m];if(r&&e[r]!==o)continue;const n=M(e,i,p,g);if(!n)return[];const s=n.value;C(c,d,s,u),c[s].value+=+e[l],c[s].label=s,c[s].group=n.group,c[s].groupIndex=n.groupIndex;const a=c[s];u.forEach(t=>{a[t]+=e[t]}),c[s].path=_(p.slice(0,n.groupIndex+1),e,s),d[s].push(e)}return Object.keys(c).forEach(t=>{const n={children:d[t]};n[l]=+c[t].value,u.forEach(e=>{n[e]=+c[t][e]}),n[e]=c[t].label,n.group=c[t].group,n.groupIndex=c[t].groupIndex,n.label=t,n.path=c[t].path,r&&(n[r]=o),f.push(n)}),f}function T(t,e){let i,r=t.length;if(!r)return e;const o=n.isObject(t[0]);for(e=o?e:"v",i=0,r=t.length;i<r;++i)o?t[i]._idx=i:t[i]={_idx:i,v:t[i]};return e}function O(t,e){e?t.sort((t,n)=>+n[e]-+t[e]):t.sort((t,e)=>+e-+t)}function R(t,e){let n,i,r;for(n=0,i=0,r=t.length;i<r;++i)n+=e?+t[i][e]:+t[i];return n}function j(t,e,n,i=!0){const r=n.split(".");let o=0;for(const s of e.split(".")){const a=r[o++];if(Number.parseInt(s,10)<Number.parseInt(a,10))break;if(m(a,s)){if(i)throw new Error(`${t} v${n} is not supported. v${e} or newer is required.`);return!1}}return!0}function E(t,e,n){if(0===t.sum)return!0;const[i]=n,r=t.nsum*t.nsum,o=e.nsum*e.nsum,s=i*i,a=Math.max(s*t.nmax/r,r/(s*t.nmin));return Math.max(s*e.nmax/o,o/(s*e.nmin))<=a}function L(t,e,n=[],i,r,o){t=t||[];const s=[],a=new u(e),h=new g("value",a.area/R(t,n[0]));let l=a.side;const c=t.length;let d,f;if(!c)return s;const p=t.slice(),m=T(p,n[0]);e?.unsorted||O(p,m);const x=t=>m?+p[t][m]:+p[t],y=t=>i&&p[t][i];for(d=0;d<c;++d){if(f={_data:t[p[d]._idx],group:void 0,groupSum:o,level:void 0,value:x(d)},i){f.level=p[d].groupIndex??r,f.group=y(d);const t=p[d];f.values=n.reduce((e,n)=>(e[n]=+t[n],e),{})}f=h.pushIf(f,E,l),f&&(s.push(a.map(h)),l=a.side,h.reset(),h.push(f))}return h.length&&s.push(a.map(h)),w(s)}const P=new Map;function S(t,e,i){if(!i||!1===i.display)return!1;if("headerBoxes"===t)return!0;const{w:r,h:o}=e,s=n.toFont(i.font||{}).lineHeight,a=Math.max(Math.min(2*n.valueOrDefault(i.padding,3),Math.min(r,o)),0);return r-a>s&&o-a>s}function D(t,e,n,i){if("headerBoxes"!==t)return n.lineHeight+2*i;const r=n.lineHeight+2*i;return e.h<2*r?e.h/3:r}function I(t,e,i,r,o){const{captions:s,labels:a,displayMode:h}=i;t.save(),t.beginPath(),t.rect(e.x,e.y,e.w,e.h),t.clip();const l=r&&(!n.defined(r.l)||r.isLeaf);l&&a.display?function(t,e,i,r,o){const s=i.labels,a=B(s.formatter,A(o,r));if(!a)return;const h=n.isArray(a)?a:[a];let l=function(t,e){const{font:i,hoverFont:r}=e,o=(t.active?r:i)||i;return Array.isArray(o)?o.map(t=>n.toFont(t)):[n.toFont(o)]}(e,s),u=F(t,h,l);const c=function(t,e,n,i){const{overflow:r,padding:o}=n,{width:s,height:a}=i;if("hidden"===r)return!(s+2*o>e.w||a+2*o>e.h);if("fit"===r){const t=Math.min(e.w/(s+2*o),e.h/(a+2*o));if(t<1)return t}return!0}(0,e,s,u);if(!c)return;n.isNumber(c)&&(u={height:u.height*c,width:u.width*c},l=function(t,e){return t.map(t=>{const{lineHeight:i,...r}=t;return n.toFont({...r,size:Math.floor(t.size*e)})})}(l,c));const{color:d,hoverColor:f,align:p}=s,g=(e.active?f:d)||d,m=n.isArray(g)?g:[g],x=function(t,e,n){const{align:i,position:r,padding:o}=e,s=z(t,i,o);let a;a="top"===r?t.y+o:"bottom"===r?t.y+t.h-o-n.height:t.y+(t.h-n.height)/2+o;return{x:s,y:a}}(e,s,u);t.textAlign=p,t.textBaseline="middle";let y=0;h.forEach((e,n)=>{const i=m[Math.min(n,m.length-1)],r=l[Math.min(n,l.length-1)],o=r.lineHeight;t.font=r.string,t.fillStyle=i,t.fillText(e,x.x,x.y+o/2+y),y+=o})}(t,e,i,r,o):!l&&S(h,e,s)&&function(t,e,i,r,o){const{captions:s,spacing:a,rtl:h,displayMode:l}=i,{color:u,hoverColor:c,font:d,hoverFont:f,padding:p,align:g}=s,m=(e.active?c:u)||u,x=g||(h?"right":"left"),y=(e.active?f:d)||d,b=n.toFont(y),v=[b];if(b.lineHeight>e.h)return;let w=function(t,e,n){return B(t.formatter,A(e,n))||n.g||""}(s,o,r);if(!w)return;const _=F(t,[w],v);_.width+2*p>e.w&&(w=function(t,e,n,i){const r="...",o=F(t,[r],i).width;if(o>=n)return"";let s,a=1,h=e.length;for(;a<=h;){const r=Math.floor((a+h)/2);s=F(t,[e.slice(0,r)],i).width,s+o>n?h=r-1:a=r+1}const l=e.slice(0,Math.max(0,a-1));return l?l+r:""}(t,w,e.w-2*p,v));const M=b.lineHeight/2,C=z(e,x,p);t.fillStyle=m,t.font=b.string,t.textAlign=x,t.textBaseline="middle";const k="headerBoxes"===l?e.y+e.h/2:e.y+p+a+M;t.fillText(w,C,k)}(t,e,i,r,o),t.restore()}function A(t,e){const n=t.$context||{active:!!t.active,raw:e,type:"data"};return n.active=!!t.active,n.raw=e,n}function B(t,e){return"function"==typeof t?t(e):t}function F(t,e,n){const i=n.reduce((t,e)=>t+=e.string,""),r=e.join()+i+(t._measureText?"-spriting":"");let o=P.get(r);if(!o){t.save();const i=e.length;let s=0,a=0;for(let r=0;r<i;r++){const i=n[Math.min(r,n.length-1)];t.font=i.string;const o=e[r];s=Math.max(s,t.measureText(o).width),a+=i.lineHeight}t.restore(),o={height:a,width:s},P.set(r,o)}return o}function z(t,e,n){return"left"===e?t.x+n:"right"===e?t.x+t.w-n:t.x+t.w/2}function H(t,e,i,r){const o=e.treeLeafKey||"_leaf";n.isObject(t)&&(t=v(i,o,t));const a=e.groups||[],h=a.length,l="headerBoxes"===e.displayMode?0:n.valueOrDefault(e.spacing,0),u=e.captions||{},c=n.toFont(u.font),d=n.valueOrDefault(u.padding,3);const f=h?function t(n,r,f,p,g){const m=x(a[r]),y=k(n,m,i,o,void 0,p,a.filter((t,e)=>e<=r),a,r),b=L(y,f,i,m,r,g),v=b.slice();return r<h-1?b.forEach(n=>{const i=function(t,n){const i="headerBoxes"===e.displayMode?{b:0,l:0,r:0,t:0}:s(e.borderWidth,t.w/2,t.h/2),r={...n,h:t.h-2*l-i.t-i.b,w:t.w-2*l-i.l-i.r,x:t.x+l+i.l,y:t.y+l+i.t};if(S(e.displayMode,r,u)){const t=D(e.displayMode,r,c,d);r.y+=t,r.h-=t}return r}(n,f),r=[],o=n._data.groupIndex+1;o<h&&r.push(...t(n._data.children,o,i,n.g,n.s)),v.push(...r),n.isLeaf=!r.length}):b.forEach(t=>{t.isLeaf=!0}),v}(t,0,r):L(t,r,i);return f.map(t=>{if("headerBoxes"!==e.displayMode||t.isLeaf)return t;if(!S(e.displayMode,t,u))return;const n=D(e.displayMode,t,c,d);return{...t,h:n}}).filter(Boolean)}function V(){const t=e.registry.plugins.get("tooltip");t&&!t.positioners.treemap&&(t.positioners.treemap=t=>{if(!t.length)return!1;return t.at(-1).element.tooltipPosition()})}class $ extends e.DatasetController{initialize(){V(),this.enableOptionSharing=!0,super.initialize()}getMinMax(t){return{max:"x"===t.axis?t.right-t.left:t.bottom-t.top,min:0}}configure(){super.configure();const{xScale:t,yScale:e}=this.getMeta();if(!t||!e)return;const n=t.right-t.left,i=e.bottom-e.top,r={h:i,rtl:!!this.options.rtl,unsorted:!!this.options.unsorted,w:n,x:0,y:0};var o,s;o=this._rect,s=r,o&&s&&o.x===s.x&&o.y===s.y&&o.w===s.w&&o.h===s.h&&o.rtl===s.rtl&&o.unsorted===s.unsorted||(this._rect=r,this._rectChanged=!0),this._rectChanged&&(t.max=n,t.configure(),e.max=i,e.configure())}update(t){const e=this.getDataset(),{data:n}=this.getMeta(),i=e.groups||[],o=[e.key||""].concat(e.sumKeys||[]);e.tree=e.tree||e.data||[];const s=e.tree,a=e.treeVersion;"reset"===t&&this.configure(),(this._rectChanged||r(this._keys||[],o)||r(this._groups||[],i)||this._prevTree!==s||this._prevTreeVersion!==a)&&(this._groups=i.slice(),this._keys=o.slice(),this._prevTree=s,this._prevTreeVersion=a,this._rectChanged=!1,e.data=H(s,e,this._keys,this._rect),this._dataCheck(),this._resyncElements()),this.updateElements(n,0,n.length,t)}updateElements(t,e,n,r){const o="reset"===r,s=this.getDataset(),a=this.resolveDataElementOptions(e,r);this._rect.options=a;const h=this.getSharedOptions(a),l=this.includeOptions(r,h||{}),{xScale:u,yScale:c}=this.getMeta();for(let a=e;a<e+n;a++){const e=h||this.resolveDataElementOptions(a,r),n=i(s.data[a],u,c,e.spacing);o&&(n.width=0,n.height=0),l&&(n.options=e),this.updateElement(t[a],a,n,r)}this.updateSharedOptions(h||{},r,a)}draw(){const{ctx:t,chartArea:e}=this.chart,i=this.getMeta().data||[],r=this.getDataset().data;n.clipArea(t,e);for(let e=0,n=i.length;e<n;++e){const n=i[e];n.hidden||n.draw(t,r[e])}n.unclipArea(t)}constructor(t,e){super(t,e),this._groups=void 0,this._keys=void 0,this._rect=void 0,this._rectChanged=!0}}function W(t,e){const{x:n,y:i,width:r,height:o}=t.getProps(["x","y","width","height"],e);return{bottom:i+o,left:n,right:n+r,top:i}}function q(t){const e=W(t),i=e.right-e.left,r=e.bottom-e.top,a=s(t.options.borderWidth,i/2,r/2),h=function(t,e,i){const r=n.toTRBLCorners(t),s=Math.min(e,i);return{bottomLeft:o(r.bottomLeft,0,s),bottomRight:o(r.bottomRight,0,s),topLeft:o(r.topLeft,0,s),topRight:o(r.topRight,0,s)}}(t.options.borderRadius,i/2,r/2),l={active:t.active,h:r,radius:h,w:i,x:e.left,y:e.top};return{inner:{active:t.active,h:l.h-a.t-a.b,radius:{bottomLeft:Math.max(0,h.bottomLeft-Math.max(a.b,a.l)),bottomRight:Math.max(0,h.bottomRight-Math.max(a.b,a.r)),topLeft:Math.max(0,h.topLeft-Math.max(a.t,a.l)),topRight:Math.max(0,h.topRight-Math.max(a.t,a.r))},w:l.w-a.l-a.r,x:l.x+a.l,y:l.y+a.t},outer:l}}function K(t,e,n,i){const r=null===e,o=null===n,s=!(!t||r&&o)&&W(t,i);return s&&(r||e>=s.left&&e<=s.right)&&(o||n>=s.top&&n<=s.bottom)}function N(t,e){t.rect(e.x,e.y,e.w,e.h)}$.id="treemap",$.version="0.0.0-development",$.defaults={animations:{numbers:{properties:["x","y","width","height"],type:"number"}},dataElementType:"treemap"},$.descriptors={_indexable:!1,_scriptable:!0,captions:{_fallback:!0,_scriptable:t=>"formatter"!==t},labels:{_fallback:!0,_scriptable:t=>"formatter"!==t}},$.overrides={hover:{},interaction:{includeInvisible:!0,intersect:!0,mode:"point"},plugins:{tooltip:{callbacks:{label(t){const e=t.dataset,n=e.data[t.dataIndex],i=n.g||n._data.label||e.label;return(i?`${i}: `:"")+n.v},title(t){if(t.length){return t[0].dataset.key||""}return""}},intersect:!0,position:"treemap"}},scales:{x:{alignToPixels:!0,bounds:"data",display:!1,type:"linear"},y:{alignToPixels:!0,bounds:"data",display:!1,reverse:!0,type:"linear"}}},$.beforeRegister=()=>{j("chart.js","3.8",e.Chart.version)},$.afterRegister=()=>{V()},$.afterUnregister=()=>{const t=e.registry.plugins.get("tooltip");t&&delete t.positioners.treemap};class G extends e.Element{draw(t,e){if(!e)return;const i=this.options,{inner:r,outer:o}=q(this),s=(a=o.radius).topLeft||a.topRight||a.bottomLeft||a.bottomRight?n.addRoundedRectPath:N;var a;t.save(),o.w===r.w&&o.h===r.h||(t.beginPath(),s(t,o),t.clip(),s(t,r),t.fillStyle=i.borderColor,t.fill("evenodd")),t.beginPath(),s(t,r),t.fillStyle=i.backgroundColor,t.fill(),function(t,e,n,i){const r=n.dividers,o=i._data?.children;if(!r.display||!Array.isArray(o)||!o.length)return;const{x:s,y:a,w:h,h:l}=e,{lineColor:u,lineCapStyle:c,lineDash:d,lineDashOffset:f,lineWidth:p}=r;if(t.save(),t.strokeStyle=u,t.lineCap=c,t.setLineDash(d),t.lineDashOffset=f,t.lineWidth=p,t.beginPath(),h>l){const e=h/2;t.moveTo(s+e,a),t.lineTo(s+e,a+l)}else{const e=l/2;t.moveTo(s,a+e),t.lineTo(s+h,a+e)}t.stroke(),t.restore()}(t,r,i,e),I(t,r,i,e,this),t.restore()}inRange(t,e,n){return K(this,t,e,n)}inXRange(t,e){return K(this,t,null,e)}inYRange(t,e){return K(this,null,t,e)}getCenterPoint(t){const{x:e,y:n,width:i,height:r}=this.getProps(["x","y","width","height"],t);return{x:e+i/2,y:n+r/2}}tooltipPosition(){return this.getCenterPoint()}constructor(t){super(),this.width=void 0,this.height=void 0,t&&Object.assign(this,t)}}G.id="treemap",G.defaults={borderRadius:0,borderWidth:0,captions:{align:void 0,color:"black",display:!0,font:{},formatter:t=>{const e=t.raw._data?.label;return t.raw.g||("string"==typeof e?e:"")},padding:3},displayMode:"containerBoxes",dividers:{display:!1,lineCapStyle:"butt",lineColor:"black",lineDash:[],lineDashOffset:0,lineWidth:1},label:void 0,labels:{align:"center",color:"black",display:!1,font:{},formatter(t){const e=t.raw._data?.label;return t.raw.g?[t.raw.g,`${t.raw.v}`]:"string"==typeof e?[e,`${t.raw.v}`]:`${t.raw.v}`},overflow:"cut",padding:3,position:"middle"},rtl:!1,spacing:.5,unsorted:!1},G.descriptors={_indexable:!1,_scriptable:!0,captions:{_fallback:!0,_scriptable:t=>"formatter"!==t},labels:{_fallback:!0,_scriptable:t=>"formatter"!==t}},G.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"},e.Chart.register($,G),t.TreemapController=$,t.TreemapElement=G,t.flatten=w,t.getGroupKey=x,t.group=k,t.index=T,t.normalizeTreeToArray=v,t.requireVersion=j,t.sort=O,t.sum=R});
|
|
//# sourceMappingURL=chartjs-chart-treemap.min.js.map
|