@krizaka/charts 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +59 -2
- package/dist/bar.d.ts +17 -0
- package/dist/bar.js +17 -0
- package/dist/bar.js.map +1 -0
- package/dist/candlestick-IG626XL4.js +13 -0
- package/dist/candlestick-IG626XL4.js.map +1 -0
- package/dist/candlestick.d.ts +42 -0
- package/dist/candlestick.js +13 -0
- package/dist/candlestick.js.map +1 -0
- package/dist/canvas-4MSYDVFO.js +14 -0
- package/dist/canvas-4MSYDVFO.js.map +1 -0
- package/dist/cartesian-BRhNQ3ib.d.ts +34 -0
- package/dist/chart.d.ts +58 -0
- package/dist/chart.js +11 -0
- package/dist/chart.js.map +1 -0
- package/dist/chunk-3CJHBJXA.js +186 -0
- package/dist/chunk-3CJHBJXA.js.map +1 -0
- package/dist/chunk-4LBXEAGC.js +133 -0
- package/dist/chunk-4LBXEAGC.js.map +1 -0
- package/dist/chunk-6FINSUOS.js +49 -0
- package/dist/chunk-6FINSUOS.js.map +1 -0
- package/dist/chunk-AA5EWWYV.js +38 -0
- package/dist/chunk-AA5EWWYV.js.map +1 -0
- package/dist/chunk-ANUCSRUN.js +43 -0
- package/dist/chunk-ANUCSRUN.js.map +1 -0
- package/dist/chunk-ARARFMNE.js +88 -0
- package/dist/chunk-ARARFMNE.js.map +1 -0
- package/dist/chunk-BISL7DYW.js +66 -0
- package/dist/chunk-BISL7DYW.js.map +1 -0
- package/dist/chunk-BV4DBGN7.js +178 -0
- package/dist/chunk-BV4DBGN7.js.map +1 -0
- package/dist/chunk-C4MFZLJM.js +19 -0
- package/dist/chunk-C4MFZLJM.js.map +1 -0
- package/dist/chunk-CSSZLFLO.js +116 -0
- package/dist/chunk-CSSZLFLO.js.map +1 -0
- package/dist/chunk-CVWSMUUB.js +378 -0
- package/dist/chunk-CVWSMUUB.js.map +1 -0
- package/dist/chunk-E5DKBSWX.js +2 -0
- package/dist/chunk-E5DKBSWX.js.map +1 -0
- package/dist/chunk-EEP7PS2L.js +54 -0
- package/dist/chunk-EEP7PS2L.js.map +1 -0
- package/dist/chunk-EQLC2QVN.js +73 -0
- package/dist/chunk-EQLC2QVN.js.map +1 -0
- package/dist/chunk-FINOPIDN.js +2 -0
- package/dist/chunk-FINOPIDN.js.map +1 -0
- package/dist/chunk-G2KF2WL4.js +2 -0
- package/dist/chunk-G2KF2WL4.js.map +1 -0
- package/dist/chunk-I3D7KUGN.js +205 -0
- package/dist/chunk-I3D7KUGN.js.map +1 -0
- package/dist/chunk-IKQV3NSL.js +76 -0
- package/dist/chunk-IKQV3NSL.js.map +1 -0
- package/dist/chunk-JTKR7ZWP.js +468 -0
- package/dist/chunk-JTKR7ZWP.js.map +1 -0
- package/dist/chunk-KNDHO67X.js +78 -0
- package/dist/chunk-KNDHO67X.js.map +1 -0
- package/dist/chunk-L2EKYWVI.js +94 -0
- package/dist/chunk-L2EKYWVI.js.map +1 -0
- package/dist/chunk-MXLITIGU.js +92 -0
- package/dist/chunk-MXLITIGU.js.map +1 -0
- package/dist/chunk-NCIQMRV3.js +155 -0
- package/dist/chunk-NCIQMRV3.js.map +1 -0
- package/dist/chunk-OB5EFDDH.js +118 -0
- package/dist/chunk-OB5EFDDH.js.map +1 -0
- package/dist/chunk-OIRHLJBC.js +83 -0
- package/dist/chunk-OIRHLJBC.js.map +1 -0
- package/dist/chunk-PBQV3B6O.js +145 -0
- package/dist/chunk-PBQV3B6O.js.map +1 -0
- package/dist/chunk-POQIHFAZ.js +2 -0
- package/dist/chunk-POQIHFAZ.js.map +1 -0
- package/dist/chunk-PWMMXRMC.js +234 -0
- package/dist/chunk-PWMMXRMC.js.map +1 -0
- package/dist/chunk-SLEJDQ3A.js +81 -0
- package/dist/chunk-SLEJDQ3A.js.map +1 -0
- package/dist/chunk-TPJDOB7R.js +15 -0
- package/dist/chunk-TPJDOB7R.js.map +1 -0
- package/dist/chunk-VKZZY2QD.js +103 -0
- package/dist/chunk-VKZZY2QD.js.map +1 -0
- package/dist/chunk-W5FX4TU3.js +102 -0
- package/dist/chunk-W5FX4TU3.js.map +1 -0
- package/dist/chunk-W5ILLSPK.js +107 -0
- package/dist/chunk-W5ILLSPK.js.map +1 -0
- package/dist/chunk-WBHFVBSK.js +25 -0
- package/dist/chunk-WBHFVBSK.js.map +1 -0
- package/dist/chunk-WNUFGMS7.js +113 -0
- package/dist/chunk-WNUFGMS7.js.map +1 -0
- package/dist/chunk-WVTIKOII.js +15 -0
- package/dist/chunk-WVTIKOII.js.map +1 -0
- package/dist/chunk-XDDALY4C.js +166 -0
- package/dist/chunk-XDDALY4C.js.map +1 -0
- package/dist/chunk-XLLYNNC6.js +89 -0
- package/dist/chunk-XLLYNNC6.js.map +1 -0
- package/dist/context-BgYUymEO.d.ts +163 -0
- package/dist/credits.d.ts +42 -0
- package/dist/credits.js +21 -0
- package/dist/credits.js.map +1 -0
- package/dist/earnings.d.ts +29 -0
- package/dist/earnings.js +22 -0
- package/dist/earnings.js.map +1 -0
- package/dist/frame-I7_xYGy5.d.ts +45 -0
- package/dist/full-S2MBPEEP.js +11 -0
- package/dist/full-S2MBPEEP.js.map +1 -0
- package/dist/funnel-QU5ZPC52.js +13 -0
- package/dist/funnel-QU5ZPC52.js.map +1 -0
- package/dist/funnel.d.ts +26 -0
- package/dist/funnel.js +13 -0
- package/dist/funnel.js.map +1 -0
- package/dist/gauge.d.ts +38 -0
- package/dist/gauge.js +13 -0
- package/dist/gauge.js.map +1 -0
- package/dist/geo.d.ts +37 -0
- package/dist/geo.js +13 -0
- package/dist/geo.js.map +1 -0
- package/dist/globe.d.ts +36 -0
- package/dist/globe.js +12 -0
- package/dist/globe.js.map +1 -0
- package/dist/goal.d.ts +26 -0
- package/dist/goal.js +17 -0
- package/dist/goal.js.map +1 -0
- package/dist/heatmap-JWQOKUGM.js +13 -0
- package/dist/heatmap-JWQOKUGM.js.map +1 -0
- package/dist/heatmap.d.ts +47 -0
- package/dist/heatmap.js +15 -0
- package/dist/heatmap.js.map +1 -0
- package/dist/host-_F8RgiIz.d.ts +15 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +148 -0
- package/dist/index.js.map +1 -0
- package/dist/labels-DE_743fQ.d.ts +72 -0
- package/dist/latency.d.ts +33 -0
- package/dist/latency.js +24 -0
- package/dist/latency.js.map +1 -0
- package/dist/line.d.ts +25 -0
- package/dist/line.js +19 -0
- package/dist/line.js.map +1 -0
- package/dist/native.d.ts +494 -0
- package/dist/native.js +1244 -0
- package/dist/native.js.map +1 -0
- package/dist/pie.d.ts +37 -0
- package/dist/pie.js +16 -0
- package/dist/pie.js.map +1 -0
- package/dist/provider.d.ts +73 -0
- package/dist/provider.js +24 -0
- package/dist/provider.js.map +1 -0
- package/dist/radar-75GRJ2IK.js +13 -0
- package/dist/radar-75GRJ2IK.js.map +1 -0
- package/dist/radar.d.ts +22 -0
- package/dist/radar.js +13 -0
- package/dist/radar.js.map +1 -0
- package/dist/sankey-XQTX2EG6.js +13 -0
- package/dist/sankey-XQTX2EG6.js.map +1 -0
- package/dist/sankey.d.ts +28 -0
- package/dist/sankey.js +13 -0
- package/dist/sankey.js.map +1 -0
- package/dist/scatter-XSNG4OKD.js +13 -0
- package/dist/scatter-XSNG4OKD.js.map +1 -0
- package/dist/scatter.d.ts +41 -0
- package/dist/scatter.js +15 -0
- package/dist/scatter.js.map +1 -0
- package/dist/sparkline.d.ts +26 -0
- package/dist/sparkline.js +16 -0
- package/dist/sparkline.js.map +1 -0
- package/dist/svg-BJUHYX3B.js +14 -0
- package/dist/svg-BJUHYX3B.js.map +1 -0
- package/dist/throughput.d.ts +37 -0
- package/dist/throughput.js +24 -0
- package/dist/throughput.js.map +1 -0
- package/dist/ticker.d.ts +38 -0
- package/dist/ticker.js +22 -0
- package/dist/ticker.js.map +1 -0
- package/dist/treemap-OMGGGB5U.js +13 -0
- package/dist/treemap-OMGGGB5U.js.map +1 -0
- package/dist/treemap.d.ts +24 -0
- package/dist/treemap.js +14 -0
- package/dist/treemap.js.map +1 -0
- package/dist/world-110m-DVFWXS42.js +18 -0
- package/dist/world-110m-DVFWXS42.js.map +1 -0
- package/package.json +614 -3
- package/registry/area-chart.json +785 -0
- package/registry/bar-chart.json +784 -0
- package/registry/calendar-heatmap.json +460 -0
- package/registry/candlestick.json +553 -0
- package/registry/chart.json +441 -0
- package/registry/charts-provider.json +191 -0
- package/registry/credit-usage.json +473 -0
- package/registry/earnings-chart.json +703 -0
- package/registry/examples/area-chart/credits-usage.d.ts +4 -0
- package/registry/examples/area-chart/credits-usage.js +38 -0
- package/registry/examples/area-chart/credits-usage.tsx +32 -0
- package/registry/examples/area-chart/native/credits-usage.d.ts +4 -0
- package/registry/examples/area-chart/native/credits-usage.dark.png +0 -0
- package/registry/examples/area-chart/native/credits-usage.js +33 -0
- package/registry/examples/area-chart/native/credits-usage.light.png +0 -0
- package/registry/examples/area-chart/native/credits-usage.tsx +27 -0
- package/registry/examples/area-chart/storage.d.ts +4 -0
- package/registry/examples/area-chart/storage.js +27 -0
- package/registry/examples/area-chart/storage.tsx +21 -0
- package/registry/examples/bar-chart/jobs-by-status.d.ts +4 -0
- package/registry/examples/bar-chart/jobs-by-status.js +37 -0
- package/registry/examples/bar-chart/jobs-by-status.tsx +31 -0
- package/registry/examples/bar-chart/native/jobs-by-status.d.ts +4 -0
- package/registry/examples/bar-chart/native/jobs-by-status.dark.png +0 -0
- package/registry/examples/bar-chart/native/jobs-by-status.js +32 -0
- package/registry/examples/bar-chart/native/jobs-by-status.light.png +0 -0
- package/registry/examples/bar-chart/native/jobs-by-status.tsx +26 -0
- package/registry/examples/bar-chart/plans-by-quarter.d.ts +4 -0
- package/registry/examples/bar-chart/plans-by-quarter.js +31 -0
- package/registry/examples/bar-chart/plans-by-quarter.tsx +26 -0
- package/registry/examples/bar-chart/top-supporters.d.ts +4 -0
- package/registry/examples/bar-chart/top-supporters.js +32 -0
- package/registry/examples/bar-chart/top-supporters.tsx +27 -0
- package/registry/examples/calendar-heatmap/publishing.d.ts +4 -0
- package/registry/examples/calendar-heatmap/publishing.js +28 -0
- package/registry/examples/calendar-heatmap/publishing.tsx +23 -0
- package/registry/examples/candlestick/auction-bids.d.ts +4 -0
- package/registry/examples/candlestick/auction-bids.js +37 -0
- package/registry/examples/candlestick/auction-bids.tsx +32 -0
- package/registry/examples/chart/polar-uploads.d.ts +4 -0
- package/registry/examples/chart/polar-uploads.js +34 -0
- package/registry/examples/chart/polar-uploads.tsx +30 -0
- package/registry/examples/charts-provider/french-orazaka.d.ts +4 -0
- package/registry/examples/charts-provider/french-orazaka.js +26 -0
- package/registry/examples/charts-provider/french-orazaka.tsx +22 -0
- package/registry/examples/charts-provider/native/french-orazaka.d.ts +4 -0
- package/registry/examples/charts-provider/native/french-orazaka.dark.png +0 -0
- package/registry/examples/charts-provider/native/french-orazaka.js +17 -0
- package/registry/examples/charts-provider/native/french-orazaka.light.png +0 -0
- package/registry/examples/charts-provider/native/french-orazaka.tsx +17 -0
- package/registry/examples/credit-usage/monthly-credits.d.ts +4 -0
- package/registry/examples/credit-usage/monthly-credits.js +24 -0
- package/registry/examples/credit-usage/monthly-credits.tsx +19 -0
- package/registry/examples/credit-usage/native/monthly-credits.d.ts +4 -0
- package/registry/examples/credit-usage/native/monthly-credits.dark.png +0 -0
- package/registry/examples/credit-usage/native/monthly-credits.js +23 -0
- package/registry/examples/credit-usage/native/monthly-credits.light.png +0 -0
- package/registry/examples/credit-usage/native/monthly-credits.tsx +18 -0
- package/registry/examples/credit-usage/storage-plan.d.ts +4 -0
- package/registry/examples/credit-usage/storage-plan.js +21 -0
- package/registry/examples/credit-usage/storage-plan.tsx +15 -0
- package/registry/examples/earnings-chart/creator-month.d.ts +4 -0
- package/registry/examples/earnings-chart/creator-month.js +29 -0
- package/registry/examples/earnings-chart/creator-month.tsx +24 -0
- package/registry/examples/earnings-chart/gross-and-net.d.ts +4 -0
- package/registry/examples/earnings-chart/gross-and-net.js +29 -0
- package/registry/examples/earnings-chart/gross-and-net.tsx +24 -0
- package/registry/examples/earnings-chart/native/creator-month.d.ts +4 -0
- package/registry/examples/earnings-chart/native/creator-month.dark.png +0 -0
- package/registry/examples/earnings-chart/native/creator-month.js +29 -0
- package/registry/examples/earnings-chart/native/creator-month.light.png +0 -0
- package/registry/examples/earnings-chart/native/creator-month.tsx +24 -0
- package/registry/examples/funnel/signup.d.ts +4 -0
- package/registry/examples/funnel/signup.js +30 -0
- package/registry/examples/funnel/signup.tsx +24 -0
- package/registry/examples/gauge/challenge-goal.d.ts +4 -0
- package/registry/examples/gauge/challenge-goal.js +24 -0
- package/registry/examples/gauge/challenge-goal.tsx +18 -0
- package/registry/examples/gauge/credits-quota.d.ts +4 -0
- package/registry/examples/gauge/credits-quota.js +26 -0
- package/registry/examples/gauge/credits-quota.tsx +19 -0
- package/registry/examples/gauge/native/credits-quota.d.ts +4 -0
- package/registry/examples/gauge/native/credits-quota.dark.png +0 -0
- package/registry/examples/gauge/native/credits-quota.js +25 -0
- package/registry/examples/gauge/native/credits-quota.light.png +0 -0
- package/registry/examples/gauge/native/credits-quota.tsx +18 -0
- package/registry/examples/geo-map/viewers.d.ts +4 -0
- package/registry/examples/geo-map/viewers.js +43 -0
- package/registry/examples/geo-map/viewers.tsx +29 -0
- package/registry/examples/globe/deployment-regions.d.ts +4 -0
- package/registry/examples/globe/deployment-regions.js +36 -0
- package/registry/examples/globe/deployment-regions.tsx +30 -0
- package/registry/examples/goal-progress/challenge-pot.d.ts +4 -0
- package/registry/examples/goal-progress/challenge-pot.js +22 -0
- package/registry/examples/goal-progress/challenge-pot.tsx +16 -0
- package/registry/examples/goal-progress/goal-reached.d.ts +4 -0
- package/registry/examples/goal-progress/goal-reached.js +11 -0
- package/registry/examples/goal-progress/goal-reached.tsx +6 -0
- package/registry/examples/goal-progress/native/challenge-pot.d.ts +4 -0
- package/registry/examples/goal-progress/native/challenge-pot.dark.png +0 -0
- package/registry/examples/goal-progress/native/challenge-pot.js +11 -0
- package/registry/examples/goal-progress/native/challenge-pot.light.png +0 -0
- package/registry/examples/goal-progress/native/challenge-pot.tsx +6 -0
- package/registry/examples/heatmap/upload-activity.d.ts +4 -0
- package/registry/examples/heatmap/upload-activity.js +30 -0
- package/registry/examples/heatmap/upload-activity.tsx +25 -0
- package/registry/examples/job-throughput/live-hours.d.ts +4 -0
- package/registry/examples/job-throughput/live-hours.js +33 -0
- package/registry/examples/job-throughput/live-hours.tsx +28 -0
- package/registry/examples/job-throughput/native/week-of-jobs.d.ts +4 -0
- package/registry/examples/job-throughput/native/week-of-jobs.dark.png +0 -0
- package/registry/examples/job-throughput/native/week-of-jobs.js +20 -0
- package/registry/examples/job-throughput/native/week-of-jobs.light.png +0 -0
- package/registry/examples/job-throughput/native/week-of-jobs.tsx +16 -0
- package/registry/examples/job-throughput/week-of-jobs.d.ts +4 -0
- package/registry/examples/job-throughput/week-of-jobs.js +20 -0
- package/registry/examples/job-throughput/week-of-jobs.tsx +16 -0
- package/registry/examples/latency-chart/by-capability.d.ts +4 -0
- package/registry/examples/latency-chart/by-capability.js +26 -0
- package/registry/examples/latency-chart/by-capability.tsx +21 -0
- package/registry/examples/latency-chart/native/by-capability.d.ts +4 -0
- package/registry/examples/latency-chart/native/by-capability.dark.png +0 -0
- package/registry/examples/latency-chart/native/by-capability.js +17 -0
- package/registry/examples/latency-chart/native/by-capability.light.png +0 -0
- package/registry/examples/latency-chart/native/by-capability.tsx +13 -0
- package/registry/examples/latency-chart/time-to-result.d.ts +4 -0
- package/registry/examples/latency-chart/time-to-result.js +27 -0
- package/registry/examples/latency-chart/time-to-result.tsx +22 -0
- package/registry/examples/line-chart/creator-earnings.d.ts +4 -0
- package/registry/examples/line-chart/creator-earnings.js +35 -0
- package/registry/examples/line-chart/creator-earnings.tsx +30 -0
- package/registry/examples/line-chart/forecast.d.ts +4 -0
- package/registry/examples/line-chart/forecast.js +36 -0
- package/registry/examples/line-chart/forecast.tsx +30 -0
- package/registry/examples/line-chart/live-jobs.d.ts +4 -0
- package/registry/examples/line-chart/live-jobs.js +21 -0
- package/registry/examples/line-chart/live-jobs.tsx +23 -0
- package/registry/examples/line-chart/native/creator-earnings.d.ts +4 -0
- package/registry/examples/line-chart/native/creator-earnings.dark.png +0 -0
- package/registry/examples/line-chart/native/creator-earnings.js +32 -0
- package/registry/examples/line-chart/native/creator-earnings.light.png +0 -0
- package/registry/examples/line-chart/native/creator-earnings.tsx +26 -0
- package/registry/examples/line-chart/states.d.ts +4 -0
- package/registry/examples/line-chart/states.js +16 -0
- package/registry/examples/line-chart/states.tsx +13 -0
- package/registry/examples/pie-chart/credit-spend.d.ts +4 -0
- package/registry/examples/pie-chart/credit-spend.js +30 -0
- package/registry/examples/pie-chart/credit-spend.tsx +24 -0
- package/registry/examples/pie-chart/native/credit-spend.d.ts +4 -0
- package/registry/examples/pie-chart/native/credit-spend.dark.png +0 -0
- package/registry/examples/pie-chart/native/credit-spend.js +17 -0
- package/registry/examples/pie-chart/native/credit-spend.light.png +0 -0
- package/registry/examples/pie-chart/native/credit-spend.tsx +12 -0
- package/registry/examples/pie-chart/storage-by-kind.d.ts +4 -0
- package/registry/examples/pie-chart/storage-by-kind.js +31 -0
- package/registry/examples/pie-chart/storage-by-kind.tsx +26 -0
- package/registry/examples/price-ticker/auction-room.d.ts +4 -0
- package/registry/examples/price-ticker/auction-room.js +21 -0
- package/registry/examples/price-ticker/auction-room.tsx +17 -0
- package/registry/examples/price-ticker/native/auction-room.d.ts +4 -0
- package/registry/examples/price-ticker/native/auction-room.dark.png +0 -0
- package/registry/examples/price-ticker/native/auction-room.js +19 -0
- package/registry/examples/price-ticker/native/auction-room.light.png +0 -0
- package/registry/examples/price-ticker/native/auction-room.tsx +15 -0
- package/registry/examples/price-ticker/no-bid-yet.d.ts +4 -0
- package/registry/examples/price-ticker/no-bid-yet.js +11 -0
- package/registry/examples/price-ticker/no-bid-yet.tsx +6 -0
- package/registry/examples/radar-chart/model-comparison.d.ts +4 -0
- package/registry/examples/radar-chart/model-comparison.js +33 -0
- package/registry/examples/radar-chart/model-comparison.tsx +28 -0
- package/registry/examples/sankey/credit-flow.d.ts +4 -0
- package/registry/examples/sankey/credit-flow.js +37 -0
- package/registry/examples/sankey/credit-flow.tsx +32 -0
- package/registry/examples/scatter-chart/watch-time.d.ts +4 -0
- package/registry/examples/scatter-chart/watch-time.js +36 -0
- package/registry/examples/scatter-chart/watch-time.tsx +31 -0
- package/registry/examples/sparkline/bars.d.ts +4 -0
- package/registry/examples/sparkline/bars.js +12 -0
- package/registry/examples/sparkline/bars.tsx +7 -0
- package/registry/examples/sparkline/native/stat-trend.d.ts +4 -0
- package/registry/examples/sparkline/native/stat-trend.dark.png +0 -0
- package/registry/examples/sparkline/native/stat-trend.js +12 -0
- package/registry/examples/sparkline/native/stat-trend.light.png +0 -0
- package/registry/examples/sparkline/native/stat-trend.tsx +7 -0
- package/registry/examples/sparkline/stat-trend.d.ts +4 -0
- package/registry/examples/sparkline/stat-trend.js +18 -0
- package/registry/examples/sparkline/stat-trend.tsx +15 -0
- package/registry/examples/sparkline/table-rows.d.ts +4 -0
- package/registry/examples/sparkline/table-rows.js +23 -0
- package/registry/examples/sparkline/table-rows.tsx +26 -0
- package/registry/examples/treemap/storage.d.ts +4 -0
- package/registry/examples/treemap/storage.js +17 -0
- package/registry/examples/treemap/storage.tsx +13 -0
- package/registry/funnel.json +487 -0
- package/registry/gauge.json +600 -0
- package/registry/geo-map.json +484 -0
- package/registry/globe.json +469 -0
- package/registry/goal-progress.json +520 -0
- package/registry/heatmap.json +531 -0
- package/registry/index.json +582 -0
- package/registry/job-throughput.json +654 -0
- package/registry/latency-chart.json +671 -0
- package/registry/line-chart.json +793 -0
- package/registry/pie-chart.json +1288 -0
- package/registry/price-ticker.json +684 -0
- package/registry/radar-chart.json +459 -0
- package/registry/sankey.json +503 -0
- package/registry/scatter-chart.json +559 -0
- package/registry/sparkline.json +563 -0
- package/registry/treemap.json +432 -0
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
bandScale,
|
|
4
|
+
linearScale,
|
|
5
|
+
niceDomain,
|
|
6
|
+
pointScale,
|
|
7
|
+
thinLabels
|
|
8
|
+
} from "./chunk-BISL7DYW.js";
|
|
9
|
+
import {
|
|
10
|
+
describeSeries
|
|
11
|
+
} from "./chunk-ANUCSRUN.js";
|
|
12
|
+
import {
|
|
13
|
+
extent,
|
|
14
|
+
normalizeSeries,
|
|
15
|
+
stack,
|
|
16
|
+
tabulate
|
|
17
|
+
} from "./chunk-W5FX4TU3.js";
|
|
18
|
+
import {
|
|
19
|
+
areaPath,
|
|
20
|
+
barPath,
|
|
21
|
+
linePath,
|
|
22
|
+
segments
|
|
23
|
+
} from "./chunk-OB5EFDDH.js";
|
|
24
|
+
import {
|
|
25
|
+
categoryFormatter,
|
|
26
|
+
shareFormatter,
|
|
27
|
+
valueFormatter
|
|
28
|
+
} from "./chunk-XLLYNNC6.js";
|
|
29
|
+
import {
|
|
30
|
+
ChartFrame,
|
|
31
|
+
Legend,
|
|
32
|
+
Tooltip,
|
|
33
|
+
colorOf,
|
|
34
|
+
cx,
|
|
35
|
+
useSettings
|
|
36
|
+
} from "./chunk-JTKR7ZWP.js";
|
|
37
|
+
import {
|
|
38
|
+
fill
|
|
39
|
+
} from "./chunk-3CJHBJXA.js";
|
|
40
|
+
|
|
41
|
+
// src/cartesian/cartesian.tsx
|
|
42
|
+
import { useMemo, useState } from "react";
|
|
43
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
44
|
+
var M = { top: 12, bottom: 26, right: 14 };
|
|
45
|
+
function Cartesian({ props, options }) {
|
|
46
|
+
const { data, x, y, yLabel, series: seriesProp, format, xFormat, xLabel, thresholds = [], markers = [], legend = true, zero, onSelect } = props;
|
|
47
|
+
const { kind, mode, stacked = false, horizontal = false } = options;
|
|
48
|
+
const { locale, labels } = useSettings(props);
|
|
49
|
+
const specs = useMemo(() => normalizeSeries(seriesProp, y, yLabel), [seriesProp, y, yLabel]);
|
|
50
|
+
const table = useMemo(() => tabulate(data, x, specs), [data, x, specs]);
|
|
51
|
+
const fmt = useMemo(() => {
|
|
52
|
+
const category = categoryFormatter(xFormat, locale);
|
|
53
|
+
return {
|
|
54
|
+
value: valueFormatter(format, locale, labels.noValue),
|
|
55
|
+
axis: valueFormatter(format, locale, labels.noValue, true),
|
|
56
|
+
category,
|
|
57
|
+
share: shareFormatter(locale)
|
|
58
|
+
};
|
|
59
|
+
}, [format, xFormat, locale, labels.noValue]);
|
|
60
|
+
const isEmpty = table.series.length === 0 || table.series.every((s) => s.values.every((v) => v == null));
|
|
61
|
+
const summary = useMemo(
|
|
62
|
+
() => isEmpty ? labels.empty : describeSeries(table, { kind, labels, value: fmt.value, category: fmt.category, share: fmt.share, thresholds }),
|
|
63
|
+
[isEmpty, table, kind, labels, fmt, thresholds]
|
|
64
|
+
);
|
|
65
|
+
const tableModel = useMemo(
|
|
66
|
+
() => ({
|
|
67
|
+
columns: [xLabel ?? labels.category, ...table.series.map((s) => s.label)],
|
|
68
|
+
rows: table.categories.map((c, i) => [fmt.category(c), ...table.series.map((s) => fmt.value(s.values[i]))])
|
|
69
|
+
}),
|
|
70
|
+
[table, fmt, xLabel, labels.category]
|
|
71
|
+
);
|
|
72
|
+
const [active, setActive] = useState(null);
|
|
73
|
+
const [pointer, setPointer] = useState(null);
|
|
74
|
+
const count = table.categories.length;
|
|
75
|
+
const colors = table.series.map((s) => colorOf(s.color, s.slot));
|
|
76
|
+
const legendNode = legend ? /* @__PURE__ */ jsx(Legend, { items: table.series.map((s, i) => ({ label: s.label, color: colors[i], shape: mode === "bar" ? "square" : "line", dashed: s.dashed })) }) : null;
|
|
77
|
+
const announce = active === null ? "" : `${fmt.category(table.categories[active])}: ${table.series.map((s) => `${s.label} ${fmt.value(s.values[active])}`).join(", ")}`;
|
|
78
|
+
const onKeyDown = (event) => {
|
|
79
|
+
if (!count) return;
|
|
80
|
+
const keys = {
|
|
81
|
+
ArrowRight: () => Math.min(count - 1, (active ?? -1) + 1),
|
|
82
|
+
ArrowDown: () => Math.min(count - 1, (active ?? -1) + 1),
|
|
83
|
+
ArrowLeft: () => Math.max(0, (active ?? count) - 1),
|
|
84
|
+
ArrowUp: () => Math.max(0, (active ?? count) - 1),
|
|
85
|
+
Home: () => 0,
|
|
86
|
+
End: () => count - 1,
|
|
87
|
+
Escape: () => null
|
|
88
|
+
};
|
|
89
|
+
if (event.key === "Enter" && active !== null && onSelect) {
|
|
90
|
+
event.preventDefault();
|
|
91
|
+
onSelect(data[active], active);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const next = keys[event.key];
|
|
95
|
+
if (!next) return;
|
|
96
|
+
event.preventDefault();
|
|
97
|
+
setPointer(null);
|
|
98
|
+
setActive(next());
|
|
99
|
+
};
|
|
100
|
+
return /* @__PURE__ */ jsx(
|
|
101
|
+
ChartFrame,
|
|
102
|
+
{
|
|
103
|
+
kind,
|
|
104
|
+
frame: props,
|
|
105
|
+
table: tableModel,
|
|
106
|
+
summary,
|
|
107
|
+
isEmpty,
|
|
108
|
+
legend: legendNode,
|
|
109
|
+
announcement: announce,
|
|
110
|
+
active: active !== null,
|
|
111
|
+
handlers: {
|
|
112
|
+
onKeyDown,
|
|
113
|
+
onBlur: () => setActive(null),
|
|
114
|
+
onPointerLeave: () => {
|
|
115
|
+
setActive(null);
|
|
116
|
+
setPointer(null);
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
children: (width, height) => /* @__PURE__ */ jsx(
|
|
120
|
+
Plot,
|
|
121
|
+
{
|
|
122
|
+
table,
|
|
123
|
+
width,
|
|
124
|
+
height,
|
|
125
|
+
options,
|
|
126
|
+
fmt,
|
|
127
|
+
colors,
|
|
128
|
+
thresholds,
|
|
129
|
+
markers,
|
|
130
|
+
zero: zero ?? (mode !== "line" || stacked),
|
|
131
|
+
autoZero: zero === void 0 && mode === "line",
|
|
132
|
+
stacked,
|
|
133
|
+
horizontal,
|
|
134
|
+
active,
|
|
135
|
+
pointer,
|
|
136
|
+
onPointer: (index, at) => {
|
|
137
|
+
setActive(index);
|
|
138
|
+
setPointer(at);
|
|
139
|
+
},
|
|
140
|
+
onSelect: onSelect ? (i) => onSelect(data[i], i) : void 0,
|
|
141
|
+
labels: { thresholdTemplate: labels.summaryThreshold, total: labels.total }
|
|
142
|
+
}
|
|
143
|
+
)
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
function Plot({ table, width, height, options, fmt, colors, thresholds, markers, zero, autoZero, stacked, horizontal, active, pointer, onPointer, onSelect, labels }) {
|
|
148
|
+
const { mode, curve = "monotone", dots, endLabels, valueLabels } = options;
|
|
149
|
+
const series = table.series;
|
|
150
|
+
const count = table.categories.length;
|
|
151
|
+
let [lo, hi] = extent(series, stacked);
|
|
152
|
+
for (const t of thresholds) {
|
|
153
|
+
lo = Math.min(lo, t.value);
|
|
154
|
+
hi = Math.max(hi, t.value);
|
|
155
|
+
}
|
|
156
|
+
const keepZero = zero || autoZero && (lo <= 0 || lo < hi * 0.5);
|
|
157
|
+
if (keepZero) {
|
|
158
|
+
lo = Math.min(0, lo);
|
|
159
|
+
hi = Math.max(0, hi);
|
|
160
|
+
}
|
|
161
|
+
const valueSpan = horizontal ? width : height;
|
|
162
|
+
const nice = niceDomain(lo, hi, Math.max(2, Math.min(6, Math.round(valueSpan / 70))));
|
|
163
|
+
const tickTexts = nice.ticks.map((t) => fmt.axis(t));
|
|
164
|
+
const categoryTexts = table.categories.map((c) => fmt.category(c));
|
|
165
|
+
const showEnd = mode !== "bar" && endLabels && series.length <= 3 && width >= 360;
|
|
166
|
+
const endWidth = showEnd ? Math.max(...series.map((s) => textWidth(fmt.axis(lastValue(s))))) + 14 : 0;
|
|
167
|
+
const left = horizontal ? Math.min(width * 0.35, Math.max(...categoryTexts.map(textWidth)) + 12) : Math.max(...tickTexts.map(textWidth)) + 10;
|
|
168
|
+
const right = Math.max(M.right, endWidth, horizontal ? textWidth(tickTexts[tickTexts.length - 1] ?? "") / 2 + 4 : 0);
|
|
169
|
+
const x0 = left;
|
|
170
|
+
const x1 = Math.max(x0 + 10, width - right);
|
|
171
|
+
const y0 = M.top + (markers.length ? 14 : 0);
|
|
172
|
+
const y1 = Math.max(y0 + 10, height - M.bottom);
|
|
173
|
+
const value = horizontal ? linearScale(nice.domain, [x0, x1], nice.ticks) : linearScale(nice.domain, [y1, y0], nice.ticks);
|
|
174
|
+
const band = bandScale(count, horizontal ? [y0, y1] : [x0, x1], count > 24 ? 0.15 : 0.3);
|
|
175
|
+
const point = mode === "bar" ? (i) => band(i) + band.bandwidth / 2 : pointScale(count, [x0, x1]);
|
|
176
|
+
const centerOf = (i) => point(i);
|
|
177
|
+
const base = value(Math.max(nice.domain[0], Math.min(nice.domain[1], 0)));
|
|
178
|
+
const labelIndexes = horizontal ? thinLabels(count, Math.floor((y1 - y0) / 18)) : thinLabels(count, Math.max(2, Math.floor((x1 - x0) / Math.max(64, Math.max(...categoryTexts.map(textWidth)) + 16))));
|
|
179
|
+
const stacks = stacked ? stack(series) : null;
|
|
180
|
+
const indexAt = (px, py) => {
|
|
181
|
+
if (!count) return null;
|
|
182
|
+
const along = horizontal ? py : px;
|
|
183
|
+
if (mode === "bar") return Math.max(0, Math.min(count - 1, Math.floor((along - (horizontal ? y0 : x0)) / band.step)));
|
|
184
|
+
const step = count > 1 ? (x1 - x0) / (count - 1) : 1;
|
|
185
|
+
return Math.max(0, Math.min(count - 1, Math.round((px - x0) / step)));
|
|
186
|
+
};
|
|
187
|
+
const onMove = (event) => {
|
|
188
|
+
const box = event.currentTarget.getBoundingClientRect();
|
|
189
|
+
const px = event.clientX - box.left;
|
|
190
|
+
const py = event.clientY - box.top;
|
|
191
|
+
onPointer(indexAt(px, py), { x: px, y: py });
|
|
192
|
+
};
|
|
193
|
+
const marks = [];
|
|
194
|
+
if (mode === "bar") {
|
|
195
|
+
const groups = stacked ? 1 : series.length;
|
|
196
|
+
const thickness = Math.min(24, Math.max(2, (band.bandwidth - (groups - 1) * 2) / groups));
|
|
197
|
+
const groupWidth = thickness * groups + (groups - 1) * 2;
|
|
198
|
+
series.forEach((s, k) => {
|
|
199
|
+
s.values.forEach((v, i) => {
|
|
200
|
+
if (v == null && !stacked) return;
|
|
201
|
+
const seg = stacks?.[k]?.[i];
|
|
202
|
+
const from = seg ? seg.base : 0;
|
|
203
|
+
const to = seg ? seg.top : v ?? 0;
|
|
204
|
+
if (from === to) return;
|
|
205
|
+
const negative = to < from;
|
|
206
|
+
const isTop = !stacked || series.slice(k + 1).every((other) => {
|
|
207
|
+
const ov = other.values[i] ?? 0;
|
|
208
|
+
return negative ? ov >= 0 : ov <= 0;
|
|
209
|
+
});
|
|
210
|
+
const offset = band(i) + (band.bandwidth - groupWidth) / 2 + (stacked ? 0 : k * (thickness + 2));
|
|
211
|
+
const a = value(from);
|
|
212
|
+
const b = value(to);
|
|
213
|
+
const gap = stacked && !isTop ? 2 : 0;
|
|
214
|
+
const radius = isTop ? 4 : 0;
|
|
215
|
+
let d;
|
|
216
|
+
if (horizontal) {
|
|
217
|
+
const start = Math.min(a, b);
|
|
218
|
+
const size = Math.abs(b - a) - gap;
|
|
219
|
+
d = barPath(negative ? start + gap : start, offset, Math.max(0, size), thickness, radius, true, negative);
|
|
220
|
+
} else {
|
|
221
|
+
const top = Math.min(a, b);
|
|
222
|
+
const size = Math.abs(b - a) - gap;
|
|
223
|
+
d = barPath(offset, negative ? top : top + gap, thickness, Math.max(0, size), radius, false, negative);
|
|
224
|
+
}
|
|
225
|
+
marks.push(
|
|
226
|
+
/* @__PURE__ */ jsx(
|
|
227
|
+
"path",
|
|
228
|
+
{
|
|
229
|
+
d,
|
|
230
|
+
className: cx("kzc-mark", horizontal ? "kzc-enter-growx" : "kzc-enter-grow"),
|
|
231
|
+
"data-negative": negative || void 0,
|
|
232
|
+
"data-dim": active !== null && active !== i ? "" : void 0,
|
|
233
|
+
style: { fill: colors[k], cursor: onSelect ? "pointer" : void 0 },
|
|
234
|
+
onClick: onSelect ? () => onSelect(i) : void 0
|
|
235
|
+
},
|
|
236
|
+
`${k}-${i}`
|
|
237
|
+
)
|
|
238
|
+
);
|
|
239
|
+
if (valueLabels && series.length === 1 && count <= 16 && v != null) {
|
|
240
|
+
const tip = value(to);
|
|
241
|
+
marks.push(
|
|
242
|
+
horizontal ? /* @__PURE__ */ jsx("text", { x: negative ? tip - 6 : tip + 6, y: offset + thickness / 2, dominantBaseline: "central", textAnchor: negative ? "end" : "start", className: "kzc-enter-fade", children: fmt.axis(v) }, `l-${i}`) : /* @__PURE__ */ jsx("text", { x: offset + thickness / 2, y: negative ? tip + 14 : tip - 6, textAnchor: "middle", className: "kzc-enter-fade", children: fmt.axis(v) }, `l-${i}`)
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
} else {
|
|
248
|
+
series.forEach((s, k) => {
|
|
249
|
+
const pts = s.values.map((v, i) => {
|
|
250
|
+
if (v == null) return null;
|
|
251
|
+
const top = stacks ? stacks[k][i].top : v;
|
|
252
|
+
return [centerOf(i), value(top)];
|
|
253
|
+
});
|
|
254
|
+
for (const seg of segments(pts)) {
|
|
255
|
+
if (mode === "area") {
|
|
256
|
+
const baseLine = stacks && k > 0 ? seg.map(([px]) => [px, value(stacks[k][Math.round(indexAtX(px, x0, x1, count))].base)]) : base;
|
|
257
|
+
marks.push(/* @__PURE__ */ jsx("path", { d: areaPath(seg, baseLine, curve), className: "kzc-area kzc-enter-fade", style: { fill: colors[k], opacity: stacked ? 0.5 : void 0 } }, `a-${k}-${seg[0][0]}`));
|
|
258
|
+
}
|
|
259
|
+
marks.push(
|
|
260
|
+
/* @__PURE__ */ jsx(
|
|
261
|
+
"path",
|
|
262
|
+
{
|
|
263
|
+
d: linePath(seg, curve),
|
|
264
|
+
pathLength: s.dashed ? void 0 : 1,
|
|
265
|
+
className: cx("kzc-line kzc-mark", s.dashed ? "kzc-enter-fade" : "kzc-enter-line"),
|
|
266
|
+
strokeDasharray: s.dashed ? "6 4" : void 0,
|
|
267
|
+
style: { stroke: colors[k] }
|
|
268
|
+
},
|
|
269
|
+
`l-${k}-${seg[0][0]}`
|
|
270
|
+
)
|
|
271
|
+
);
|
|
272
|
+
if (dots || seg.length === 1) {
|
|
273
|
+
for (const [px, py] of seg) marks.push(/* @__PURE__ */ jsx("circle", { cx: px, cy: py, r: 4, className: "kzc-dot kzc-enter-fade", style: { fill: colors[k] } }, `d-${k}-${px}`));
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
if (showEnd) {
|
|
277
|
+
const last = [...pts].reverse().find(Boolean);
|
|
278
|
+
if (last) {
|
|
279
|
+
marks.push(/* @__PURE__ */ jsx("circle", { cx: last[0], cy: last[1], r: 4, className: "kzc-dot kzc-enter-fade", style: { fill: colors[k] } }, `e-${k}`));
|
|
280
|
+
marks.push(
|
|
281
|
+
/* @__PURE__ */ jsx("text", { x: last[0] + 9, y: last[1], dominantBaseline: "central", className: "kzc-strong kzc-enter-fade", children: fmt.axis(lastValue(s)) }, `et-${k}`)
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
const thresholdMarks = thresholds.map((t, i) => {
|
|
288
|
+
const at = value(t.value);
|
|
289
|
+
const text = fill(labels.thresholdTemplate, { label: t.label, value: fmt.value(t.value) });
|
|
290
|
+
return horizontal ? /* @__PURE__ */ jsxs("g", { "data-tone": t.tone ?? "neutral", children: [
|
|
291
|
+
/* @__PURE__ */ jsx("line", { x1: at, x2: at, y1: y0, y2: y1, className: "kzc-threshold" }),
|
|
292
|
+
/* @__PURE__ */ jsx("text", { x: at + 4, y: y0 + 10, className: "kzc-threshold-label", children: text })
|
|
293
|
+
] }, `t-${i}`) : /* @__PURE__ */ jsxs("g", { "data-tone": t.tone ?? "neutral", children: [
|
|
294
|
+
/* @__PURE__ */ jsx("line", { x1: x0, x2: x1, y1: at, y2: at, className: "kzc-threshold" }),
|
|
295
|
+
/* @__PURE__ */ jsx("text", { x: x1, y: at - 6, textAnchor: "end", className: "kzc-threshold-label", children: text })
|
|
296
|
+
] }, `t-${i}`);
|
|
297
|
+
});
|
|
298
|
+
const markerMarks = markers.map((m, i) => {
|
|
299
|
+
const index = table.categories.findIndex((c) => sameCategory(c, m.x));
|
|
300
|
+
if (index < 0) return null;
|
|
301
|
+
const at = centerOf(index);
|
|
302
|
+
return horizontal ? null : /* @__PURE__ */ jsxs("g", { "data-tone": m.tone ?? "neutral", children: [
|
|
303
|
+
/* @__PURE__ */ jsx("line", { x1: at, x2: at, y1: y0 - 4, y2: y1, className: "kzc-threshold" }),
|
|
304
|
+
/* @__PURE__ */ jsx("text", { x: at, y: y0 - 8, textAnchor: at > (x0 + x1) / 2 ? "end" : "start", className: "kzc-threshold-label", children: m.label })
|
|
305
|
+
] }, `m-${i}`);
|
|
306
|
+
});
|
|
307
|
+
const cursorAt = active !== null ? centerOf(active) : null;
|
|
308
|
+
const tipRows = active !== null ? series.map((s, k) => ({ label: s.label, value: fmt.value(s.values[active]), color: colors[k], shape: mode === "bar" ? "square" : "line" })) : [];
|
|
309
|
+
const stackTotal = active !== null && stacked && series.length > 1 ? series.reduce((sum, s) => sum + (s.values[active] ?? 0), 0) : null;
|
|
310
|
+
const anchor = active === null ? null : pointer ?? (horizontal ? { x: value(Math.max(...series.map((s) => s.values[active] ?? 0))), y: cursorAt } : { x: cursorAt, y: Math.min(...series.map((s) => s.values[active] == null ? y1 : value(s.values[active]))) });
|
|
311
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
312
|
+
/* @__PURE__ */ jsxs("svg", { className: "kzc-svg", width, height, viewBox: `0 0 ${width} ${height}`, "aria-hidden": true, onPointerMove: onMove, children: [
|
|
313
|
+
nice.ticks.map(
|
|
314
|
+
(t, i) => horizontal ? /* @__PURE__ */ jsxs("g", { children: [
|
|
315
|
+
/* @__PURE__ */ jsx("line", { x1: value(t), x2: value(t), y1: y0, y2: y1, className: t === 0 ? "kzc-axis" : "kzc-grid" }),
|
|
316
|
+
/* @__PURE__ */ jsx("text", { x: value(t), y: y1 + 16, textAnchor: "middle", children: tickTexts[i] })
|
|
317
|
+
] }, t) : /* @__PURE__ */ jsxs("g", { children: [
|
|
318
|
+
/* @__PURE__ */ jsx("line", { x1: x0, x2: x1, y1: value(t), y2: value(t), className: t === 0 ? "kzc-axis" : "kzc-grid" }),
|
|
319
|
+
/* @__PURE__ */ jsx("text", { x: x0 - 8, y: value(t), textAnchor: "end", dominantBaseline: "central", children: tickTexts[i] })
|
|
320
|
+
] }, t)
|
|
321
|
+
),
|
|
322
|
+
labelIndexes.map(
|
|
323
|
+
(i) => horizontal ? /* @__PURE__ */ jsx("text", { x: x0 - 8, y: centerOf(i), textAnchor: "end", dominantBaseline: "central", children: clip(categoryTexts[i], left - 12) }, i) : /* @__PURE__ */ jsx("text", { x: centerOf(i), y: y1 + 17, textAnchor: mode !== "bar" && i === 0 ? "start" : mode !== "bar" && i === count - 1 ? "end" : "middle", children: categoryTexts[i] }, i)
|
|
324
|
+
),
|
|
325
|
+
cursorAt !== null && mode !== "bar" && /* @__PURE__ */ jsx("line", { x1: cursorAt, x2: cursorAt, y1: y0, y2: y1, className: "kzc-cursor" }),
|
|
326
|
+
cursorAt !== null && mode === "bar" && /* @__PURE__ */ jsx(
|
|
327
|
+
"rect",
|
|
328
|
+
{
|
|
329
|
+
x: horizontal ? x0 : band(active) - (band.step - band.bandwidth) / 2,
|
|
330
|
+
y: horizontal ? band(active) - (band.step - band.bandwidth) / 2 : y0,
|
|
331
|
+
width: horizontal ? x1 - x0 : band.step,
|
|
332
|
+
height: horizontal ? band.step : y1 - y0,
|
|
333
|
+
style: { fill: "var(--kz-surface-2)", opacity: 0.6 }
|
|
334
|
+
}
|
|
335
|
+
),
|
|
336
|
+
/* @__PURE__ */ jsx("g", { children: marks }),
|
|
337
|
+
thresholdMarks,
|
|
338
|
+
markerMarks,
|
|
339
|
+
active !== null && mode !== "bar" && series.map((s, k) => {
|
|
340
|
+
const v = s.values[active];
|
|
341
|
+
if (v == null) return null;
|
|
342
|
+
const top = stacked ? stack(series)[k][active].top : v;
|
|
343
|
+
return /* @__PURE__ */ jsx("circle", { cx: cursorAt, cy: value(top), r: 5, className: "kzc-dot", style: { fill: colors[k] } }, k);
|
|
344
|
+
})
|
|
345
|
+
] }),
|
|
346
|
+
active !== null && anchor && /* @__PURE__ */ jsx(
|
|
347
|
+
Tooltip,
|
|
348
|
+
{
|
|
349
|
+
x: anchor.x,
|
|
350
|
+
y: anchor.y,
|
|
351
|
+
width,
|
|
352
|
+
title: categoryTexts[active],
|
|
353
|
+
rows: stackTotal !== null ? [...tipRows, { label: labels.total, value: fmt.value(stackTotal) }] : tipRows
|
|
354
|
+
}
|
|
355
|
+
)
|
|
356
|
+
] });
|
|
357
|
+
}
|
|
358
|
+
var lastValue = (s) => [...s.values].reverse().find((v) => v != null) ?? null;
|
|
359
|
+
function textWidth(text) {
|
|
360
|
+
return Math.ceil(text.length * 6.4);
|
|
361
|
+
}
|
|
362
|
+
function clip(text, max) {
|
|
363
|
+
if (textWidth(text) <= max) return text;
|
|
364
|
+
const chars = Math.max(3, Math.floor(max / 6.4) - 1);
|
|
365
|
+
return `${text.slice(0, chars)}\u2026`;
|
|
366
|
+
}
|
|
367
|
+
function indexAtX(px, x0, x1, count) {
|
|
368
|
+
return count > 1 ? (px - x0) / (x1 - x0) * (count - 1) : 0;
|
|
369
|
+
}
|
|
370
|
+
function sameCategory(a, b) {
|
|
371
|
+
if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime();
|
|
372
|
+
return a === b || String(a) === String(b);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
export {
|
|
376
|
+
Cartesian
|
|
377
|
+
};
|
|
378
|
+
//# sourceMappingURL=chunk-CVWSMUUB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cartesian/cartesian.tsx"],"sourcesContent":["\"use client\";\n// Line, area and bar charts: one cartesian engine in plain SVG (no chart library: a line chart weighs a few kB, not\n// the 180 kB of a general engine), drawn on the --kz-* roles and the palette's CSS variables — a theme switch repaints\n// it with no JavaScript. Thin marks (2 px lines, bars ≤ 24 px with a 4 px rounded data end, a 2 px gap between stacked\n// segments), recessive grid, round ticks, selective direct labels, thresholds and markers, a crosshair tooltip and\n// the keyboard.\nimport { type KeyboardEvent, type PointerEvent, type ReactNode, useMemo, useState } from \"react\";\n\nimport { extent, normalizeSeries, type Series, stack, type Table, tabulate } from \"../core/data\";\nimport { describeSeries } from \"../core/describe\";\nimport { categoryFormatter, shareFormatter, valueFormatter } from \"../core/format\";\nimport { type ChartKind, fill } from \"../core/labels\";\nimport { bandScale, linearScale, niceDomain, pointScale, thinLabels } from \"../core/scale\";\nimport { areaPath, barPath, type Curve, linePath, type Point, segments } from \"../core/shape\";\nimport type { Accessor, CategoryFormat, Datum, Marker, SeriesSpec, Threshold, ValueFormat } from \"../core/types\";\nimport { ChartFrame, type ChartFrameProps, useSettings } from \"../web/frame\";\nimport { colorOf, cx, Legend, Tooltip } from \"../web/parts\";\n\n/** What every cartesian chart takes: rows, the category field, the series, the formats, thresholds and markers. */\nexport interface CartesianProps<T extends Datum> extends ChartFrameProps {\n /** The rows, in the order of the x axis. */\n data: readonly T[];\n /** The field (or function) of the category: a month (`\"2026-04\"`), a day, a label. Default: the row's position. */\n x?: Accessor<T, unknown>;\n /** A single series: its field. Use `series` for several. */\n y?: Accessor<T, number | null | undefined>;\n /** The name of the single `y` series (legend, tooltip, table). Default: the field's name. */\n yLabel?: string;\n /** The series to draw, each with its field and its name; the palette follows their order. */\n series?: readonly SeriesSpec<T>[];\n /** How the values are written (axis, tooltip, table, summary). Default `\"number\"`. */\n format?: ValueFormat;\n /** How the categories are written. Default: dates by their precision (`2026-04` → `Apr 2026`), text as is. */\n xFormat?: CategoryFormat;\n /** The header of the categories in the data table (`Month`). */\n xLabel?: string;\n /** Horizontal lines at a value: a goal, a payout threshold. */\n thresholds?: readonly Threshold[];\n /** Vertical markers at a category: a launch, an incident. */\n markers?: readonly Marker[];\n /** Show the legend (from two series). Default true. */\n legend?: boolean;\n /** Start the value axis at zero. Default: true for bars and areas; for lines, unless the values sit far from zero. */\n zero?: boolean;\n /** Called with the row when a point or a bar is clicked (or Enter is pressed on it). */\n onSelect?: (datum: T, index: number) => void;\n}\n\nexport interface CartesianOptions {\n readonly kind: ChartKind;\n readonly mode: \"line\" | \"area\" | \"bar\";\n readonly curve?: Curve;\n readonly stacked?: boolean;\n readonly horizontal?: boolean;\n readonly dots?: boolean;\n readonly endLabels?: boolean;\n readonly valueLabels?: boolean;\n}\n\nconst M = { top: 12, bottom: 26, right: 14 };\n\nexport function Cartesian<T extends Datum>({ props, options }: { props: CartesianProps<T>; options: CartesianOptions }) {\n const { data, x, y, yLabel, series: seriesProp, format, xFormat, xLabel, thresholds = [], markers = [], legend = true, zero, onSelect } = props;\n const { kind, mode, stacked = false, horizontal = false } = options;\n const { locale, labels } = useSettings(props);\n\n const specs = useMemo(() => normalizeSeries(seriesProp, y, yLabel), [seriesProp, y, yLabel]);\n const table = useMemo(() => tabulate(data, x, specs), [data, x, specs]);\n const fmt = useMemo(() => {\n const category = categoryFormatter(xFormat, locale);\n return {\n value: valueFormatter(format, locale, labels.noValue),\n axis: valueFormatter(format, locale, labels.noValue, true),\n category,\n share: shareFormatter(locale),\n };\n }, [format, xFormat, locale, labels.noValue]);\n\n const isEmpty = table.series.length === 0 || table.series.every((s) => s.values.every((v) => v == null));\n const summary = useMemo(\n () => (isEmpty ? labels.empty : describeSeries(table, { kind, labels, value: fmt.value, category: fmt.category, share: fmt.share, thresholds })),\n [isEmpty, table, kind, labels, fmt, thresholds],\n );\n const tableModel = useMemo(\n () => ({\n columns: [xLabel ?? labels.category, ...table.series.map((s) => s.label)],\n rows: table.categories.map((c, i) => [fmt.category(c), ...table.series.map((s) => fmt.value(s.values[i]))]),\n }),\n [table, fmt, xLabel, labels.category],\n );\n\n const [active, setActive] = useState<number | null>(null);\n const [pointer, setPointer] = useState<{ x: number; y: number } | null>(null);\n const count = table.categories.length;\n\n const colors = table.series.map((s) => colorOf(s.color, s.slot));\n const legendNode = legend ? (\n <Legend items={table.series.map((s, i) => ({ label: s.label, color: colors[i]!, shape: mode === \"bar\" ? \"square\" : \"line\", dashed: s.dashed }))} />\n ) : null;\n\n const announce = active === null ? \"\" : `${fmt.category(table.categories[active])}: ${table.series.map((s) => `${s.label} ${fmt.value(s.values[active])}`).join(\", \")}`;\n\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (!count) return;\n const keys: Record<string, () => number | null> = {\n ArrowRight: () => Math.min(count - 1, (active ?? -1) + 1),\n ArrowDown: () => Math.min(count - 1, (active ?? -1) + 1),\n ArrowLeft: () => Math.max(0, (active ?? count) - 1),\n ArrowUp: () => Math.max(0, (active ?? count) - 1),\n Home: () => 0,\n End: () => count - 1,\n Escape: () => null,\n };\n if (event.key === \"Enter\" && active !== null && onSelect) {\n event.preventDefault();\n onSelect(data[active]!, active);\n return;\n }\n const next = keys[event.key];\n if (!next) return;\n event.preventDefault();\n setPointer(null);\n setActive(next());\n };\n\n return (\n <ChartFrame\n kind={kind}\n frame={props}\n table={tableModel}\n summary={summary}\n isEmpty={isEmpty}\n legend={legendNode}\n announcement={announce}\n active={active !== null}\n handlers={{\n onKeyDown,\n onBlur: () => setActive(null),\n onPointerLeave: () => {\n setActive(null);\n setPointer(null);\n },\n }}\n >\n {(width, height) => (\n <Plot\n table={table}\n width={width}\n height={height}\n options={options}\n fmt={fmt}\n colors={colors}\n thresholds={thresholds}\n markers={markers}\n zero={zero ?? (mode !== \"line\" || stacked)}\n autoZero={zero === undefined && mode === \"line\"}\n stacked={stacked}\n horizontal={horizontal}\n active={active}\n pointer={pointer}\n onPointer={(index, at) => {\n setActive(index);\n setPointer(at);\n }}\n onSelect={onSelect ? (i) => onSelect(data[i]!, i) : undefined}\n labels={{ thresholdTemplate: labels.summaryThreshold, total: labels.total }}\n />\n )}\n </ChartFrame>\n );\n}\n\ninterface PlotProps {\n table: Table;\n width: number;\n height: number;\n options: CartesianOptions;\n fmt: { value: (v: number | null | undefined) => string; axis: (v: number | null | undefined) => string; category: (c: unknown) => string };\n colors: string[];\n thresholds: readonly Threshold[];\n markers: readonly Marker[];\n zero: boolean;\n autoZero: boolean;\n stacked: boolean;\n horizontal: boolean;\n active: number | null;\n pointer: { x: number; y: number } | null;\n onPointer: (index: number | null, at: { x: number; y: number } | null) => void;\n onSelect?: (index: number) => void;\n labels: { thresholdTemplate: string; total: string };\n}\n\nfunction Plot({ table, width, height, options, fmt, colors, thresholds, markers, zero, autoZero, stacked, horizontal, active, pointer, onPointer, onSelect, labels }: PlotProps) {\n const { mode, curve = \"monotone\", dots, endLabels, valueLabels } = options;\n const series = table.series;\n const count = table.categories.length;\n\n // The value domain: the data, the thresholds, zero when asked (or when the data is near it), round ticks.\n let [lo, hi] = extent(series, stacked);\n for (const t of thresholds) {\n lo = Math.min(lo, t.value);\n hi = Math.max(hi, t.value);\n }\n const keepZero = zero || (autoZero && (lo <= 0 || lo < hi * 0.5));\n if (keepZero) {\n lo = Math.min(0, lo);\n hi = Math.max(0, hi);\n }\n const valueSpan = horizontal ? width : height;\n const nice = niceDomain(lo, hi, Math.max(2, Math.min(6, Math.round(valueSpan / 70))));\n const tickTexts = nice.ticks.map((t) => fmt.axis(t));\n const categoryTexts = table.categories.map((c) => fmt.category(c));\n\n const showEnd = mode !== \"bar\" && endLabels && series.length <= 3 && width >= 360;\n const endWidth = showEnd ? Math.max(...series.map((s) => textWidth(fmt.axis(lastValue(s))))) + 14 : 0;\n\n const left = horizontal ? Math.min(width * 0.35, Math.max(...categoryTexts.map(textWidth)) + 12) : Math.max(...tickTexts.map(textWidth)) + 10;\n const right = Math.max(M.right, endWidth, horizontal ? textWidth(tickTexts[tickTexts.length - 1] ?? \"\") / 2 + 4 : 0);\n const x0 = left;\n const x1 = Math.max(x0 + 10, width - right);\n const y0 = M.top + (markers.length ? 14 : 0);\n const y1 = Math.max(y0 + 10, height - M.bottom);\n\n const value = horizontal ? linearScale(nice.domain, [x0, x1], nice.ticks) : linearScale(nice.domain, [y1, y0], nice.ticks);\n const band = bandScale(count, horizontal ? [y0, y1] : [x0, x1], count > 24 ? 0.15 : 0.3);\n const point = mode === \"bar\" ? (i: number) => band(i) + band.bandwidth / 2 : pointScale(count, [x0, x1]);\n const centerOf = (i: number) => point(i);\n const base = value(Math.max(nice.domain[0], Math.min(nice.domain[1], 0)));\n\n // Which category labels fit: about one every 64 px along x, every 18 px along y.\n const labelIndexes = horizontal ? thinLabels(count, Math.floor((y1 - y0) / 18)) : thinLabels(count, Math.max(2, Math.floor((x1 - x0) / Math.max(64, Math.max(...categoryTexts.map(textWidth)) + 16))));\n\n const stacks = stacked ? stack(series) : null;\n\n const indexAt = (px: number, py: number) => {\n if (!count) return null;\n const along = horizontal ? py : px;\n if (mode === \"bar\") return Math.max(0, Math.min(count - 1, Math.floor((along - (horizontal ? y0 : x0)) / band.step)));\n const step = count > 1 ? (x1 - x0) / (count - 1) : 1;\n return Math.max(0, Math.min(count - 1, Math.round((px - x0) / step)));\n };\n\n const onMove = (event: PointerEvent<SVGSVGElement>) => {\n const box = event.currentTarget.getBoundingClientRect();\n const px = event.clientX - box.left;\n const py = event.clientY - box.top;\n onPointer(indexAt(px, py), { x: px, y: py });\n };\n\n const marks: ReactNode[] = [];\n if (mode === \"bar\") {\n const groups = stacked ? 1 : series.length;\n const thickness = Math.min(24, Math.max(2, (band.bandwidth - (groups - 1) * 2) / groups));\n const groupWidth = thickness * groups + (groups - 1) * 2;\n series.forEach((s, k) => {\n s.values.forEach((v, i) => {\n if (v == null && !stacked) return;\n const seg = stacks?.[k]?.[i];\n const from = seg ? seg.base : 0;\n const to = seg ? seg.top : (v ?? 0);\n if (from === to) return;\n const negative = to < from;\n const isTop = !stacked || series.slice(k + 1).every((other) => {\n const ov = other.values[i] ?? 0;\n return negative ? ov >= 0 : ov <= 0;\n });\n const offset = band(i) + (band.bandwidth - groupWidth) / 2 + (stacked ? 0 : k * (thickness + 2));\n const a = value(from);\n const b = value(to);\n // The 2 px surface gap between stacked segments: each segment gives up 2 px at its far end.\n const gap = stacked && !isTop ? 2 : 0;\n const radius = isTop ? 4 : 0;\n let d: string;\n if (horizontal) {\n const start = Math.min(a, b);\n const size = Math.abs(b - a) - gap;\n d = barPath(negative ? start + gap : start, offset, Math.max(0, size), thickness, radius, true, negative);\n } else {\n const top = Math.min(a, b);\n const size = Math.abs(b - a) - gap;\n d = barPath(offset, negative ? top : top + gap, thickness, Math.max(0, size), radius, false, negative);\n }\n marks.push(\n <path\n key={`${k}-${i}`}\n d={d}\n className={cx(\"kzc-mark\", horizontal ? \"kzc-enter-growx\" : \"kzc-enter-grow\")}\n data-negative={negative || undefined}\n data-dim={active !== null && active !== i ? \"\" : undefined}\n style={{ fill: colors[k], cursor: onSelect ? \"pointer\" : undefined }}\n onClick={onSelect ? () => onSelect(i) : undefined}\n />,\n );\n if (valueLabels && series.length === 1 && count <= 16 && v != null) {\n const tip = value(to);\n marks.push(\n horizontal ? (\n <text key={`l-${i}`} x={negative ? tip - 6 : tip + 6} y={offset + thickness / 2} dominantBaseline=\"central\" textAnchor={negative ? \"end\" : \"start\"} className=\"kzc-enter-fade\">\n {fmt.axis(v)}\n </text>\n ) : (\n <text key={`l-${i}`} x={offset + thickness / 2} y={negative ? tip + 14 : tip - 6} textAnchor=\"middle\" className=\"kzc-enter-fade\">\n {fmt.axis(v)}\n </text>\n ),\n );\n }\n });\n });\n } else {\n series.forEach((s, k) => {\n const pts = s.values.map((v, i) => {\n if (v == null) return null;\n const top = stacks ? stacks[k]![i]!.top : v;\n return [centerOf(i), value(top)] as Point;\n });\n for (const seg of segments(pts)) {\n if (mode === \"area\") {\n const baseLine = stacks && k > 0 ? seg.map(([px]) => [px, value(stacks[k]![Math.round(indexAtX(px, x0, x1, count))]!.base)] as Point) : base;\n marks.push(<path key={`a-${k}-${seg[0]![0]}`} d={areaPath(seg, baseLine, curve)} className=\"kzc-area kzc-enter-fade\" style={{ fill: colors[k], opacity: stacked ? 0.5 : undefined }} />);\n }\n marks.push(\n <path\n key={`l-${k}-${seg[0]![0]}`}\n d={linePath(seg, curve)}\n pathLength={s.dashed ? undefined : 1}\n className={cx(\"kzc-line kzc-mark\", s.dashed ? \"kzc-enter-fade\" : \"kzc-enter-line\")}\n strokeDasharray={s.dashed ? \"6 4\" : undefined}\n style={{ stroke: colors[k] }}\n />,\n );\n if (dots || seg.length === 1) {\n for (const [px, py] of seg) marks.push(<circle key={`d-${k}-${px}`} cx={px} cy={py} r={4} className=\"kzc-dot kzc-enter-fade\" style={{ fill: colors[k] }} />);\n }\n }\n if (showEnd) {\n const last = [...pts].reverse().find(Boolean);\n if (last) {\n marks.push(<circle key={`e-${k}`} cx={last[0]} cy={last[1]} r={4} className=\"kzc-dot kzc-enter-fade\" style={{ fill: colors[k] }} />);\n marks.push(\n <text key={`et-${k}`} x={last[0] + 9} y={last[1]} dominantBaseline=\"central\" className=\"kzc-strong kzc-enter-fade\">\n {fmt.axis(lastValue(s))}\n </text>,\n );\n }\n }\n });\n }\n\n // Thresholds: a dashed line in the tone, its label and value on the surface.\n const thresholdMarks = thresholds.map((t, i) => {\n const at = value(t.value);\n const text = fill(labels.thresholdTemplate, { label: t.label, value: fmt.value(t.value) });\n return horizontal ? (\n <g key={`t-${i}`} data-tone={t.tone ?? \"neutral\"}>\n <line x1={at} x2={at} y1={y0} y2={y1} className=\"kzc-threshold\" />\n <text x={at + 4} y={y0 + 10} className=\"kzc-threshold-label\">\n {text}\n </text>\n </g>\n ) : (\n <g key={`t-${i}`} data-tone={t.tone ?? \"neutral\"}>\n <line x1={x0} x2={x1} y1={at} y2={at} className=\"kzc-threshold\" />\n <text x={x1} y={at - 6} textAnchor=\"end\" className=\"kzc-threshold-label\">\n {text}\n </text>\n </g>\n );\n });\n\n const markerMarks = markers.map((m, i) => {\n const index = table.categories.findIndex((c) => sameCategory(c, m.x));\n if (index < 0) return null;\n const at = centerOf(index);\n return horizontal ? null : (\n <g key={`m-${i}`} data-tone={m.tone ?? \"neutral\"}>\n <line x1={at} x2={at} y1={y0 - 4} y2={y1} className=\"kzc-threshold\" />\n <text x={at} y={y0 - 8} textAnchor={at > (x0 + x1) / 2 ? \"end\" : \"start\"} className=\"kzc-threshold-label\">\n {m.label}\n </text>\n </g>\n );\n });\n\n const cursorAt = active !== null ? centerOf(active) : null;\n const tipRows = active !== null ? series.map((s, k) => ({ label: s.label, value: fmt.value(s.values[active]), color: colors[k], shape: mode === \"bar\" ? (\"square\" as const) : (\"line\" as const) })) : [];\n const stackTotal = active !== null && stacked && series.length > 1 ? series.reduce((sum, s) => sum + (s.values[active] ?? 0), 0) : null;\n const anchor =\n active === null\n ? null\n : pointer ?? (horizontal ? { x: value(Math.max(...series.map((s) => s.values[active] ?? 0))), y: cursorAt! } : { x: cursorAt!, y: Math.min(...series.map((s) => (s.values[active] == null ? y1 : value(s.values[active]!)))) });\n\n return (\n <>\n <svg className=\"kzc-svg\" width={width} height={height} viewBox={`0 0 ${width} ${height}`} aria-hidden onPointerMove={onMove}>\n {nice.ticks.map((t, i) =>\n horizontal ? (\n <g key={t}>\n <line x1={value(t)} x2={value(t)} y1={y0} y2={y1} className={t === 0 ? \"kzc-axis\" : \"kzc-grid\"} />\n <text x={value(t)} y={y1 + 16} textAnchor=\"middle\">\n {tickTexts[i]}\n </text>\n </g>\n ) : (\n <g key={t}>\n <line x1={x0} x2={x1} y1={value(t)} y2={value(t)} className={t === 0 ? \"kzc-axis\" : \"kzc-grid\"} />\n <text x={x0 - 8} y={value(t)} textAnchor=\"end\" dominantBaseline=\"central\">\n {tickTexts[i]}\n </text>\n </g>\n ),\n )}\n {labelIndexes.map((i) =>\n horizontal ? (\n <text key={i} x={x0 - 8} y={centerOf(i)} textAnchor=\"end\" dominantBaseline=\"central\">\n {clip(categoryTexts[i]!, left - 12)}\n </text>\n ) : (\n <text key={i} x={centerOf(i)} y={y1 + 17} textAnchor={mode !== \"bar\" && i === 0 ? \"start\" : mode !== \"bar\" && i === count - 1 ? \"end\" : \"middle\"}>\n {categoryTexts[i]}\n </text>\n ),\n )}\n {cursorAt !== null && mode !== \"bar\" && <line x1={cursorAt} x2={cursorAt} y1={y0} y2={y1} className=\"kzc-cursor\" />}\n {cursorAt !== null && mode === \"bar\" && (\n <rect\n x={horizontal ? x0 : band(active!) - (band.step - band.bandwidth) / 2}\n y={horizontal ? band(active!) - (band.step - band.bandwidth) / 2 : y0}\n width={horizontal ? x1 - x0 : band.step}\n height={horizontal ? band.step : y1 - y0}\n style={{ fill: \"var(--kz-surface-2)\", opacity: 0.6 }}\n />\n )}\n <g>{marks}</g>\n {thresholdMarks}\n {markerMarks}\n {active !== null &&\n mode !== \"bar\" &&\n series.map((s, k) => {\n const v = s.values[active];\n if (v == null) return null;\n const top = stacked ? stack(series)[k]![active]!.top : v;\n return <circle key={k} cx={cursorAt!} cy={value(top)} r={5} className=\"kzc-dot\" style={{ fill: colors[k] }} />;\n })}\n </svg>\n {active !== null && anchor && (\n <Tooltip\n x={anchor.x}\n y={anchor.y}\n width={width}\n title={categoryTexts[active]}\n rows={stackTotal !== null ? [...tipRows, { label: labels.total, value: fmt.value(stackTotal) }] : tipRows}\n />\n )}\n </>\n );\n}\n\nconst lastValue = (s: Series) => [...s.values].reverse().find((v) => v != null) ?? null;\n\n/** An estimate of a label's width at 11 px (no layout on the server): the margins are sized from it. */\nexport function textWidth(text: string): number {\n return Math.ceil(text.length * 6.4);\n}\n\nfunction clip(text: string, max: number): string {\n if (textWidth(text) <= max) return text;\n const chars = Math.max(3, Math.floor(max / 6.4) - 1);\n return `${text.slice(0, chars)}…`;\n}\n\nfunction indexAtX(px: number, x0: number, x1: number, count: number): number {\n return count > 1 ? ((px - x0) / (x1 - x0)) * (count - 1) : 0;\n}\n\nfunction sameCategory(a: unknown, b: unknown): boolean {\n if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime();\n return a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_LABELS,
|
|
7
|
+
fillIn,
|
|
8
|
+
roundMoney
|
|
9
|
+
} from "./chunk-WNUFGMS7.js";
|
|
10
|
+
import {
|
|
11
|
+
valueFormatter
|
|
12
|
+
} from "./chunk-XLLYNNC6.js";
|
|
13
|
+
import {
|
|
14
|
+
useSettings
|
|
15
|
+
} from "./chunk-JTKR7ZWP.js";
|
|
16
|
+
|
|
17
|
+
// src/goal/goal-progress.tsx
|
|
18
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
+
function GoalProgress({ raised, goal, currency, supporters, timeLeft, labels: given, description, ...props }) {
|
|
20
|
+
const words = { ...GOAL_LABELS, ...given };
|
|
21
|
+
const { locale } = useSettings(props);
|
|
22
|
+
const format = roundMoney(currency);
|
|
23
|
+
const reached = goal > 0 && raised >= goal;
|
|
24
|
+
const facts = [
|
|
25
|
+
supporters != null ? fillIn(words.supporters, { count: valueFormatter("integer", locale)(supporters) }) : null,
|
|
26
|
+
reached ? words.reached : null
|
|
27
|
+
].filter(Boolean);
|
|
28
|
+
const line = facts.length > 0 || timeLeft ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
29
|
+
facts.join(" \xB7 "),
|
|
30
|
+
facts.length > 0 && timeLeft ? " \xB7 " : null,
|
|
31
|
+
timeLeft ? /* @__PURE__ */ jsx(Fragment, { children: typeof timeLeft === "string" ? fillIn(words.left, { time: timeLeft }) : timeLeft }) : null
|
|
32
|
+
] }) : null;
|
|
33
|
+
return /* @__PURE__ */ jsx(
|
|
34
|
+
Gauge,
|
|
35
|
+
{
|
|
36
|
+
...props,
|
|
37
|
+
value: raised,
|
|
38
|
+
max: goal,
|
|
39
|
+
format,
|
|
40
|
+
caption: fillIn(words.raised, { goal: valueFormatter(format, locale)(goal) }),
|
|
41
|
+
tone: reached ? "success" : "accent",
|
|
42
|
+
description: description || line ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
43
|
+
description,
|
|
44
|
+
description && line ? " \xB7 " : null,
|
|
45
|
+
line
|
|
46
|
+
] }) : void 0
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export {
|
|
52
|
+
GoalProgress
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=chunk-EEP7PS2L.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/goal/goal-progress.tsx"],"sourcesContent":["\"use client\";\n// A pot towards its goal (an Orochia challenge, a crowdfunded request): the amount raised in money minor units on a\n// gauge whose arc fills towards the goal, “raised of $500” under it, the supporters and the time left beside the\n// title, the success tone once the goal is reached (and the amount past it still written). A Gauge preset.\nimport type { ReactNode } from \"react\";\n\nimport { valueFormatter } from \"../core/format\";\nimport { Gauge, type GaugeProps } from \"../gauge/gauge\";\nimport { GOAL_LABELS, type GoalLabels } from \"../needs/labels\";\nimport { fillIn, roundMoney } from \"../needs/model\";\nimport { useSettings } from \"../web/frame\";\n\nexport interface GoalProgressProps extends Omit<GaugeProps, \"value\" | \"min\" | \"max\" | \"format\" | \"caption\" | \"target\" | \"zones\" | \"tone\" | \"labels\"> {\n /** The amount raised, in **minor units** (cents). */\n raised: number;\n /** The goal, in minor units. */\n goal: number;\n /** The ISO 4217 currency. */\n currency: string;\n /** How many people chipped in. */\n supporters?: number;\n /** The time left, written by the app (a `Countdown`, “2 days”). */\n timeLeft?: ReactNode;\n /** The words, passed translated; English by default. */\n labels?: Partial<GoalLabels>;\n}\n\n/** A pot towards its goal, in money: the arc fills, the words say how much of what, and who chipped in. */\nexport function GoalProgress({ raised, goal, currency, supporters, timeLeft, labels: given, description, ...props }: GoalProgressProps) {\n const words = { ...GOAL_LABELS, ...given };\n const { locale } = useSettings(props);\n const format = roundMoney(currency);\n const reached = goal > 0 && raised >= goal;\n const facts = [\n supporters != null ? fillIn(words.supporters, { count: valueFormatter(\"integer\", locale)(supporters) }) : null,\n reached ? words.reached : null,\n ].filter(Boolean);\n const line =\n facts.length > 0 || timeLeft ? (\n <>\n {facts.join(\" · \")}\n {facts.length > 0 && timeLeft ? \" · \" : null}\n {timeLeft ? <>{typeof timeLeft === \"string\" ? fillIn(words.left, { time: timeLeft }) : timeLeft}</> : null}\n </>\n ) : null;\n return (\n <Gauge\n {...props}\n value={raised}\n max={goal}\n format={format}\n caption={fillIn(words.raised, { goal: valueFormatter(format, locale)(goal) })}\n tone={reached ? \"success\" : \"accent\"}\n description={\n description || line ? (\n <>\n {description}\n {description && line ? \" · \" : null}\n {line}\n </>\n ) : undefined\n }\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAuCM,SAGc,eAHd;AAXC,SAAS,aAAa,EAAE,QAAQ,MAAM,UAAU,YAAY,UAAU,QAAQ,OAAO,aAAa,GAAG,MAAM,GAAsB;AACtI,QAAM,QAAQ,EAAE,GAAG,aAAa,GAAG,MAAM;AACzC,QAAM,EAAE,OAAO,IAAI,YAAY,KAAK;AACpC,QAAM,SAAS,WAAW,QAAQ;AAClC,QAAM,UAAU,OAAO,KAAK,UAAU;AACtC,QAAM,QAAQ;AAAA,IACZ,cAAc,OAAO,OAAO,MAAM,YAAY,EAAE,OAAO,eAAe,WAAW,MAAM,EAAE,UAAU,EAAE,CAAC,IAAI;AAAA,IAC1G,UAAU,MAAM,UAAU;AAAA,EAC5B,EAAE,OAAO,OAAO;AAChB,QAAM,OACJ,MAAM,SAAS,KAAK,WAClB,iCACG;AAAA,UAAM,KAAK,QAAK;AAAA,IAChB,MAAM,SAAS,KAAK,WAAW,WAAQ;AAAA,IACvC,WAAW,gCAAG,iBAAO,aAAa,WAAW,OAAO,MAAM,MAAM,EAAE,MAAM,SAAS,CAAC,IAAI,UAAS,IAAM;AAAA,KACxG,IACE;AACN,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,OAAO;AAAA,MACP,KAAK;AAAA,MACL;AAAA,MACA,SAAS,OAAO,MAAM,QAAQ,EAAE,MAAM,eAAe,QAAQ,MAAM,EAAE,IAAI,EAAE,CAAC;AAAA,MAC5E,MAAM,UAAU,YAAY;AAAA,MAC5B,aACE,eAAe,OACb,iCACG;AAAA;AAAA,QACA,eAAe,OAAO,WAAQ;AAAA,QAC9B;AAAA,SACH,IACE;AAAA;AAAA,EAER;AAEJ;","names":[]}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
polar,
|
|
4
|
+
strokeArcPath
|
|
5
|
+
} from "./chunk-OB5EFDDH.js";
|
|
6
|
+
import {
|
|
7
|
+
valueFormatter
|
|
8
|
+
} from "./chunk-XLLYNNC6.js";
|
|
9
|
+
import {
|
|
10
|
+
ChartFrame,
|
|
11
|
+
colorOf,
|
|
12
|
+
useSettings
|
|
13
|
+
} from "./chunk-JTKR7ZWP.js";
|
|
14
|
+
import {
|
|
15
|
+
fill
|
|
16
|
+
} from "./chunk-3CJHBJXA.js";
|
|
17
|
+
|
|
18
|
+
// src/gauge/gauge.tsx
|
|
19
|
+
import { useMemo } from "react";
|
|
20
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
+
var START = -120 * Math.PI / 180;
|
|
22
|
+
var END = 120 * Math.PI / 180;
|
|
23
|
+
function Gauge(props) {
|
|
24
|
+
const { value, min = 0, max = 100, format, caption, target, zones = [], tone = "accent" } = props;
|
|
25
|
+
const { locale, labels } = useSettings(props);
|
|
26
|
+
const fmt = useMemo(() => valueFormatter(format, locale, labels.noValue), [format, locale, labels.noValue]);
|
|
27
|
+
const clamped = Math.min(max, Math.max(min, value));
|
|
28
|
+
const ratio = max > min ? (clamped - min) / (max - min) : 0;
|
|
29
|
+
const zone = zones.find((z) => clamped <= z.to) ?? zones[zones.length - 1];
|
|
30
|
+
const color = colorOf(zone?.tone ?? tone, 1);
|
|
31
|
+
const text = fmt(value);
|
|
32
|
+
const summary = [
|
|
33
|
+
`${labels.kinds.gauge}: ${text} (${min === 0 ? "" : `${fmt(min)} \u2013 `}${fmt(max)})${zone?.label ? `, ${zone.label}` : ""}.`,
|
|
34
|
+
target ? `${fill(labels.summaryThreshold, { label: target.label, value: fmt(target.value) })}.` : ""
|
|
35
|
+
].filter(Boolean).join(" ");
|
|
36
|
+
const table = { columns: [labels.category, labels.value], rows: [[props.title, text], ["min", fmt(min)], ["max", fmt(max)], ...target ? [[target.label, fmt(target.value)]] : []] };
|
|
37
|
+
const at = (v) => START + (Math.min(max, Math.max(min, v)) - min) / (max - min || 1) * (END - START);
|
|
38
|
+
return /* @__PURE__ */ jsx(ChartFrame, { kind: "gauge", frame: { ...props, dataTable: false }, defaultHeight: 180, table, summary, isEmpty: false, navigable: false, children: (width, height) => {
|
|
39
|
+
const radius = Math.max(20, Math.min(width / 2 - 12, (height - 30) / 1.58));
|
|
40
|
+
const cx = width / 2;
|
|
41
|
+
const cy = 8 + radius;
|
|
42
|
+
const stroke = Math.max(8, radius * 0.16);
|
|
43
|
+
let from = min;
|
|
44
|
+
return /* @__PURE__ */ jsx("div", { role: "meter", "aria-label": props.title, "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": clamped, "aria-valuetext": caption ? `${text} ${caption}` : text, style: { height: "100%" }, children: /* @__PURE__ */ jsxs("svg", { className: "kzc-svg", width, height, viewBox: `0 0 ${width} ${height}`, "aria-hidden": true, children: [
|
|
45
|
+
/* @__PURE__ */ jsx("path", { d: strokeArcPath(cx, cy, radius, START, END), style: { fill: "none", stroke: "var(--kz-surface-3)", strokeWidth: stroke, strokeLinecap: "round" } }),
|
|
46
|
+
zones.map((z, i) => {
|
|
47
|
+
const d = strokeArcPath(cx, cy, radius + stroke / 2 + 4, at(from), at(z.to));
|
|
48
|
+
from = z.to;
|
|
49
|
+
return /* @__PURE__ */ jsx("path", { d, "data-tone": z.tone, style: { fill: "none", stroke: "var(--kzc-tone)", strokeWidth: 3, opacity: 0.7 } }, i);
|
|
50
|
+
}),
|
|
51
|
+
ratio > 0 && /* @__PURE__ */ jsx("path", { d: strokeArcPath(cx, cy, radius, START, at(clamped)), pathLength: 1, className: "kzc-line kzc-enter-line", style: { stroke: color, strokeWidth: stroke } }),
|
|
52
|
+
target && /* @__PURE__ */ jsx("g", { "data-tone": target.tone ?? "neutral", children: /* @__PURE__ */ jsx(
|
|
53
|
+
"line",
|
|
54
|
+
{
|
|
55
|
+
x1: polar(cx, cy, radius - stroke, at(target.value))[0],
|
|
56
|
+
y1: polar(cx, cy, radius - stroke, at(target.value))[1],
|
|
57
|
+
x2: polar(cx, cy, radius + stroke, at(target.value))[0],
|
|
58
|
+
y2: polar(cx, cy, radius + stroke, at(target.value))[1],
|
|
59
|
+
style: { stroke: "var(--kzc-text)", strokeWidth: 2, strokeLinecap: "round" }
|
|
60
|
+
}
|
|
61
|
+
) }),
|
|
62
|
+
/* @__PURE__ */ jsx("text", { x: cx, y: cy, textAnchor: "middle", dominantBaseline: "central", className: "kzc-strong", style: { fontSize: Math.max(12, Math.min(32, radius / 2.6, radius * 1.45 / (text.length * 0.58))) }, children: text }),
|
|
63
|
+
caption && /* @__PURE__ */ jsx("text", { x: cx, y: cy + Math.max(16, radius / 3.2), textAnchor: "middle", dominantBaseline: "central", children: caption }),
|
|
64
|
+
/* @__PURE__ */ jsx("text", { x: polar(cx, cy, radius, START)[0], y: polar(cx, cy, radius, START)[1] + stroke + 6, textAnchor: "middle", children: fmt(min) }),
|
|
65
|
+
/* @__PURE__ */ jsx("text", { x: polar(cx, cy, radius, END)[0], y: polar(cx, cy, radius, END)[1] + stroke + 6, textAnchor: "middle", children: fmt(max) })
|
|
66
|
+
] }) });
|
|
67
|
+
} });
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export {
|
|
71
|
+
Gauge
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=chunk-EQLC2QVN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/gauge/gauge.tsx"],"sourcesContent":["\"use client\";\n// One value against its range: a 240° arc, the value written in the middle, an optional target tick and coloured\n// zones (a quota that turns to warning, then danger). Plain SVG; exposed as a `meter` (value, range and its words).\nimport { useMemo } from \"react\";\n\nimport { valueFormatter } from \"../core/format\";\nimport { fill } from \"../core/labels\";\nimport { polar, strokeArcPath } from \"../core/shape\";\nimport type { Threshold, Tone, ValueFormat } from \"../core/types\";\nimport { ChartFrame, type ChartFrameProps, useSettings } from \"../web/frame\";\nimport { colorOf } from \"../web/parts\";\n\nexport interface GaugeZone {\n /** The zone runs from the previous one's end (or `min`) to this value. */\n readonly to: number;\n readonly tone: Tone;\n /** Its name, in the summary and the table (“Over quota”). */\n readonly label?: string;\n}\n\nexport interface GaugeProps extends Omit<ChartFrameProps, \"dataTable\" | \"exportable\"> {\n /** The value. */\n/** The value. */\n value: number;\n /** The start of the range. Default 0. */\n/** The start of the range. Default 0. */\n min?: number;\n /** The end of the range. Default 100. */\n/** The end of the range. Default 100. */\n max?: number;\n /** How the value is written. */\n/** How the value and the range are written. */\n format?: ValueFormat;\n /** The words under the value (“of 50 000 credits”). */\n caption?: string;\n /** A tick on the arc: the objective. */\n target?: Threshold;\n /** Coloured zones along the arc: the value takes the tone of the zone it is in. */\n zones?: readonly GaugeZone[];\n /** The tone of the value without zones. Default `\"accent\"`. */\n/** The tone of the value without zones. Default `\"accent\"`. */\n tone?: Tone;\n}\n\nconst START = (-120 * Math.PI) / 180;\nconst END = (120 * Math.PI) / 180;\n\n/** One figure against its range — credits used of a plan, a challenge's progress, a load. */\nexport function Gauge(props: GaugeProps) {\n const { value, min = 0, max = 100, format, caption, target, zones = [], tone = \"accent\" } = props;\n const { locale, labels } = useSettings(props);\n const fmt = useMemo(() => valueFormatter(format, locale, labels.noValue), [format, locale, labels.noValue]);\n const clamped = Math.min(max, Math.max(min, value));\n const ratio = max > min ? (clamped - min) / (max - min) : 0;\n const zone = zones.find((z) => clamped <= z.to) ?? zones[zones.length - 1];\n const color = colorOf(zone?.tone ?? tone, 1);\n const text = fmt(value);\n const summary = [\n `${labels.kinds.gauge}: ${text} (${min === 0 ? \"\" : `${fmt(min)} – `}${fmt(max)})${zone?.label ? `, ${zone.label}` : \"\"}.`,\n target ? `${fill(labels.summaryThreshold, { label: target.label, value: fmt(target.value) })}.` : \"\",\n ]\n .filter(Boolean)\n .join(\" \");\n const table = { columns: [labels.category, labels.value], rows: [[props.title, text], [\"min\", fmt(min)], [\"max\", fmt(max)], ...(target ? [[target.label, fmt(target.value)]] : [])] };\n const at = (v: number) => START + ((Math.min(max, Math.max(min, v)) - min) / (max - min || 1)) * (END - START);\n\n return (\n <ChartFrame kind=\"gauge\" frame={{ ...props, dataTable: false }} defaultHeight={180} table={table} summary={summary} isEmpty={false} navigable={false}>\n {(width, height) => {\n // The arc spans 240°: its lowest points sit at half the radius below the centre, the range labels under them.\n const radius = Math.max(20, Math.min(width / 2 - 12, (height - 30) / 1.58));\n const cx = width / 2;\n const cy = 8 + radius;\n const stroke = Math.max(8, radius * 0.16);\n let from = min;\n return (\n <div role=\"meter\" aria-label={props.title} aria-valuemin={min} aria-valuemax={max} aria-valuenow={clamped} aria-valuetext={caption ? `${text} ${caption}` : text} style={{ height: \"100%\" }}>\n <svg className=\"kzc-svg\" width={width} height={height} viewBox={`0 0 ${width} ${height}`} aria-hidden>\n <path d={strokeArcPath(cx, cy, radius, START, END)} style={{ fill: \"none\", stroke: \"var(--kz-surface-3)\", strokeWidth: stroke, strokeLinecap: \"round\" }} />\n {zones.map((z, i) => {\n const d = strokeArcPath(cx, cy, radius + stroke / 2 + 4, at(from), at(z.to));\n from = z.to;\n return <path key={i} d={d} data-tone={z.tone} style={{ fill: \"none\", stroke: \"var(--kzc-tone)\", strokeWidth: 3, opacity: 0.7 }} />;\n })}\n {ratio > 0 && (\n <path d={strokeArcPath(cx, cy, radius, START, at(clamped))} pathLength={1} className=\"kzc-line kzc-enter-line\" style={{ stroke: color, strokeWidth: stroke }} />\n )}\n {target && (\n <g data-tone={target.tone ?? \"neutral\"}>\n <line\n x1={polar(cx, cy, radius - stroke, at(target.value))[0]}\n y1={polar(cx, cy, radius - stroke, at(target.value))[1]}\n x2={polar(cx, cy, radius + stroke, at(target.value))[0]}\n y2={polar(cx, cy, radius + stroke, at(target.value))[1]}\n style={{ stroke: \"var(--kzc-text)\", strokeWidth: 2, strokeLinecap: \"round\" }}\n />\n </g>\n )}\n <text x={cx} y={cy} textAnchor=\"middle\" dominantBaseline=\"central\" className=\"kzc-strong\" style={{ fontSize: Math.max(12, Math.min(32, radius / 2.6, (radius * 1.45) / (text.length * 0.58))) }}>\n {text}\n </text>\n {caption && (\n <text x={cx} y={cy + Math.max(16, radius / 3.2)} textAnchor=\"middle\" dominantBaseline=\"central\">\n {caption}\n </text>\n )}\n <text x={polar(cx, cy, radius, START)[0]} y={polar(cx, cy, radius, START)[1] + stroke + 6} textAnchor=\"middle\">\n {fmt(min)}\n </text>\n <text x={polar(cx, cy, radius, END)[0]} y={polar(cx, cy, radius, END)[1] + stroke + 6} textAnchor=\"middle\">\n {fmt(max)}\n </text>\n </svg>\n </div>\n );\n }}\n </ChartFrame>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAGA,SAAS,eAAe;AA0EZ,SACE,KADF;AAjCZ,IAAM,QAAS,OAAO,KAAK,KAAM;AACjC,IAAM,MAAO,MAAM,KAAK,KAAM;AAGvB,SAAS,MAAM,OAAmB;AACvC,QAAM,EAAE,OAAO,MAAM,GAAG,MAAM,KAAK,QAAQ,SAAS,QAAQ,QAAQ,CAAC,GAAG,OAAO,SAAS,IAAI;AAC5F,QAAM,EAAE,QAAQ,OAAO,IAAI,YAAY,KAAK;AAC5C,QAAM,MAAM,QAAQ,MAAM,eAAe,QAAQ,QAAQ,OAAO,OAAO,GAAG,CAAC,QAAQ,QAAQ,OAAO,OAAO,CAAC;AAC1G,QAAM,UAAU,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAClD,QAAM,QAAQ,MAAM,OAAO,UAAU,QAAQ,MAAM,OAAO;AAC1D,QAAM,OAAO,MAAM,KAAK,CAAC,MAAM,WAAW,EAAE,E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