lintje 0.13.0 → 0.13.2
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/dist-elements/actions.js +1 -1
- package/dist-elements/chunks/addon-CpQCmf0a.js +5 -0
- package/dist-elements/chunks/{avatar-LhpMTvpD.js → avatar-B6dKdtGU.js} +1 -1
- package/dist-elements/chunks/axes-Ce4tMvPe.js +129 -0
- package/dist-elements/chunks/base-D8Q8sQCj.js +252 -0
- package/dist-elements/chunks/chart-styles-nx70xRzE.js +45 -0
- package/dist-elements/chunks/{controls-DksmKkWN.js → controls-DHkjleqE.js} +1 -1
- package/dist-elements/chunks/date-format-imsP7-Nh.js +1 -0
- package/dist-elements/chunks/dialog-D4xqY347.js +1 -0
- package/dist-elements/chunks/{disclosure-CCO3GRDT.js → disclosure-DK8aIhWl.js} +5 -5
- package/dist-elements/chunks/{download-DXiWLTI2.js → download-Fdo7dKWd.js} +2 -2
- package/dist-elements/chunks/focus-trap-DmfusP3B.js +1 -0
- package/dist-elements/chunks/input-CgCrHxiZ.js +1 -0
- package/dist-elements/chunks/input-DyOCwq6h.js +8 -0
- package/dist-elements/chunks/{month-grid-S8RlqdwA.js → month-grid-BsW9jRNi.js} +8 -8
- package/dist-elements/chunks/{other-DoAwQm3o.js → other-BnXhCURa.js} +2 -1
- package/dist-elements/chunks/{player-BvpcNxBe.js → player-CnoXMz2g.js} +21 -21
- package/dist-elements/chunks/sentence-CxM-gm_8.js +3 -0
- package/dist-elements/chunks/{sheet-D7wJCRja.js → sheet-DKBISOgH.js} +2 -2
- package/dist-elements/chunks/stagger-VUPHAfRM.js +28 -0
- package/dist-elements/core.js +1 -1
- package/dist-elements/custom-elements.json +274 -28
- package/dist-elements/data-types.json +179 -11
- package/dist-elements/feedback.js +1 -1
- package/dist-elements/guides/dashboard.md +3 -1
- package/dist-elements/guides/page-contents.md +2 -1
- package/dist-elements/guides/start.md +6 -2
- package/dist-elements/layout.js +1 -1
- package/dist-elements/lintje.js +1417 -1293
- package/dist-elements/overlays.js +1 -1
- package/dist-elements/tag/accordion.js +3 -3
- package/dist-elements/tag/ai-label.js +5 -5
- package/dist-elements/tag/announcement.js +10 -10
- package/dist-elements/tag/app-search.js +44 -39
- package/dist-elements/tag/attachment.js +28 -27
- package/dist-elements/tag/audio-player.js +54 -49
- package/dist-elements/tag/badge.js +1 -1
- package/dist-elements/tag/breadcrumbs.js +14 -14
- package/dist-elements/tag/button.js +1 -1
- package/dist-elements/tag/card-list.js +10 -9
- package/dist-elements/tag/card.js +41 -41
- package/dist-elements/tag/chart.js +636 -599
- package/dist-elements/tag/chat-answer.js +23 -23
- package/dist-elements/tag/chat-composer.js +57 -54
- package/dist-elements/tag/chat-message.js +16 -16
- package/dist-elements/tag/chat-questions.js +79 -68
- package/dist-elements/tag/chat-steps.js +29 -27
- package/dist-elements/tag/chat-strip.js +25 -25
- package/dist-elements/tag/chat-suggestions.js +5 -5
- package/dist-elements/tag/chat.js +62 -61
- package/dist-elements/tag/checkbox-group.js +15 -12
- package/dist-elements/tag/checkbox.js +9 -9
- package/dist-elements/tag/code.js +7 -7
- package/dist-elements/tag/combobox.js +21 -21
- package/dist-elements/tag/conflict-alert.js +2 -2
- package/dist-elements/tag/copy-button.js +10 -8
- package/dist-elements/tag/data-table.js +303 -297
- package/dist-elements/tag/date-input.js +15 -15
- package/dist-elements/tag/date-range.js +18 -18
- package/dist-elements/tag/description-list.js +24 -24
- package/dist-elements/tag/dialog.js +7 -7
- package/dist-elements/tag/document-viewer.js +32 -32
- package/dist-elements/tag/drawer.js +9 -9
- package/dist-elements/tag/empty-state.js +1 -1
- package/dist-elements/tag/error-page.js +14 -14
- package/dist-elements/tag/error-summary.js +15 -15
- package/dist-elements/tag/expander.js +4 -4
- package/dist-elements/tag/explainer.js +6 -6
- package/dist-elements/tag/field.js +5 -5
- package/dist-elements/tag/file-upload.js +19 -18
- package/dist-elements/tag/filter-bar.js +45 -44
- package/dist-elements/tag/filter-sheet.js +7 -7
- package/dist-elements/tag/filter-zone.js +23 -23
- package/dist-elements/tag/find.js +14 -14
- package/dist-elements/tag/footer.js +13 -13
- package/dist-elements/tag/form-actions.js +5 -2
- package/dist-elements/tag/form-section.js +4 -4
- package/dist-elements/tag/form.js +3 -3
- package/dist-elements/tag/gallery.js +11 -11
- package/dist-elements/tag/graph.js +58 -58
- package/dist-elements/tag/grid-item.js +1 -1
- package/dist-elements/tag/grid.js +1 -1
- package/dist-elements/tag/hero.js +7 -7
- package/dist-elements/tag/highlight.js +3 -3
- package/dist-elements/tag/icon-button.js +1 -1
- package/dist-elements/tag/icon.js +1 -1
- package/dist-elements/tag/job-list.js +4 -4
- package/dist-elements/tag/key.js +1 -1
- package/dist-elements/tag/kpi-row.js +25 -22
- package/dist-elements/tag/kpi.js +85 -82
- package/dist-elements/tag/language-nav.js +20 -20
- package/dist-elements/tag/level-meter.js +7 -7
- package/dist-elements/tag/list.js +54 -48
- package/dist-elements/tag/log-viewer.js +96 -97
- package/dist-elements/tag/logo.js +23 -23
- package/dist-elements/tag/map.js +173 -168
- package/dist-elements/tag/menu-button.js +49 -49
- package/dist-elements/tag/modal.js +12 -10
- package/dist-elements/tag/multiselect.js +21 -21
- package/dist-elements/tag/note.js +6 -6
- package/dist-elements/tag/notifications.js +37 -37
- package/dist-elements/tag/number-input.js +19 -18
- package/dist-elements/tag/page-header.js +17 -17
- package/dist-elements/tag/pagination.js +41 -40
- package/dist-elements/tag/person-group.js +10 -10
- package/dist-elements/tag/person.js +7 -7
- package/dist-elements/tag/popover.js +1 -1
- package/dist-elements/tag/progress-bar.js +1 -1
- package/dist-elements/tag/prose.js +1 -1
- package/dist-elements/tag/qr-code.js +5 -5
- package/dist-elements/tag/radio-group.js +18 -17
- package/dist-elements/tag/range.js +25 -25
- package/dist-elements/tag/recording-status.js +9 -9
- package/dist-elements/tag/repeater.js +4 -4
- package/dist-elements/tag/segmented.js +11 -11
- package/dist-elements/tag/select.js +7 -7
- package/dist-elements/tag/shell.js +360 -354
- package/dist-elements/tag/skeleton.js +1 -1
- package/dist-elements/tag/slot-picker.js +12 -12
- package/dist-elements/tag/sortable-list.js +23 -23
- package/dist-elements/tag/spinner.js +1 -1
- package/dist-elements/tag/split-pane.js +9 -9
- package/dist-elements/tag/status-dot.js +1 -1
- package/dist-elements/tag/stepper.js +18 -18
- package/dist-elements/tag/streaming-text.js +13 -13
- package/dist-elements/tag/sub-nav.js +26 -26
- package/dist-elements/tag/tabs.js +40 -40
- package/dist-elements/tag/tag-input.js +32 -29
- package/dist-elements/tag/text-editor.js +21 -19
- package/dist-elements/tag/text-input.js +21 -21
- package/dist-elements/tag/textarea.js +13 -11
- package/dist-elements/tag/tile.js +1 -1
- package/dist-elements/tag/time-input.js +16 -16
- package/dist-elements/tag/timeline.js +74 -71
- package/dist-elements/tag/toast.js +14 -12
- package/dist-elements/tag/toggle.js +6 -6
- package/dist-elements/tag/toggletip.js +6 -6
- package/dist-elements/tag/token-value.js +1 -1
- package/dist-elements/tag/tooltip.js +1 -1
- package/dist-elements/tag/transcript.js +34 -35
- package/dist-elements/tag/translator.js +4 -3
- package/dist-elements/tag/tree-view.js +22 -22
- package/dist-elements/tag/user-menu.js +58 -57
- package/dist-elements/tag/video-player.js +12 -12
- package/dist-elements/tokens.css +34 -16
- package/dist-elements/tokens.json +12 -2
- package/dist-elements/types/components/actions/copy-button/copy-button.d.ts +5 -0
- package/dist-elements/types/components/actions/menu-button/menu-button.d.ts +6 -1
- package/dist-elements/types/components/charts/kpi/kpi.d.ts +7 -0
- package/dist-elements/types/components/charts/kpi-row/kpi-row.d.ts +10 -2
- package/dist-elements/types/components/chat/chat/chat.d.ts +1 -1
- package/dist-elements/types/components/chat/chat-composer/chat-composer.d.ts +0 -2
- package/dist-elements/types/components/chat/chat-questions/chat-questions.d.ts +2 -1
- package/dist-elements/types/components/chat/shared/chat-terms.d.ts +2 -0
- package/dist-elements/types/components/content/attachment/attachment.d.ts +6 -1
- package/dist-elements/types/components/content/audio-player/audio-player.d.ts +6 -0
- package/dist-elements/types/components/content/log-viewer/log-viewer.d.ts +4 -0
- package/dist-elements/types/components/content/translator/translator.d.ts +5 -0
- package/dist-elements/types/components/feedback/toast/toast.d.ts +5 -1
- package/dist-elements/types/components/filters/filter-zone/filter-zone.d.ts +3 -1
- package/dist-elements/types/components/forms/form-actions/form-actions.d.ts +4 -1
- package/dist-elements/types/components/forms/stepper/stepper.d.ts +1 -0
- package/dist-elements/types/components/frame/app-search/app-search.d.ts +2 -0
- package/dist-elements/types/components/frame/shell/header.d.ts +5 -1
- package/dist-elements/types/components/frame/shell/navigation.d.ts +0 -2
- package/dist-elements/types/components/frame/shell/shell.d.ts +5 -0
- package/dist-elements/types/components/frame/user-menu/user-menu.d.ts +2 -0
- package/dist-elements/types/components/inputs/checkbox-group/checkbox-group.d.ts +2 -1
- package/dist-elements/types/components/inputs/date-input/date-input.d.ts +5 -0
- package/dist-elements/types/components/inputs/radio-group/radio-group.d.ts +1 -2
- package/dist-elements/types/components/inputs/shared/field-foot.d.ts +6 -0
- package/dist-elements/types/components/inputs/shared/input.d.ts +17 -2
- package/dist-elements/types/components/inputs/tag-input/tag-input.d.ts +2 -0
- package/dist-elements/types/components/inputs/text-input/text-input.d.ts +5 -2
- package/dist-elements/types/components/inputs/textarea/textarea.d.ts +11 -0
- package/dist-elements/types/components/overlays/tooltip/tooltip.d.ts +4 -1
- package/dist-elements/types/components/shared/charts/dual-axis-chart/dual-axis-chart.d.ts +2 -2
- package/dist-elements/types/components/shared/charts/dumbbell-chart/dumbbell-chart.d.ts +4 -1
- package/dist-elements/types/components/shared/charts/histogram-chart/histogram-chart.d.ts +2 -1
- package/dist-elements/types/components/shared/charts/map-chart/leaflet.d.ts +4 -0
- package/dist-elements/types/components/shared/charts/map-chart/map-chart.d.ts +10 -1
- package/dist-elements/types/components/shared/charts/map-chart/marks.d.ts +3 -1
- package/dist-elements/types/components/shared/charts/map-chart/reveal.d.ts +2 -2
- package/dist-elements/types/components/shared/charts/pie-chart/pie-chart.d.ts +4 -3
- package/dist-elements/types/components/shared/charts/scatter-chart/scatter-chart.d.ts +2 -1
- package/dist-elements/types/components/shared/charts/shared/axes.d.ts +7 -6
- package/dist-elements/types/components/shared/charts/shared/colors.d.ts +12 -7
- package/dist-elements/types/components/shared/charts/shared/controller.d.ts +88 -5
- package/dist-elements/types/components/shared/charts/shared/fold.d.ts +38 -0
- package/dist-elements/types/components/shared/charts/shared/forecast.d.ts +6 -1
- package/dist-elements/types/components/shared/charts/shared/mark-select.d.ts +4 -3
- package/dist-elements/types/components/shared/charts/shared/nearest-mark.d.ts +25 -0
- package/dist-elements/types/components/shared/charts/shared/plot-keys.d.ts +9 -1
- package/dist-elements/types/components/shared/charts/shared/scale.d.ts +5 -4
- package/dist-elements/types/components/shared/charts/stacked-bar-chart/stacked-bar-chart.d.ts +4 -1
- package/dist-elements/types/components/shared/charts/treemap-chart/treemap-chart.d.ts +7 -0
- package/dist-elements/types/components/shared/charts/treemap-chart/treemap-labels.d.ts +3 -2
- package/dist-elements/types/components/shared/date-format.d.ts +3 -3
- package/dist-elements/types/components/shared/other.d.ts +2 -1
- package/dist-elements/types/components/tables/data-table/data-table.d.ts +7 -3
- package/dist-elements/types/components/tables/data-table/filters.d.ts +2 -1
- package/dist-elements/types/components/tables/list/list.d.ts +2 -0
- package/dist-elements/types/components/tables/pagination/pagination.d.ts +1 -0
- package/dist-elements/types/core/format.d.ts +15 -3
- package/dist-elements/types/core/scroll-room.d.ts +16 -0
- package/dist-elements/types/types.d.ts +6 -1
- package/package.json +1 -1
- package/dist-elements/chunks/addon-uVno0du7.js +0 -5
- package/dist-elements/chunks/axes-Bvby71Kw.js +0 -129
- package/dist-elements/chunks/base-CA5SqOS7.js +0 -252
- package/dist-elements/chunks/chart-styles-DOqcYbwm.js +0 -45
- package/dist-elements/chunks/date-format-DvDaZtFc.js +0 -1
- package/dist-elements/chunks/dialog-IENGotYb.js +0 -1
- package/dist-elements/chunks/focus-trap-BQYLu24z.js +0 -1
- package/dist-elements/chunks/input-Ca1jedrl.js +0 -8
- package/dist-elements/chunks/input-_KQsbmkp.js +0 -1
- package/dist-elements/chunks/sentence-C9bcudIj.js +0 -3
- package/dist-elements/chunks/stagger-w2eZPjUS.js +0 -27
|
@@ -1,363 +1,369 @@
|
|
|
1
|
-
import{
|
|
2
|
-
cx=${
|
|
1
|
+
import{A as e,B as t,Dn as n,En as r,J as i,Nt as a,Ut as o,_ as s,b as c,d as l,f as u,g as d,gn as f,h as p,l as m,mt as h,o as g,p as _,r as v,rt as y,u as b,v as x,wn as S,xn as C,yn as w,z as T}from"../chunks/base-D8Q8sQCj.js";import{a as E,n as D,r as O,t as k}from"../chunks/download-Fdo7dKWd.js";import{a as A,i as j,n as M,r as N,t as P}from"../chunks/stagger-VUPHAfRM.js";import{A as F,B as I,D as L,E as R,F as z,H as B,I as V,L as H,M as U,O as W,R as G,S as ee,T as K,V as q,_ as J,b as Y,c as X,f as te,g as ne,h as Z,i as Q,j as re,n as $,o as ie,r as ae,s as oe,t as se,u as ce,v as le,w as ue,x as de,y as fe,z as pe}from"../chunks/axes-Ce4tMvPe.js";import{n as me,r as he}from"../chunks/chart-styles-nx70xRzE.js";import{t as ge}from"./announcement.js";var _e=/* @__PURE__ */ new Set([`ArrowRight`,`ArrowDown`]),ve=/* @__PURE__ */ new Set([`ArrowLeft`,`ArrowUp`]);function ye(e){return[`${[e.kicker,e.note?`${e.title} ${e.note}`:e.title].filter(Boolean).join(`, `)}: ${e.rows.map(e=>`${e.label} ${e.value}${e.aside?`, ${e.aside}`:``}`.trim()).join(`, `)}`,...(e.events??[]).map(e=>`Gebeurtenis ${e.number}: ${e.label}`)].join(`. `)}function be(e){try{return e.matches(`:focus-visible`)}catch{return!0}}function xe(e,t,n){let r=(t,r,i)=>{let a=n(r),o=t.closest(`[data-tooltip-anchor]`),s=t.getBoundingClientRect(),c=o?.getBoundingClientRect()??s;e.liftAt(r),e.status=i?a.sentence??ye(a.content):``;let l=s.left-c.left;e.showTooltipAt(l+a.x,s.top-c.top+a.y,a.content,a.side??(a.flip==null?void 0:l+a.flip))},i=(t,n)=>{e.keyFrom=null,r(t,n,!0)};return{keydown(n){if(n.target!==n.currentTarget||t===0)return;let r=e.hoverIndex??e.keyFrom,a=r==null?-1:Math.min(r,t-1),o;if(_e.has(n.key))o=Math.min(t-1,a+1);else if(ve.has(n.key))o=Math.max(0,a-1);else if(n.key===`Home`)o=0;else if(n.key===`End`)o=t-1;else return;n.preventDefault(),i(n.currentTarget,o)},focus(n){let r=n.currentTarget;n.target===r&&t!==0&&be(r)&&i(r,Math.min(e.hoverIndex??0,t-1))},point(t,n,i=!1){let a=t.currentTarget,o=a.closest(`svg`)??a,s=()=>r(o,n,!1);if(i)s();else{let r=t instanceof MouseEvent?{x:t.clientX,y:t.clientY}:void 0;e.pointTo(n,s,r,()=>{e.liftAt(n),e.requestUpdate()})}},leave(){e.pointerLeft()},blur(){e.keyFrom=null,(e.hoverIndex!=null||e.status)&&(e.liftAt(null),e.status=``,e.hideTooltip(),e.requestUpdate())}}}function Se(e){return r`<p class="visually-hidden" role="status">${e.status}</p>`}var Ce=2.5;function we(e,t){let n=[],r=[];return e.forEach((e,i)=>{e==null?(r.length&&n.push(r),r=[]):r.push(t(e,i))}),r.length&&n.push(r),n}var Te=18,Ee=4,De=8;function Oe(e){let t=[];return e.map(e=>{let n=t.findIndex(t=>t.every(t=>Math.abs(t-e)>=22));return n===-1&&(n=t.push([])-1),t[n].push(e),n})}function ke(e,t,n,r,i){let a=e=>Math.min(i,Math.max(0,e)),o=e.map((e,r)=>{if(r<n-1)return null;if(r===n-1)return e==null?null:{low:e,high:e};let{low:i,high:a}=Z(t,r);return i==null||a==null?null:{low:i,high:a}}),s=[],c=[];return o.forEach((e,t)=>{e?c.push({...e,i:t}):c.length&&(s.push(c),c=[])}),c.length&&s.push(c),s.filter(e=>e.length>1).map(e=>{let t=e.map(e=>r(a(e.high),e.i)),n=e.map(e=>r(a(e.low),e.i)).reverse();return[...t,...n].map(e=>`${e.x},${e.y}`).join(` `)})}function Ae(e,t){let{controller:i,description:a}=t,{labels:s,axisTitle:c,unit:l,fixedMax:u,small:f=!1}=e,p=e.series.some(e=>!e.comparison)?le(e.forecastFrom,s.length):null,m=e.forecastLabel??`Raming`,h=p==null?e.asOfIndex:void 0,_=p==null?e.asOfLabel:void 0,v=p==null?e.pendingHours??0:0,y=(e.events??[]).filter(e=>Number.isInteger(e.index)&&e.index>=0&&e.index<s.length).sort((e,t)=>e.index-t.index).map((e,t)=>({...e,number:t+1})),b=i.id;i.measure({width:!0,height:t.height??(f?`--chart-h-small`:`--chart-h-main`),fit:!!t.expanded&&!t.mobile});let C=e.series.filter(e=>!e.comparison).length>1,w=0,T=e.series.map(e=>({...e,color:ue(e.color),symbol:C&&!e.comparison?re(e.color)?e.color:F[w++%F.length]:void 0})),E=T.filter(e=>!i.hiddenSeries.includes(e.label)),D=e=>p!=null&&!e.comparison,O=[...T.flatMap(e=>e.values),...T.flatMap(e=>D(e)?ee(e.forecast):[])].filter(e=>e!=null),{max:k,ticks:j}=H(u??Math.max(...O,1)),M=V(j,i.width,{font:i.font,minimum:Math.ceil(x(s[0]??``,i.font)/2)}),P=A(t,{left:M.width}),I=y.map(e=>Math.min(P.width-Te/2,Math.max(Te/2,q(e.index,s.length,P)))),L=Oe(I),R=L.length?Math.max(...L)+1:0,G=R?R*22+De:z.top,K=p==null||fe(q(p-1,s.length,P),P,m,i.font),X=A(t,{left:M.width,top:G+(p==null?0:J(K))}),te=e=>Ee+L[e]*22,Z=v>6,Q=h??s.length-1,$=e=>e.comparison?`var(--color-chart-secondary)`:e.color??`var(--color-chart-default)`,ae=T.filter(e=>!e.comparison),se=E.filter(e=>!e.comparison),me=p!=null&&se.length>1&&se.some(e=>e.label===i.emphasis)?i.emphasis:null,he=e=>se.length===1?se[0].label===e.label:e.label===me,ge=ae.length===1?$(ae[0]):`var(--color-text-muted)`,_e=[...T.map(e=>({label:e.label,color:$(e),shape:e.comparison?`dashed`:`line`,symbol:e.symbol,hidden:i.hiddenSeries.includes(e.label),fixed:T.length<2})),...p==null?[]:[{label:m,color:ge,shape:`dotted`,fixed:!0}],...p!=null&&ae.some(e=>Y(e.forecast,p,s.length))?[{label:e.intervalLabel??`Marge`,color:ge,shape:`band`,fixed:!0}]:[]],ve=Math.max(1,Math.ceil(s.length/8)),be=s.map((e,t)=>({label:e,x:q(t,s.length,X),i:t})).filter(e=>e.i%ve===0),Ae=(e,t)=>D(e)&&t>=p;function je(e){let t=y.filter(t=>t.index===e);return{title:s[e],...p!=null&&e>=p?{note:m.toLowerCase()}:{},rows:E.flatMap(t=>[{label:t.label,value:t.values[e]==null?`geen gegevens`:d(t.values[e]),color:$(t),...p==null?{}:{marker:t.comparison?`dashed`:Ae(t,e)?`dotted`:`line`}},...Ae(t,e)&&t.forecast?[de(t.forecast,e)]:[]]),...t.length?{events:t}:{}}}let Me=e=>{let t=E.map(t=>t.values[e]).filter(e=>e!=null);return t.length?Math.max(...t):null},Ne=(e,t)=>p!=null&&e>=p?ye({...t,note:void 0,rows:t.rows.map(e=>e.marker===`dotted`?{...e,label:`${e.label} ${m.toLowerCase()}`}:e)}):void 0,Pe=xe(i,s.length,e=>{let t=Me(e),n=je(e);return{x:q(e,s.length,X),y:t==null?X.top:B(t,k,X),content:n,sentence:Ne(e,n)}}),Fe=e=>{let t=Me(e);return t==null?S:n`<circle class="lintje-chart__focus-point" r="7.5"
|
|
2
|
+
cx=${q(e,s.length,X)} cy=${B(t,k,X)} />`},Ie=e=>n`<rect class="lintje-chart__forecast-ground" x=${e} y=${X.top}
|
|
3
3
|
width=${Math.max(0,X.width-X.right-e)}
|
|
4
|
-
height=${Math.max(0,X.height-X.top-X.bottom)} />`,Le=[
|
|
4
|
+
height=${Math.max(0,X.height-X.top-X.bottom)} />`,Le=[v>0?(()=>{let e=q(Q,s.length,X),t=Z?pe(X)/(s.length-1):X.width-X.right-e;return n`<rect x=${e} y=${X.top} width=${Math.max(0,t)}
|
|
5
5
|
height=${X.height-X.top-X.bottom}
|
|
6
|
-
fill="url(#hatch-${
|
|
7
|
-
${
|
|
8
|
-
y1=${
|
|
9
|
-
${
|
|
10
|
-
<rect class="lintje-chart__event-chip" x=${I[t]-Te/2} y=${
|
|
6
|
+
fill="url(#hatch-${b})" />`})():S,y.length?n`<g>
|
|
7
|
+
${y.map((e,t)=>{let r=q(e.index,s.length,X);return n`<line class="lintje-chart__event-line" x1=${r} x2=${r}
|
|
8
|
+
y1=${te(t)+Te} y2=${X.height-X.bottom} />`})}
|
|
9
|
+
${y.map((e,t)=>n`
|
|
10
|
+
<rect class="lintje-chart__event-chip" x=${I[t]-Te/2} y=${te(t)}
|
|
11
11
|
width=${Te} height=${Te} />
|
|
12
|
-
<text class="lintje-chart__event-number" x=${I[t]} y=${
|
|
12
|
+
<text class="lintje-chart__event-number" x=${I[t]} y=${te(t)+Te/2}
|
|
13
13
|
text-anchor="middle" dominant-baseline="central">${e.number}</text>
|
|
14
14
|
`)}
|
|
15
|
-
</g>`:S,
|
|
16
|
-
${T.map(e=>{let t
|
|
17
|
-
<g class="lintje-chart__series ${
|
|
18
|
-
${
|
|
19
|
-
fill=${t} points=${
|
|
20
|
-
${
|
|
21
|
-
${e.area&&!e.comparison?
|
|
22
|
-
points=${`${
|
|
23
|
-
${
|
|
24
|
-
${
|
|
15
|
+
</g>`:S,n`<g class="lintje-chart__reveal">
|
|
16
|
+
${T.map(e=>{let t=$(e),r=e.comparison?void 0:W(t),i=(e,t)=>({x:q(t,s.length,X),y:B(e,k,X),i:t}),a=D(e),o=we(Z?e.values.slice(0,Q+1):a?e.values.slice(0,p):e.values,i),c=a?we(e.values.map((e,t)=>t<p-1?null:e),i).filter(e=>e.length>1||e[0].i>=p):[],l=[...o,...c];if(l.length===0)return S;let u=l[l.length-1],d=u[u.length-1],f=X.height-X.bottom,m=a&&e.forecast?ke(e.values,e.forecast,p,i,k):[],h=!E.includes(e),g=me!=null&&e.label!==me;return n`
|
|
17
|
+
<g class="lintje-chart__series ${h?`is-off`:``} ${g?`is-muted`:``}">
|
|
18
|
+
${m.map(r=>n`<polygon class="lintje-chart__band ${he(e)?`is-filled`:``}"
|
|
19
|
+
fill=${t} points=${r} />`)}
|
|
20
|
+
${o.map(i=>{let a=i.map(e=>`${e.x},${e.y}`).join(` `);return n`
|
|
21
|
+
${e.area&&!e.comparison?n`<polygon fill=${t} fill-opacity=".14"
|
|
22
|
+
points=${`${i[0].x},${f} ${a} ${i[i.length-1].x},${f}`} />`:S}
|
|
23
|
+
${r&&i.length>1?n`<polyline class="lintje-chart__line lintje-chart__line--casing" points=${a} stroke=${r} />`:S}
|
|
24
|
+
${i.length===1?n`<circle cx=${i[0].x} cy=${i[0].y} r=${Ce} fill=${t} />`:n`<polyline
|
|
25
25
|
class="lintje-chart__line"
|
|
26
|
-
points=${
|
|
26
|
+
points=${a}
|
|
27
27
|
stroke=${t}
|
|
28
28
|
stroke-dasharray=${e.comparison?`5 4`:S}
|
|
29
29
|
opacity=${e.comparison?.9:1} />`}
|
|
30
30
|
`})}
|
|
31
|
-
${
|
|
32
|
-
${n
|
|
33
|
-
points=${
|
|
34
|
-
<polyline class="lintje-chart__line lintje-chart__line--forecast" points=${
|
|
31
|
+
${c.map(e=>{let i=e.map(e=>`${e.x},${e.y}`).join(` `);return e.length===1?n`<circle cx=${e[0].x} cy=${e[0].y} r=${Ce} fill=${t} />`:n`
|
|
32
|
+
${r?n`<polyline class="lintje-chart__line lintje-chart__line--casing lintje-chart__line--forecast"
|
|
33
|
+
points=${i} stroke=${r} />`:S}
|
|
34
|
+
<polyline class="lintje-chart__line lintje-chart__line--forecast" points=${i} stroke=${t} />
|
|
35
35
|
`})}
|
|
36
36
|
<!-- The line's own shape at its end; a 4 px point there at an early as-of time. -->
|
|
37
|
-
${e.symbol?
|
|
37
|
+
${e.symbol?n`<path class="lintje-chart__line-end" d=${U(e.symbol,4.5,d.x,d.y)} fill=${t} />`:Z&&!e.comparison?n`<circle cx=${d.x} cy=${d.y} r="4" fill=${t} />`:S}
|
|
38
38
|
</g>
|
|
39
39
|
`})}
|
|
40
|
-
</g>`,
|
|
41
|
-
r="4" fill=${
|
|
42
|
-
cx=${
|
|
43
|
-
${
|
|
44
|
-
<rect x=${
|
|
40
|
+
</g>`,p==null?S:ie({mode:`forecast`,area:X,x:q(p-1,s.length,X),label:m,font:i.font}),Z&&_?ie({area:X,index:Q,count:s.length,label:`peilmoment ${_}`,pendingHours:v,lastValue:(()=>{let e=E.find(e=>!e.comparison)?.values[Q];return e==null?void 0:`${d(e)}${l?` ${l}`:``}`})()}):S,i.hoverIndex==null?S:E.map(e=>{let t=i.hoverIndex,r=e.values[t];if(r==null||Z&&t>Q)return S;let a=Ae(e,t),o=q(t,s.length,X),c=B(r,k,X),l=a?void 0:W($(e));return n`<circle class="lintje-chart__hover-point ${a?`lintje-chart__hover-point--forecast`:``}"
|
|
41
|
+
r="4" fill=${a?S:$(e)} color=${a?$(e):S}
|
|
42
|
+
cx=${o} cy=${c} />
|
|
43
|
+
${l?n`<circle class="lintje-chart__hover-casing" r="4" stroke=${l} cx=${o} cy=${c} />`:S}`}),i.hoverIndex!=null&&i.status?Fe(i.hoverIndex):S,s.map((e,t)=>{let r=q(t,s.length,X),i=pe(X)/Math.max(1,s.length-1);return n`
|
|
44
|
+
<rect x=${r-i/2} y=${X.top} width=${i}
|
|
45
45
|
height=${X.height-X.top-X.bottom}
|
|
46
46
|
fill="transparent"
|
|
47
|
-
@mousemove=${e=>
|
|
48
|
-
@mouseleave=${
|
|
49
|
-
`})];return
|
|
50
|
-
<div class="lintje-chart-wrap ${
|
|
51
|
-
${
|
|
52
|
-
${
|
|
53
|
-
@keydown=${e=>
|
|
54
|
-
${ce({items:_e,onToggle:e=>
|
|
55
|
-
${oe({
|
|
56
|
-
${
|
|
57
|
-
${
|
|
47
|
+
@mousemove=${e=>Pe.point(e,t)}
|
|
48
|
+
@mouseleave=${Pe.leave} />
|
|
49
|
+
`})];return r`
|
|
50
|
+
<div class="lintje-chart-wrap ${f?`lintje-chart--small`:``}"
|
|
51
|
+
${o({"--lintje-event-size":`${Te}px`})}
|
|
52
|
+
${g(i.attach)} ?data-in-view=${i.inView} data-tooltip-anchor
|
|
53
|
+
@keydown=${e=>i.dismiss(e)}>
|
|
54
|
+
${ce({items:_e,onToggle:e=>i.toggleSeries(e),onEmphasis:p!=null&&ae.length>1?e=>i.emphasise(e):void 0})}
|
|
55
|
+
${oe({font:i.font,id:b,ticks:j,max:k,area:X,formatTick:M.format,axisTitle:c??l,xLabels:be,underlay:p==null?S:Ie(q(p-1,s.length,X)),description:[a,p==null?``:ne(s,p,m),...y.map(e=>`Gebeurtenis ${e.number}, ${s[e.index]}: ${e.label}.`)].filter(Boolean).join(` `),keys:Pe},Le)}
|
|
56
|
+
${y.length?r`<ol class="lintje-chart-events" role="list" aria-label="Gebeurtenissen">
|
|
57
|
+
${y.map(e=>r`<li class="lintje-chart-events__item">
|
|
58
58
|
<span class="lintje-event-chip"><span class="lintje-event-chip__number">${e.number}</span></span>
|
|
59
|
-
<span><span class="lintje-chart-events__category">${
|
|
59
|
+
<span><span class="lintje-chart-events__category">${s[e.index]}</span> ·
|
|
60
60
|
${e.label}</span>
|
|
61
61
|
</li>`)}
|
|
62
62
|
</ol>`:S}
|
|
63
|
-
${N(
|
|
64
|
-
${Se(
|
|
63
|
+
${N(i)}
|
|
64
|
+
${Se(i)}
|
|
65
65
|
</div>
|
|
66
|
-
`}var je={clickable:!1,state:``,markId:S,role:S,tabIndex:S,pressed:S,label:S,click:S,keydown:S};function Me(e,t){let n=/* @__PURE__ */ new Set;for(let e of t)e?.href&&n.add(e.id);let r=e.selectedId!=null&&n.has(e.selectedId)?e.selectedId:null,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
66
|
+
`}var je={clickable:!1,state:``,markId:S,role:S,tabIndex:S,pressed:S,label:S,click:S,keydown:S};function Me(e,t){let n=/* @__PURE__ */ new Set;for(let e of t)e?.href&&n.add(e.id);let r=e.selectedId!=null&&n.has(e.selectedId)?e.selectedId:null,a=()=>{r!=null&&e.onClear?.(r)},o=(t,n)=>{if(t.id===r)return a();e.onSelect?.({id:t.id,label:n,href:t.href})};return{active:r,interactive:!!e.onSelect&&n.size>0,of(t,n,a){if(!t?.href||!e.onSelect)return r==null?je:{...je,state:`is-muted`};let s=t.id===r,c=e.choosing??e.selectedId!==void 0;return{clickable:!0,state:`is-clickable ${s?`is-selected`:r==null?``:`is-muted`}`,markId:t.id,role:c?`button`:`link`,tabIndex:0,pressed:c?s?`true`:`false`:S,label:a??n,click:r=>{i(r)?(r.preventDefault(),e.onSelect?.({id:t.id,label:n,href:t.href},!0)):r.type===`click`&&o(t,n)},keydown:e=>{(e.key===`Enter`||e.key===` `&&c)&&(e.preventDefault(),o(t,n))}}},escape(e){e.key===`Escape`&&r!=null&&(e.stopPropagation(),a())}}}function Ne(e,t,n,r){let i=null,a=r;for(let r of e){if(!r.mark?.clickable)continue;let e=Math.max(r.x-t,0,t-(r.x+r.width)),o=Math.max(r.y-n,0,n-(r.y+r.height)),s=Math.hypot(e,o);s<=a&&(i=r.mark,a=s)}return i}function Pe(e,t,n){let r=e.getScreenCTM?.();if(r)return new DOMPoint(t.clientX,t.clientY).matrixTransform(r.inverse());let i=e.ownerSVGElement?.getBoundingClientRect(),a=i&&i.width>0?n.width/i.width:1;return{x:(t.clientX-(i?.left??0))*a,y:(t.clientY-(i?.top??0))*a}}function Fe(e,r,i){if(!r.some(e=>e.mark?.clickable))return n`${i}`;let a=n=>{if(n.target.closest?.(`[data-mark-id]`))return;let i=n.currentTarget,{x:a,y:o}=Pe(i,n,e),s=Ne(r,a,o,t(i,`--h-target`,48)/2);s&&s.click!==S&&s.click(n)};return n`<g @click=${a} @auxclick=${a}>
|
|
67
|
+
<rect class="lintje-chart__hit" x=${e.left} y=${e.top}
|
|
68
|
+
width=${Math.max(0,e.width-e.left-e.right)}
|
|
69
|
+
height=${Math.max(0,e.height-e.top-e.bottom)} />
|
|
70
|
+
${i}
|
|
71
|
+
</g>`}var Ie=8;function Le(e,t){let{controller:i,description:a}=t,{labels:s,values:c,axisTitle:l,trend:u,dataLabels:f=!0,small:m=!1,links:h}=e,v=ue(e.color)??`var(--color-chart-default)`,y=le(e.forecastFrom,s.length),b=e.forecastLabel??`Raming`,x=l??`Waarde`,C=W(v)??v,w=e=>y!=null&&e>=y,T=i.id,E=Me(t,h??[]);i.measure({width:!0,height:t.height??(m?`--chart-h-small`:`--chart-h-main`),fit:!!t.expanded&&!t.mobile});let D=[...c,...y==null?[]:ee(e.forecast)].filter(e=>e!=null),{max:O,ticks:k}=H(Math.max(...D,1)),j=V(k,i.width,{font:i.font}),P=e=>{let t=G(y,s.length,e);return t.center-t.bandWidth/2},F=A(t,{left:j.width}),I=y==null||fe(P(F),F,b,i.font),L=A(t,{left:j.width,...y==null?{}:{top:z.top+J(I)}}),R=t=>{if(!w(t)||c[t]==null)return null;let{low:n,high:r}=Z(e.forecast,t);if(n==null||r==null)return null;let i=e=>B(Math.min(O,Math.max(0,e)),O,L);return{top:i(r),bottom:i(n)}},U=L.height-L.bottom,{width:K,bandWidth:q}=G(0,s.length,L),X=f&&c.every(e=>e==null||_(p(e,K),q-4)),te=t=>({title:s[t],...w(t)?{note:b.toLowerCase()}:{},rows:[{label:x,value:c[t]==null?`geen gegevens`:d(c[t]),color:v,...w(t)?{marker:`open`}:{}},...w(t)&&e.forecast?[de(e.forecast,t)]:[]]}),Q=xe(i,s.length,e=>({x:G(e,s.length,L).center,y:c[e]==null?L.top:Math.min(B(c[e],O,L),R(e)?.top??1/0),content:te(e)})),re=y==null?0:P(L),$=we(u??[],(e,t)=>({x:G(t,s.length,L).center,y:B(e,O,L)})),ae=[],se=[c.map((e,t)=>{let r=G(t,s.length,L);if(e==null)return n`<rect class="lintje-chart__missing" x=${r.x} y=${L.top} width=${r.width}
|
|
72
|
+
height=${Math.max(0,U-L.top)} fill="url(#hatch-${T})"
|
|
73
|
+
@mousemove=${e=>Q.point(e,t)}
|
|
74
|
+
@mouseleave=${Q.leave} />`;let a=B(e,O,L),c=w(t),l=R(t),u=E.of(h?.[t],s[t],`${s[t]}${c?` ${b.toLowerCase()}`:``}: ${d(e)}`),f=c?.75:0;return ae.push({x:r.x,y:a,width:r.width,height:Math.max(0,U-a),mark:u}),n`
|
|
75
|
+
<g class="lintje-chart__bar-group ${i.hoverIndex===t?`is-hovered`:``}"
|
|
76
|
+
${o(M(t,s.length))}
|
|
77
|
+
@mousemove=${e=>Q.point(e,t)}
|
|
78
|
+
@mouseleave=${Q.leave}>
|
|
79
|
+
<rect class="lintje-chart__bar lintje-chart__mark ${c?`lintje-chart__bar--forecast`:``} ${u.state}"
|
|
80
|
+
x=${r.x+f} y=${a+f} width=${Math.max(0,r.width-2*f)}
|
|
81
|
+
height=${Math.max(0,U-a-f)} fill=${v}
|
|
82
|
+
stroke=${c?C:S}
|
|
83
|
+
data-mark-id=${u.markId} role=${u.role} tabindex=${u.tabIndex}
|
|
84
|
+
aria-pressed=${u.pressed} aria-label=${u.label}
|
|
85
|
+
@click=${u.click} @auxclick=${u.click} @keydown=${u.keydown} />
|
|
86
|
+
${l?n`<path class="lintje-chart__interval" stroke=${C}
|
|
87
|
+
d=${`M${r.center},${l.top}V${l.bottom}M${r.center-Ie/2},${l.top}h${Ie}M${r.center-Ie/2},${l.bottom}h${Ie}`} />`:S}
|
|
88
|
+
${X?n`<text x=${r.center} y=${Math.min(a,l?.top??a)-5} text-anchor="middle"
|
|
84
89
|
class="lintje-chart__data-label">
|
|
85
|
-
${
|
|
90
|
+
${p(e,r.width)}
|
|
86
91
|
</text>`:S}
|
|
87
92
|
</g>
|
|
88
|
-
`})
|
|
89
|
-
${
|
|
90
|
-
fill="var(--color-chart-emphasis)" />`:
|
|
93
|
+
`}),$.length?n`<g class="lintje-chart__trend">
|
|
94
|
+
${$.map(e=>e.length===1?n`<circle cx=${e[0].x} cy=${e[0].y} r=${Ce}
|
|
95
|
+
fill="var(--color-chart-emphasis)" />`:n`<polyline fill="none" stroke="var(--color-chart-emphasis)" stroke-width="1.5"
|
|
91
96
|
stroke-dasharray="5 4"
|
|
92
97
|
points=${e.map(e=>`${e.x},${e.y}`).join(` `)} />`)}
|
|
93
|
-
</g>`:S,
|
|
94
|
-
<div class="lintje-chart-wrap ${
|
|
95
|
-
${
|
|
96
|
-
@keydown=${e=>
|
|
97
|
-
${
|
|
98
|
-
${oe({
|
|
99
|
-
width=${Math.max(0,
|
|
100
|
-
height=${Math.max(0,
|
|
101
|
-
${N(
|
|
102
|
-
${Se(
|
|
98
|
+
</g>`:S,y==null?S:ie({mode:`forecast`,area:L,x:re,label:b,font:i.font})];return r`
|
|
99
|
+
<div class="lintje-chart-wrap ${m?`lintje-chart--small`:``}"
|
|
100
|
+
${g(i.attach)} ?data-in-view=${i.inView} data-tooltip-anchor
|
|
101
|
+
@keydown=${e=>i.dismiss(e)||E.escape(e)}>
|
|
102
|
+
${y==null?S:ce({items:[{label:x,color:v,shape:`square`,fixed:!0},{label:b,color:v,shape:`open`,fixed:!0},...Y(e.forecast,y,s.length)?[{label:e.intervalLabel??`Marge`,color:v,shape:`interval`,fixed:!0}]:[]]})}
|
|
103
|
+
${oe({font:i.font,id:T,ticks:k,max:O,area:L,axisTitle:l,description:y==null?a:`${a} ${ne(s,y,b)}`,formatTick:j.format,xLabels:s.map((e,t)=>({label:e,x:G(t,s.length,L).center})),underlay:y==null?S:n`<rect class="lintje-chart__forecast-ground" x=${re} y=${L.top}
|
|
104
|
+
width=${Math.max(0,L.width-L.right-re)}
|
|
105
|
+
height=${Math.max(0,U-L.top)} />`,interactive:E.interactive,keys:Q},Fe(L,ae,se))}
|
|
106
|
+
${N(i)}
|
|
107
|
+
${Se(i)}
|
|
103
108
|
</div>
|
|
104
|
-
`}function
|
|
105
|
-
<figure class="lintje-chart lintje-chart--rows" ${
|
|
109
|
+
`}function Re(e){return e*26+24}function ze(e,t){let{controller:i,description:a}=t,{rows:s,threshold:c,thresholdLabel:l,unit:u}=e,f=ue(e.color)??`var(--color-chart-dark-yellow)`,p=ue(e.aboveThresholdColor)??`var(--color-chart-red)`,m=i.id,h=s.map(e=>e.href?{id:e.id??e.label,href:e.href}:null),_=Me(t,h),v=Re(s.length);i.measure({width:!0,height:v});let y=i.width,b=I(s.map(e=>e.label),y,{font:i.font}),{labelEnd:x,barStart:C}=b,w=Math.max(...s.map(e=>e.value),c??0)*1.15,T=e=>Math.max(40,y-C-60)*e/w,E=e=>`${d(e)}${u?` ${u}`:``}`,D=e=>{let t=s[e],n=c!=null&&t.value>c;return{title:t.label,rows:[{label:`Waarde`,value:E(t.value),color:n?p:f},...c==null?[]:[{label:`Norm`,value:E(c),color:`var(--color-chart-emphasis)`}]]}},O=xe(i,s.length,e=>({x:C+T(s[e].value),y:e*26+4,content:D(e)}));return r`
|
|
110
|
+
<figure class="lintje-chart lintje-chart--rows" ${g(i.attach)} ?data-in-view=${i.inView}
|
|
106
111
|
data-tooltip-anchor
|
|
107
|
-
@keydown=${e=>
|
|
108
|
-
<svg viewBox="0 0 ${
|
|
109
|
-
aria-labelledby="${
|
|
110
|
-
${
|
|
112
|
+
@keydown=${e=>i.dismiss(e)||_.escape(e)}>
|
|
113
|
+
<svg viewBox="0 0 ${y} ${v}" class="lintje-chart__svg" role=${ae(_.interactive)}
|
|
114
|
+
aria-labelledby="${m}-desc" width=${y} height=${v}
|
|
115
|
+
${o({height:`${v}px`,...Q(m)})}
|
|
111
116
|
tabindex="0" @keydown=${O.keydown} @focus=${O.focus} @blur=${O.blur}>
|
|
112
|
-
<desc id="${
|
|
113
|
-
<defs>${
|
|
114
|
-
${
|
|
115
|
-
<line x1=${
|
|
117
|
+
<desc id="${m}-desc">${a}</desc>
|
|
118
|
+
<defs>${X(m)}</defs>
|
|
119
|
+
${c==null?S:n`
|
|
120
|
+
<line x1=${C+T(c)} x2=${C+T(c)} y1=${4} y2=${s.length*26+2}
|
|
116
121
|
stroke="var(--color-chart-emphasis)" stroke-width="1" stroke-dasharray="3 3" />
|
|
117
|
-
<text x=${
|
|
118
|
-
${l??`norm ${c
|
|
122
|
+
<text x=${C+T(c)+6} y=${s.length*26+16} class="lintje-chart__axis-label">
|
|
123
|
+
${l??`norm ${d(c)}`}
|
|
119
124
|
</text>
|
|
120
125
|
`}
|
|
121
|
-
${
|
|
122
|
-
<g class="lintje-chart__bar-row ${
|
|
123
|
-
@mousemove=${e=>
|
|
124
|
-
@mouseleave=${
|
|
126
|
+
${s.map((e,t)=>{let r=t*26+4,a=c!=null&&e.value>c,l=T(e.value),m=_.of(h[t],e.label,`${e.label}: ${d(e.value)}${u?` ${u}`:``}`);return n`
|
|
127
|
+
<g class="lintje-chart__bar-row ${i.hoverIndex===t?`is-hovered`:``}"
|
|
128
|
+
@mousemove=${e=>O.point(e,t)}
|
|
129
|
+
@mouseleave=${O.leave}>
|
|
125
130
|
<!-- Hit area across the whole row, so the tooltip doesn't flicker between bars. -->
|
|
126
|
-
<rect x=${0} y=${
|
|
127
|
-
<text x=${
|
|
128
|
-
<rect class="lintje-chart__bar lintje-chart__bar--horizontal lintje-chart__mark ${
|
|
129
|
-
${
|
|
130
|
-
x=${
|
|
131
|
-
fill=${a?f
|
|
132
|
-
data-mark-id=${
|
|
133
|
-
aria-pressed=${
|
|
134
|
-
@click=${
|
|
135
|
-
<text x=${
|
|
136
|
-
class="lintje-chart__data-label ${
|
|
137
|
-
${
|
|
131
|
+
<rect x=${0} y=${r-5} width=${y} height=${26} fill="transparent" />
|
|
132
|
+
<text x=${x} y=${r+16-3} text-anchor="end" class="lintje-chart__axis-label">${b.fit(e.label)}</text>
|
|
133
|
+
<rect class="lintje-chart__bar lintje-chart__bar--horizontal lintje-chart__mark ${m.state}"
|
|
134
|
+
${o(M(t,s.length))}
|
|
135
|
+
x=${C} y=${r} width=${Math.max(0,l)} height=${16}
|
|
136
|
+
fill=${a?p:f}
|
|
137
|
+
data-mark-id=${m.markId} role=${m.role} tabindex=${m.tabIndex}
|
|
138
|
+
aria-pressed=${m.pressed} aria-label=${m.label}
|
|
139
|
+
@click=${m.click} @auxclick=${m.click} @keydown=${m.keydown} />
|
|
140
|
+
<text x=${C+l+6} y=${r+16-3} font-weight="700"
|
|
141
|
+
class="lintje-chart__data-label ${c==null?``:`lintje-chart__data-label--halo`}">
|
|
142
|
+
${d(e.value)}${u?` ${u}`:``}
|
|
138
143
|
</text>
|
|
139
144
|
</g>
|
|
140
145
|
`})}
|
|
141
146
|
</svg>
|
|
142
|
-
${N(
|
|
143
|
-
${Se(
|
|
147
|
+
${N(i)}
|
|
148
|
+
${Se(i)}
|
|
144
149
|
</figure>
|
|
145
|
-
`}function
|
|
146
|
-
<figure class="lintje-chart lintje-chart--rows" ${
|
|
147
|
-
data-tooltip-anchor @keydown=${e=>
|
|
148
|
-
<svg viewBox="0 0 ${
|
|
149
|
-
aria-labelledby="${
|
|
150
|
-
tabindex="0" @keydown=${
|
|
151
|
-
<desc id="${
|
|
152
|
-
${
|
|
153
|
-
<g class="lintje-chart__bar-row ${
|
|
154
|
-
@mousemove=${e=>
|
|
155
|
-
@mouseleave=${
|
|
156
|
-
<rect x=${0} y=${
|
|
157
|
-
<text x=${
|
|
158
|
-
<rect class="lintje-chart__bar lintje-chart__bar--horizontal" ${
|
|
159
|
-
x=${h} y=${
|
|
160
|
-
<text x=${
|
|
161
|
-
text-anchor=${
|
|
162
|
-
class="lintje-chart__data-label ${
|
|
150
|
+
`}function Be(e,t){let{controller:i,description:a}=t,{rows:c,target:l=100}=e,u=i.id,d=Re(c.length);i.measure({width:!0,height:d});let f=i.width,p=I(c.map(e=>e.label),f,{font:i.font}),{labelEnd:m,barStart:h}=p,_=e=>Math.max(40,f-h-70)*e/110,v=h+_(l),y=e=>e>=l?`var(--color-chart-green)`:`var(--color-attention)`,b=e=>({title:c[e].label,rows:[{label:`Voortgang`,value:s(c[e].value),color:y(c[e].value)},{label:`Doel`,value:s(l),color:`var(--color-chart-emphasis)`}]}),x=xe(i,c.length,e=>({x:h+_(c[e].value),y:e*26+4,content:b(e)}));return r`
|
|
151
|
+
<figure class="lintje-chart lintje-chart--rows" ${g(i.attach)} ?data-in-view=${i.inView}
|
|
152
|
+
data-tooltip-anchor @keydown=${e=>i.dismiss(e)}>
|
|
153
|
+
<svg viewBox="0 0 ${f} ${d}" class="lintje-chart__svg" role="img"
|
|
154
|
+
aria-labelledby="${u}-desc" width=${f} height=${d} ${o({height:`${d}px`})}
|
|
155
|
+
tabindex="0" @keydown=${x.keydown} @focus=${x.focus} @blur=${x.blur}>
|
|
156
|
+
<desc id="${u}-desc">${a}</desc>
|
|
157
|
+
${c.map((e,t)=>{let r=t*26+4,a=_(e.value),u=y(e.value),d=h+a+46>f,g=e.value>=l?`lintje-chart__data-label--inside`:`lintje-chart__data-label--inside-light`;return n`
|
|
158
|
+
<g class="lintje-chart__bar-row ${i.hoverIndex===t?`is-hovered`:``}"
|
|
159
|
+
@mousemove=${e=>x.point(e,t)}
|
|
160
|
+
@mouseleave=${x.leave}>
|
|
161
|
+
<rect x=${0} y=${r-5} width=${f} height=${26} fill="transparent" />
|
|
162
|
+
<text x=${m} y=${r+16-3} text-anchor="end" class="lintje-chart__axis-label">${p.fit(e.label)}</text>
|
|
163
|
+
<rect class="lintje-chart__bar lintje-chart__bar--horizontal" ${o(M(t,c.length))}
|
|
164
|
+
x=${h} y=${r} width=${Math.max(0,a)} height=${16} fill=${u} />
|
|
165
|
+
<text x=${d?h+a-6:h+a+6} y=${r+16-3}
|
|
166
|
+
text-anchor=${d?`end`:`start`}
|
|
167
|
+
class="lintje-chart__data-label ${d?g:``}" font-weight="700">${s(e.value)}</text>
|
|
163
168
|
</g>
|
|
164
169
|
`})}
|
|
165
|
-
<line x1=${
|
|
170
|
+
<line x1=${v} x2=${v} y1=${0} y2=${c.length*26+2}
|
|
166
171
|
stroke="var(--color-chart-emphasis)" stroke-width="1" stroke-dasharray="3 3" />
|
|
167
|
-
<text x=${
|
|
172
|
+
<text x=${v+6} y=${c.length*26+16} class="lintje-chart__axis-label">norm ${l}</text>
|
|
168
173
|
</svg>
|
|
169
|
-
${N(
|
|
170
|
-
${Se(
|
|
174
|
+
${N(i)}
|
|
175
|
+
${Se(i)}
|
|
171
176
|
</figure>
|
|
172
|
-
`}var
|
|
173
|
-
<g class="lintje-chart__bar-group ${
|
|
174
|
-
${
|
|
175
|
-
@mousemove=${e=>
|
|
176
|
-
@mouseleave=${
|
|
177
|
-
${f.map((
|
|
177
|
+
`}var Ve=/* @__PURE__ */ new WeakMap;function He(e,t){return e.duration>0?Math.min(1,(t-e.start)/e.duration):1}function Ue(e,t){let n=He(e,t);if(n>=1)return e.to;let r=e.ease(n);return e.to.map((t,n)=>e.from[n]+(t-e.from[n])*r)}function We(e,t,n){let r=performance.now(),i=Ve.get(e);if(!i||i.key!==t){let a={key:t,from:n,to:n,start:r,duration:0,ease:e=>e,element:i?.element,attach:e=>{a.element=e}};return Ve.set(e,a),n}if(i.to.some((e,t)=>e!==n[t])){let t=i.element,a=!t||u();if(i.from=a?n:Ue(i,r),i.to=n,i.start=r,i.duration=a?0:b(t,`--dur-layer`),i.ease=t?l(t,`--ease-in-motion`):e=>e,i.frame==null&&i.duration>0){let t=i,n=()=>{t.frame=void 0;let r=He(t,performance.now())>=1;e.requestUpdate(),r||(t.frame=requestAnimationFrame(n))};t.frame=requestAnimationFrame(n)}}return Ue(i,r)}function Ge(e){return Ve.get(e)}function Ke(e,t){let{controller:i,description:a}=t,{labels:s,axisTitle:c,small:l=!1}=e,u=i.id;i.measure({width:!0,height:t.height??(l?`--chart-h-small`:`--chart-h-main`),fit:!!t.expanded&&!t.mobile});let f=e.series.map((e,t)=>({...e,color:ue(e.color)??(t===0?`var(--color-chart-default)`:`var(--color-chart-secondary)`),hidden:i.hiddenSeries.includes(e.label)})),m=f.filter(e=>!e.hidden),h=Me(t,m.flatMap(e=>e.links??[])),{max:v,ticks:y}=H(Math.max(...f.flatMap(e=>e.values),1)),b=V(y,i.width,{font:i.font}),x=A(t,{left:b.width}),C=x.height-x.bottom,w=G(0,s.length,x).width/Math.max(1,m.length),T=We(i,f.map(e=>e.label).join(`\0`),f.map(e=>+!e.hidden)),E=Ge(i),D=G(0,s.length,x).width/Math.max(1,T.reduce((e,t)=>e+t,0)),O=T.map((e,t)=>T.slice(0,t).reduce((e,t)=>e+t,0)*D),k=m.every(e=>e.values.every(e=>_(p(e,w),w-2))),j=f.map(e=>({label:e.label,color:e.color,shape:`square`,hidden:e.hidden,fixed:f.length<2})),P=e=>({title:s[e],rows:m.map(t=>({label:t.label,value:d(t.values[e]),color:t.color}))}),F=xe(i,s.length,e=>({x:G(e,s.length,x).center,y:B(Math.max(0,...m.map(t=>t.values[e])),v,x),content:P(e)})),I=[],L=s.map((e,t)=>{let r=G(t,s.length,x);return n`
|
|
178
|
+
<g class="lintje-chart__bar-group ${i.hoverIndex===t?`is-hovered`:``}"
|
|
179
|
+
${o(M(t,s.length))}
|
|
180
|
+
@mousemove=${e=>F.point(e,t)}
|
|
181
|
+
@mouseleave=${F.leave}>
|
|
182
|
+
${f.map((i,a)=>{let o=i.values[t],s=B(o,v,x),c=r.x+O[a],l=Math.max(0,T[a]*D-2),u=i.hidden?void 0:h.of(i.links?.[t],`${e} · ${i.label}`,`${e}, ${i.label}: ${d(o)}`);return I.push({x:c,y:s,width:l,height:Math.max(0,C-s),mark:u}),n`
|
|
178
183
|
<g>
|
|
179
|
-
<rect class="lintje-chart__bar lintje-chart__mark ${
|
|
180
|
-
x=${
|
|
181
|
-
height=${Math.max(0,
|
|
182
|
-
data-mark-id=${
|
|
183
|
-
tabindex=${
|
|
184
|
-
aria-label=${
|
|
185
|
-
@click=${
|
|
184
|
+
<rect class="lintje-chart__bar lintje-chart__mark ${u?.state??``}"
|
|
185
|
+
x=${c} y=${s} width=${l}
|
|
186
|
+
height=${Math.max(0,C-s)} fill=${i.color}
|
|
187
|
+
data-mark-id=${u?.markId??S} role=${u?.role??S}
|
|
188
|
+
tabindex=${u?.tabIndex??S} aria-pressed=${u?.pressed??S}
|
|
189
|
+
aria-label=${u?.label??S} aria-hidden=${u?S:`true`}
|
|
190
|
+
@click=${u?.click??S} @auxclick=${u?.click??S} @keydown=${u?.keydown??S} />
|
|
186
191
|
<!-- Every label keeps its node and fades, so one that fits after a switch does not
|
|
187
192
|
draw in again. -->
|
|
188
|
-
<g class="lintje-chart__series ${!
|
|
189
|
-
<text x=${
|
|
190
|
-
class="lintje-chart__data-label">${
|
|
193
|
+
<g class="lintje-chart__series ${!i.hidden&&k?``:`is-off`}">
|
|
194
|
+
<text x=${c+l/2} y=${s-4} text-anchor="middle"
|
|
195
|
+
class="lintje-chart__data-label">${p(o,w)}</text>
|
|
191
196
|
</g>
|
|
192
197
|
</g>
|
|
193
198
|
`})}
|
|
194
199
|
</g>
|
|
195
|
-
`});return
|
|
196
|
-
<div class="lintje-chart-wrap ${
|
|
197
|
-
${
|
|
198
|
-
@keydown=${e=>
|
|
199
|
-
${ce({items:j,onToggle:e=>
|
|
200
|
-
${oe({
|
|
201
|
-
${N(
|
|
202
|
-
${Se(
|
|
200
|
+
`});return r`
|
|
201
|
+
<div class="lintje-chart-wrap ${l?`lintje-chart--small`:``}"
|
|
202
|
+
${g(i.attach)} ?data-in-view=${i.inView} data-tooltip-anchor
|
|
203
|
+
@keydown=${e=>i.dismiss(e)||h.escape(e)}>
|
|
204
|
+
${ce({items:j,onToggle:e=>i.toggleSeries(e)})}
|
|
205
|
+
${oe({font:i.font,id:u,ticks:y,max:v,area:x,axisTitle:c,description:a,formatTick:b.format,xLabels:s.map((e,t)=>({label:e,x:G(t,s.length,x).center})),interactive:h.interactive,keys:F},Fe(x,I,n`<g ${g(E.attach)}>${L}</g>`))}
|
|
206
|
+
${N(i)}
|
|
207
|
+
${Se(i)}
|
|
203
208
|
</div>
|
|
204
|
-
`}var
|
|
205
|
-
<g class="lintje-chart__bar-group ${
|
|
206
|
-
${
|
|
207
|
-
@mousemove=${e=>
|
|
208
|
-
@mouseleave=${
|
|
209
|
+
`}var qe=[[1],[1,4],[1,2,4],[1,2,3,4],[1,2,3,4,5]];function Je(e){return e<1?[]:qe[Math.min(e,qe.length)-1]}function Ye(e,t){let n=Je(e);return v(t)?n.map(e=>e===1?`var(--color-chart-${t})`:`var(--color-chart-${t}-tint-${e})`):n.map(e=>`var(--color-chart-tint-${e})`)}var Xe=e=>e.reduce((e,t)=>e+(t??0),0),Ze=e=>Array.isArray(e.folded),Qe=e=>e.color===`other`||e.label.toLowerCase().startsWith(`overig`),$e=e=>e.color===`other`||e.color==null&&Qe(e);function et(e,t){let n=e.filter(e=>t(e)&&!Qe(e)),r=e.find(Qe);if(n.length+ +!!r<=5)return[...e];let i=new Set([...n].sort((e,t)=>Xe(t.values)-Xe(e.values)).slice(0,4)),a=n.filter(e=>!i.has(e)),o=r?[r,...a]:a,s=a[0].values.map((e,t)=>o.some(e=>e.values[t]==null)?null:o.reduce((e,n)=>e+n.values[t],0)),c={label:r?.label??`Overig`,values:s,color:`other`,folded:a},l=e.filter(e=>!a.includes(e));return r?l.map(e=>e===r?c:e):[...l,c]}function tt(e,t){let{controller:i,description:a}=t,{labels:c,axisTitle:l,normalized:u=!1,totalOnTop:f=!0,small:m=!1}=e,h=i.id;i.measure({width:!0,height:t.height??(m?`--chart-h-small`:`--chart-h-main`),fit:!!t.expanded&&!t.mobile});let v=et(e.series,e=>e.color==null),y=v.filter(e=>e.color==null&&!Qe(e)).length,b=y>0&&v.some($e),x=y+ +!!b,C=0,w=v.map((e,t)=>{let n=$e(e);return{...e,values:e.values,links:Ze(e)?void 0:e.links,folded:Ze(e)?e.folded:[],j:t,rung:n?b?x-1:-1:e.color==null?C++:-1,color:n?b?void 0:ue(`other`):ue(e.color),hidden:i.hiddenSeries.includes(e.label)}}),T=w.filter(e=>!e.hidden),E=Me(t,T.flatMap(e=>e.links??[])),D=c.map((e,t)=>w.reduce((e,n)=>e+n.values[t],0)),O=c.map((e,t)=>T.reduce((e,n)=>e+n.values[t],0)),k=(e,t)=>e/(D[t]||1)*100,j=We(i,w.map(e=>e.label).join(`\0`),w.map(e=>+!e.hidden)),P=Ge(i),{max:F,ticks:I}=u?{max:100,ticks:[0,25,50,75,100]}:H(Math.max(...D,1)),z=V(I,i.width,{font:i.font}),U=A(t,{left:z.width}),W=U.height-U.bottom,{width:ee,bandWidth:K}=G(0,c.length,U),q=f&&!u,J=q&&O.every(e=>_(p(e,K),K-4)),Y=Ye(x),X=e=>e.color??Y[e.rung],te=Je(x),ne=e=>{let t=v[e].color;if(t===`remainder`)return`lintje-chart__data-label--inside-text`;let{rung:n}=w[e],r=n>=0?L(void 0,te[n]):L(t,1);return r?R(r):null},Z=e=>({title:c[e],rows:T.flatMap(t=>[{label:t.label,value:u?s(k(t.values[e],e)):d(t.values[e]),color:X(t)},...t.folded.map(t=>({label:t.label,value:u?s(k(t.values[e],e)):d(t.values[e]),part:!0}))])}),Q=xe(i,c.length,e=>({x:G(e,c.length,U).center,y:B(u?k(O[e],e):O[e],F,U),content:Z(e)})),re=w.map(e=>({label:e.label,color:X(e),shape:`square`,hidden:e.hidden,fixed:w.length<2})),$=[],ie=c.map((e,t)=>{let r=G(t,c.length,U),a=0,l=w.map(e=>{let{j:n}=e,r=e.values[t],i=u?k(r,t):r,o=B(a,F,U);a+=i*j[n];let s=B(a,F,U);return{row:e,j:n,value:i,y1:s,height:Math.max(0,o-s)}}),f=B(a,F,U);return n`
|
|
210
|
+
<g class="lintje-chart__bar-group ${i.hoverIndex===t?`is-hovered`:``}"
|
|
211
|
+
${o(M(t,c.length))}
|
|
212
|
+
@mousemove=${e=>Q.point(e,t)}
|
|
213
|
+
@mouseleave=${Q.leave}>
|
|
209
214
|
<!-- The hit area under the whole column, so the tooltip also follows the empty
|
|
210
215
|
space above the stack. It lies *under* the segments: on top it swallowed
|
|
211
216
|
every click on a segment that drills. -->
|
|
212
|
-
<rect x=${
|
|
217
|
+
<rect x=${r.x} y=${U.top} width=${r.width} height=${W-U.top} fill="transparent" />
|
|
213
218
|
<!-- The segments in one group, so the column lifts on hover as a whole. -->
|
|
214
219
|
<g class="lintje-chart__bar">
|
|
215
|
-
${
|
|
216
|
-
<rect class="lintje-chart__mark lintje-chart__segment ${
|
|
217
|
-
x=${
|
|
218
|
-
fill=${
|
|
219
|
-
data-mark-id=${
|
|
220
|
-
tabindex=${
|
|
221
|
-
aria-label=${
|
|
222
|
-
@click=${
|
|
220
|
+
${l.map(i=>{let a=i.row.hidden?void 0:E.of(i.row.links?.[t],`${e} · ${i.row.label}`,`${e}, ${i.row.label}: ${d(i.row.values[t])}`);return $.push({x:r.x,y:i.y1,width:r.width,height:i.height,mark:a}),n`
|
|
221
|
+
<rect class="lintje-chart__mark lintje-chart__segment ${a?.state??``}"
|
|
222
|
+
x=${r.x} y=${i.y1} width=${r.width} height=${i.height}
|
|
223
|
+
fill=${X(i.row)}
|
|
224
|
+
data-mark-id=${a?.markId??S} role=${a?.role??S}
|
|
225
|
+
tabindex=${a?.tabIndex??S} aria-pressed=${a?.pressed??S}
|
|
226
|
+
aria-label=${a?.label??S} aria-hidden=${a?S:`true`}
|
|
227
|
+
@click=${a?.click??S} @auxclick=${a?.click??S} @keydown=${a?.keydown??S} />
|
|
223
228
|
`})}
|
|
224
229
|
</g>
|
|
225
230
|
<!-- Percentages inside the segments when they are >= 16 px tall and fit the width. Each
|
|
226
231
|
keeps its node and fades, so a switch does not draw it in again. -->
|
|
227
|
-
${
|
|
228
|
-
<g class="lintje-chart__series ${!e.row.hidden&&
|
|
229
|
-
<text x=${
|
|
230
|
-
class="lintje-chart__data-label ${
|
|
232
|
+
${u?l.map(e=>n`
|
|
233
|
+
<g class="lintje-chart__series ${!e.row.hidden&&ne(e.j)&&e.height>=16&&_(s(e.value),ee-4)?``:`is-off`}">
|
|
234
|
+
<text x=${r.center} y=${e.y1+e.height/2+4} text-anchor="middle"
|
|
235
|
+
class="lintje-chart__data-label ${ne(e.j)??``}">${s(e.value)}</text>
|
|
231
236
|
</g>`):S}
|
|
232
|
-
${
|
|
233
|
-
<text x=${
|
|
234
|
-
class="lintje-chart__data-label" font-weight="700">${
|
|
237
|
+
${q?n`<g class="lintje-chart__series ${J?``:`is-off`}">
|
|
238
|
+
<text x=${r.center} y=${f-5} text-anchor="middle"
|
|
239
|
+
class="lintje-chart__data-label" font-weight="700">${p(O[t],r.bandWidth)}</text>
|
|
235
240
|
</g>`:S}
|
|
236
241
|
</g>
|
|
237
|
-
`});return
|
|
238
|
-
<div class="lintje-chart-wrap ${
|
|
239
|
-
${
|
|
240
|
-
@keydown=${e=>
|
|
241
|
-
${ce({items:
|
|
242
|
-
${oe({
|
|
243
|
-
${N(
|
|
244
|
-
${Se(
|
|
242
|
+
`});return r`
|
|
243
|
+
<div class="lintje-chart-wrap ${m?`lintje-chart--small`:``}"
|
|
244
|
+
${g(i.attach)} ?data-in-view=${i.inView} data-tooltip-anchor
|
|
245
|
+
@keydown=${e=>i.dismiss(e)||E.escape(e)}>
|
|
246
|
+
${ce({items:re,onToggle:e=>i.toggleSeries(e)})}
|
|
247
|
+
${oe({font:i.font,id:h,ticks:I,max:F,area:U,axisTitle:l,description:a,formatTick:z.format,xLabels:c.map((e,t)=>({label:e,x:G(t,c.length,U).center})),interactive:E.interactive,keys:Q},Fe(U,$,n`<g ${g(P.attach)}>${ie}</g>`))}
|
|
248
|
+
${N(i)}
|
|
249
|
+
${Se(i)}
|
|
245
250
|
</div>
|
|
246
|
-
`}var
|
|
247
|
-
${e.segments.map(e=>
|
|
248
|
-
points=${`${
|
|
249
|
-
${e.fits?
|
|
251
|
+
`}var nt=`geen gegevens`;function rt(e,t){let{controller:i,description:a}=t,{labels:o,axisTitle:s,unit:c,small:l=!1}=e,u=i.id,f=o.length;i.measure({width:!0,height:t.height??(l?`--chart-h-small`:`--chart-h-main`),fit:!!t.expanded&&!t.mobile});let p=et(e.series,()=>!0),m=p.filter($e).length,h=Ye(p.length-m+ +!!m,e.color),_=0,v=p.map(e=>({...e,folded:Ze(e)?e.folded:[],color:$e(e)?h[h.length-1]:h[_++],hidden:i.hiddenSeries.includes(e.label)})),y=v.filter(e=>!e.hidden),b=We(i,v.map(e=>e.label).join(`\0`),v.map(e=>+!e.hidden)),C=b.some((e,t)=>e!==+!v[t].hidden),w=Ge(i),T=v.map(()=>o.map(()=>!1)),E=v.map(()=>o.map(()=>0)),D=v.map(()=>o.map(()=>0)),O=o.map(()=>!1);o.forEach((e,t)=>{let n=0;v.forEach((e,r)=>{if(b[r]===0)return;let i=e.values[t];O[t]||i==null?O[t]=!0:(T[r][t]=!0,E[r][t]=n,n+=i*b[r],D[r][t]=n)})});let k=b.some(e=>e>0),j=o.map((e,t)=>v.map(e=>e.values[t]).filter(e=>e!=null)).filter(e=>e.length>0).map(e=>e.reduce((e,t)=>e+t,0)),{max:M,ticks:P}=H(Math.max(...j,1)),F=V(P,i.width,{font:i.font,minimum:Math.ceil(x(o[0]??``,i.font)/2)}),I=A(t,{left:F.width}),L=I.height-I.bottom,R=e=>q(e,f,I),z=e=>B(e,M,I),U=e=>{let t=[];return o.forEach((n,r)=>{if(!e(r))return;let i=t[t.length-1];i&&i[i.length-1]===r-1?i.push(r):t.push([r])}),t},W=o.map((e,t)=>{let n=0;for(let e of y){let r=e.values[t];if(r==null)return{level:n,complete:!1};n+=r}return{level:n,complete:y.length>0}}),G=v.map(e=>({label:e.label,color:e.color,shape:`square`,hidden:e.hidden,fixed:v.length<2})),ee=Math.max(1,Math.ceil(f/8)),K=o.map((e,t)=>({label:e,x:R(t),i:t})).filter(e=>e.i%ee===0),J=y.length<v.length?`Totaal getoond`:`Totaal`;function Y(e){return{title:o[e],rows:[...[...y].reverse().flatMap(t=>[{label:t.label,value:t.values[e]==null?nt:d(t.values[e]),color:t.color},...t.folded.map(t=>({label:t.label,value:t.values[e]==null?nt:d(t.values[e]),part:!0}))]),...y.length>0?[{label:J,value:W[e].complete?d(W[e].level):nt,divider:!0}]:[]]}}let X=xe(i,f,e=>({x:R(e),y:W[e].level>0?z(W[e].level):I.top,content:Y(e)})),te=e=>{let t=[0,0];return v.forEach((n,r)=>{T[r][e]&&T[r][e+1]&&(t=[D[r][e],D[r][e+1]])}),t},ne=(k?U(e=>O[e]):[]).map(e=>{let t=Math.max(0,e[0]-1),n=Math.min(f-1,e[e.length-1]+1),r=Array.from({length:n-t},(e,n)=>t+n).map(e=>{let[t,n]=te(e);return{k:e,left:z(t),right:z(n)}}),a=R(t),o=R(n)-a,s=Math.min(L,...r.flatMap(e=>[e.left,e.right]));return{segments:r,from:a,width:o,ceiling:s,fits:x(nt,i.font)+8<=o&&s-I.top>=20}}),Z=(e,t)=>t.map(t=>`${R(t)},${z(e[t])}`),Q=[ne.map(e=>n`
|
|
252
|
+
${e.segments.map(e=>n`<polygon fill="url(#hatch-${u})"
|
|
253
|
+
points=${`${R(e.k)},${I.top} ${R(e.k+1)},${I.top} ${R(e.k+1)},${e.right} ${R(e.k)},${e.left}`} />`)}
|
|
254
|
+
${e.fits?n`<text x=${e.from+e.width/2} y=${(I.top+e.ceiling)/2+4}
|
|
250
255
|
text-anchor="middle"
|
|
251
|
-
class="lintje-chart__as-of-note lintje-chart__data-label--halo">${
|
|
252
|
-
`),
|
|
253
|
-
${
|
|
254
|
-
${
|
|
255
|
-
points=${[...
|
|
256
|
+
class="lintje-chart__as-of-note lintje-chart__data-label--halo">${nt}</text>`:S}
|
|
257
|
+
`),n`<g class="lintje-chart__reveal" ${g(w.attach)}>
|
|
258
|
+
${v.map((e,t)=>{let r=U(e=>T[t][e]);return n`<g>
|
|
259
|
+
${r.map(r=>r.length===1?n`<circle cx=${R(r[0])} cy=${z(D[t][r[0]])} r="2.5" fill=${e.color} />`:n`<polygon fill=${e.color}
|
|
260
|
+
points=${[...Z(D[t],r),...Z(E[t],r).reverse()].join(` `)} />`)}
|
|
256
261
|
</g>`})}
|
|
257
262
|
<!-- Between two parts a 1 px line in the surface: along each part's lower edge, not the floor. -->
|
|
258
|
-
${
|
|
259
|
-
</g>`,
|
|
260
|
-
cx=${
|
|
261
|
-
<rect x=${
|
|
262
|
-
height=${
|
|
263
|
+
${v.map((e,t)=>U(e=>T[t][e]&&E[t][e]>0).filter(e=>e.length>1).map(e=>n`<polyline class="lintje-chart__segment" fill="none" points=${Z(E[t],e).join(` `)} />`))}
|
|
264
|
+
</g>`,i.hoverIndex!=null&&!C?v.map((e,t)=>T[t][i.hoverIndex]?n`<circle class="lintje-chart__hover-point" r="4" fill=${e.color}
|
|
265
|
+
cx=${R(i.hoverIndex)} cy=${z(D[t][i.hoverIndex])} />`:S):S,o.map((e,t)=>{let r=pe(I)/Math.max(1,f-1);return n`
|
|
266
|
+
<rect x=${R(t)-r/2} y=${I.top} width=${r}
|
|
267
|
+
height=${L-I.top}
|
|
263
268
|
fill="transparent"
|
|
264
|
-
@mousemove=${e=>
|
|
265
|
-
@mouseleave=${
|
|
266
|
-
`})];return
|
|
269
|
+
@mousemove=${e=>X.point(e,t)}
|
|
270
|
+
@mouseleave=${X.leave} />
|
|
271
|
+
`})];return r`
|
|
267
272
|
<div class="lintje-chart-wrap ${l?`lintje-chart--small`:``}"
|
|
268
|
-
${
|
|
269
|
-
@keydown=${e=>
|
|
270
|
-
${ce({items:
|
|
271
|
-
${oe({
|
|
272
|
-
${N(
|
|
273
|
-
${Se(
|
|
273
|
+
${g(i.attach)} ?data-in-view=${i.inView} data-tooltip-anchor
|
|
274
|
+
@keydown=${e=>i.dismiss(e)}>
|
|
275
|
+
${ce({items:G,onToggle:e=>i.toggleSeries(e)})}
|
|
276
|
+
${oe({font:i.font,id:u,ticks:P,max:M,area:I,formatTick:F.format,axisTitle:s??c,xLabels:K,description:a,keys:X},Q)}
|
|
277
|
+
${N(i)}
|
|
278
|
+
${Se(i)}
|
|
274
279
|
</div>
|
|
275
|
-
`}var
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
280
|
+
`}var it=5,at=e=>{let t=e.label.toLowerCase();return e.color===`other`||t.startsWith(`overig`)||t===`rest`},ot=e=>!e.remainder&&!at(e);function st(e){let t=e.filter(ot).sort((e,t)=>t.value-e.value),n=e.filter(e=>!e.remainder&&at(e)),r=e.filter(e=>e.remainder);if(t.length>(n.length>0?4:it)){let e=t.splice(4).reduce((e,t)=>e+t.value,0);if(n.length>0){let[t]=n;n[0]={label:t.label,value:t.value+e,color:t.color}}else n.push({label:`Overig`,value:e})}return[...t,...n,...r]}function ct(e,t){let{controller:i,description:a}=t,{donut:c=!1,centerValue:l,centerLabel:u,legendTable:f=!0,labelHeader:p=`Categorie`}=e,m=i.id,h=st(e.segments),_=h.map(e=>({...e,color:ue(e.color)})),v=_.map(e=>e.href?{id:e.id??e.label,href:e.href}:null),y=Me(t,v),b=e=>{let t=y.of(v[e],_[e].label,_[e].label).state;return t.includes(`is-selected`)?`is-selected`:t.includes(`is-muted`)?`is-muted`:``},x=!!t.expanded;i.measure(x?{width:!0,height:`--chart-h-main`,fit:!f}:{});let C=x?Math.max(240,Math.min(560,i.height-24)):e.size??200,w=_.reduce((e,t)=>e+t.value,0),T=C/2,E=c?T*.62:0,D=h.filter(ot),O=D.some(e=>e.color==null),k=h.some(e=>!e.remainder&&at(e)),A=Ye(D.length+(O&&k?1:0),e.color),j=-1,M=h.map((e,t)=>(ot(e)&&(j+=1),(e.color===`other`?void 0:_[t].color)??(e.remainder?`var(--color-chart-remainder)`:at(e)?O?A[A.length-1]:`var(--color-chart-other)`:A[Math.min(j,A.length-1)]))),P=(e,t)=>[T+t*Math.cos(e*Math.PI/180),T+t*Math.sin(e*Math.PI/180)],F=-90,I=_.map((e,t)=>{let n=e.value/w,r=F,i=F+n*360;F=i;let a=+(n>.5),[o,s]=P(r,T),[l,u]=P(i,T);return{segment:e,i:t,d:c?(()=>{let[e,t]=P(i,E),[n,c]=P(r,E);return`M ${o} ${s} A ${T} ${T} 0 ${a} 1 ${l} ${u} L ${e} ${t} A ${E} ${E} 0 ${a} 0 ${n} ${c} Z`})():`M ${T} ${T} L ${o} ${s} A ${T} ${T} 0 ${a} 1 ${l} ${u} Z`,color:M[t],middle:(r+i)/2}}),L=i.hoverIndex,R=L==null?void 0:I[L],z=(e,t)=>{let n=r`<span class="lintje-pie-chart__label-inner">
|
|
281
|
+
<span class="lintje-pie-chart__marker" ${o({background:M[t]})}></span>${e.label}
|
|
282
|
+
</span>`,i=y.of(v[t],e.label,e.label),a=i.click;return!i.clickable||a===S?n:i.role===`link`?r`<a class="lintje-pie-chart__action" href=${v[t].href}
|
|
283
|
+
@click=${e=>{e.preventDefault(),a(e)}}
|
|
284
|
+
@auxclick=${e=>{e.preventDefault(),a(e)}}>${n}</a>`:r`<button type="button" class="lintje-pie-chart__action" aria-pressed=${i.pressed}
|
|
285
|
+
@click=${a}>${n}</button>`},B=e=>{i.hoverIndex=e,i.requestUpdate()},V=e=>`${d(e.value)} · ${s(e.value/w*100)}`,H=e=>({title:_[e].label,rows:[{label:`Aantal`,value:V(_[e]),color:M[e]}]}),U=xe(i,I.length,e=>{let[t,n]=P(I[e].middle,(T+E)/2);return{x:t,y:n,content:H(e)}});return r`
|
|
286
|
+
<div class="lintje-pie-chart ${x?`lintje-pie-chart--expanded`:``} ${f?``:`lintje-pie-chart--legend`}"
|
|
287
|
+
${g(i.attach)} ?data-in-view=${i.inView} data-tooltip-anchor
|
|
288
|
+
@keydown=${e=>i.dismiss(e)||y.escape(e)}>
|
|
289
|
+
${f?S:ce({items:_.map((e,t)=>({label:e.label,color:M[t],key:String(t)})),onEmphasis:e=>B(e==null?null:Number(e))})}
|
|
290
|
+
<svg viewBox="0 0 ${C} ${C}" width=${C} height=${C} role=${ae(y.interactive)}
|
|
291
|
+
class="lintje-pie-chart__svg" aria-labelledby="${m}-desc" ${o(Q(m))}
|
|
292
|
+
tabindex="0" @keydown=${U.keydown} @focus=${U.focus} @blur=${U.blur}>
|
|
293
|
+
<desc id="${m}-desc">${a}</desc>
|
|
284
294
|
<defs>
|
|
285
|
-
${
|
|
295
|
+
${X(m)}
|
|
286
296
|
<!-- The draw-in: a ring as wide as the pie, its dash swept from twelve o'clock clockwise,
|
|
287
297
|
as the slices run. Past the edge, so a lifted slice is never cut off. -->
|
|
288
|
-
<mask id="${
|
|
289
|
-
<circle class="lintje-pie-chart__sweep" cx=${
|
|
290
|
-
fill="none" stroke="white" stroke-width=${
|
|
291
|
-
transform="rotate(-90 ${
|
|
298
|
+
<mask id="${m}-sweep" maskUnits="userSpaceOnUse" x=${-T} y=${-T} width=${C*2} height=${C*2}>
|
|
299
|
+
<circle class="lintje-pie-chart__sweep" cx=${T} cy=${T} r=${T*.55}
|
|
300
|
+
fill="none" stroke="white" stroke-width=${T*1.1} pathLength="1"
|
|
301
|
+
transform="rotate(-90 ${T} ${T})" />
|
|
292
302
|
</mask>
|
|
293
303
|
</defs>
|
|
294
|
-
<g mask="url(#${
|
|
295
|
-
${
|
|
304
|
+
<g mask="url(#${m}-sweep)">
|
|
305
|
+
${I.map(({segment:e,i:t,d:r,color:i})=>{let a=y.of(v[t],e.label,`${e.label}: ${V(e)}`);return n`
|
|
296
306
|
<path d=${r} fill=${i}
|
|
297
|
-
class="lintje-pie-chart__segment lintje-chart__mark lintje-chart__segment ${
|
|
298
|
-
${
|
|
299
|
-
data-mark-id=${
|
|
300
|
-
aria-pressed=${
|
|
301
|
-
@click=${
|
|
302
|
-
@mousemove=${e=>
|
|
303
|
-
@mouseleave=${
|
|
307
|
+
class="lintje-pie-chart__segment lintje-chart__mark lintje-chart__segment ${L===t?`is-hovered`:``} ${a.state}"
|
|
308
|
+
${o({"transform-origin":`${T}px ${T}px`})}
|
|
309
|
+
data-mark-id=${a.markId} role=${a.role} tabindex=${a.tabIndex}
|
|
310
|
+
aria-pressed=${a.pressed} aria-label=${a.label}
|
|
311
|
+
@click=${a.click} @auxclick=${a.click} @keydown=${a.keydown}
|
|
312
|
+
@mousemove=${e=>U.point(e,t)}
|
|
313
|
+
@mouseleave=${U.leave} />
|
|
304
314
|
`})}
|
|
305
315
|
</g>
|
|
306
316
|
<!-- The hovered segment once more on top, lifted with a light shadow: in place, the
|
|
307
317
|
next segment would cover that shadow on one side (user test 13 Sep). -->
|
|
308
|
-
${
|
|
309
|
-
${
|
|
310
|
-
${
|
|
311
|
-
<text x=${
|
|
312
|
-
${u?
|
|
318
|
+
${R?n`<path d=${R.d} fill=${R.color} class="lintje-pie-chart__lift lintje-chart__segment"
|
|
319
|
+
${o({"transform-origin":`${T}px ${T}px`})} aria-hidden="true" />`:S}
|
|
320
|
+
${c&&l?n`
|
|
321
|
+
<text x=${T} y=${T+2} text-anchor="middle" class="lintje-pie-chart__center">${l}</text>
|
|
322
|
+
${u?n`<text x=${T} y=${T+20} text-anchor="middle" class="lintje-chart__axis-label">${u}</text>`:S}
|
|
313
323
|
`:S}
|
|
314
324
|
</svg>
|
|
315
325
|
|
|
316
|
-
${
|
|
326
|
+
${f?r`
|
|
317
327
|
<table class="lintje-pie-chart__table">
|
|
318
|
-
<caption class="visually-hidden">Legenda: ${
|
|
328
|
+
<caption class="visually-hidden">Legenda: ${a}</caption>
|
|
319
329
|
<thead>
|
|
320
330
|
<tr>
|
|
321
|
-
<th scope="col" class="lintje-pie-chart__column-label">${
|
|
331
|
+
<th scope="col" class="lintje-pie-chart__column-label">${p}</th>
|
|
322
332
|
<th scope="col" class="lintje-pie-chart__column-label lintje-pie-chart__column-label--numeric">aantal</th>
|
|
323
333
|
<th scope="col" class="lintje-pie-chart__column-label lintje-pie-chart__column-label--numeric">%</th>
|
|
324
334
|
</tr>
|
|
325
335
|
</thead>
|
|
326
336
|
<tbody>
|
|
327
|
-
${
|
|
328
|
-
<tr class="lintje-pie-chart__row ${
|
|
329
|
-
@mouseenter=${()=>
|
|
330
|
-
<th scope="row" class="lintje-pie-chart__label">
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
</span>
|
|
334
|
-
</th>
|
|
335
|
-
<td class="lintje-pie-chart__value">${c(e.value)}</td>
|
|
336
|
-
<td class="lintje-pie-chart__value">${r(e.value/x*100)}</td>
|
|
337
|
+
${_.map((e,t)=>r`
|
|
338
|
+
<tr class="lintje-pie-chart__row ${L===t?`is-hovered`:``} ${b(t)}"
|
|
339
|
+
@mouseenter=${()=>B(t)} @mouseleave=${()=>B(null)}>
|
|
340
|
+
<th scope="row" class="lintje-pie-chart__label">${z(e,t)}</th>
|
|
341
|
+
<td class="lintje-pie-chart__value">${d(e.value)}</td>
|
|
342
|
+
<td class="lintje-pie-chart__value">${s(e.value/w*100)}</td>
|
|
337
343
|
</tr>
|
|
338
344
|
`)}
|
|
339
345
|
</tbody>
|
|
340
346
|
<tfoot>
|
|
341
347
|
<tr>
|
|
342
348
|
<th scope="row" class="lintje-pie-chart__total-label">Totaal</th>
|
|
343
|
-
<td class="lintje-pie-chart__total">${
|
|
349
|
+
<td class="lintje-pie-chart__total">${d(w)}</td>
|
|
344
350
|
<td class="lintje-pie-chart__total"></td>
|
|
345
351
|
</tr>
|
|
346
352
|
</tfoot>
|
|
347
353
|
</table>
|
|
348
354
|
`:S}
|
|
349
|
-
${N(
|
|
350
|
-
${Se(
|
|
355
|
+
${N(i)}
|
|
356
|
+
${Se(i)}
|
|
351
357
|
</div>
|
|
352
|
-
`}function
|
|
358
|
+
`}function lt(e,t){let{controller:i,description:a}=t,{labels:s,threshold:c,thresholdLabel:l,small:u=!1,pendingHours:f=0}=e,p={...e.left,color:ue(e.left.color)},m={...e.right,color:ue(e.right.color)},h=i.id;i.measure({width:!0,height:t.height??(u?`--chart-h-small`:`--chart-h-main`),fit:!!t.expanded&&!t.mobile});let _=p.color??`var(--color-chart-default)`,v=m.color??`var(--color-chart-dark-yellow)`,y=H(Math.max(...p.values.filter(e=>e!=null),1)),b=H(Math.max(...m.values.filter(e=>e!=null),c??0,1)),x=V(y.ticks,i.width,{font:i.font}),C=V(b.ticks,i.width,{font:i.font}),w=A(t,{left:x.width,right:C.width}),T=w.height-w.bottom,E=i.hiddenSeries.includes(`left`),D=i.hiddenSeries.includes(`right`),O=i.hiddenSeries.includes($),k=e=>`lintje-chart__series ${e?`is-off`:``}`,j=[{key:`left`,label:`${p.label} (linkeras)`,color:_,shape:`square`,hidden:E},{key:`right`,label:`${m.label} (rechteras)`,color:v,shape:`line`,hidden:D},...c==null?[]:[{key:$,label:l??`Norm ${c}`,color:`var(--color-chart-emphasis)`,shape:`dashed`,hidden:O}]],P=Math.max(1,Math.ceil(s.length/8)),F=i.hoverIndex,I=W(v),L=[[]];m.values.forEach((e,t)=>{e==null?L[L.length-1].length&&L.push([]):L[L.length-1].push(`${G(t,s.length,w).center},${B(e,b.max,w)}`)});let R=(e,t)=>e==null?`geen gegevens`:`${d(e)}${t?` ${t}`:``}`,z=e=>({title:s[e],rows:[...E?[]:[{label:p.label,value:R(p.values[e],p.unit),color:_}],...D?[]:[{label:m.label,value:R(m.values[e],m.unit),color:v}]]}),U=xe(i,s.length,e=>({x:G(e,s.length,w).center,y:Math.min(E||p.values[e]==null?T:B(p.values[e],y.max,w),D||m.values[e]==null?T:B(m.values[e],b.max,w)),content:z(e)}));return r`
|
|
353
359
|
<div class="lintje-chart-wrap ${u?`lintje-chart--small`:``}"
|
|
354
|
-
${
|
|
355
|
-
@keydown=${e=>
|
|
356
|
-
${ce({items:j,onToggle:e=>
|
|
360
|
+
${g(i.attach)} ?data-in-view=${i.inView} data-tooltip-anchor
|
|
361
|
+
@keydown=${e=>i.dismiss(e)}>
|
|
362
|
+
${ce({items:j,onToggle:e=>i.toggleSeries(e)})}
|
|
357
363
|
<figure class="lintje-chart">
|
|
358
|
-
<svg viewBox="0 0 ${w.width} ${w.height}" class="lintje-chart__svg" role=${
|
|
364
|
+
<svg viewBox="0 0 ${w.width} ${w.height}" class="lintje-chart__svg" role=${ae(!1)}
|
|
359
365
|
aria-labelledby="${h}-desc" width=${w.width} height=${w.height}
|
|
360
|
-
tabindex="0" @keydown=${
|
|
366
|
+
tabindex="0" @keydown=${U.keydown} @focus=${U.focus} @blur=${U.blur}>
|
|
361
367
|
<desc id="${h}-desc">${a}</desc>
|
|
362
368
|
<defs>
|
|
363
369
|
<pattern id="hatch-${h}" width="6" height="6" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
|
|
@@ -365,166 +371,168 @@ import{Dt as e,Lt as t,R as n,_ as r,bn as i,ct as a,d as o,f as s,g as c,h as l
|
|
|
365
371
|
</pattern>
|
|
366
372
|
</defs>
|
|
367
373
|
<!-- Incomplete hours at the end: hatched, never drawn as zero. -->
|
|
368
|
-
${
|
|
374
|
+
${f>0?(()=>{let e=G(s.length-f,s.length,w);return n`<rect x=${e.x-(e.bandWidth-e.width)/2} y=${w.top}
|
|
369
375
|
width=${w.width-w.right-e.x+(e.bandWidth-e.width)/2}
|
|
370
376
|
height=${T-w.top} fill="url(#hatch-${h})" />`})():S}
|
|
371
377
|
|
|
372
|
-
${
|
|
378
|
+
${y.ticks.map(e=>{let t=B(e,y.max,w),r=e===0;return n`
|
|
373
379
|
<g>
|
|
374
380
|
<line x1=${w.left} x2=${w.width-w.right} y1=${t} y2=${t}
|
|
375
|
-
stroke=${
|
|
376
|
-
stroke-width=${
|
|
377
|
-
<text x=${w.left-8} y=${t+4} text-anchor="end" class="lintje-chart__axis-label" fill=${
|
|
378
|
-
${
|
|
381
|
+
stroke=${r?`var(--color-chart-zero)`:`var(--color-chart-grid)`}
|
|
382
|
+
stroke-width=${r?1.5:1} />
|
|
383
|
+
<text x=${w.left-8} y=${t+4} text-anchor="end" class="lintje-chart__axis-label" fill=${_}>
|
|
384
|
+
${x.format(e)}
|
|
379
385
|
</text>
|
|
380
386
|
</g>
|
|
381
387
|
`})}
|
|
382
|
-
${
|
|
383
|
-
<text x=${w.width-w.right+8} y=${B(e,
|
|
384
|
-
class="lintje-chart__axis-label"
|
|
388
|
+
${b.ticks.map(e=>n`
|
|
389
|
+
<text x=${w.width-w.right+8} y=${B(e,b.max,w)+4}
|
|
390
|
+
class="lintje-chart__axis-label">${C.format(e)}</text>
|
|
385
391
|
`)}
|
|
386
392
|
|
|
387
393
|
<!-- 2 px axis lines in the color of their series -->
|
|
388
|
-
<line x1=${w.left} x2=${w.left} y1=${w.top} y2=${T} stroke=${
|
|
394
|
+
<line x1=${w.left} x2=${w.left} y1=${w.top} y2=${T} stroke=${_} stroke-width="2" />
|
|
389
395
|
<line x1=${w.width-w.right} x2=${w.width-w.right} y1=${w.top} y2=${T}
|
|
390
|
-
stroke=${
|
|
396
|
+
stroke=${v} stroke-width="2" />
|
|
391
397
|
|
|
392
398
|
<!-- Bars grow in one after another; the hit areas below sit on top, so hover comes
|
|
393
399
|
from hoverIndex rather than :hover. -->
|
|
394
400
|
<g class=${k(E)}>
|
|
395
|
-
${
|
|
396
|
-
height=${Math.max(0,T-w.top)} fill="url(#hatch-${h})" />`;let i=B(e,
|
|
397
|
-
<g class="lintje-chart__bar-group ${F===
|
|
398
|
-
${
|
|
401
|
+
${p.values.map((e,t)=>{let r=G(t,s.length,w);if(e==null)return n`<rect class="lintje-chart__missing" x=${r.x} y=${w.top} width=${r.width}
|
|
402
|
+
height=${Math.max(0,T-w.top)} fill="url(#hatch-${h})" />`;let i=B(e,y.max,w);return n`
|
|
403
|
+
<g class="lintje-chart__bar-group ${F===t?`is-hovered`:``}"
|
|
404
|
+
${o(M(t,s.length))}>
|
|
399
405
|
<rect class="lintje-chart__bar" x=${r.x} y=${i} width=${r.width}
|
|
400
|
-
height=${Math.max(0,T-i)} fill=${
|
|
406
|
+
height=${Math.max(0,T-i)} fill=${_} />
|
|
401
407
|
</g>
|
|
402
408
|
`})}
|
|
403
409
|
</g>
|
|
404
410
|
|
|
405
|
-
${
|
|
406
|
-
y1=${B(
|
|
411
|
+
${c==null?S:n`<line class=${k(O)} x1=${w.left} x2=${w.width-w.right}
|
|
412
|
+
y1=${B(c,b.max,w)} y2=${B(c,b.max,w)}
|
|
407
413
|
stroke="var(--color-chart-emphasis)" stroke-width="1" stroke-dasharray="4 3" />`}
|
|
408
414
|
|
|
409
415
|
<g class=${k(D)}>
|
|
410
416
|
<g class="lintje-chart__reveal">
|
|
411
|
-
${
|
|
412
|
-
${I&&e.length>1?
|
|
417
|
+
${L.filter(e=>e.length>0).map(e=>{let t=e.join(` `),[r,i]=e[0].split(`,`);return n`
|
|
418
|
+
${I&&e.length>1?n`<polyline class="lintje-chart__line lintje-chart__line--casing"
|
|
413
419
|
stroke=${I} points=${t} />`:S}
|
|
414
|
-
${e.length===1?
|
|
420
|
+
${e.length===1?n`<circle cx=${r} cy=${i} r="2.5" fill=${v} />`:n`<polyline class="lintje-chart__line" stroke=${v} points=${t} />`}
|
|
415
421
|
`})}
|
|
416
422
|
</g>
|
|
417
423
|
</g>
|
|
418
424
|
|
|
419
|
-
${
|
|
420
|
-
<text x=${
|
|
425
|
+
${s.filter((e,t)=>t%P===0).map((e,t)=>n`
|
|
426
|
+
<text x=${G(t*P,s.length,w).center} y=${w.height-8}
|
|
421
427
|
text-anchor="middle" class="lintje-chart__axis-label">${e}</text>
|
|
422
428
|
`)}
|
|
423
429
|
|
|
424
430
|
<!-- Hover point on the right-axis line; no point for a missing value. -->
|
|
425
|
-
${F!=null&&!D&&
|
|
426
|
-
cx=${
|
|
427
|
-
cy=${B(
|
|
428
|
-
${
|
|
429
|
-
cx=${
|
|
430
|
-
cy=${B(
|
|
431
|
-
${
|
|
432
|
-
<rect x=${
|
|
431
|
+
${F!=null&&!D&&m.values[F]!=null?n`<circle class="lintje-chart__hover-point" r="4" fill=${v}
|
|
432
|
+
cx=${G(F,s.length,w).center}
|
|
433
|
+
cy=${B(m.values[F],b.max,w)} />
|
|
434
|
+
${W(v)?n`<circle class="lintje-chart__hover-casing" r="4" stroke=${W(v)}
|
|
435
|
+
cx=${G(F,s.length,w).center}
|
|
436
|
+
cy=${B(m.values[F],b.max,w)} />`:S}`:S}
|
|
437
|
+
${s.map((e,t)=>{let r=G(t,s.length,w);return n`
|
|
438
|
+
<rect x=${r.x} y=${w.top} width=${r.bandWidth} height=${T-w.top}
|
|
433
439
|
fill="transparent"
|
|
434
|
-
@mousemove=${e=>
|
|
435
|
-
@mouseleave=${
|
|
440
|
+
@mousemove=${e=>U.point(e,t)}
|
|
441
|
+
@mouseleave=${U.leave} />
|
|
436
442
|
`})}
|
|
437
443
|
</svg>
|
|
438
444
|
</figure>
|
|
439
|
-
${N(
|
|
440
|
-
${Se(
|
|
445
|
+
${N(i)}
|
|
446
|
+
${Se(i)}
|
|
441
447
|
</div>
|
|
442
|
-
`}var
|
|
448
|
+
`}var ut=4.5,dt=5.5,ft=44,pt=8,mt=(e,t)=>e.left<t.right&&t.left<e.right&&e.top<t.bottom&&t.top<e.bottom;function ht(e,t,n,r){let i=5.5,a=[];for(let[o,s]of e.entries()){if(!t.includes(s.label))continue;let c=x(s.label,r,700),l=s.y-9,u=l-12,d=l+3,f=[{anchor:`end`,x:s.x-pt,left:s.x-pt-c},{anchor:`start`,x:s.x+pt,left:s.x+pt}].map(e=>({...e,right:e.left+c,top:u,bottom:d})).find(t=>t.left>=n.left&&t.right<=n.width-n.right&&t.top>=0&&a.every(e=>!mt(t,e))&&e.every((e,n)=>n===o||!mt(t,{left:e.x-i,right:e.x+i,top:e.y-i,bottom:e.y+i})));if(!f)return[];a.push({...f,label:s.label,y:l})}return a.map(({label:e,x:t,y:n,anchor:r})=>({label:e,x:t,y:n,anchor:r}))}var gt=e=>e.charAt(0).toUpperCase()+e.slice(1),_t=(e,t)=>`${d(e)}${t?` ${t}`:``}`;function vt(e){let t=new Set(e.series.map(e=>e.color).filter(re)),n=F.filter(e=>!t.has(e)),r=0;return e.series.map(e=>{let t=re(e.color)?e.color:n[r++%n.length];return{color:ue(e.color??t),symbol:t}})}function yt(e,i){let{controller:a,description:s}=i,{axisTitle:c,unit:l,xTitle:u,xUnit:f,threshold:p,thresholdLabel:h,small:_=!1}=e,v=a.id;a.measure({width:!0,height:i.height??(_?`--chart-h-small`:`--chart-h-main`),fit:!!i.expanded&&!i.mobile});let y=vt(e),b=e.series.map((e,t)=>({...e,...y[t]})),x=e=>a.hiddenSeries.includes(e.label),C=b.flatMap((e,t)=>e.points.map((n,r)=>({point:n,row:e,key:`${t}:${r}`})).filter(e=>e.point.x!=null&&e.point.y!=null)).sort((e,t)=>e.point.x-t.point.x||e.point.y-t.point.y),w=C.filter(({row:e})=>!x(e)),T=new Map(w.map((e,t)=>[e.key,t])),E=a.hiddenSeries.includes($),D=H(Math.max(...C.map(({point:e})=>e.x),1),i.mobile?3:6),O=H(Math.max(...C.map(({point:e})=>e.y),p??0,1)),k=V(O.ticks,a.width,{font:a.font}),j=A(i,{left:k.width,bottom:ft}),P=e=>j.left+pe(j)*e/D.max,F=D.ticks.map((e,t)=>({label:d(e),x:P(e),anchor:t===D.ticks.length-1?`end`:`middle`})),I=[...b.map(e=>({label:e.label,color:e.color,shape:`point`,symbol:e.symbol,hidden:x(e),fixed:b.length<2&&p==null})),...p==null?[]:[{key:$,label:h??`Norm`,color:`var(--color-chart-emphasis)`,shape:`dashed`,hidden:E}]];function L(e){let{point:t,row:n}=w[e];return{title:t.label,rows:[{label:n.label,value:``,color:n.color,symbol:n.symbol},{label:gt(u),value:_t(t.x,f)},{label:gt(c),value:_t(t.y,l)}]}}let R=e=>({x:P(e.x),y:B(e.y,O.max,j)}),z=e=>R(w[e].point),G=xe(a,w.length,e=>({...z(e),content:L(e)})),ee=w.map(({point:e,row:t})=>e.href?{id:e.id??`${t.label} · ${e.label}`,href:e.href}:null),K=Me(i,ee),q=w.map(({point:e},t)=>K.of(ee[t],e.label,ye(L(t)))),J=ht(w.map((e,t)=>({label:e.point.label,...z(t)})),e.dataLabels??[],j,a.font),Y=p==null?0:B(p,O.max,j),X=a.hoverIndex==null?void 0:w[a.hoverIndex],te=e=>{let n=e.target.closest?.(`[data-point]`);if(n)return Number(n.getAttribute(`data-point`));let r=e.currentTarget,i=r.ownerSVGElement?.getBoundingClientRect(),a=i&&i.width>0?j.width/i.width:1,o=(e.clientX-(i?.left??0))*a,s=(e.clientY-(i?.top??0))*a,c=t(r,`--h-target`,48)/2,l=null,u=c;return w.forEach((e,t)=>{let{x:n,y:r}=z(t),i=Math.hypot(n-o,r-s);i<=u&&(l=t,u=i)}),l},ne=e=>{let t=te(e);t==null?(a.hoverIndex!=null||a.tooltip)&&G.leave():G.point(e,t)},Z=e=>{let t=te(e),n=t==null?null:q[t];n?.clickable&&n.click!==S&&n.click(e)},Q=X!=null&&q[a.hoverIndex]?.clickable,re=[p==null?S:n`
|
|
443
449
|
<g class="lintje-chart__series ${E?`is-off`:``}">
|
|
444
450
|
<g class="lintje-chart__reference">
|
|
445
451
|
<line x1=${j.left} x2=${j.width-j.right} y1=${Y} y2=${Y}
|
|
446
452
|
stroke="var(--color-chart-emphasis)" stroke-width="1" stroke-dasharray="3 3" />
|
|
447
453
|
<text x=${j.left+6} y=${Y-6}
|
|
448
454
|
class="lintje-chart__axis-label lintje-chart__axis-label--halo">
|
|
449
|
-
${
|
|
455
|
+
${h??`norm ${_t(p,l)}`}
|
|
450
456
|
</text>
|
|
451
457
|
</g>
|
|
452
458
|
</g>
|
|
453
|
-
`,
|
|
454
|
-
<rect class="lintje-chart__hit ${
|
|
459
|
+
`,n`<g @mousemove=${ne} @mouseleave=${G.leave} @click=${Z} @auxclick=${Z}>
|
|
460
|
+
<rect class="lintje-chart__hit ${Q?`is-clickable`:``}"
|
|
455
461
|
x="0" y="0" width=${j.width} height=${j.height} />
|
|
456
462
|
<g>
|
|
457
|
-
${
|
|
458
|
-
<path class="lintje-chart__point lintje-chart__mark ${
|
|
459
|
-
${
|
|
460
|
-
d=${
|
|
461
|
-
stroke=${
|
|
462
|
-
data-point=${
|
|
463
|
-
data-mark-id=${
|
|
464
|
-
tabindex=${
|
|
465
|
-
aria-pressed=${
|
|
466
|
-
@keydown=${
|
|
463
|
+
${m(C,e=>e.key,({point:e,row:t,key:r},i)=>{let{x:a,y:s}=R(e),c=W(t.color),l=T.get(r),u=l==null?void 0:q[l];return n`
|
|
464
|
+
<path class="lintje-chart__point lintje-chart__mark ${c?``:`lintje-chart__segment`} ${u?.state??`is-off`}"
|
|
465
|
+
${o(M(i,C.length))}
|
|
466
|
+
d=${U(t.symbol,ut,a,s)} fill=${t.color}
|
|
467
|
+
stroke=${c??S} stroke-width=${c?1:S}
|
|
468
|
+
data-point=${l??S}
|
|
469
|
+
data-mark-id=${u?.markId??S} role=${u?.role??S}
|
|
470
|
+
tabindex=${u?.tabIndex??S}
|
|
471
|
+
aria-pressed=${u?.pressed??S} aria-label=${u?.label??S}
|
|
472
|
+
@keydown=${u?.keydown??S} />
|
|
467
473
|
`})}
|
|
468
474
|
</g>
|
|
469
475
|
|
|
470
|
-
${J.map(e=>
|
|
476
|
+
${J.map(e=>n`
|
|
471
477
|
<text x=${e.x} y=${e.y} text-anchor=${e.anchor}
|
|
472
478
|
class="lintje-chart__data-label lintje-chart__data-label--halo">${e.label}</text>
|
|
473
479
|
`)}
|
|
474
480
|
|
|
475
481
|
<!-- The point under the pointer or the keyboard, raised with a ring in the surface. -->
|
|
476
|
-
${X?(()=>{let{x:e,y:t}=
|
|
482
|
+
${X?(()=>{let{x:e,y:t}=z(a.hoverIndex),r=W(X.row.color),i=U(X.row.symbol,dt,e,t);return n`
|
|
477
483
|
<path class="lintje-chart__hover-point" d=${i} fill=${X.row.color} />
|
|
478
|
-
${n
|
|
484
|
+
${r?n`<path class="lintje-chart__hover-casing" d=${i} stroke=${r} />`:S}
|
|
479
485
|
`})():S}
|
|
480
|
-
</g>`];return
|
|
481
|
-
<div class="lintje-chart-wrap ${
|
|
482
|
-
${
|
|
483
|
-
@keydown=${e=>
|
|
484
|
-
${ce({items:I,onToggle:e=>
|
|
485
|
-
${oe({
|
|
486
|
-
${N(
|
|
487
|
-
${Se(
|
|
486
|
+
</g>`];return r`
|
|
487
|
+
<div class="lintje-chart-wrap ${_?`lintje-chart--small`:``}"
|
|
488
|
+
${g(a.attach)} ?data-in-view=${a.inView} data-tooltip-anchor
|
|
489
|
+
@keydown=${e=>a.dismiss(e)||K.escape(e)}>
|
|
490
|
+
${ce({items:I,onToggle:e=>a.toggleSeries(e)})}
|
|
491
|
+
${oe({font:a.font,id:v,ticks:O.ticks,max:O.max,area:j,formatTick:k.format,axisTitle:c,xLabels:F,xTitle:u,description:s,interactive:K.interactive,keys:G},re)}
|
|
492
|
+
${N(a)}
|
|
493
|
+
${Se(a)}
|
|
488
494
|
</div>
|
|
489
|
-
`}var
|
|
490
|
-
<div class="lintje-heatmap" ${
|
|
491
|
-
data-tooltip-anchor
|
|
492
|
-
|
|
495
|
+
`}var bt=[`var(--color-chart-seq-1)`,`var(--color-chart-seq-2)`,`var(--color-chart-seq-3)`,`var(--color-chart-seq-4)`,`var(--color-chart-seq-5)`],xt=bt.length,St=[1,2,2.5,5,10];function Ct(e,t){if(!(e>0)||!Number.isFinite(e))return 1;let n=10**Math.floor(Math.log10(e)),r=0,i=1/0;for(let a of St){let o=a*n;if(t&&!Number.isInteger(o))continue;let s=Math.abs(Math.log(o/e));s<i&&(i=s,r=o)}return r||(t?1:n)}function wt(e,t){let n=Math.max(0,Math.min(10,-Math.floor(Math.log10(t))+1));return Number(e.toFixed(n))}function Tt(e){let t=[];for(let n of e)for(let e of n??[])e!=null&&Number.isFinite(e)&&t.push(e);if(t.length===0)return[];let n=Math.min(...t),r=Math.max(...t);if(n===r)return[];let i=t.every(Number.isInteger),a=Ct((r-n)/xt,i),o=Math.floor(n/a)*a,s=[];for(let e=1;e<xt;e+=1){let t=wt(o+e*a,a);if(t>r)break;s.push(t)}return s}function Et(e,t,n=0){let r=d(e,n),i=t?.trim()??``;return i?i===`%`?`${r}%`:`${r} ${i}`:r}function Dt(e){let t=0;for(let n of e){let e=String(n),r=e.indexOf(`.`);r>=0&&(t=Math.max(t,e.length-r-1))}return Math.min(t,4)}function Ot(e,t={}){let n=(t.bounds?.length?t.bounds.slice(0,xt-1):null)??Tt(e),r=Dt(n),i=e=>Et(e,t.unit,r),a=e=>d(e,r);if(n.length===0){let e=bt.length-1;return[{limit:1/0,color:bt[e],label:`alle waarden`,ramp:e}]}return[{limit:n[0],color:bt[0],label:`< ${i(n[0])}`,ramp:0},...n.slice(1).map((e,t)=>({limit:e,color:bt[t+1],label:`${a(n[t])}–${i(e)}`,ramp:t+1})),{limit:1/0,color:bt[n.length],label:`≥ ${i(n[n.length-1])}`,ramp:n.length}]}function kt(e,t){let n=e.findIndex(e=>t<e.limit);return n===-1?e.length-1:n}function At(e,t,n){return Array.from({length:n},(n,r)=>Array.from({length:t},(t,n)=>e?.[n]?.[r]))}function jt(e){if(e.mobile)return e.mobile;let t=e.rowLabels.length,n=e.columnLabels.length;if(!(n<=t))return{columnLabels:e.rowLabels,rowLabels:e.columnLabels,values:At(e.values,t,n),links:e.links?At(e.links,t,n):void 0}}function Mt(e,t){let{controller:n,description:i,mobile:a=!1}=t,s=a?jt(e):void 0,c=s?.columnLabels??e.columnLabels,l=s?.rowLabels??e.rowLabels,u=s?.values??e.values,f=s?s.links:e.links,p=s?!0:e.compact??!1,{unit:m}=e,h=Me(t,(f??[]).flat()),_=Ot(u,{bounds:e.bounds,unit:m}),v=e=>kt(_,e);n.measure({});let y=n.selectedCell,b=e=>`class-${e}`,x=e=>n.hiddenSeries.includes(b(_[e].ramp));return r`
|
|
496
|
+
<div class="lintje-heatmap" ${g(n.attach)} ?data-in-view=${n.inView}
|
|
497
|
+
data-tooltip-anchor
|
|
498
|
+
@keydown=${e=>n.dismiss(e)||h.escape(e)}>
|
|
499
|
+
${ce({items:_.map(e=>({key:b(e.ramp),label:e.label,color:e.color,shape:`square`,hidden:n.hiddenSeries.includes(b(e.ramp)),fixed:_.length<2})),onToggle:e=>n.toggleSeries(e)})}
|
|
493
500
|
<table class="lintje-heatmap__grid ${p?`is-compact`:``}">
|
|
494
|
-
<caption class="visually-hidden">${
|
|
501
|
+
<caption class="visually-hidden">${i}</caption>
|
|
495
502
|
<thead>
|
|
496
503
|
<tr>
|
|
497
504
|
<td></td>
|
|
498
|
-
${
|
|
505
|
+
${c.map(e=>r`<th scope="col" class="lintje-heatmap__column-label">${e}</th>`)}
|
|
499
506
|
</tr>
|
|
500
507
|
</thead>
|
|
501
508
|
<tbody>
|
|
502
|
-
${
|
|
509
|
+
${l.map((e,t)=>r`
|
|
503
510
|
<tr>
|
|
504
511
|
<th scope="row" class="lintje-heatmap__row-label" title=${e}>
|
|
505
512
|
<span class="lintje-heatmap__row-label-text">${e}</span>
|
|
506
513
|
</th>
|
|
507
|
-
${
|
|
514
|
+
${c.map((i,a)=>{let s=u[t]?.[a];if(s==null)return r`
|
|
508
515
|
<td class="lintje-heatmap__slot">
|
|
509
516
|
<div class="lintje-heatmap__cell is-empty"
|
|
510
|
-
title="${e} · ${
|
|
517
|
+
title="${e} · ${c[a]}: geen meting">
|
|
511
518
|
<span class="visually-hidden">geen meting</span>
|
|
512
519
|
</div>
|
|
513
520
|
</td>
|
|
514
|
-
`;let
|
|
521
|
+
`;let g=v(s),b=h.of(f?.[t]?.[a],`${e} · ${c[a]}`),C=!b.clickable&&y?.row===t&&y?.column===a;return r`
|
|
515
522
|
<td class="lintje-heatmap__slot">
|
|
516
523
|
<button
|
|
517
524
|
type="button"
|
|
518
|
-
class="lintje-heatmap__cell lintje-heatmap__cell--class-${_[
|
|
525
|
+
class="lintje-heatmap__cell lintje-heatmap__cell--class-${_[g].ramp} ${C?`is-selected`:``} ${x(g)?`is-dimmed`:``} ${b.state}"
|
|
519
526
|
data-mark-id=${b.markId}
|
|
520
|
-
|
|
521
|
-
|
|
527
|
+
role=${b.role===`link`?`link`:S}
|
|
528
|
+
${o({"--lintje-cell":_[g].color,...P(a,t,c.length,l.length)})}
|
|
529
|
+
@click=${b.clickable?b.click:()=>{n.selectedCell=C?null:{row:t,column:a},n.requestUpdate()}}
|
|
522
530
|
@auxclick=${b.click}
|
|
523
|
-
@mousemove=${p?void 0:t=>
|
|
524
|
-
@mouseleave=${p?void 0:()=>
|
|
525
|
-
aria-pressed=${b.clickable?b.pressed:
|
|
526
|
-
aria-label="${e} ${
|
|
527
|
-
>${
|
|
531
|
+
@mousemove=${p?void 0:t=>n.showTooltip(t,{title:`${e} · ${c[a]}`,rows:[{label:`klasse ${_[g].label}`,value:Et(s,m),color:_[g].color}]})}
|
|
532
|
+
@mouseleave=${p?void 0:()=>n.pointerLeft()}
|
|
533
|
+
aria-pressed=${b.clickable?b.pressed:C}
|
|
534
|
+
aria-label="${e} ${c[a]}: ${Et(s,m)}, klasse ${_[g].label}"
|
|
535
|
+
>${d(s)}</button>
|
|
528
536
|
</td>
|
|
529
537
|
`})}
|
|
530
538
|
</tr>
|
|
@@ -533,66 +541,66 @@ import{Dt as e,Lt as t,R as n,_ as r,bn as i,ct as a,d as o,f as s,g as c,h as l
|
|
|
533
541
|
</table>
|
|
534
542
|
|
|
535
543
|
<!-- Selected cell: a 48 px line with day, block, value, class. -->
|
|
536
|
-
${y&&
|
|
544
|
+
${y&&u[y.row]?.[y.column]!=null?r`
|
|
537
545
|
<p class="lintje-heatmap__selection">
|
|
538
|
-
<b>${
|
|
539
|
-
${
|
|
540
|
-
${_[v(
|
|
546
|
+
<b>${l[y.row]} ${c[y.column]}</b> ·
|
|
547
|
+
${Et(u[y.row][y.column],m)} · klasse
|
|
548
|
+
${_[v(u[y.row][y.column])].label}
|
|
541
549
|
</p>
|
|
542
550
|
`:S}
|
|
543
551
|
|
|
544
|
-
${N(
|
|
552
|
+
${N(n)}
|
|
545
553
|
</div>
|
|
546
|
-
`}var
|
|
547
|
-
height=${Math.max(0,j-k.top)} fill="url(#hatch-${
|
|
548
|
-
<g class="lintje-chart__bar-group" ${
|
|
549
|
-
<rect class="lintje-chart__bar lintje-chart__segment" x=${
|
|
550
|
-
height=${Math.max(0,j-i)} fill=${
|
|
554
|
+
`}var Nt=16,Pt=56,Ft=8,It=18;function Lt(e){return d(e,+!Number.isInteger(e))}function Rt(e,t){let n=t?` ${t}`:``;return e.to==null?`${Lt(e.from)}${n} of meer`:`${Lt(e.from)} tot ${Lt(e.to)}${n}`}function zt(e,t,n=``){let r=t.width,i=e.map(e=>{let t=x(e.text,n,e.bold?700:400),i=e.x+6+t<=r;return{x:i?e.x+6:e.x-6,anchor:i?`start`:`end`,left:i?e.x+6:e.x-6-t,right:i?e.x+6+t:e.x-6}}),a=i.length===2?+(e[1].x>=e[0].x):-1,o=i.length===2&&i[0].left<i[1].right+Ft&&i[1].left<i[0].right+Ft;return i.map((e,n)=>({x:e.x,y:t.top+12+(o&&n===a?It:0),anchor:e.anchor}))}function Bt(e,t){let{controller:i,description:a}=t,{bins:c,axisTitle:l,xTitle:u,unit:f,median:p,threshold:m,small:h=!1}=e,_=e.label??`Aantal`,v=ue(e.color)??`var(--color-chart-default)`,y=i.id,b=e=>f?`${e} ${f}`:e;i.measure({width:!0,height:t.height??(h?`--chart-h-small`:`--chart-h-main`),fit:!!t.expanded&&!t.mobile});let C=c.map(e=>e.count).filter(e=>e!=null),w=C.length===c.length?C.reduce((e,t)=>e+t,0):null,{max:T,ticks:E}=H(Math.max(...C,1)),D=V(E,i.width,{font:i.font}),O=A(t),k=A(t,{left:D.width,bottom:O.bottom+(u?Nt:0)}),j=k.height-k.bottom,P=k.width-k.right,F=c[0]?.from??0,I=c[c.length-1],L=c.length>1?c[c.length-1].from-c[c.length-2].from:1,R=I?I.to??I.from+L:1,z=e=>k.left+(e-F)/Math.max(R-F,2**-52)*(P-k.left),U=c.map(e=>{let t=z(e.from),n=z(e.to??R)-t;return{x:t,width:n,center:t+n/2}}),W=e=>i.hiddenSeries.includes(e),G=W(_),ee=e=>{let t=c[e].count;return{title:Rt(c[e],f),rows:G?[]:[{label:_,value:t==null?`geen gegevens`:d(t),color:v},...t!=null&&w!=null&&w>0?[{label:`Aandeel`,value:s(t/w*100,1),color:v}]:[]]}},K=xe(i,c.length,e=>({x:U[e].center,y:c[e].count==null?k.top:B(c[e].count,T,k),content:ee(e)})),q=I?.to==null&&c.length>0,J=[...c.slice(0,q?-1:void 0).map(e=>e.from),...q?[]:I?[I.to]:[]].map(e=>({label:Lt(e),x:z(e)})),Y=q?{label:`${Lt(I.from)}+`,x:U[U.length-1].center}:null,X=J.length>1?(J[J.length-1].x-J[0].x)/(J.length-1):1,ne=Math.max(1,Math.ceil(Pt/X)),Z=te(J.filter((e,t)=>t%ne===0),i.font),Q=(e,t)=>Math.abs(t.x-e.x)<(x(e.label,i.font)+x(t.label,i.font))/2+Ft,re=q?Y:J[J.length-1];re&&!Z.includes(re)&&(Z.length&&Q(Z[Z.length-1],re)&&(Z=Z.slice(0,-1)),q||(Z=[...Z,re]));let ie=q?I.from:R,ae=e=>e!=null&&e>=F&&e<=ie,le=[...ae(p)?[{key:se,x:z(p),text:e.medianLabel??b(`mediaan ${Lt(p)}`),bold:!0,dashed:!1}]:[],...ae(m)?[{key:$,x:z(m),text:e.thresholdLabel??b(`norm ${Lt(m)}`),bold:!1,dashed:!0}]:[]],de=zt(le,k,i.font),fe=e=>e.charAt(0).toUpperCase()+e.slice(1),pe=[{label:_,color:v,shape:`square`,fixed:le.length===0,hidden:G},...ae(p)?[{label:fe(e.medianLabel??`Mediaan`),color:`var(--color-chart-emphasis)`,shape:`line`,key:se,hidden:W(se)}]:[],...ae(m)?[{label:fe(e.thresholdLabel??`Norm`),color:`var(--color-chart-emphasis)`,shape:`dashed`,key:$,hidden:W($)}]:[]],me=e=>{let t=U[e],r=c[e].count;if(r==null)return n`<rect class="lintje-chart__missing" x=${t.x} y=${k.top} width=${t.width}
|
|
555
|
+
height=${Math.max(0,j-k.top)} fill="url(#hatch-${y})" />`;let i=B(r,T,k);return n`
|
|
556
|
+
<g class="lintje-chart__bar-group" ${o(M(e,c.length))}>
|
|
557
|
+
<rect class="lintje-chart__bar lintje-chart__segment" x=${t.x} y=${i} width=${t.width}
|
|
558
|
+
height=${Math.max(0,j-i)} fill=${v} />
|
|
551
559
|
</g>
|
|
552
|
-
`},he=
|
|
553
|
-
x=${
|
|
554
|
-
height=${Math.max(0,j-B(ge,T,k))} fill=${
|
|
560
|
+
`},he=i.hoverIndex,ge=he==null?null:c[he]?.count,_e=[n`<g class="lintje-chart__series ${G?`is-off`:``}">${c.map((e,t)=>me(t))}</g>`,he!=null&&ge!=null&&!G?n`<rect class="lintje-chart__bar lintje-chart__bar--lifted lintje-chart__segment"
|
|
561
|
+
x=${U[he].x} y=${B(ge,T,k)} width=${U[he].width}
|
|
562
|
+
height=${Math.max(0,j-B(ge,T,k))} fill=${v} />`:S,Z.map(e=>n`
|
|
555
563
|
<line x1=${e.x} x2=${e.x} y1=${j} y2=${j+4}
|
|
556
564
|
stroke="var(--color-chart-zero)" stroke-width="1" />
|
|
557
565
|
<text x=${e.x} y=${j+20} text-anchor="middle" class="lintje-chart__axis-label">${e.label}</text>
|
|
558
|
-
`),Y?
|
|
559
|
-
<g class="lintje-chart__series ${
|
|
566
|
+
`),Y?n`<text x=${Y.x} y=${j+20} text-anchor="middle" class="lintje-chart__axis-label">${Y.label}</text>`:S,le.map((e,t)=>{let r=de[t];return n`
|
|
567
|
+
<g class="lintje-chart__series ${W(e.key)?`is-off`:``}">
|
|
560
568
|
<g class="lintje-chart__reference">
|
|
561
569
|
<line x1=${e.x} x2=${e.x} y1=${k.top} y2=${j}
|
|
562
570
|
stroke="var(--color-chart-emphasis)" stroke-width=${e.dashed?1:1.5}
|
|
563
571
|
stroke-dasharray=${e.dashed?`3 3`:S} />
|
|
564
|
-
<text x=${
|
|
572
|
+
<text x=${r.x} y=${r.y} text-anchor=${r.anchor}
|
|
565
573
|
class=${e.bold?`lintje-chart__data-label lintje-chart__data-label--halo`:`lintje-chart__axis-label lintje-chart__axis-label--halo`}>${e.text}</text>
|
|
566
574
|
</g>
|
|
567
575
|
</g>
|
|
568
|
-
`}),
|
|
576
|
+
`}),U.map((e,t)=>n`
|
|
569
577
|
<rect x=${e.x} y=${k.top} width=${e.width} height=${Math.max(0,j-k.top)}
|
|
570
578
|
fill="transparent"
|
|
571
|
-
@mousemove=${e=>
|
|
572
|
-
@mouseleave=${
|
|
573
|
-
`)];return
|
|
579
|
+
@mousemove=${e=>K.point(e,t)}
|
|
580
|
+
@mouseleave=${K.leave} />
|
|
581
|
+
`)];return r`
|
|
574
582
|
<div class="lintje-chart-wrap ${h?`lintje-chart--small`:``}"
|
|
575
|
-
${
|
|
576
|
-
@keydown=${e=>
|
|
577
|
-
${ce({items:pe,onToggle:e=>
|
|
578
|
-
${oe({
|
|
579
|
-
${N(
|
|
580
|
-
${Se(
|
|
583
|
+
${g(i.attach)} ?data-in-view=${i.inView} data-tooltip-anchor
|
|
584
|
+
@keydown=${e=>i.dismiss(e)}>
|
|
585
|
+
${ce({items:pe,onToggle:e=>i.toggleSeries(e)})}
|
|
586
|
+
${oe({font:i.font,id:y,ticks:E,max:T,area:k,axisTitle:l,xTitle:u,description:a,formatTick:D.format,keys:K},_e)}
|
|
587
|
+
${N(i)}
|
|
588
|
+
${Se(i)}
|
|
581
589
|
</div>
|
|
582
|
-
`}var
|
|
583
|
-
<div class="lintje-chart-wrap ${
|
|
584
|
-
${
|
|
585
|
-
@keydown=${e=>
|
|
586
|
-
${ce({items:A,onToggle:e=>
|
|
590
|
+
`}var Vt=16,Ht=6,Ut=18,Wt=16,Gt=3,Kt=4,qt=8,Jt=40,Yt=.7,Xt=420,Zt=12,Qt=2;function $t(e){let t=new Set(e.series.map(e=>e.color).filter(re)),n=F.filter(e=>!t.has(e)),r=0;return e.series.map(t=>{let i=e.axes.map((e,n)=>t.values[n]??null);if(t.comparison)return{label:t.label,values:i,comparison:!0,color:`var(--color-chart-secondary)`};let a=re(t.color)?t.color:n[r++%n.length];return{label:t.label,values:i,comparison:!1,color:ue(t.color??a),symbol:a}})}function en(e){let t=e.length,n=e.findIndex(e=>e==null);if(n===-1)return{closed:!0,runs:[e.map((e,t)=>t)]};let r=[],i=[];for(let a=1;a<=t;a++){let o=(n+a)%t;e[o]==null?(i.length&&r.push(i),i=[]):i.push(o)}return i.length&&r.push(i),{closed:!1,runs:r}}function tn(e,t=e/5){let n=[];for(let r=1;r*t<e-t*1e-6;r++)n.push(Math.round(r*t*1e6)/1e6);return[...n,e]}var nn=e=>Number.isInteger(e)?0:String(e).split(`.`)[1]?.length??0;function rn(e,t,n){let r=e.area??`emphasis`,i=t.filter(e=>!e.comparison);return new Set(i.filter(e=>e.complete&&r!==`never`&&(r===`always`||i.length===1||e.label===n)).map(e=>e.label))}function an(e,t){let{controller:n,description:i,mobile:a=!1}=t,{axes:s,unit:c,threshold:l,small:u=!1}=e,f=s.length,p=$t(e),m=e=>n.hiddenSeries.includes(e.label),h=n.hiddenSeries.includes($),_=p.length<2&&l==null,v=p.filter(e=>!m(e)),y=p.filter(e=>!e.comparison),b=v.filter(e=>!e.comparison),x=Math.min(2,Math.max(0,...p.flatMap(e=>e.values.filter(e=>e!=null)).map(nn),...l==null?[]:[nn(l)])),S=e=>d(e,x),C=e=>`${S(e)}${c?` ${c}`:``}`,w=e=>{let t=Math.round(e*10**x)/10**x;return t===0?S(0):`${t>0?`+`:`−`}${S(Math.abs(t))}`},T=b.length>1&&b.some(e=>e.label===n.emphasis)?n.emphasis:null,E=rn(e,v.map(e=>({...e,complete:e.values.every(e=>e!=null)})),T),D=s.map((e,t)=>p.some(e=>e.values[t]==null)),O=e.dataLabels!==!1&&y.length===1,k=O&&!m(y[0]),A=[...p.map(e=>e.comparison?{label:e.label,color:e.color,shape:`line`,hidden:m(e),fixed:_}:{label:e.label,color:e.color,shape:`line`,symbol:e.symbol,hidden:m(e),fixed:_}),...l==null?[]:[{key:$,label:e.thresholdLabel??`Norm ${C(l)}`,color:`var(--color-chart-emphasis)`,shape:`dashed`,hidden:h}],...D.some(Boolean)?[{label:`Geen gegevens`,shape:`hatch`,fixed:!0}]:[]];function j(t){let n=v.map(e=>{let n=e.values[t];return{label:e.label,value:n==null?`geen gegevens`:C(n),color:e.color,symbol:e.symbol,marker:e.comparison?`line`:void 0}});l!=null&&!h&&n.push({label:e.thresholdLabel??`Norm`,value:C(l),color:`var(--color-chart-emphasis)`,marker:`dashed`});let[r]=b,i=b.length===1?r.values[t]:null;if(i!=null){let e=v.find(e=>e.comparison),r=e?.values[t];e&&r!=null&&n.push({label:`t.o.v. ${e.label}`,value:w(i-r),divider:!0}),l!=null&&!h&&n.push({label:`t.o.v. norm`,value:w(i-l),divider:!(e&&r!=null)})}return{title:s[t],rows:n}}let{width:M,height:P,body:F,at:I}=(a?sn:on)({spec:e,controller:n,options:t,layers:p,shown:v,fills:E,emphasis:T,missing:D,reserve:O,labelled:k,hidden:m,normOff:h,format:S,contentAt:j,pointer:{point:(e,t)=>L.point(e,t),leave:()=>L.leave()}}),L=xe(n,f,e=>({...I(e),content:j(e)}));return r`
|
|
591
|
+
<div class="lintje-chart-wrap ${u?`lintje-chart--small`:``}"
|
|
592
|
+
${g(n.attach)} ?data-in-view=${n.inView} data-tooltip-anchor
|
|
593
|
+
@keydown=${e=>n.dismiss(e)}>
|
|
594
|
+
${ce({items:A,onToggle:e=>n.toggleSeries(e),onEmphasis:y.length>1?e=>n.emphasise(e):void 0})}
|
|
587
595
|
<figure class="lintje-chart">
|
|
588
596
|
<svg viewBox="0 0 ${M} ${P}" width=${M} height=${P}
|
|
589
|
-
class="lintje-chart__svg lintje-radar ${
|
|
590
|
-
${
|
|
591
|
-
role=${
|
|
597
|
+
class="lintje-chart__svg lintje-radar ${a?`lintje-radar--rows`:``}"
|
|
598
|
+
${o({height:`${P}px`})}
|
|
599
|
+
role=${ae(!1)} aria-labelledby="${n.id}-desc" tabindex="0"
|
|
592
600
|
@keydown=${L.keydown} @focus=${L.focus} @blur=${L.blur}>
|
|
593
|
-
<desc id="${
|
|
601
|
+
<desc id="${n.id}-desc">${i}</desc>
|
|
594
602
|
<defs>
|
|
595
|
-
<pattern id="hatch-${
|
|
603
|
+
<pattern id="hatch-${n.id}" width="6" height="6" patternUnits="userSpaceOnUse"
|
|
596
604
|
patternTransform="rotate(45)">
|
|
597
605
|
<line x1="0" y1="0" x2="0" y2="6" stroke="var(--color-chart-hatch)" stroke-width="2" />
|
|
598
606
|
</pattern>
|
|
@@ -600,316 +608,345 @@ import{Dt as e,Lt as t,R as n,_ as r,bn as i,ct as a,d as o,f as s,g as c,h as l
|
|
|
600
608
|
${F}
|
|
601
609
|
</svg>
|
|
602
610
|
</figure>
|
|
603
|
-
${N(
|
|
604
|
-
${Se(
|
|
611
|
+
${N(n)}
|
|
612
|
+
${Se(n)}
|
|
605
613
|
</div>
|
|
606
|
-
`}function
|
|
607
|
-
<text x=${
|
|
608
|
-
${u?
|
|
609
|
-
<text x=${
|
|
610
|
-
class="lintje-chart__data-label lintje-radar__value ${
|
|
611
|
-
${
|
|
614
|
+
`}function on({spec:e,controller:t,options:r,layers:i,shown:a,fills:s,emphasis:c,missing:l,reserve:u,labelled:f,hidden:p,normOff:m,format:h,pointer:g}){let{axes:_,max:v,threshold:y,small:b=!1}=e,C=_.length,w=b?`--chart-h-small`:`--chart-h-main`;t.measure({width:!0,height:r.height??w,fit:!!r.expanded});let T=t.width,E=r.height??(r.expanded||b?t.height:Math.max(t.height,Math.min(Xt,Math.round(T*Yt)))),D=e=>-Math.PI/2+2*Math.PI*e/C,O=t.font,k=e=>x(e,O)*14/12,A=Math.max(0,..._.map((e,t)=>Math.abs(Math.cos(D(t)))<.1?0:k(e)+Ht+2)),j=24+(u?Wt:0),M=Math.max(Jt,Math.min(T/2-A-Vt,E/2-j-Vt)),N=T/2,P=E/2,F=(e,t)=>({x:N+t*Math.cos(D(e)),y:P+t*Math.sin(D(e))}),I=e=>Math.max(0,Math.min(e,v))/v*M,L=e=>e.map(e=>`${e.x},${e.y}`).join(` `),R=e=>L(_.map((t,n)=>F(n,I(e)))),z=tn(v,e.step),B=Math.max(0,...z.map(nn)),V=t.hoverIndex,H=e=>{let t=a.map(t=>t.values[e]).filter(e=>e!=null);return F(e,t.length?I(Math.max(...t)):M/2)},G=[...i.filter(e=>e.comparison),...i.filter(e=>!e.comparison)],ee=e=>c!=null&&e.label!==c,K=o({"transform-origin":`${N}px ${P}px`}),q=_.map((e,t)=>{let r=Math.cos(D(t)),a=Math.sin(D(t)),o=F(t,M+Vt+Ht),s=Math.abs(r)<.1,c=s?`middle`:r>0?`start`:`end`,l;l=s&&a<0?o.y-4-(u?Wt:0):s?o.y+12:u?o.y-2:o.y+5;let d=u?i.find(e=>!e.comparison)?.values[t]:void 0;return n`
|
|
615
|
+
<text x=${o.x} y=${l} text-anchor=${c} class="lintje-radar__name">${e}</text>
|
|
616
|
+
${u?n`<g class="lintje-chart__series ${f?``:`is-off`}">
|
|
617
|
+
<text x=${o.x} y=${l+Wt} text-anchor=${c}
|
|
618
|
+
class="lintje-chart__data-label lintje-radar__value ${d==null?`lintje-radar__no-value`:``}">
|
|
619
|
+
${d==null?`geen gegevens`:h(d)}</text>
|
|
612
620
|
</g>`:S}
|
|
613
|
-
`}),J=(e,t)=>{let
|
|
614
|
-
<polygon class="lintje-radar__area ${
|
|
615
|
-
points=${
|
|
616
|
-
</g></g>`;let{closed:
|
|
617
|
-
${
|
|
618
|
-
<polyline class="lintje-chart__line" points=${
|
|
619
|
-
`}),
|
|
620
|
-
stroke=${
|
|
621
|
-
${
|
|
622
|
-
</g></g>`},Y=e=>{let t=M+
|
|
623
|
-
points=${`${N+
|
|
624
|
-
x1=${N} y1=${P} x2=${
|
|
625
|
-
class="lintje-chart__axis-label lintje-chart__axis-label--halo">${
|
|
626
|
-
<polygon class="lintje-chart__reference lintje-radar__norm" points=${
|
|
627
|
-
</g>`,
|
|
628
|
-
<path class="lintje-chart__hover-point" d=${
|
|
629
|
-
${
|
|
630
|
-
`}),
|
|
631
|
-
${
|
|
632
|
-
@mousemove=${e=>
|
|
633
|
-
</g>`],at:
|
|
621
|
+
`}),J=(e,t)=>{let r=`lintje-chart__series ${p(e)?`is-off`:``}`,i=e.values.map((e,t)=>e==null?null:F(t,I(e)));if(t===`area`)return e.comparison||i.some(e=>e==null)?S:n`<g class=${r}><g class="lintje-radar__layer" ${K}>
|
|
622
|
+
<polygon class="lintje-radar__area ${s.has(e.label)?`is-filled`:``}"
|
|
623
|
+
points=${L(i)} fill=${e.color} />
|
|
624
|
+
</g></g>`;let{closed:a,runs:o}=en(e.values),c=e.comparison?void 0:W(e.color),l=o.map(t=>{let r=t.map(e=>i[e]),o=L(a?[...r,r[0]]:r);return r.length===1?e.comparison?n`<circle cx=${r[0].x} cy=${r[0].y} r="2.5" fill=${e.color} />`:S:n`
|
|
625
|
+
${c?n`<polyline class="lintje-chart__line lintje-chart__line--casing" points=${o} stroke=${c} />`:S}
|
|
626
|
+
<polyline class="lintje-chart__line" points=${o} stroke=${e.color} />
|
|
627
|
+
`}),u=e.symbol?i.map(t=>t?n`<path d=${U(e.symbol,Gt,t.x,t.y)} fill=${e.color}
|
|
628
|
+
stroke=${c??S} stroke-width=${c?1:S} />`:S):S;return t===`lift`?n`<g class="lintje-radar__lift" aria-hidden="true">${l}${u}</g>`:n`<g class=${r}><g class="lintje-radar__layer ${ee(e)?`is-muted`:``}" ${K}>
|
|
629
|
+
${l}${u}
|
|
630
|
+
</g></g>`},Y=e=>{let t=M+Vt,n=Math.PI/C,r=e=>`${N+t*Math.cos(e)},${P+t*Math.sin(e)}`;return`${N},${P} ${r(D(e)-n)} ${r(D(e))} ${r(D(e)+n)}`};return{width:T,height:E,body:[z.map(e=>n`<polygon class="lintje-radar__ring" points=${R(e)} />`),l.map((e,r)=>{if(!e)return S;let i=D(r),a=-Math.sin(i)*5,o=Math.cos(i)*5,s=F(r,M);return n`<polygon class="lintje-radar__gap" fill="url(#hatch-${t.id})"
|
|
631
|
+
points=${`${N+a},${P+o} ${s.x+a},${s.y+o} ${s.x-a},${s.y-o} ${N-a},${P-o}`} />`}),_.map((e,t)=>{let r=F(t,M+Vt);return n`<line class="lintje-radar__spoke ${V===t?`is-active`:``}"
|
|
632
|
+
x1=${N} y1=${P} x2=${r.x} y2=${r.y} />`}),z.map(e=>{let t=F(0,I(e));return n`<text x=${t.x+qt/2} y=${t.y+4}
|
|
633
|
+
class="lintje-chart__axis-label lintje-chart__axis-label--halo">${d(e,B)}</text>`}),y==null?S:n`<g class="lintje-chart__series ${m?`is-off`:``}">
|
|
634
|
+
<polygon class="lintje-chart__reference lintje-radar__norm" points=${R(y)} />
|
|
635
|
+
</g>`,G.map(e=>J(e,`area`)),G.map(e=>J(e,`line`)),c==null?S:J(i.find(e=>e.label===c),`lift`),q,V==null?S:a.map(e=>{let t=e.values[V];if(t==null)return S;let r=F(V,I(t)),i=e.comparison?void 0:W(e.color),a=U(e.symbol,Kt,r.x,r.y);return n`
|
|
636
|
+
<path class="lintje-chart__hover-point" d=${a} fill=${e.color} />
|
|
637
|
+
${i?n`<path class="lintje-chart__hover-casing" d=${a} stroke=${i} />`:S}
|
|
638
|
+
`}),n`<g @mouseleave=${g.leave}>
|
|
639
|
+
${_.map((e,t)=>n`<polygon class="lintje-chart__hit" points=${Y(t)}
|
|
640
|
+
@mousemove=${e=>g.point(e,t)} />`)}
|
|
641
|
+
</g>`],at:H}}function sn({spec:e,controller:t,layers:r,shown:i,reserve:a,labelled:s,hidden:c,normOff:l,format:u,pointer:f}){let{axes:p,max:m,threshold:h}=e;t.measure({width:!0});let g=t.width,_=g-1,v=r.filter(e=>!e.comparison),y=[...v.map(e=>({layer:e,size:v.length===1?8:6})),...r.filter(e=>e.comparison).map(e=>({layer:e,size:4}))],b=y.reduce((e,t)=>e+t.size,0)+Qt*Math.max(0,y.length-1),C=22+b+Zt,w=p.length*C,T=w+16,E=e=>.5+Math.max(0,Math.min(e,m))/m*_,D=t.font,O=r.find(e=>!e.comparison),k=i.find(e=>!e.comparison),A=t.hoverIndex,j=e=>{let t=k?.values[e];return{x:t==null?g/2:E(t),y:e*C+Ut+4}},N=p.map((e,r)=>{let i=r*C,d=i+Ut+4,m=a?O?.values[r]:void 0,v=a?m==null?`geen gegevens`:u(m):``,w=a&&m!=null&&h!=null&&m<h,T=`lintje-chart__series ${s?``:`is-off`}`,k=d;return n`
|
|
634
642
|
<g class="lintje-radar__row ${A===r?`is-active`:``}">
|
|
635
643
|
<text x="0" y=${i+14} class="lintje-radar__name">${e}</text>
|
|
636
|
-
${a?
|
|
637
|
-
class="lintje-chart__data-label lintje-radar__value ${
|
|
638
|
-
${w?
|
|
644
|
+
${a?n`<g class=${T}><text x=${g} y=${i+14} text-anchor="end"
|
|
645
|
+
class="lintje-chart__data-label lintje-radar__value ${m==null?`lintje-radar__no-value`:``}">${v}</text></g>`:S}
|
|
646
|
+
${w?n`<g class=${T}><text x=${g-x(v,D,700)-6} y=${i+14} text-anchor="end"
|
|
639
647
|
class="lintje-chart__axis-label lintje-radar__value">onder norm</text></g>`:S}
|
|
640
|
-
${
|
|
641
|
-
fill="url(#hatch-${
|
|
642
|
-
width=${Math.max(0,E(
|
|
643
|
-
${
|
|
644
|
-
<line class="lintje-radar__zero" x1="0.5" x2="0.5" y1=${
|
|
645
|
-
${
|
|
646
|
-
<line class="lintje-chart__reference lintje-radar__norm" x1=${E(
|
|
647
|
-
y1=${
|
|
648
|
+
${y.map(({layer:e,size:i})=>{let a=k;k+=i+Qt;let s=e.values[r],l=c(e)?`is-off`:``;return s==null?n`<rect class="lintje-radar__bar lintje-chart__series ${l}" x="0.5" y=${a} width=${_} height=${i}
|
|
649
|
+
fill="url(#hatch-${t.id})" />`:n`<rect class="lintje-chart__bar lintje-chart__bar--horizontal lintje-radar__bar lintje-chart__series ${l}" x="0.5" y=${a}
|
|
650
|
+
width=${Math.max(0,E(s)-.5)} height=${i} fill=${e.color}
|
|
651
|
+
${o(M(r,p.length))} />`})}
|
|
652
|
+
<line class="lintje-radar__zero" x1="0.5" x2="0.5" y1=${d-2} y2=${d+b+2} />
|
|
653
|
+
${h==null?S:n`<g class="lintje-chart__series ${l?`is-off`:``}">
|
|
654
|
+
<line class="lintje-chart__reference lintje-radar__norm" x1=${E(h)} x2=${E(h)}
|
|
655
|
+
y1=${d-3} y2=${d+b+3} />
|
|
648
656
|
</g>`}
|
|
649
|
-
<rect class="lintje-chart__hit" x="0" y=${i} width=${
|
|
650
|
-
@mousemove=${e=>
|
|
657
|
+
<rect class="lintje-chart__hit" x="0" y=${i} width=${g} height=${C}
|
|
658
|
+
@mousemove=${e=>f.point(e,r)} />
|
|
651
659
|
</g>
|
|
652
|
-
`}),P=[0,...
|
|
660
|
+
`}),P=[0,...tn(m,e.step)],F=Math.max(0,...P.map(nn)),I=P.map((e,t)=>n`<text x=${E(e)} y=${w+12}
|
|
653
661
|
text-anchor=${t===0?`start`:t===P.length-1?`end`:`middle`}
|
|
654
|
-
class="lintje-chart__axis-label">${
|
|
662
|
+
class="lintje-chart__axis-label">${d(e,F)}</text>`);return{width:g,height:T,body:n`<g @mouseleave=${f.leave}>${N}</g>${I}`,at:j}}var cn=`moment:from`,ln=`moment:to`,un=28,dn=44,fn=20,pn=24,mn=24,hn=14,gn=6,_n=4,vn=2,yn=5,bn=3,xn=10,Sn=8,Cn=`geen gegevens`,wn=`buiten de as`;function Tn(e,t=!1){return pn+e*(t?dn:un)+mn}var En=e=>Number.isInteger(e)?0:String(e).split(`.`)[1]?.length??0;function Dn(e){return Math.max(0,...e.flatMap(e=>[e.from,e.to]).filter(e=>e!=null).map(En))}function On(e,t){return e.from==null||e.to==null?null:Number((e.to-e.from).toFixed(t))||0}function kn(e){let t=e.rows.flatMap(e=>[e.from,e.to]).filter(e=>e!=null),n=H(Math.max(0,...t,e.threshold??0));if(e.min==null&&e.max==null)return{min:0,...n};let r=e.min??0,i=e.max!=null&&e.max>r?e.max:Math.max(n.max,r+1),a=H(i-r,5),o=a.ticks[1]-a.ticks[0],s=[];for(let e=Math.ceil(r/o-1e-9)*o;e<=i+1e-9;e+=o)s.push(Number(e.toFixed(6)));return{min:r,max:i,ticks:s}}function An(e,t,n){let r=e.x+e.side*(t+vn),i=r+e.side*yn;return`M${r} ${n-bn}L${i} ${n}L${r} ${n+bn}Z`}function jn(e,t){let{controller:i,description:a,mobile:s=!1}=t,{rows:l,fromLabel:u,toLabel:f,threshold:p,unit:m}=e,h=i.id,_=ue(e.color)??`var(--color-chart-default)`,v=W(_),y=!i.hiddenSeries.includes(cn),b=!i.hiddenSeries.includes(ln),C=p!=null&&!i.hiddenSeries.includes(`reference:threshold`),w=Dn(l),T=Math.max(w,p==null?0:En(p)),E=e=>d(e,w),D=e=>`${E(e)}${m?` ${m}`:``}`,O=(e,t=w)=>e===0?d(0,t):`${e>0?`+`:`−`}${d(Math.abs(e),t)}`,k=e=>Number((e-p).toFixed(T))||0,A=l.map(e=>On(e,w)),j=i.width,P=i.font,F=l.map(e=>s?c(e.label,j,P,400,14):[e.label]),L=F.map(e=>s?dn+(e.length-1)*fn:un),R=L.reduce((e,t,n)=>[...e,e[n]+t],[pn]),z=R[l.length],B=z+mn;i.measure({width:!0,height:B});let{min:V,max:H,ticks:U}=kn(e),G=Math.max(0,...U.map(En)),ee=I(l.map(e=>e.label),j,{font:P}),K=Math.ceil(Math.max(x(`Verschil`,P),x(Cn,P),...A.map(e=>e==null?0:x(O(e),P,700)))),q=s?hn:ee.barStart+hn,J=Math.max(q+40,j-K-Sn-hn),Y=e=>q+(Math.min(H,Math.max(V,e))-V)/(H-V)*(J-q),X=e=>e==null?null:{value:e,x:Y(e),side:e<V?-1:+(e>H)},te=l.map(e=>({from:X(e.from),to:X(e.to)})),ne=e=>R[e]+(s?L[e]-dn+31:un/2),Z=l.map(e=>e.href?{id:e.id??e.label,href:e.href}:null),Q=Me(t,Z),re=l.some(e=>e.from==null||e.to==null),ie=te.some(({from:e,to:t})=>e!=null&&e.side!==0||t!=null&&t.side!==0),oe=[{key:cn,label:u,shape:`ring`,color:`var(--color-chart-secondary)`,hidden:!y},{key:ln,label:f,shape:`dot`,color:_,hidden:!b},...p==null?[]:[{key:$,label:e.thresholdLabel??`Norm ${d(p,T)}`,color:`var(--color-chart-emphasis)`,shape:`dashed`,hidden:!C}],...re?[{label:`Geen gegevens`,shape:`hatch`,fixed:!0}]:[],...ie?[{label:`Buiten de as`,shape:`off-axis`,color:`var(--color-text-muted)`,fixed:!0}]:[]],se=(e,t,n,r,i)=>({label:e,value:t==null?Cn:D(t),marker:r,color:i,aside:n!=null&&n.side!==0?wn:void 0}),le=e=>{let t=l[e],n=[];y&&n.push(se(u,t.from,te[e].from,`ring`,`var(--color-chart-secondary)`)),b&&n.push(se(f,t.to,te[e].to,`dot`,_));let r=y&&b?A[e]:null;return r!=null&&n.push({label:`Verschil`,value:O(r),divider:!0}),C&&b&&t.to!=null&&n.push({label:`t.o.v. norm`,value:O(k(t.to),T),divider:r==null}),{title:t.label,rows:n}},de=e=>{let{title:t,rows:n}=le(e),r=A[e],i=y&&b?r==null?Cn:O(r):null;return ye({title:i?`${t} ${i}`:t,rows:n.filter(e=>e.label!==`Verschil`)})},fe=xe(i,l.length,e=>{let t=[y?te[e].from:null,b?te[e].to:null].filter(e=>e!=null),n=t.length?t.map(e=>e.x):[q],r=s?0:2;return{x:Math.max(...n)+r,flip:Math.min(...n)-r,y:s?R[e+1]+12:ne(e),content:le(e)}}),pe=(e,t)=>fe.point(e,t),me=p!=null&&p>=V&&p<=H?(()=>{let t=Y(p),r=e.thresholdLabel??`norm ${d(p,T)}`,i=t+6+x(r,P)<=J+hn;return n`<g class="lintje-chart__series ${C?``:`is-off`}">
|
|
655
663
|
<line class="lintje-chart__reference lintje-dumbbell__norm" x1=${t} x2=${t}
|
|
656
|
-
y1=${20} y2=${
|
|
657
|
-
<text x=${
|
|
658
|
-
class="lintje-chart__axis-label lintje-chart__reference">${
|
|
659
|
-
</g>`})():S,
|
|
660
|
-
class="lintje-chart__axis-label">${
|
|
661
|
-
<g class="lintje-dumbbell__row ${
|
|
662
|
-
data-mark-id=${
|
|
663
|
-
aria-pressed=${
|
|
664
|
-
@click=${
|
|
665
|
-
${
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
${
|
|
670
|
-
|
|
671
|
-
|
|
664
|
+
y1=${20} y2=${z} />
|
|
665
|
+
<text x=${i?t+6:t-6} y=${15} text-anchor=${i?`start`:`end`}
|
|
666
|
+
class="lintje-chart__axis-label lintje-chart__reference">${r}</text>
|
|
667
|
+
</g>`})():S,he=[U.map(e=>n`<line class="lintje-dumbbell__grid" x1=${Y(e)} x2=${Y(e)} y1=${pn} y2=${z} />`),V<=0&&H>=0?n`<line class="lintje-dumbbell__zero" x1=${Y(0)} x2=${Y(0)} y1=${pn} y2=${z} />`:S,U.map(e=>n`<text x=${Y(e)} y=${z+16} text-anchor="middle"
|
|
668
|
+
class="lintje-chart__axis-label">${d(e,G)}</text>`),n`<text x=${j} y=${15} text-anchor="end" class="lintje-chart__axis-label">Verschil</text>`,me,n`<g @mouseleave=${fe.leave}>${l.map((e,t)=>{let{from:r,to:a}=te[t],c=R[t],u=ne(t),d=A[t],f=y&&b&&r!=null&&a!=null&&r.side!==0&&r.side===a.side,p=Q.of(Z[t],e.label,de(t)),m=b&&a?a:y&&r?r:null;return n`
|
|
669
|
+
<g class="lintje-dumbbell__row ${i.hoverIndex===t?`is-hovered`:``} ${p.state}"
|
|
670
|
+
data-mark-id=${p.markId} role=${p.role} tabindex=${p.tabIndex}
|
|
671
|
+
aria-pressed=${p.pressed} aria-label=${p.label}
|
|
672
|
+
@click=${p.click} @keydown=${p.keydown}>
|
|
673
|
+
${s?n`${F[t].map((e,t)=>n`<rect class="lintje-dumbbell__knockout" x="-2" y=${c+t*fn-1} width=${x(e,P,400,14)+4} height=${fn} />`)}<text x="0" y=${c+14} class="lintje-dumbbell__name lintje-dumbbell__name--above">${F[t].map((e,t)=>n`<tspan x="0" dy=${t?fn:0}>${e}</tspan>`)}</text>`:n`<text x=${ee.labelEnd} y=${u+4} text-anchor="end"
|
|
674
|
+
class="lintje-chart__axis-label lintje-dumbbell__name">${ee.fit(e.label)}</text>`}
|
|
675
|
+
<!-- What a chosen row dims in the others: the marks, one group, never the words or the ring. -->
|
|
676
|
+
<g class="lintje-dumbbell__marks">
|
|
677
|
+
${r==null||a==null?n`<rect class="lintje-dumbbell__gap" x=${q} y=${u-5} width=${J-q}
|
|
678
|
+
height="10" fill="url(#hatch-${h})" />`:S}
|
|
679
|
+
${r!=null&&a!=null&&!f?n`<g class="lintje-chart__series ${y&&b?``:`is-off`}">
|
|
680
|
+
<line class="lintje-dumbbell__link" x1=${r.x} x2=${a.x} y1=${u} y2=${u}
|
|
681
|
+
${o({...M(t,l.length),"--lintje-dumbbell-from":`${r.x}px`})} />
|
|
672
682
|
</g>`:S}
|
|
673
|
-
${
|
|
674
|
-
<circle class="lintje-dumbbell__ring" cx=${
|
|
675
|
-
${
|
|
683
|
+
${r==null?S:n`<g class="lintje-chart__series ${y?``:`is-off`}">
|
|
684
|
+
<circle class="lintje-dumbbell__ring" cx=${r.x} cy=${u} r=${gn} />
|
|
685
|
+
${r.side!==0&&!f?n`<path class="lintje-chart__off-axis" d=${An(r,7,u)}
|
|
676
686
|
fill="var(--color-chart-secondary)" />`:S}
|
|
677
687
|
</g>`}
|
|
678
|
-
${a==null?S:
|
|
679
|
-
<circle class="lintje-dumbbell__dot" cx=${a.x} cy=${
|
|
680
|
-
stroke=${
|
|
681
|
-
${
|
|
682
|
-
${a.side===0?S:
|
|
683
|
-
fill=${
|
|
688
|
+
${a==null?S:n`<g class="lintje-chart__series ${b?``:`is-off`}">
|
|
689
|
+
<circle class="lintje-dumbbell__dot" cx=${a.x} cy=${u} r=${_n} fill=${_}
|
|
690
|
+
stroke=${v??S} stroke-width=${v?1:S}
|
|
691
|
+
${o({...M(t,l.length),"--lintje-dumbbell-shift":`${r==null?0:r.x-a.x}px`})} />
|
|
692
|
+
${a.side===0?S:n`<path class="lintje-chart__off-axis" d=${An(a,f?7:_n,u)}
|
|
693
|
+
fill=${_} stroke=${v??S} stroke-width=${v?1:S} />`}
|
|
684
694
|
</g>`}
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
695
|
+
</g>
|
|
696
|
+
${m?n`<circle class="lintje-dumbbell__focus" cx=${m.x} cy=${u} r=${xn} />`:n`<rect class="lintje-dumbbell__focus" x="1.5" y=${c+1.5}
|
|
697
|
+
width=${Math.max(0,j-3)} height=${Math.max(0,L[t]-3)} />`}
|
|
698
|
+
<g class="lintje-chart__series ${y&&b?``:`is-off`}">
|
|
699
|
+
<text x=${j} y=${u+4} text-anchor="end"
|
|
700
|
+
class="lintje-chart__data-label lintje-dumbbell__difference ${d==null?`lintje-dumbbell__no-value`:``}">${d==null?Cn:O(d)}</text>
|
|
689
701
|
</g>
|
|
690
702
|
<!-- The whole row answers, so the tooltip does not flicker between ring and dot. -->
|
|
691
|
-
<rect class="lintje-chart__hit" x="0" y=${c} width=${
|
|
692
|
-
@mouseenter=${e=>
|
|
703
|
+
<rect class="lintje-chart__hit" x="0" y=${c} width=${j} height=${L[t]}
|
|
704
|
+
@mouseenter=${e=>pe(e,t)} />
|
|
693
705
|
</g>
|
|
694
|
-
`})}</g>`];return
|
|
695
|
-
<div class="lintje-chart-wrap" ${
|
|
706
|
+
`})}</g>`];return r`
|
|
707
|
+
<div class="lintje-chart-wrap" ${g(i.attach)} ?data-in-view=${i.inView}
|
|
696
708
|
data-tooltip-anchor
|
|
697
|
-
@keydown=${e=>
|
|
698
|
-
${ce({items:
|
|
709
|
+
@keydown=${e=>i.dismiss(e)||Q.escape(e)}>
|
|
710
|
+
${ce({items:oe,onToggle:e=>i.toggleSeries(e)})}
|
|
699
711
|
<figure class="lintje-chart">
|
|
700
|
-
<svg viewBox="0 0 ${
|
|
701
|
-
class="lintje-chart__svg lintje-dumbbell ${
|
|
702
|
-
${
|
|
703
|
-
role=${
|
|
704
|
-
@keydown=${
|
|
705
|
-
<desc id="${
|
|
712
|
+
<svg viewBox="0 0 ${j} ${B}" width=${j} height=${B}
|
|
713
|
+
class="lintje-chart__svg lintje-dumbbell ${s?`lintje-dumbbell--rows`:``}"
|
|
714
|
+
${o({height:`${B}px`})}
|
|
715
|
+
role=${ae(Q.interactive)} aria-labelledby="${h}-desc" tabindex="0"
|
|
716
|
+
@keydown=${fe.keydown} @focus=${fe.focus} @blur=${fe.blur}>
|
|
717
|
+
<desc id="${h}-desc">${a}</desc>
|
|
706
718
|
<defs>
|
|
707
|
-
<pattern id="hatch-${
|
|
719
|
+
<pattern id="hatch-${h}" width="6" height="6" patternUnits="userSpaceOnUse"
|
|
708
720
|
patternTransform="rotate(45)">
|
|
709
721
|
<line x1="0" y1="0" x2="0" y2="6" stroke="var(--color-chart-hatch)" stroke-width="2" />
|
|
710
722
|
</pattern>
|
|
711
723
|
</defs>
|
|
712
|
-
${
|
|
724
|
+
${he}
|
|
713
725
|
</svg>
|
|
714
726
|
</figure>
|
|
715
|
-
${N(
|
|
716
|
-
${Se(
|
|
727
|
+
${N(i)}
|
|
728
|
+
${Se(i)}
|
|
717
729
|
</div>
|
|
718
|
-
`}function
|
|
730
|
+
`}function Mn(e,t){let n=e.reduce((e,t)=>e+t,0),r=Math.max(...e),i=Math.min(...e),a=t*t;return Math.max(a*r/(n*n),n*n/(a*i))}function Nn(e,t){let n=()=>({x:t.x,y:t.y,width:0,height:0}),r=e.reduce((e,t)=>t>0?e+t:e,0),i=e.map(n);if(r<=0||t.width<=0||t.height<=0)return i;let a=t.width*t.height/r,o=e.flatMap((e,t)=>e>0?[{index:t,area:e*a}]:[]),{x:s,y:c,width:l,height:u}=t,d=0;for(;d<o.length;){let e=Math.min(l,u),t=d+1;for(;t<o.length&&Mn(o.slice(d,t+1).map(e=>e.area),e)<=Mn(o.slice(d,t).map(e=>e.area),e);)t+=1;let n=o.slice(d,t),r=t===o.length,a=n.reduce((e,t)=>e+t.area,0);if(l>=u){let e=r?l:a/u,t=c;for(let[r,a]of n.entries()){let o=r===n.length-1?c+u-t:a.area/e;i[a.index]={x:s,y:t,width:e,height:o},t+=o}s+=e,l-=e}else{let e=r?u:a/l,t=s;for(let[r,a]of n.entries()){let o=r===n.length-1?s+l-t:a.area/e;i[a.index]={x:t,y:c,width:o,height:e},t+=o}c+=e,u-=e}d=t}return i}var Pn={14:18,12:16},Fn=3,In=4,Ln=`…`;function Rn(e,t,n,r,i){let a=[];for(let o of e.split(/\s+/).filter(Boolean)){let e=a.at(-1);if(e!=null&&i(`${e} ${o}`,n,r)<=t)a[a.length-1]=`${e} ${o}`;else if(i(o,n,r)<=t)a.push(o);else return null}return a.length>0&&a.length<=Fn?a.map(e=>({text:e,size:n,bold:r})):null}function zn(e,t,n,r){if(r(e,12,n)<=t)return{text:e,size:12,bold:n};for(let i=e.length-1;i>=In;i--){let a=`${e.slice(0,i).trimEnd()}${Ln}`;if(r(a,12,n)<=t)return{text:a,size:12,bold:n}}return null}var Bn=(e,t)=>e.reduce((e,n)=>e+Pn[n.size]*t,0);function Vn(e,t,n,r=1){let i=t.width-16,a=t.height-16,o=e=>e!=null&&Bn(e,r)<=a&&e.every(e=>n(e.text,e.size,e.bold)<=i),s=e.share!=null,c={text:e.amount,size:12,bold:!s},l={text:`${e.amount} · ${e.share}`,size:12,bold:!1},u=t=>Rn(e.name,i,t,s,n),d=s?[Hn(u(14),l),Hn(u(12),l),Hn(u(12),c),u(12)]:[Hn(u(12),c),u(12)];for(let e of d)if(o(e))return e;let f=zn(e.name,i,s,n);return f?o([f,c])?[f,c]:o([f])?[f]:[]:[]}function Hn(e,t){return e?[...e,t]:null}var Un=.01,Wn=e=>Number.isInteger(e)?0:Math.min(4,String(e).split(`.`)[1]?.length??0),Gn=e=>Array.isArray(e.parts)&&e.parts.length>0;function Kn(e){return Gn(e)?e.parts.reduce((e,t)=>e+Math.max(0,t.value??0),0):Math.max(0,e.value??0)}function qn(e){return Gn(e)?e.parts.every(e=>e.value==null):e.value==null}var Jn=e=>[...e].sort((e,t)=>t.value-e.value);function Yn(e,t,n){let r=e.filter(e=>e.value<t);if(r.length<2)return{items:e,folded:!1};let i=r.map(({label:e,value:t})=>({label:e,value:t}));return{items:[...e.filter(e=>e.value>=t),n(i)],folded:!0}}var Xn=e=>e.reduce((e,t)=>e+t.value,0);function Zn(e){let t=e.parts??[],n=t.reduce((e,t)=>e+Kn(t),0),r=n*Un,i=t.flatMap(e=>Gn(e)?e.parts.map(e=>e.value):[e.value]),a=Math.max(0,...i.filter(e=>typeof e==`number`).map(Wn)),o=t.flatMap(e=>qn(e)?[e.label]:Gn(e)?e.parts.filter(e=>e.value==null).map(e=>e.label):[]),s=!1,c=Yn(Jn(t.filter(e=>Kn(e)>0).map(e=>{let t=Kn(e),n=[];if(Gn(e)){let t=Yn(Jn(e.parts.filter(e=>(e.value??0)>0).map(e=>({label:e.label,value:e.value,other:!1,folded:[]}))),r,e=>({label:`Overig`,value:Xn(e),other:!0,folded:e}));n=t.items,s||=t.folded}return{label:e.label,value:t,id:e.id??e.label,href:e.href,other:!1,folded:[],areas:n,missing:Gn(e)?e.parts.filter(e=>e.value==null).map(e=>e.label):[],rank:0}})),r,e=>({label:`Overig`,value:Xn(e),id:`Overig`,other:!0,folded:e,areas:[],missing:[],rank:-1})),l=0;return{groups:c.items.map(e=>e.other?e:{...e,rank:l++}),total:n,decimals:a,missing:o,folded:s||c.folded,nested:t.some(Gn)}}function Qn(e){let{total:t,nested:n}=Zn(e),r=e.parts??[],i=(e,t)=>[...Jn(e.filter(e=>t(e)>0).map(e=>({item:e,value:t(e)}))).map(({item:e})=>e),...e.filter(e=>!(t(e)>0))],a=e=>e==null?null:e<0||t<=0?``:Number((e/t*100).toFixed(1)),o=e.label??`Waarde`;return[[e.labelHeader??`Deel`,...n?[`Onderdeel`]:[],e.unit?`${o} (${e.unit})`:o,`Aandeel in het totaal (%)`],...i(r,Kn).flatMap(e=>{if(!Gn(e)){let t=e.value??null;return[[e.label,...n?[``]:[],t,a(t)]]}return i(e.parts,e=>e.value??0).map(t=>[e.label,t.label,t.value??null,a(t.value)])})]}var $n=28,er=2,tr=4;function nr(e,t){let n=Zn(e),{groups:i,total:a,decimals:o}=n,c=i.filter(e=>!e.other).length,l=Ye(c,e.color),u=Je(c),f=v(e.color)?e.color:void 0,p=i.map(e=>e.other?`var(--color-chart-other)`:l[Math.min(e.rank,l.length-1)]),m=i.map(t=>{if(t.other||e.dataLabels===!1)return null;let n=L(f,u[Math.min(t.rank,u.length-1)]);return n?R(n):null}),h=i.map(e=>{if(e.other)return null;let t=K(f,u[Math.min(e.rank,u.length-1)]);return t===`text`?`lintje-treemap__label--muted`:t?R(t):null}),_=i.map(e=>e.href&&!e.other?{id:e.id,href:e.href}:null),y=Me(t,_),b=e=>d(e,o),x=t=>`${b(t)}${e.unit?` ${e.unit}`:``}`,C=(e,t=a)=>s(t>0?e/t*100:0,1),w=i.map((e,t)=>y.of(_[t],e.label,`${e.label}: ${x(e.value)} · ${C(e.value)}`)),T=[...n.folded?[{label:`Overig: posten onder 1 % samen`,color:`var(--color-chart-other)`,shape:`square`,fixed:!0}]:[],...n.missing.length?[{label:`Geen gegevens: ${n.missing.join(`, `)}`,shape:`hatch`,fixed:!0}]:[]],E=`totaal ${x(a)}${n.missing.length?`, zonder ${n.missing.join(`, `)}`:``}`,D={spec:e,model:n,options:t,colors:p,inks:m,dimmedInks:h,marks:w,format:b,withUnit:x,share:C,legend:T,totalLine:E},{controller:O}=t;return r`
|
|
719
731
|
<div class="lintje-chart-wrap lintje-treemap ${e.small?`lintje-chart--small`:``}"
|
|
720
|
-
${
|
|
721
|
-
@keydown=${e=>
|
|
722
|
-
${
|
|
723
|
-
<p class="lintje-treemap__total">${
|
|
724
|
-
${t.mobile?
|
|
725
|
-
${N(
|
|
726
|
-
${Se(
|
|
732
|
+
${g(O.attach)} ?data-in-view=${O.inView} data-tooltip-anchor
|
|
733
|
+
@keydown=${e=>{if(O.dismiss(e))return;let t=e.key===`Escape`&&y.active!=null;y.escape(e),t&&O.sayStatus(`Keuze opgeheven`)}}>
|
|
734
|
+
${T.length?ce({items:T}):S}
|
|
735
|
+
<p class="lintje-treemap__total">${E}</p>
|
|
736
|
+
${t.mobile?ur(D):lr(D,y.interactive)}
|
|
737
|
+
${N(O)}
|
|
738
|
+
${Se(O)}
|
|
727
739
|
</div>
|
|
728
|
-
`}function
|
|
729
|
-
class="lintje-chart__data-label lintje-treemap__label lintje-treemap__label--${
|
|
730
|
-
width=${e.rect.width} height=${e.rect.height} fill=${e.color} />`,
|
|
731
|
-
<g class="${t} ${
|
|
740
|
+
`}function rr(e,t,n,r,i){let{spec:a,withUnit:o,share:s}=e,c=i?t.label:void 0;if(n.other)return{kicker:c,title:n.label,rows:[...n.folded.map(e=>({label:e.label,value:o(e.value)})),{label:`Samen`,value:o(n.value),color:r,divider:!0}]};let l=[{label:a.label??`Waarde`,value:o(n.value),color:r},...i?[{label:`Aandeel in ${t.label}`,value:s(n.value,t.value)}]:[],{label:`Aandeel in het totaal`,value:s(n.value)}];return i&&t.missing.length&&l.push({label:`${t.label}, zonder ${t.missing.join(`, `)}`,value:o(t.value),divider:!0}),{kicker:c,title:n.label,rows:l}}function ir(e,t,n,r){let i=n;return e.map(e=>{let n={text:e.text,x:t,y:i+e.size*r,line:e};return i+=Pn[e.size]*r,n})}var ar=(e,t)=>e.reduce((e,n)=>e+Pn[n.size]*t,0);function or(e,t,n,r){let{model:i,colors:a,inks:o,format:s,share:c}=e,l=r.scale??1,u=(e,t,n)=>x(e,r,n?700:400,t),d=Nn(i.groups.map(e=>e.value),{x:0,y:0,width:t,height:n});return i.groups.flatMap((t,n)=>{let r=d[n],i=a[n],f=o[n]!=null;if(!t.areas.length){let a=f&&!t.other?Vn({name:t.label,amount:s(t.value),share:c(t.value)},r,u,l):[];return[{group:n,rect:r,color:i,label:t.label,value:t.value,other:t.other,lines:ir(a,r.x+8,r.y+8,l),content:rr(e,t,t,i,!1)}]}let p=Nn(t.areas.map(e=>e.value),r);return t.areas.map((r,a)=>{let o=p[a],d=[];if(f&&!r.other){let e=a===0?Vn({name:t.label,amount:s(t.value),share:c(t.value)},o,u,l):[],n=e.length?ar(e,l)+tr:0,i=Vn({name:r.label,amount:s(r.value)},{width:o.width,height:o.height-n},u,l);d=[...ir(e,o.x+8,o.y+8,l),...ir(i,o.x+8,o.y+8+n,l)]}return{group:n,rect:o,color:r.other?`var(--color-chart-other)`:i,label:r.label,value:r.value,other:r.other,lines:d,content:rr(e,t,r,r.other?`var(--color-chart-other)`:i,!0)}})})}function sr(e,t,r,i){let a=i?r:t;return!t||!a||!e.lines.length?S:e.lines.map(({text:e,x:t,y:r,line:i})=>n`<text x=${t} y=${r}
|
|
741
|
+
class="lintje-chart__data-label lintje-treemap__label lintje-treemap__label--${i.size} ${i.bold?`lintje-treemap__label--bold`:``} ${a}">${e}</text>`)}function cr(e,t,n,r,i){let a=(e,t)=>t>=i?[e,e+t]:[e+t/2-i/2,e+t/2+i/2],o=null,s=1/0;return e.forEach((e,c)=>{if(!t[c]||e.width>=i&&e.height>=i)return;let[l,u]=a(e.x,e.width),[d,f]=a(e.y,e.height);if(n<l||n>u||r<d||r>f)return;let p=Math.hypot(Math.max(e.x-n,0,n-e.x-e.width),Math.max(e.y-r,0,r-e.y-e.height));p<s&&(o=c,s=p)}),o}function lr(e,i){let{spec:a,model:s,options:c,inks:l,dimmedInks:u,marks:d}=e,{controller:f,description:p}=c,m=f.id;f.measure({width:!0,height:c.height??(a.small?`--chart-h-small`:`--chart-h-main`),fit:!!c.expanded});let h=f.width,g=f.height,_=or(e,h,g,f.font),v=Nn(s.groups.map(e=>e.value),{x:0,y:0,width:h,height:g}),b=e=>d[e].state.includes(`is-muted`),x=xe(f,_.length,e=>{let{rect:t,content:n}=_[e],r=t.x+t.width/2<h/2;return{x:r?t.x+t.width:t.x,y:t.y+t.height/2,content:n,side:r?void 0:`left`}}),C=e=>{let t=f.hoverIndex;if((e.key===`Enter`||e.key===` `)&&e.target===e.currentTarget){let n=t==null?void 0:_[t],r=n?d[n.group].keydown:void 0;if(typeof r!=`function`)return;r(e);let i=d[n.group].state.includes(`is-selected`);f.sayStatus(i?`Keuze opgeheven`:`${s.groups[n.group].label} gekozen`)}else x.keydown(e)},w=(e,t)=>x.point(e,t),T=x.leave,E=s.groups.map((e,t)=>d[t].clickable),D=e=>{let n=e.currentTarget,r=n.getScreenCTM?.(),i=n.getBoundingClientRect(),a=r?new DOMPoint(e.clientX,e.clientY).matrixTransform(r.inverse()):{x:e.clientX-i.left,y:e.clientY-i.top},o=cr(v,E,a.x,a.y,t(n,`--h-target-text`,24)),c=e.target.closest?.(`[data-part-id]`);if(o==null||c?.getAttribute(`data-part-id`)===s.groups[o].id)return;let l=d[o].click;l!==S&&(e.stopPropagation(),l(e))},O=f.hoverIndex==null?void 0:_[f.hoverIndex],k=(e,t=``)=>n`<rect class="lintje-treemap__area lintje-chart__segment ${t}" x=${e.rect.x} y=${e.rect.y}
|
|
742
|
+
width=${e.rect.width} height=${e.rect.height} fill=${e.color} />`,A=(e,t)=>n`
|
|
743
|
+
<g class="${t} ${b(e.group)?`is-muted`:``}" aria-hidden="true">
|
|
732
744
|
<rect class="lintje-treemap__ground" x=${e.rect.x} y=${e.rect.y}
|
|
733
745
|
width=${e.rect.width} height=${e.rect.height} />
|
|
734
|
-
${
|
|
735
|
-
</g>`,
|
|
746
|
+
${k(e)}${sr(e,l[e.group],u[e.group],b(e.group))}
|
|
747
|
+
</g>`,j=s.groups.findIndex((e,t)=>d[t].state.includes(`is-selected`)),N=JSON.stringify(a.parts);return r`
|
|
736
748
|
<figure class="lintje-chart">
|
|
737
|
-
<svg viewBox="0 0 ${
|
|
738
|
-
class="lintje-chart__svg lintje-treemap__svg" ${
|
|
739
|
-
role=${
|
|
740
|
-
@keydown=${
|
|
741
|
-
|
|
742
|
-
<
|
|
743
|
-
|
|
749
|
+
<svg viewBox="0 0 ${h} ${g}" width=${h} height=${g}
|
|
750
|
+
class="lintje-chart__svg lintje-treemap__svg" ${o({height:`${g}px`,...Q(m)})}
|
|
751
|
+
role=${ae(i)} aria-labelledby="${m}-desc" tabindex="0"
|
|
752
|
+
@keydown=${C} @focus=${x.focus} @blur=${x.blur} @mouseleave=${T}
|
|
753
|
+
@click=${{handleEvent:D,capture:!0}} @auxclick=${{handleEvent:D,capture:!0}}>
|
|
754
|
+
<desc id="${m}-desc">${p}</desc>
|
|
755
|
+
<defs>${X(m)}</defs>
|
|
756
|
+
${y(N,n`${s.groups.map((e,t)=>{let r=d[t],i=_.filter(e=>e.group===t);return n`
|
|
744
757
|
<g class="lintje-treemap__group ${r.state}" data-part-id=${e.id}
|
|
745
|
-
${
|
|
758
|
+
${o(M(t,s.groups.length))}
|
|
746
759
|
role=${r.role} aria-pressed=${r.pressed} aria-label=${r.label} @click=${r.click}>
|
|
747
|
-
${i.map(e=>
|
|
760
|
+
${i.map(e=>n`<rect class="lintje-treemap__area lintje-chart__segment" x=${e.rect.x} y=${e.rect.y}
|
|
748
761
|
width=${e.rect.width} height=${e.rect.height} fill=${e.color}
|
|
749
|
-
@mousemove=${t=>
|
|
762
|
+
@mousemove=${t=>w(t,_.indexOf(e))} />`)}
|
|
750
763
|
</g>`})}
|
|
751
764
|
<!-- The labels apart from the parts: a part's name as a button is its own sentence. -->
|
|
752
765
|
<g class="lintje-treemap__labels" aria-hidden="true">
|
|
753
|
-
${
|
|
766
|
+
${_.map(e=>sr(e,l[e.group],u[e.group],b(e.group)))}
|
|
754
767
|
</g>`)}
|
|
755
768
|
<!-- The line between parts, on their border, over the areas on both sides of it. -->
|
|
756
769
|
<g class="lintje-treemap__edges" aria-hidden="true">
|
|
757
|
-
${
|
|
770
|
+
${v.map(e=>n`<rect class="lintje-treemap__edge" x=${e.x} y=${e.y} width=${e.width} height=${e.height} />`)}
|
|
758
771
|
</g>
|
|
759
|
-
${
|
|
760
|
-
x=${
|
|
761
|
-
width=${Math.max(0,
|
|
762
|
-
${
|
|
763
|
-
${
|
|
772
|
+
${j>=0?n`<rect class="lintje-chart__mark is-selected lintje-treemap__outline" aria-hidden="true"
|
|
773
|
+
x=${v[j].x+3} y=${v[j].y+3}
|
|
774
|
+
width=${Math.max(0,v[j].width-6)} height=${Math.max(0,v[j].height-6)} />`:S}
|
|
775
|
+
${O?A(O,`lintje-treemap__lift`):S}
|
|
776
|
+
${O?A(O,`lintje-treemap__focus`):S}
|
|
764
777
|
</svg>
|
|
765
778
|
</figure>
|
|
766
|
-
`}function
|
|
767
|
-
fill=${
|
|
768
|
-
<span class="lintje-treemap__track ${
|
|
769
|
-
<span class="lintje-treemap__bar" ${
|
|
770
|
-
</span>`,T=
|
|
771
|
-
<span class="lintje-treemap__swatch" ${
|
|
772
|
-
<span class="lintje-treemap__name">${
|
|
773
|
-
<span class="lintje-treemap__amount">${
|
|
774
|
-
<span class="lintje-treemap__share">${
|
|
775
|
-
${w(
|
|
776
|
-
<li class="lintje-treemap__row ${
|
|
777
|
-
${h?
|
|
778
|
-
aria-controls=${p} aria-label="Onderdelen van ${
|
|
779
|
-
@click=${()=>
|
|
780
|
-
${
|
|
781
|
-
</button>`:
|
|
782
|
-
${
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
<span class="lintje-
|
|
779
|
+
`}function ur(e){let{spec:t,model:i,options:s,colors:c,marks:l,format:u,share:d}=e,{controller:f,description:p}=s,m=f.id;f.measure({width:!0});let h=f.width,g=ue(t.color)??`var(--color-chart-default)`,_=Math.max(0,...i.groups.map(e=>e.value)),v=e=>`${_>0?e/_*100:0}%`,b=Math.max(0,h-er*Math.max(0,i.groups.length-1)),x=0,C=i.groups.map((e,t)=>{let r=i.total>0?e.value/i.total*b:0,a=n`<rect class="lintje-treemap__piece" x=${x} y="0" width=${r} height=${$n}
|
|
780
|
+
fill=${c[t]} ${o(M(t,i.groups.length))} />`;return x+=r+er,a}),w=(e,t,n=!1)=>r`
|
|
781
|
+
<span class="lintje-treemap__track ${n?`lintje-treemap__track--sub`:``}" aria-hidden="true">
|
|
782
|
+
<span class="lintje-treemap__bar" ${o({width:v(e),background:t})}></span>
|
|
783
|
+
</span>`,T=i.groups.map((e,t)=>{let n=l[t],s=f.openParts.includes(e.id),p=`${m}-parts-${t}`,h=e.areas.length>0,_=e.other?`var(--color-chart-other)`:g,v=r`
|
|
784
|
+
<span class="lintje-treemap__swatch" ${o({background:c[t]})} aria-hidden="true"></span>
|
|
785
|
+
<span class="lintje-treemap__name">${e.label}${e.other?r`<span class="lintje-treemap__count"> · ${e.folded.length} posten</span>`:S}</span>
|
|
786
|
+
<span class="lintje-treemap__amount">${u(e.value)}</span>
|
|
787
|
+
<span class="lintje-treemap__share">${d(e.value)}</span>
|
|
788
|
+
${w(e.value,_)}`;return r`
|
|
789
|
+
<li class="lintje-treemap__row ${e.other?`lintje-treemap__row--other`:``} ${n.state}">
|
|
790
|
+
${h?r`<button type="button" class="lintje-treemap__toggle" aria-expanded=${s?`true`:`false`}
|
|
791
|
+
aria-controls=${p} aria-label="Onderdelen van ${e.label}"
|
|
792
|
+
@click=${()=>f.toggleOpen(e.id)}>
|
|
793
|
+
${a(s?`functioneel-delta-omlaag`:`functioneel-delta-rechts`,{size:16})}
|
|
794
|
+
</button>`:i.nested?r`<span class="lintje-treemap__toggle-space" aria-hidden="true"></span>`:S}
|
|
795
|
+
${n.clickable?r`<button type="button" class="lintje-treemap__part lintje-treemap__part--button"
|
|
796
|
+
role=${n.role===`link`?`link`:S} aria-pressed=${n.pressed}
|
|
797
|
+
data-mark-id=${n.markId} @click=${n.click}>${v}</button>`:r`<div class="lintje-treemap__part">${v}</div>`}
|
|
798
|
+
${h&&s?r`<ul class="lintje-treemap__subs" role="list" id=${p}>
|
|
799
|
+
${e.areas.map(e=>r`<li class="lintje-treemap__sub ${e.other?`lintje-treemap__sub--other`:``}">
|
|
800
|
+
<span class="lintje-treemap__name">${e.label}${e.other?r`<span class="lintje-treemap__count"> · ${e.folded.length} posten</span>`:S}</span>
|
|
801
|
+
<span class="lintje-treemap__amount">${u(e.value)}</span>
|
|
788
802
|
<!-- In the total, as in the part's row and the CSV: one column, one share. -->
|
|
789
|
-
<span class="lintje-treemap__share">${
|
|
803
|
+
<span class="lintje-treemap__share">${d(e.value)}</span>
|
|
790
804
|
${w(e.value,e.other?`var(--color-chart-other)`:g,!0)}
|
|
791
805
|
</li>`)}
|
|
792
|
-
${
|
|
806
|
+
${e.missing.map(e=>r`<li class="lintje-treemap__sub">
|
|
793
807
|
<span class="lintje-treemap__name">${e}</span>
|
|
794
808
|
<span class="lintje-treemap__amount lintje-treemap__amount--none">geen gegevens</span>
|
|
795
809
|
</li>`)}
|
|
796
810
|
</ul>`:S}
|
|
797
|
-
</li>`}),E=
|
|
811
|
+
</li>`}),E=t.parts.filter(qn).map(e=>r`
|
|
798
812
|
<li class="lintje-treemap__row lintje-treemap__row--missing">
|
|
799
|
-
${
|
|
813
|
+
${i.nested?r`<span class="lintje-treemap__toggle-space" aria-hidden="true"></span>`:S}
|
|
800
814
|
<div class="lintje-treemap__part">
|
|
801
815
|
<span class="lintje-treemap__swatch lintje-treemap__swatch--hatch" aria-hidden="true"></span>
|
|
802
816
|
<span class="lintje-treemap__name">${e.label}</span>
|
|
803
817
|
<span class="lintje-treemap__amount lintje-treemap__amount--none">geen gegevens</span>
|
|
804
818
|
</div>
|
|
805
|
-
</li>`);return
|
|
806
|
-
<svg viewBox="0 0 ${h} ${
|
|
807
|
-
class="lintje-chart__svg lintje-treemap__strip" ${
|
|
819
|
+
</li>`);return r`
|
|
820
|
+
<svg viewBox="0 0 ${h} ${$n}" width=${h} height=${$n}
|
|
821
|
+
class="lintje-chart__svg lintje-treemap__strip" ${o({height:`${$n}px`})}
|
|
808
822
|
role="img" aria-labelledby="${m}-desc">
|
|
809
|
-
<desc id="${m}-desc">${
|
|
810
|
-
${
|
|
823
|
+
<desc id="${m}-desc">${p}</desc>
|
|
824
|
+
${y(JSON.stringify(t.parts),n`${C}`)}
|
|
811
825
|
</svg>
|
|
812
|
-
<ul class="lintje-treemap__rows ${
|
|
813
|
-
`}var
|
|
814
|
-
<path d=${
|
|
815
|
-
class="lintje-chart__mark lintje-sankey__band ${
|
|
816
|
-
data-mark-id=${
|
|
817
|
-
aria-pressed=${
|
|
818
|
-
@click=${
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
826
|
+
<ul class="lintje-treemap__rows ${i.nested?``:`lintje-treemap__rows--flat`}" role="list">${T}${E}</ul>
|
|
827
|
+
`}var dr=12,fr=14,pr=96,mr=32,hr=6,gr=21,_r=36,vr=24,yr=2,br=28,xr=24,Sr=8,Cr=e=>e.reduce((e,t)=>e+(t.value??0),0);function wr(e){let t=/* @__PURE__ */ new Map,n=e.steps.map((e,n)=>({label:e.label,nodes:e.nodes.map((e,r)=>{let i={id:e.id,label:e.label,href:e.href,value:e.value,step:n,index:r,size:0,unknown:!1,atLeast:!1,inflow:[],outflow:[],stub:0,rest:0};return t.has(e.id)||t.set(e.id,i),i})})),r=e.flows.flatMap(e=>{let n=t.get(e.from),r=t.get(e.to);return!n||!r||r.step!==n.step+1?[]:[{id:e.id??`${e.from}→${e.to}`,from:n,to:r,value:e.value,href:e.href}]});for(let e of r)e.from.outflow.push(e),e.to.inflow.push(e);let i=[],a=n.length-1;for(let e of n)for(let t of e.nodes){t.outflow.sort((e,t)=>e.to.index-t.to.index),t.inflow.sort((e,t)=>e.from.index-t.from.index);let e=Cr(t.inflow),n=Cr(t.outflow),r=t.outflow.some(e=>e.value==null),o=[...t.inflow,...t.outflow].some(e=>e.value!=null);t.value==null?(t.size=Math.max(e,n),t.unknown=!o,t.atLeast=!t.unknown&&t.inflow.some(e=>e.value==null),r&&t.inflow.length===0?(t.atLeast=!t.unknown,i.push(`node "${t.id}" has a missing flow out of it and no value`)):r&&(t.stub=Math.max(0,e-n))):t.value<n?(t.size=n,i.push(`node "${t.id}" has a value below the known flows out of it`)):(t.size=t.value,r&&(t.stub=t.value-n)),t.rest=t.step<a?Math.max(0,t.size-n-t.stub):0}return{steps:n,flows:r,total:(n[0]?.nodes??[]).reduce((e,t)=>e+t.size,0),problems:i}}function Tr(e){let t=Math.max(1,...e.steps.map(e=>e.nodes.length));return vr+t*_r+(t-1)*fr}function Er(e){let t=[];for(let n of e.steps)for(let e of n.nodes){t.push({kind:`node`,node:e});let n=!1;for(let r of e.outflow)r.value==null?(e.stub>0&&!n&&t.push({kind:`stub`,node:e}),n=!0):r.value>0&&t.push({kind:`flow`,flow:r})}return t}function Dr(e,t){let{width:n,height:r,nameWidth:i,valueWidth:a}=t,{steps:o}=e,s=o.length,c=(e,t)=>Math.max(0,...(o[e]?.nodes??[]).map(e=>Math.max(i(e),t?a(e):0))),l=e=>{let t=c(0,e)+hr,r=n-(s>1?c(s-1,e)+hr:0)-dr,i=s>1?(r-t)/(s-1):0;return{columns:o.map((e,n)=>t+i*n),run:i-dr}},u=o.slice(1,-1).flatMap(e=>e.nodes),d=l(!0),f=d.run>=(s>2?pr:0)+mr&&u.every(e=>a(e)<=88),{columns:p,run:m}=f?d:l(!1);if(s>1&&m<mr){let e=(s-1)*44+dr,t=Math.max(0,Math.min(p[0],n-e));p=o.map((e,n)=>t+n*44),m=mr}let h=s>2?Math.max(0,Math.min(pr,m-mr)):0,g=r-vr,_=(e,t)=>t.reduce((t,n)=>t+Math.max(n.size*e,_r),0)+fr*Math.max(0,t.length-1),v=e=>o.every(t=>_(e,t.nodes)<=g+1e-6),y=Math.max(0,...o.flatMap(e=>e.nodes.map(e=>e.size))),b=0;if(y>0){let e=0,t=g/y;if(v(t))e=t;else for(let n=0;n<48;n++){let n=(e+t)/2;v(n)?e=n:t=n}b=e}let x=/* @__PURE__ */ new Map;o.forEach((e,t)=>{let n=vr+Math.max(0,(g-_(b,e.nodes))/2);for(let r of e.nodes){let e=r.size*b,i=Math.max(e,_r);x.set(r,{x:p[t],y:n+(i-e)/2,h:e,slot:i,slotTop:n}),n+=i+fr}});let S=/* @__PURE__ */ new Map,C=/* @__PURE__ */ new Map,w=/* @__PURE__ */ new Map;for(let e of x.keys()){let t=x.get(e),n=t.y;for(let r of e.outflow)if(r.value!=null)S.set(r,n),n+=r.value*b;else if(e.stub>0&&!w.has(e)){let r=e.stub*b;w.set(e,{x:t.x+dr,y:n,h:Math.max(yr,r)}),n+=r}n=t.y;for(let t of e.inflow)t.value!=null&&(C.set(t,n),n+=t.value*b)}let T=/* @__PURE__ */ new Map;for(let t of e.flows){if(t.value==null||t.value<=0)continue;let e=t.value*b,n=Math.max(yr,e),r=(e-n)/2,i=x.get(t.from).x+dr;T.set(t,{a:S.get(t)+r,b:C.get(t)+r,thickness:n,x0:i,xs:i+(t.from.step>0?h:0),x1:x.get(t.to).x})}return{width:n,height:r,scale:b,columns:p,strip:h,values:f,node:x,band:T,stub:w}}function Or({a:e,b:t,thickness:n,x0:r,xs:i,x1:a}){let o=(i+a)/2;return[`M${r},${e}`,`H${i}`,`C${o},${e} ${o},${t} ${a},${t}`,`V${t+n}`,`C${o},${t+n} ${o},${e+n} ${i},${e+n}`,`H${r}`,`Z`].join(` `)}function kr({a:e,b:t,thickness:n,x0:r,xs:i,x1:a}){let o=(i+a)/2;return`M${r},${e+n/2} H${i} C${o},${e+n/2} ${o},${t+n/2} ${a},${t+n/2}`}var Ar=/* @__PURE__ */ new WeakSet;function jr(e){if(e.kind===`flow`)return{flows:/* @__PURE__ */ new Set([e.flow]),nodes:/* @__PURE__ */ new Set([e.flow.from,e.flow.to]),stubs:/* @__PURE__ */ new Set};let{node:t}=e;if(e.kind===`stub`){let e=t.outflow.filter(e=>e.value==null);return{flows:/* @__PURE__ */ new Set,nodes:/* @__PURE__ */ new Set([t,...e.map(e=>e.to)]),stubs:/* @__PURE__ */ new Set([t])}}let n=[...t.inflow,...t.outflow];return{flows:new Set(n),nodes:/* @__PURE__ */ new Set([t,...n.map(e=>e.from),...n.map(e=>e.to)]),stubs:/* @__PURE__ */ new Set([t])}}function Mr(e,t){let n=wr(e);n.problems.length&&!Ar.has(e)&&(Ar.add(e),console.warn(`lintje-chart (sankey): ${n.problems.join(`; `)}`));let r=e.label??`Aantal`,i=ue(e.color)??`var(--color-chart-default)`,a=e.share!==!1,o=t=>`${d(t)}${e.unit?` ${e.unit}`:``}`,c=(e,t)=>s(t>0?e/t*100:0),l=e=>e.unknown?`geen gegevens`:`${e.atLeast?`≥ `:``}${d(e.size)}`,u=e=>e.unknown?`geen gegevens`:`${e.atLeast?`≥ `:``}${o(e.size)}`,f=e=>e.unknown||e.atLeast||n.total<=0?null:c(e.size,n.total),p=Me(t,[...n.steps.flatMap(e=>e.nodes.map(e=>e.href?{id:e.id,href:e.href}:null)),...n.flows.map(e=>e.href?{id:e.id,href:e.href}:null)]);return t.mobile?Fr(e,t,n,p,{count:l,pct:c}):Pr(e,t,n,p,{name:r,color:i,showShare:a,withUnit:o,pct:c,count:l,countWithUnit:u,nodeShare:f,small:e.small??!1})}function Nr(e,t,n,r){return e.of(t.href?{id:t.id,href:t.href}:null,n,r)}function Pr(e,t,i,a,s){let{controller:c,description:l}=t,{name:u,color:d,showShare:f,withUnit:p,pct:m,count:h,countWithUnit:_,nodeShare:v}=s,y=c.id,b=s.small?`--chart-h-small`:`--chart-h-main`;c.measure({width:!0,height:t.height??b,fit:!!t.expanded});let C=c.width,w=t.height??Math.max(c.height,Tr(e)),T=c.font,E=e=>{let t=f?v(e):null;return{count:h(e),share:t==null?``:` · ${t}`}},D=e=>x(e.label,T,400,14),O=e=>{let t=E(e);return x(t.count,T,700)+x(t.share,T)},k=Dr(i,{width:C,height:w,nameWidth:D,valueWidth:O}),A=Er(i),j=i.steps.length-1,P=e=>{let t=v(e),n=[{label:u,value:_(e),color:d}];t!=null&&n.push({label:`van het totaal`,value:t});let r=e.step===j?e.inflow.map(e=>({label:`uit ${e.from.label}`,value:e.value})):e.outflow.map(e=>({label:`→ ${e.to.label}`,value:e.value}));return r.forEach((e,t)=>n.push({label:e.label,value:e.value==null?`geen gegevens`:p(e.value),divider:t===0})),e.rest>0&&n.push({label:`eindigt hier`,value:p(e.rest),divider:!r.length}),{title:`${e.label} (${i.steps[e.step].label})`,rows:n}},F=e=>({title:`${e.from.label} → ${e.to.label}`,rows:[{label:u,value:p(e.value??0),color:d},{label:`van ${e.from.label}`,value:m(e.value??0,e.from.size)},{label:`van het totaal`,value:m(e.value??0,i.total)}]}),I=e=>`${e.label} zonder ${i.steps[e.step+1]?.label??``}`.trim(),L=e=>e.outflow.filter(e=>e.value==null),R=e=>({title:`Geen gegevens`,rows:[{label:I(e),value:p(e.stub)},...L(e).map((e,t)=>({label:`→ ${e.to.label}`,value:``,divider:t===0}))]}),z=e=>{if(e.kind===`flow`){let{flow:t}=e;return`${t.from.label} → ${t.to.label}: ${p(t.value??0)} (${m(t.value??0,t.from.size)} van ${t.from.label})`}let{node:t}=e;if(e.kind===`stub`){let e=L(t).map(e=>e.to.label);return`${I(t)}: ${p(t.stub)}, geen gegevens over ${e.join(` en `)}`}let n=v(t);return`${t.label} (${i.steps[t.step].label}): ${_(t)}${n==null?``:` (${n} van het totaal)`}`},B=e=>e.kind===`flow`?F(e.flow):e.kind===`stub`?R(e.node):P(e.node),V=xe(c,A.length,e=>{let t=A[e],n=B(t),r=z(t);if(t.kind===`flow`){let e=k.band.get(t.flow),i=(e.xs+e.x1)/2;return{x:i,y:(e.a+e.b)/2+e.thickness/2,content:n,sentence:r,side:i>C/2?`left`:void 0}}if(t.kind===`stub`){let e=k.stub.get(t.node);return{x:e.x+br,y:e.y+e.h/2,content:n,sentence:r}}let i=k.node.get(t.node),a=i.slotTop+i.slot/2;return t.node.step===0?{x:i.x+dr,y:a,content:n,sentence:r}:{x:i.x,y:a,content:n,sentence:r,side:`left`}}),H=(e,t)=>V.point(e,t),U=(e,t)=>V.point(e,t,!0),W=/* @__PURE__ */ new Map;A.forEach((e,t)=>W.set(e.kind===`flow`?e.flow:e.kind===`stub`?`stub:${e.node.id}`:e.node,t));let G=a.active==null?void 0:A.find(e=>e.kind===`flow`?e.flow.id===a.active:e.kind===`node`&&e.node.id===a.active),ee=(c.hoverIndex==null?void 0:A[c.hoverIndex])??G,K=ee?jr(ee):null,q=!!c.status,J=e=>q&&e!=null&&e===c.hoverIndex?`is-current`:``,Y=e=>K&&!e?`is-dimmed`:``,te=e=>`${e.clickable?`is-clickable`:``} ${e.pressed===`true`?`is-selected`:``}`,ne=`url(#hatch-${y})`,Z=i.steps.slice(0,-1).map((e,t)=>{let r=i.flows.filter(e=>e.from.step===t&&k.band.has(e)).map(e=>{let t=k.band.get(e),r=W.get(e),i=Nr(a,e,`${e.from.label} → ${e.to.label}`,z({kind:`flow`,flow:e})),o=K?.flows.has(e)??!1;return n`<g @mousemove=${e=>r!=null&&H(e,r)}>
|
|
828
|
+
<path d=${Or(t)} fill=${d}
|
|
829
|
+
class="lintje-chart__mark lintje-sankey__band ${te(i)} ${o?`is-active`:``} ${Y(o)} ${J(r)}"
|
|
830
|
+
data-mark-id=${i.markId} role=${i.role} tabindex=${i.tabIndex}
|
|
831
|
+
aria-pressed=${i.pressed} aria-label=${i.label}
|
|
832
|
+
@click=${i.click} @keydown=${i.keydown}
|
|
833
|
+
@focus=${i.clickable?e=>r!=null&&U(e,r):S}
|
|
834
|
+
@blur=${i.clickable?()=>c.hoverAt(null):S} />
|
|
835
|
+
${t.thickness<Sr?n`<path class="lintje-sankey__hit lintje-sankey__hit--line ${i.clickable?`is-clickable`:``}"
|
|
836
|
+
d=${kr(t)} @click=${i.click} />`:S}
|
|
837
|
+
</g>`}),s=e.nodes.map(e=>{let t=k.stub.get(e);if(!t)return S;let r=W.get(`stub:${e.id}`);return n`<rect class="lintje-sankey__stub ${Y(K?.stubs.has(e)??!1)} ${J(r)}"
|
|
838
|
+
x=${t.x} y=${t.y} width=${br} height=${t.h} fill=${ne}
|
|
839
|
+
@mousemove=${e=>r!=null&&H(e,r)} />`});return n`<g class="lintje-sankey__flows" ${o(M(t,Math.max(1,i.steps.length-1)))}>
|
|
840
|
+
${r}${s}
|
|
841
|
+
</g>`}),re=i.steps.flatMap(e=>e.nodes.map(e=>{let t=k.node.get(e),r=W.get(e),i=Nr(a,e,e.label,z({kind:`node`,node:e})),o=Math.max(t.h,Math.min(xr,t.slot));return t.h===0&&i.clickable?S:n`<g @mousemove=${e=>r!=null&&H(e,r)}>
|
|
842
|
+
<rect class="lintje-sankey__hit ${i.clickable?`is-clickable`:``}"
|
|
843
|
+
x=${t.x+dr/2-xr/2} y=${t.y+t.h/2-o/2}
|
|
844
|
+
width=${xr} height=${o} @click=${i.click} />
|
|
845
|
+
${t.h>0?n`<rect class="lintje-chart__mark lintje-sankey__node ${te(i)} ${Y(K?.nodes.has(e)??!1)} ${J(r)}"
|
|
846
|
+
x=${t.x} y=${t.y} width=${dr} height=${t.h} fill=${d}
|
|
847
|
+
data-mark-id=${i.markId} role=${i.role} tabindex=${i.tabIndex}
|
|
848
|
+
aria-pressed=${i.pressed} aria-label=${i.label}
|
|
849
|
+
@click=${i.click} @keydown=${i.keydown}
|
|
850
|
+
@focus=${i.clickable?e=>r!=null&&U(e,r):S}
|
|
851
|
+
@blur=${i.clickable?()=>c.hoverAt(null):S} />`:S}
|
|
852
|
+
</g>`})),$=i.steps.flatMap((e,t)=>e.nodes.map(e=>{let r=k.node.get(e),i=t===0,o=i?r.x-hr:r.x+dr+hr,s=i?`end`:`start`,l=r.slotTop+r.slot/2,u=E(e),d=t>0&&t<j,f=n`<text x=${o} y=${k.values?l-3:l+5} text-anchor=${s}
|
|
836
853
|
class="lintje-sankey__name">${e.label}</text>
|
|
837
|
-
${
|
|
838
|
-
class="lintje-chart__data-label lintje-sankey__value">${
|
|
839
|
-
class="lintje-sankey__share">${
|
|
840
|
-
|
|
854
|
+
${k.values?n`<text x=${o} y=${l+14} text-anchor=${s}
|
|
855
|
+
class="lintje-chart__data-label lintje-sankey__value">${u.count}<tspan
|
|
856
|
+
class="lintje-sankey__share">${u.share}</tspan></text>`:S}`,p=W.get(e),m=r.h===0?Nr(a,e,e.label,z({kind:`node`,node:e})):null;if(m?.clickable){let t=Math.max(D(e),k.values?O(e):0)+12,r=k.values?_r:gr,a=k.values?`${e.label} ${u.count}${u.share}`:e.label;return n`<g class="lintje-sankey__label lintje-sankey__label--control ${te(m)} ${d?`is-on-band`:``} ${J(p)}"
|
|
857
|
+
data-mark-id=${m.markId} role=${m.role} tabindex=${m.tabIndex}
|
|
858
|
+
aria-pressed=${m.pressed} aria-label=${a}
|
|
859
|
+
@click=${m.click} @keydown=${m.keydown}
|
|
860
|
+
@mousemove=${e=>p!=null&&H(e,p)}
|
|
861
|
+
@focus=${e=>p!=null&&U(e,p)}
|
|
862
|
+
@blur=${()=>c.hoverAt(null)}>
|
|
863
|
+
<rect class="lintje-sankey__label-box" x=${i?o+hr-t:o-hr}
|
|
864
|
+
y=${l-Math.max(r,xr)/2} width=${t}
|
|
865
|
+
height=${Math.max(r,xr)} />
|
|
866
|
+
${f}
|
|
867
|
+
</g>`}return n`<g class="lintje-sankey__label ${d?`is-on-band`:``}"
|
|
868
|
+
aria-hidden=${a.interactive?`true`:S}>
|
|
869
|
+
${f}
|
|
870
|
+
</g>`})),ie=i.steps.map((e,t)=>n`<text x=${t===0?k.columns[0]+dr:k.columns[t]} y="12"
|
|
841
871
|
text-anchor=${t===0?`end`:`start`}
|
|
842
|
-
class="lintje-chart__axis-label">${e.label}</text>`),
|
|
843
|
-
<div class="lintje-chart-wrap ${
|
|
844
|
-
${
|
|
845
|
-
@keydown=${e=>
|
|
846
|
-
${ce({items:
|
|
872
|
+
class="lintje-chart__axis-label">${e.label}</text>`),oe=i.flows.some(e=>e.value==null),se=[{label:u,color:d,shape:`square`,fixed:!0},{label:`Stroom: de breedte is het aantal`,color:d,shape:`flow`,fixed:!0},...oe?[{label:`Geen gegevens`,shape:`hatch`,fixed:!0}]:[]],le=[n`<g aria-hidden=${a.interactive?`true`:S}>${ie}</g>`,n`<g @mouseleave=${V.leave}>${Z}${re}</g>`,n`<g>${$}</g>`];return r`
|
|
873
|
+
<div class="lintje-chart-wrap ${s.small?`lintje-chart--small`:``}"
|
|
874
|
+
${g(c.attach)} ?data-in-view=${c.inView} data-tooltip-anchor
|
|
875
|
+
@keydown=${e=>c.dismiss(e)||a.escape(e)}>
|
|
876
|
+
${ce({items:se})}
|
|
847
877
|
<figure class="lintje-chart">
|
|
848
|
-
<svg viewBox="0 0 ${
|
|
878
|
+
<svg viewBox="0 0 ${C} ${w}" width=${C} height=${w}
|
|
849
879
|
class="lintje-chart__svg lintje-sankey"
|
|
850
|
-
${
|
|
851
|
-
role=${
|
|
852
|
-
@keydown=${
|
|
853
|
-
<desc id="${
|
|
880
|
+
${o({height:`${w}px`,...Q(y)})}
|
|
881
|
+
role=${ae(a.interactive)} aria-labelledby="${y}-desc" tabindex="0"
|
|
882
|
+
@keydown=${V.keydown} @focus=${V.focus} @blur=${V.blur}>
|
|
883
|
+
<desc id="${y}-desc">${l}</desc>
|
|
854
884
|
<defs>
|
|
855
|
-
<pattern id="hatch-${
|
|
885
|
+
<pattern id="hatch-${y}" width="6" height="6" patternUnits="userSpaceOnUse"
|
|
856
886
|
patternTransform="rotate(45)">
|
|
857
887
|
<line x1="0" y1="0" x2="0" y2="6" stroke="var(--color-chart-hatch)" stroke-width="2" />
|
|
858
888
|
</pattern>
|
|
859
|
-
${
|
|
889
|
+
${X(y)}
|
|
860
890
|
</defs>
|
|
861
|
-
${
|
|
891
|
+
${le}
|
|
862
892
|
</svg>
|
|
863
893
|
</figure>
|
|
864
|
-
${N(
|
|
865
|
-
${Se(
|
|
894
|
+
${N(c)}
|
|
895
|
+
${Se(c)}
|
|
866
896
|
</div>
|
|
867
|
-
`}function
|
|
868
|
-
<p class="lintje-sankey__heading" id=${
|
|
869
|
-
${
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
897
|
+
`}function Fr(e,t,n,i,a){let{controller:s,description:c}=t,{count:l,pct:u}=a;s.measure({width:!0});let f=s.width,p=s.font,m=v(e.color)?e.color:void 0,h=s.id,_=e=>e.charAt(0).toLowerCase()+e.slice(1),y=n.steps.slice(0,-1).map((e,t)=>{let a=n.steps[t+1],s=a.nodes.length>5?new Set([...a.nodes].sort((e,t)=>t.size-e.size).slice(0,4)):new Set(a.nodes),c=a.nodes.filter(e=>s.has(e)),g=c.length+ +(s.size<a.nodes.length),v=Ye(g,m),y=Je(g),b=e=>s.has(e)?c.indexOf(e):g-1,C=e=>v[b(e)],w=e=>L(m,y[b(e)]),T=L(m,y[g-1]),E=e.nodes.filter(e=>e.outflow.length>0||e.size>0),D=`${h}-transition-${t}`;return r`<section class="lintje-sankey__transition" role="group" aria-labelledby=${D}>
|
|
898
|
+
<p class="lintje-sankey__heading" id=${D}>${e.label} → ${_(a.label)}</p>
|
|
899
|
+
${E.map(e=>{let t=[],n=!1,a=0;for(let r of e.outflow)if(r.value==null)!n&&e.stub>0&&t.push({weight:e.stub,fill:``,kind:`missing`}),n=!0;else if(r.value>0&&!s.has(r.to))a+=r.value;else if(r.value>0){let n=w(r.to);t.push({weight:r.value,fill:C(r.to),kind:n??`unlabelled`,share:n?u(r.value,e.size):void 0})}a>0&&t.push({weight:a,fill:v[g-1],kind:T??`unlabelled`,share:T?u(a,e.size):void 0}),e.rest>0&&t.push({weight:e.rest,fill:``,kind:`rest`,share:u(e.rest,e.size)});let c=Math.max(0,f-2*Math.max(0,t.length-1)),m=t.reduce((e,t)=>e+t.weight,0)||1,h=Nr(i,e,e.label,`${e.label}: ${l(e)}`),_=e.outflow.filter(e=>!s.has(e.to)),y=(t,n=!1)=>{let a=t.href?t:t.to,s=t.value==null?`${t.to.label}: geen gegevens`:`${t.to.label}: ${d(t.value)}, ${u(t.value,e.size)} van ${e.label}`,c=Nr(i,a,t.to.label,s);return r`<li class="lintje-sankey__row ${n?`lintje-sankey__row--part`:``}">
|
|
900
|
+
<span class="lintje-sankey__row-mark ${c.state}" data-mark-id=${c.markId}
|
|
901
|
+
role=${c.role} tabindex=${c.tabIndex} aria-pressed=${c.pressed}
|
|
902
|
+
aria-label=${c.label} @click=${c.click} @keydown=${c.keydown}>
|
|
903
|
+
${n?S:r`<span class="lintje-sankey__swatch ${t.value==null?`lintje-sankey__swatch--missing`:``}"
|
|
904
|
+
${o({background:t.value==null?void 0:C(t.to)})}></span>`}
|
|
905
|
+
<span class="lintje-sankey__row-name">${t.to.label}</span>
|
|
906
|
+
${t.value==null?r`<span class="lintje-sankey__row-share">geen gegevens</span>`:r`<span class="lintje-sankey__row-count">${d(t.value)}</span>
|
|
907
|
+
<span class="lintje-sankey__row-share">${u(t.value,e.size)}</span>`}
|
|
908
|
+
</span>
|
|
909
|
+
</li>`},b=t=>{let n=t.every(e=>e.value!=null),i=t.reduce((e,t)=>e+(t.value??0),0);return r`<li class="lintje-sankey__row">
|
|
910
|
+
<span class="lintje-sankey__row-mark">
|
|
911
|
+
<span class="lintje-sankey__swatch" ${o({background:v[g-1]})}></span>
|
|
912
|
+
<span class="lintje-sankey__row-name">Overig</span>
|
|
913
|
+
${n?r`<span class="lintje-sankey__row-count">${d(i)}</span>
|
|
914
|
+
<span class="lintje-sankey__row-share">${u(i,e.size)}</span>`:r`<span class="lintje-sankey__row-share">geen gegevens</span>`}
|
|
915
|
+
</span>
|
|
916
|
+
</li>`};return r`<div class="lintje-sankey__source">
|
|
917
|
+
<p class="lintje-sankey__source-head ${h.state}" data-mark-id=${h.markId}
|
|
918
|
+
role=${h.role} tabindex=${h.tabIndex} aria-pressed=${h.pressed}
|
|
919
|
+
aria-label=${h.label} @click=${h.click} @keydown=${h.keydown}>
|
|
873
920
|
<!-- The space keeps name and count two words, as the button's name says them (2.5.3). -->
|
|
874
|
-
<span>${e.label}</span> <span>${
|
|
921
|
+
<span>${e.label}</span> <span>${l(e)}</span>
|
|
875
922
|
</p>
|
|
876
923
|
<div class="lintje-sankey__bar" aria-hidden="true">
|
|
877
|
-
${
|
|
878
|
-
${
|
|
879
|
-
>${
|
|
924
|
+
${t.map(e=>{let t=e.share!=null&&x(e.share,p,700)+8<=c*e.weight/m;return r`<span class="lintje-sankey__piece lintje-sankey__piece--${e.kind}"
|
|
925
|
+
${o({"--lintje-weight":String(e.weight),background:e.fill||void 0})}
|
|
926
|
+
>${t?e.share:S}</span>`})}
|
|
880
927
|
</div>
|
|
881
|
-
<ul class="lintje-sankey__rows">
|
|
882
|
-
${e.outflow.
|
|
883
|
-
|
|
884
|
-
role=${u.role} tabindex=${u.tabIndex} aria-pressed=${u.pressed}
|
|
885
|
-
aria-label=${u.label} @click=${u.click} @keydown=${u.keydown}>
|
|
886
|
-
<span class="lintje-sankey__swatch ${n.value==null?`lintje-sankey__swatch--missing`:``}"
|
|
887
|
-
${t({background:n.value==null?void 0:s[l(n.to)]})}></span>
|
|
888
|
-
<span class="lintje-sankey__row-name">${n.to.label}</span>
|
|
889
|
-
${n.value==null?i`<span class="lintje-sankey__row-share">geen gegevens</span>`:i`<span class="lintje-sankey__row-count">${c(n.value)}</span>
|
|
890
|
-
<span class="lintje-sankey__row-share">${d(n.value,e.size)}</span>`}
|
|
891
|
-
</span>
|
|
892
|
-
</li>`})}
|
|
893
|
-
${e.rest>0?i`<li class="lintje-sankey__row">
|
|
928
|
+
<ul class="lintje-sankey__rows" role="list">
|
|
929
|
+
${[...e.outflow.filter(e=>s.has(e.to)).map(e=>y(e)),..._.length?[b(_),..._.map(e=>y(e,!0))]:[]]}
|
|
930
|
+
${e.rest>0?r`<li class="lintje-sankey__row">
|
|
894
931
|
<span class="lintje-sankey__row-mark">
|
|
895
932
|
<span class="lintje-sankey__swatch lintje-sankey__swatch--rest"></span>
|
|
896
933
|
<span class="lintje-sankey__row-name">eindigt hier</span>
|
|
897
|
-
<span class="lintje-sankey__row-count">${
|
|
898
|
-
<span class="lintje-sankey__row-share">${
|
|
934
|
+
<span class="lintje-sankey__row-count">${d(e.rest)}</span>
|
|
935
|
+
<span class="lintje-sankey__row-share">${u(e.rest,e.size)}</span>
|
|
899
936
|
</span>
|
|
900
937
|
</li>`:S}
|
|
901
938
|
</ul>
|
|
902
939
|
</div>`})}
|
|
903
|
-
</section>`});return
|
|
904
|
-
<div class="lintje-chart-wrap" ${
|
|
905
|
-
data-tooltip-anchor @keydown=${e=>
|
|
906
|
-
<figure class="lintje-chart lintje-sankey lintje-sankey--rows" aria-labelledby="${
|
|
907
|
-
<figcaption id="${
|
|
940
|
+
</section>`});return r`
|
|
941
|
+
<div class="lintje-chart-wrap" ${g(s.attach)} ?data-in-view=${s.inView}
|
|
942
|
+
data-tooltip-anchor @keydown=${e=>i.escape(e)}>
|
|
943
|
+
<figure class="lintje-chart lintje-sankey lintje-sankey--rows" aria-labelledby="${h}-desc">
|
|
944
|
+
<figcaption id="${h}-desc" class="visually-hidden">${c}</figcaption>
|
|
908
945
|
${y}
|
|
909
946
|
</figure>
|
|
910
947
|
</div>
|
|
911
|
-
`}function
|
|
912
|
-
id=${
|
|
948
|
+
`}function Ir(e,t){switch(t.controller.follow(e),e.kind){case`line`:return Ae(e,t);case`bar`:return Le(e,t);case`horizontal-bar`:return ze(e,t);case`target-progress`:return Be(e,t);case`grouped-bar`:return Ke(e,t);case`stacked-bar`:return tt(e,t);case`stacked-area`:return rt(e,t);case`pie`:return ct(e,t);case`dual-axis`:return lt(e,t);case`scatter`:return yt(e,t);case`heatmap`:return Mt(e,t);case`histogram`:return Bt(e,t);case`radar`:return an(e,t);case`dumbbell`:return jn(e,t);case`treemap`:return nr(e,t);case`sankey`:return Mr(e,t)}}var Lr=`.lintje-chart__svg, .lintje-pie-chart__svg`;function Rr(e){return(e??``).normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`grafiek`}function zr(e){switch(e.kind){case`line`:case`stacked-area`:case`dual-axis`:case`scatter`:return`line`;case`pie`:return e.donut?`donut`:`pie`;case`radar`:return`pie`;case`heatmap`:return`heatmap`;case`treemap`:return`treemap`;default:return`bar`}}function Br(e,t){switch(e.kind){case`horizontal-bar`:case`target-progress`:return e.rows.length?`${Re(e.rows.length)}px`:void 0;case`dumbbell`:return e.rows.length?`${Tn(e.rows.length,t)}px`:void 0;case`pie`:case`heatmap`:return;case`sankey`:return`max(${Tr(e)}px, var(${e.small?`--chart-h-small`:`--chart-h-main`}))`;default:return e.small?`var(--chart-h-small)`:void 0}}function Vr(e){let t=e.kind===`bar`||e.series.some(e=>!e.comparison)?le(e.forecastFrom,e.labels.length):null,n=(e.forecastLabel??`Raming`).toLowerCase();return{from:t,bounds:(e,n)=>{if(t==null||n<t)return[``,``];let{low:r,high:i}=Z(e,n);return[r,i]},kind:e=>t==null?[]:[e<t?`gemeten`:n],kindHeader:t==null?[]:[`Soort`]}}function Hr(e){switch(e.kind){case`line`:{let t=e.events??[],n=e=>t.filter(t=>t.index===e).map(e=>e.label).join(`; `),r=Vr(e),i=e=>r.from!=null&&!e.comparison&&e.forecast!=null;return[[``,...e.series.flatMap(e=>[e.label,...i(e)?[`${e.label} ondergrens`,`${e.label} bovengrens`]:[]]),...t.length?[`Gebeurtenis`]:[],...r.kindHeader],...e.labels.map((a,o)=>[a,...e.series.flatMap(e=>[e.values[o],...i(e)?r.bounds(e.forecast,o):[]]),...t.length?[n(o)]:[],...r.kind(o)])]}case`bar`:{let t=Vr(e),n=t.from!=null&&e.forecast!=null;return[[``,e.axisTitle??`Waarde`,...n?[`Ondergrens`,`Bovengrens`]:[],...e.trend?[`Trend`]:[],...t.kindHeader],...e.labels.map((r,i)=>[r,e.values[i],...n?t.bounds(e.forecast,i):[],...e.trend?[e.trend[i]]:[],...t.kind(i)])]}case`horizontal-bar`:return[[``,e.unit?`Waarde (${e.unit})`:`Waarde`],...e.rows.map(e=>[e.label,e.value])];case`target-progress`:return[[``,`Voortgang (%)`,`Doel (%)`],...e.rows.map(t=>[t.label,t.value,e.target??100])];case`grouped-bar`:case`stacked-bar`:return[[``,...e.series.map(e=>e.label)],...e.labels.map((t,n)=>[t,...e.series.map(e=>e.values[n])])];case`stacked-area`:return[[``,...e.series.map(e=>e.label),`Totaal`],...e.labels.map((t,n)=>{let r=e.series.map(e=>e.values[n]),i=r.some(e=>e==null)?null:Number(r.reduce((e,t)=>e+t,0).toFixed(Ur(r)));return[t,...r,i]})];case`pie`:return[[``,`Aantal`],...e.segments.map(e=>[e.label,e.value])];case`dual-axis`:{let t=e=>e.unit?`${e.label} (${e.unit})`:e.label;return[[``,t(e.left),t(e.right)],...e.labels.map((t,n)=>[t,e.left.values[n],e.right.values[n]])]}case`scatter`:{let t=(e,t)=>{let n=e.charAt(0).toUpperCase()+e.slice(1);return t?`${n} (${t})`:n};return[[`Reeks`,`Naam`,t(e.xTitle,e.xUnit),t(e.axisTitle,e.unit)],...e.series.flatMap(e=>e.points.map(t=>[e.label,t.label,t.x,t.y]))]}case`heatmap`:return[[``,...e.columnLabels],...e.rowLabels.map((t,n)=>[t,...e.values[n]??[]])];case`radar`:{let t=e.threshold==null?[]:[e.thresholdLabel??`Norm`];return[[``,...e.series.map(e=>e.label),...t],...e.axes.map((t,n)=>[t,...e.series.map(e=>e.values[n]??null),...e.threshold==null?[]:[e.threshold]])]}case`dumbbell`:{let t=Dn(e.rows),n=e.threshold==null?[]:[e.thresholdLabel??`Norm`];return[[``,e.fromLabel,e.toLabel,`Verschil`,...n],...e.rows.map(n=>[n.label,n.from,n.to,On(n,t),...e.threshold==null?[]:[e.threshold]])]}case`histogram`:{let t=t=>e.unit?`${t} (${e.unit})`:t;return[[`Klasse`,t(`Van`),t(`Tot`),`Aantal`],...e.bins.map(t=>[Rt(t,e.unit),t.from,t.to??``,t.count])]}case`treemap`:return Qn(e);case`sankey`:{let{flows:t}=wr(e);return[[`Van`,`Naar`,e.unit?`Aantal (${e.unit})`:`Aantal`,`Aandeel van de bron (%)`],...t.map(e=>[e.from.label,e.to.label,e.value,e.value==null||e.from.size<=0?null:Math.round(e.value/e.from.size*100)])]}}}function Ur(e){return e.reduce((e,t)=>{if(typeof t!=`number`||Number.isInteger(t))return e;let n=String(t).split(`.`)[1]??``;return Math.max(e,n.length)},0)}var Wr=class extends E{static{this.styles=[T,C(ge),C(e),...me]}static{this.properties={data:{attribute:!1}}}#e=new j(()=>this.requestUpdate());#t=null;#n=new f(this);get dataSettings(){return this.data??void 0}willUpdate(e){super.willUpdate(e)}disconnectedCallback(){this.#e.detach(),this.#t?.detach(),this.#t=null,super.disconnectedCallback()}get ready(){return(this.data?.state??`ready`)===`ready`}get expandable(){return this.data?.expandable!==!1}get downloadName(){let e=this.data?.download;return e===!1?null:e?.filename??Rr(this.data?.title)}csv(){let e=this.data,t=this.downloadName;e&&t!==null&&D(t,Hr(e.chart))}png(){let e=this.data;if(!e)return;let t=this.renderRoot.querySelector(this.expanded?`lintje-modal`:`lintje-tile`),n=t?.querySelector(Lr);for(;n&&n.parentElement!==t;)n=n.parentElement;if(!n)return;let r=this.#n.matches&&e.mobileSubtitle?e.mobileSubtitle:e.subtitle,i=k(n,{title:e.title,subtitle:r,footnote:e.footnote});O(this.downloadName??Rr(e.title),i)}expandChanged(e){e?this.#t??=new j(()=>this.requestUpdate()):(this.#t?.detach(),this.#t=null)}render(){let e=this.data;if(!e)return S;let t=this.ready,n=this.#n.matches&&e.mobileSubtitle?e.mobileSubtitle:e.subtitle,i=this.id?`${this.id}-tile`:void 0;return r`<lintje-tile
|
|
949
|
+
id=${i??S}
|
|
913
950
|
span=${e.span??S}
|
|
914
951
|
heading=${e.title??S}
|
|
915
952
|
?collapsed-mobile=${!!e.collapsedMobile}
|
|
@@ -923,11 +960,11 @@ import{Dt as e,Lt as t,R as n,_ as r,bn as i,ct as a,d as o,f as s,g as c,h as l
|
|
|
923
960
|
state=${e.state??`ready`}
|
|
924
961
|
message=${e.message??S}
|
|
925
962
|
last-known=${e.lastKnown??S}
|
|
926
|
-
content-height=${
|
|
963
|
+
content-height=${Br(e.chart,this.#n.matches)??S}
|
|
927
964
|
@lintje-tile-expand=${e=>{e.stopPropagation(),this.expand(!0)}}
|
|
928
965
|
@lintje-tile-download=${e=>{e.stopPropagation(),this.csv()}}
|
|
929
966
|
>
|
|
930
|
-
${e.notice?
|
|
967
|
+
${e.notice?r`<lintje-announcement
|
|
931
968
|
slot="notice"
|
|
932
969
|
compact
|
|
933
970
|
.data=${e.notice}
|
|
@@ -935,6 +972,6 @@ import{Dt as e,Lt as t,R as n,_ as r,bn as i,ct as a,d as o,f as s,g as c,h as l
|
|
|
935
972
|
${this.content()}
|
|
936
973
|
</lintje-tile>
|
|
937
974
|
|
|
938
|
-
${this.renderExpandModal(this.expanded&&this.#t?
|
|
939
|
-
${he({kind:
|
|
940
|
-
</div>`;case`empty`:case`error`:return S;default:return
|
|
975
|
+
${this.renderExpandModal(this.expanded&&this.#t?Ir(e.chart,{...this.chartOptions(this.#t),expanded:!0}):S,{heading:e.title,subtitle:n,footnote:e.footnote,csv:()=>this.csv(),png:()=>this.png()})}`}content(){let e=this.data;switch(e.state??`ready`){case`loading`:return r`<div slot="loading">
|
|
976
|
+
${he({kind:zr(e.chart),height:Br(e.chart,this.#n.matches),status:!1})}
|
|
977
|
+
</div>`;case`empty`:case`error`:return S;default:return Ir(e.chart,this.chartOptions(this.#e))}}select(e,t=!1){t?e.href&&this.followLink(e.href,void 0,void 0,{newTab:!0}):this.emit(`lintje-mark-select`,e)&&e.href&&this.followLink(e.href)}async focusMark(e,t=null){if(await this.updateComplete,t instanceof HTMLElement&&t.isConnected&&t.dataset.markId===e)return t.focus();let n=this.renderRoot.querySelector(this.expanded?`lintje-modal`:`lintje-tile`),r=n?.querySelector(`[data-mark-id="${CSS.escape(e)}"]`)??n?.querySelector(`${Lr}, .lintje-heatmap, .lintje-sankey--rows`);r&&!r.hasAttribute(`tabindex`)&&r.setAttribute(`tabindex`,`-1`),r?.focus()}chartOptions(e){return{controller:e,description:this.data?.description??``,mobile:this.#n.matches,selectedId:this.data?.selectedId??null,choosing:this.data?.selectedId!==void 0||this.data?.clearHref!==void 0,onSelect:({id:e,label:t,href:n},r)=>this.select({id:e,label:t,href:n},r),onClear:e=>{let t=h();this.select({id:null,label:null,href:this.data?.clearHref}),this.focusMark(e,t)}}}};w(`lintje-chart`,Wr);export{Wr as LintjeChart};
|