@tabler/charts 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +94 -16
- package/dist/{annotations-CpCWA29b.cjs → annotations--m-HzMBM.cjs} +86 -10
- package/dist/annotations--m-HzMBM.cjs.map +1 -0
- package/dist/{annotations-B02GR_KU.d.ts → annotations-CCDUC1lW.d.ts} +16 -30
- package/dist/{annotations-CHafaGd4.d.cts → annotations-CqZM1z9R.d.cts} +16 -30
- package/dist/{annotations-BQ8l-qHs.js → annotations-DGITy6th.js} +86 -10
- package/dist/annotations-DGITy6th.js.map +1 -0
- package/dist/annotations.cjs +1 -1
- package/dist/annotations.d.cts +1 -1
- package/dist/annotations.d.ts +1 -1
- package/dist/annotations.js +1 -1
- package/dist/{area-WdtfqvhX.js → area-BN0uE9R0.js} +4 -3
- package/dist/area-BN0uE9R0.js.map +1 -0
- package/dist/{area-h_FvieFb.d.cts → area-D6LNLk3r.d.cts} +2 -2
- package/dist/{area-DEFQm_SQ.d.ts → area-DEFL-Yun.d.ts} +2 -2
- package/dist/{area-DYdQ_sMV.cjs → area-D_N8b4Ng.cjs} +4 -3
- package/dist/area-D_N8b4Ng.cjs.map +1 -0
- package/dist/area.cjs +1 -1
- package/dist/area.d.cts +1 -1
- package/dist/area.d.ts +1 -1
- package/dist/area.js +1 -1
- package/dist/{axis-YfAerNBA.cjs → axis-BzBkkC5X.cjs} +12 -7
- package/dist/axis-BzBkkC5X.cjs.map +1 -0
- package/dist/{axis-MMaVoSWB.js → axis-C5obgdJt.js} +12 -7
- package/dist/axis-C5obgdJt.js.map +1 -0
- package/dist/{bar-CVkOJ7WA.cjs → bar-BrmfXugT.cjs} +5 -4
- package/dist/bar-BrmfXugT.cjs.map +1 -0
- package/dist/{bar-D9B_arKf.d.ts → bar-Bs_rPqgR.d.ts} +1 -1
- package/dist/{bar-DZCQ-kyf.d.cts → bar-CEt8YRxf.d.cts} +2 -2
- package/dist/{bar-BOcRcArc.js → bar-D_KKd2fL.js} +5 -4
- package/dist/bar-D_KKd2fL.js.map +1 -0
- package/dist/bar.cjs +1 -1
- package/dist/bar.d.cts +1 -1
- package/dist/bar.d.ts +1 -1
- package/dist/bar.js +1 -1
- package/dist/{calendar-BSvO8nRb.d.cts → calendar-B7843sQu.d.cts} +2 -2
- package/dist/{calendar-DAFXjV99.cjs → calendar-BG_q_NC_.cjs} +2 -2
- package/dist/{calendar-DAFXjV99.cjs.map → calendar-BG_q_NC_.cjs.map} +1 -1
- package/dist/{calendar-BXgIX5H1.js → calendar-CF3gfDQk.js} +2 -2
- package/dist/{calendar-BXgIX5H1.js.map → calendar-CF3gfDQk.js.map} +1 -1
- package/dist/{calendar-Bq3vFzPl.d.ts → calendar-D10_ki1S.d.ts} +2 -2
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.d.cts +1 -1
- package/dist/calendar.d.ts +1 -1
- package/dist/calendar.js +1 -1
- package/dist/{candlestick-BtT9glp9.js → candlestick-B1onjo1o.js} +3 -2
- package/dist/candlestick-B1onjo1o.js.map +1 -0
- package/dist/{candlestick-BcomxeVG.d.cts → candlestick-B7YXUVVh.d.cts} +4 -3
- package/dist/{candlestick-CSmRuZ4v.cjs → candlestick-BwrFKak_.cjs} +3 -2
- package/dist/candlestick-BwrFKak_.cjs.map +1 -0
- package/dist/{candlestick-B3WcLzph.d.ts → candlestick-XpqJvarq.d.ts} +4 -3
- package/dist/candlestick.cjs +2 -2
- package/dist/candlestick.d.cts +1 -1
- package/dist/candlestick.d.ts +1 -1
- package/dist/candlestick.js +2 -2
- package/dist/{cartesian-DRSXHxWe.cjs → cartesian-B9CrasFJ.cjs} +49 -7
- package/dist/cartesian-B9CrasFJ.cjs.map +1 -0
- package/dist/{cartesian-BrPqb5Qn.js → cartesian-COglz544.js} +45 -9
- package/dist/cartesian-COglz544.js.map +1 -0
- package/dist/{chart-B6TTY4Kr.js → chart-B97FBRCd.js} +22 -12
- package/dist/chart-B97FBRCd.js.map +1 -0
- package/dist/{chart-CYrrUCi3.d.ts → chart-CE9EVbfV.d.ts} +240 -62
- package/dist/{chart-CbPzP5Dp.d.cts → chart-Dz4geQZy.d.cts} +240 -62
- package/dist/{chart-D_lyOy-M.cjs → chart-GUmmjJ7S.cjs} +27 -11
- package/dist/chart-GUmmjJ7S.cjs.map +1 -0
- package/dist/{core-CQ0FaJ4G.js → core-7fgM3su0.js} +84 -16
- package/dist/core-7fgM3su0.js.map +1 -0
- package/dist/{core-C3qEppSm.d.ts → core-BUQzLsRJ.d.ts} +21 -6
- package/dist/{core-D2PSked3.cjs → core-BZTrsPxc.cjs} +93 -13
- package/dist/core-BZTrsPxc.cjs.map +1 -0
- package/dist/{core-9BnLEW4K.d.cts → core-Ck5uHcW8.d.cts} +40 -23
- package/dist/core.cjs +20 -16
- package/dist/core.d.cts +23 -21
- package/dist/core.d.ts +23 -21
- package/dist/core.js +18 -17
- package/dist/{dates-DerXTb1J.cjs → dates-0YNY49KQ.cjs} +2 -2
- package/dist/{dates-DerXTb1J.cjs.map → dates-0YNY49KQ.cjs.map} +1 -1
- package/dist/{dates-DLe2Ww64.js → dates-CKDRgpin.js} +2 -2
- package/dist/{dates-DLe2Ww64.js.map → dates-CKDRgpin.js.map} +1 -1
- package/dist/end-labels-B3oRvjxw.js +114 -0
- package/dist/end-labels-B3oRvjxw.js.map +1 -0
- package/dist/end-labels-CS-fnpp-.cjs +119 -0
- package/dist/end-labels-CS-fnpp-.cjs.map +1 -0
- package/dist/end-labels.cjs +11 -0
- package/dist/end-labels.cjs.map +1 -0
- package/dist/end-labels.d.cts +6 -0
- package/dist/end-labels.d.ts +6 -0
- package/dist/end-labels.js +11 -0
- package/dist/end-labels.js.map +1 -0
- package/dist/{export-chart-DoeiAyR2.js → export-chart-BOH_nfcH.js} +76 -4
- package/dist/export-chart-BOH_nfcH.js.map +1 -0
- package/dist/{export-chart-CPtXmZvi.cjs → export-chart-Be4T9J3m.cjs} +81 -3
- package/dist/export-chart-Be4T9J3m.cjs.map +1 -0
- package/dist/export.cjs +4 -2
- package/dist/export.cjs.map +1 -1
- package/dist/export.d.cts +4 -3
- package/dist/export.d.ts +4 -3
- package/dist/export.js +4 -3
- package/dist/export.js.map +1 -1
- package/dist/features-B55rwpQC.js.map +1 -1
- package/dist/features-DEDP5CEQ.cjs.map +1 -1
- package/dist/{funnel-CarOh8w_.d.cts → funnel-B9ridzNx.d.cts} +2 -2
- package/dist/{funnel-BdcfUkb5.d.ts → funnel-FogM8flk.d.ts} +2 -2
- package/dist/funnel.d.cts +1 -1
- package/dist/funnel.d.ts +1 -1
- package/dist/{gauge-Ds9k1UV2.d.cts → gauge-BScJ7U6O.d.cts} +2 -2
- package/dist/{gauge-Zy25jfps.d.ts → gauge-D78oq1Lx.d.ts} +2 -2
- package/dist/gauge.d.cts +1 -1
- package/dist/gauge.d.ts +1 -1
- package/dist/heat-Bsqq4zw9.js +38 -0
- package/dist/heat-Bsqq4zw9.js.map +1 -0
- package/dist/heat-DYsivvDq.cjs +49 -0
- package/dist/heat-DYsivvDq.cjs.map +1 -0
- package/dist/{heatmap-Dcc_bsoQ.cjs → heatmap-Dyzrd4Fd.cjs} +3 -3
- package/dist/{heatmap-Dcc_bsoQ.cjs.map → heatmap-Dyzrd4Fd.cjs.map} +1 -1
- package/dist/{heatmap-C1v8bwpq.js → heatmap-J7fxG7MM.js} +3 -3
- package/dist/{heatmap-C1v8bwpq.js.map → heatmap-J7fxG7MM.js.map} +1 -1
- package/dist/{heatmap-CJ-0dfhJ.d.cts → heatmap-Jvwo7iFW.d.cts} +2 -2
- package/dist/{heatmap-Jp5sHRTo.d.ts → heatmap-mFCnP6aB.d.ts} +2 -2
- package/dist/heatmap.cjs +1 -1
- package/dist/heatmap.d.cts +1 -1
- package/dist/heatmap.d.ts +1 -1
- package/dist/heatmap.js +1 -1
- package/dist/index.cjs +37 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -21
- package/dist/index.d.ts +23 -21
- package/dist/index.js +34 -27
- package/dist/index.js.map +1 -1
- package/dist/interaction-DXYSjgnP.cjs.map +1 -1
- package/dist/interaction-En1KlwFO.js.map +1 -1
- package/dist/layout-CYerDebD.d.cts +29 -0
- package/dist/layout-CYerDebD.d.ts +29 -0
- package/dist/{line-CxR4tg1Q.js → line-CXH0L10d.js} +43 -8
- package/dist/line-CXH0L10d.js.map +1 -0
- package/dist/{line-vyWO030v.d.cts → line-Cu9ctpbv.d.cts} +9 -2
- package/dist/{line-YiCuhVMI.cjs → line-DHbYCQy4.cjs} +43 -8
- package/dist/line-DHbYCQy4.cjs.map +1 -0
- package/dist/{line-Bpr5uVLQ.d.ts → line-TkzA7wMK.d.ts} +8 -1
- package/dist/line.cjs +1 -1
- package/dist/line.d.cts +1 -1
- package/dist/line.d.ts +1 -1
- package/dist/line.js +1 -1
- package/dist/{map-49FcfdmJ.d.cts → map-BirylCmT.d.cts} +2 -2
- package/dist/{map-C15NC7kW.js → map-CYp6x-uS.js} +3 -26
- package/dist/map-CYp6x-uS.js.map +1 -0
- package/dist/{map-BqrZ80vT.cjs → map-ChwSgooH.cjs} +4 -27
- package/dist/map-ChwSgooH.cjs.map +1 -0
- package/dist/{map-BMC61J-P.d.ts → map-DNqog2Xs.d.ts} +2 -2
- package/dist/map.cjs +1 -1
- package/dist/map.d.cts +1 -1
- package/dist/map.d.ts +1 -1
- package/dist/map.js +1 -1
- package/dist/maps/world.d.cts +1 -1
- package/dist/maps/world.d.ts +1 -1
- package/dist/{others-ls5eKtZ4.d.cts → others-CuNdpvjd.d.cts} +1 -1
- package/dist/{parliament-Cz9n_DoK.d.ts → parliament-CHdf13XU.d.ts} +2 -2
- package/dist/{parliament-C7V8UJj1.d.cts → parliament-CsYgh4N2.d.cts} +2 -2
- package/dist/parliament.d.cts +1 -1
- package/dist/parliament.d.ts +1 -1
- package/dist/{patterns-Dw7OMD_2.cjs → patterns-BPN1c9qe.cjs} +2 -2
- package/dist/{patterns-Dw7OMD_2.cjs.map → patterns-BPN1c9qe.cjs.map} +1 -1
- package/dist/{patterns-BMUINoka.js → patterns-CVrLrJXg.js} +2 -2
- package/dist/{patterns-BMUINoka.js.map → patterns-CVrLrJXg.js.map} +1 -1
- package/dist/patterns.cjs +1 -1
- package/dist/patterns.d.cts +1 -1
- package/dist/patterns.d.ts +1 -1
- package/dist/patterns.js +1 -1
- package/dist/{percentage-bar-cSeiLdwU.d.ts → percentage-bar-CSAbzDOn.d.ts} +2 -2
- package/dist/{percentage-bar-R1--2grK.d.cts → percentage-bar-UZHCRvlK.d.cts} +3 -3
- package/dist/percentage-bar.d.cts +1 -1
- package/dist/percentage-bar.d.ts +1 -1
- package/dist/{pie-vD5-g8je.d.cts → pie-AFedsDcF.d.cts} +12 -3
- package/dist/{pie-Bd8wyrtY.js → pie-Ch6Bx0ih.js} +54 -39
- package/dist/pie-Ch6Bx0ih.js.map +1 -0
- package/dist/{pie-BseZlCgP.cjs → pie-Cll1OrVZ.cjs} +54 -39
- package/dist/pie-Cll1OrVZ.cjs.map +1 -0
- package/dist/{pie-BQQkvy1N.d.ts → pie-Cn2H3pz8.d.ts} +11 -2
- package/dist/pie.cjs +1 -1
- package/dist/pie.d.cts +1 -1
- package/dist/pie.d.ts +1 -1
- package/dist/pie.js +1 -1
- package/dist/point-shapes.d.cts +1 -1
- package/dist/point-shapes.d.ts +1 -1
- package/dist/{radar-D6XqkFWQ.js → radar-Bg-IiIWB.js} +3 -3
- package/dist/{radar-D6XqkFWQ.js.map → radar-Bg-IiIWB.js.map} +1 -1
- package/dist/{radar-vLxilcr4.d.ts → radar-DEer2jjd.d.ts} +2 -2
- package/dist/{radar-7I6hsY_h.d.cts → radar-DxmjXhMc.d.cts} +2 -2
- package/dist/{radar-DjISDnSf.cjs → radar-wDyX17S3.cjs} +3 -3
- package/dist/{radar-DjISDnSf.cjs.map → radar-wDyX17S3.cjs.map} +1 -1
- package/dist/radar.cjs +1 -1
- package/dist/radar.d.cts +1 -1
- package/dist/radar.d.ts +1 -1
- package/dist/radar.js +1 -1
- package/dist/range-bar-BnKjJP89.cjs +348 -0
- package/dist/range-bar-BnKjJP89.cjs.map +1 -0
- package/dist/range-bar-C4cRaaQE.d.ts +123 -0
- package/dist/range-bar-D32dIQOY.d.cts +123 -0
- package/dist/range-bar-Dx6ce0J1.js +343 -0
- package/dist/range-bar-Dx6ce0J1.js.map +1 -0
- package/dist/range-bar.cjs +3 -0
- package/dist/range-bar.d.cts +3 -0
- package/dist/range-bar.d.ts +3 -0
- package/dist/range-bar.js +1 -0
- package/dist/{sankey-DqiuxUx7.d.cts → sankey-D-8ATwBT.d.cts} +2 -2
- package/dist/{sankey-7As41Fo4.d.ts → sankey-DpYJsOI4.d.ts} +2 -2
- package/dist/sankey.d.cts +1 -1
- package/dist/sankey.d.ts +1 -1
- package/dist/{scatter-DCMAtt5L.js → scatter-0Z7K_YUz.js} +65 -19
- package/dist/scatter-0Z7K_YUz.js.map +1 -0
- package/dist/{scatter-BXkXGgM_.d.ts → scatter-BAL5K9_4.d.ts} +22 -9
- package/dist/{scatter-DL0zAV09.d.cts → scatter-BUGbnRzM.d.cts} +22 -9
- package/dist/{scatter-Bwkblr4L.cjs → scatter-CZ8do3Up.cjs} +65 -19
- package/dist/scatter-CZ8do3Up.cjs.map +1 -0
- package/dist/scatter.cjs +1 -1
- package/dist/scatter.d.cts +2 -2
- package/dist/scatter.d.ts +2 -2
- package/dist/scatter.js +1 -1
- package/dist/slice-labels-1TBq7p3q.d.cts +28 -0
- package/dist/slice-labels-C9ucsBVW.js +88 -0
- package/dist/slice-labels-C9ucsBVW.js.map +1 -0
- package/dist/slice-labels-CbFiy46l.cjs +93 -0
- package/dist/slice-labels-CbFiy46l.cjs.map +1 -0
- package/dist/slice-labels-Cm5CyV7B.d.ts +28 -0
- package/dist/slice-labels.cjs +11 -0
- package/dist/slice-labels.cjs.map +1 -0
- package/dist/slice-labels.d.cts +6 -0
- package/dist/slice-labels.d.ts +6 -0
- package/dist/slice-labels.js +11 -0
- package/dist/slice-labels.js.map +1 -0
- package/dist/{sparkline-BElUSd0r.d.ts → sparkline-CtoBJe-a.d.ts} +2 -2
- package/dist/{sparkline-BMSuEPHP.cjs → sparkline-DjR-V6BI.cjs} +2 -2
- package/dist/{sparkline-BMSuEPHP.cjs.map → sparkline-DjR-V6BI.cjs.map} +1 -1
- package/dist/{sparkline-RYly7bR0.d.cts → sparkline-DwHJfeZz.d.cts} +2 -2
- package/dist/{sparkline-NDmq90kP.js → sparkline-_dxwtdli.js} +2 -2
- package/dist/{sparkline-NDmq90kP.js.map → sparkline-_dxwtdli.js.map} +1 -1
- package/dist/sparkline.cjs +1 -1
- package/dist/sparkline.d.cts +1 -1
- package/dist/sparkline.d.ts +1 -1
- package/dist/sparkline.js +1 -1
- package/dist/{stack-BTWYIwLO.d.cts → stack-CcmyALx0.d.cts} +1 -1
- package/dist/{stack-jVKvg2x_.js → stack-CyVlS7Fr.js} +2 -2
- package/dist/{stack-jVKvg2x_.js.map → stack-CyVlS7Fr.js.map} +1 -1
- package/dist/{stack-BO4624CY.cjs → stack-DBhmYNat.cjs} +2 -2
- package/dist/{stack-BO4624CY.cjs.map → stack-DBhmYNat.cjs.map} +1 -1
- package/dist/style.css +1 -1
- package/dist/{time-axis-B3VekUfX.cjs → time-axis-CVKjQKSS.cjs} +3 -3
- package/dist/{time-axis-B3VekUfX.cjs.map → time-axis-CVKjQKSS.cjs.map} +1 -1
- package/dist/{time-axis-CLjqOakA.js → time-axis-CkmbAw4Z.js} +3 -3
- package/dist/{time-axis-CLjqOakA.js.map → time-axis-CkmbAw4Z.js.map} +1 -1
- package/dist/time.cjs +2 -2
- package/dist/time.js +2 -2
- package/dist/{treemap-25vHO_UK.d.cts → treemap-C2maqerU.d.cts} +26 -4
- package/dist/{treemap-BCXUbixd.d.ts → treemap-D_zbubo3.d.ts} +26 -4
- package/dist/{treemap-CZk8kKFD.cjs → treemap-PulGXZv0.cjs} +38 -8
- package/dist/treemap-PulGXZv0.cjs.map +1 -0
- package/dist/{treemap-C4glsx-g.js → treemap-lbYxb-7h.js} +38 -8
- package/dist/treemap-lbYxb-7h.js.map +1 -0
- package/dist/treemap.cjs +1 -1
- package/dist/treemap.d.cts +1 -1
- package/dist/treemap.d.ts +1 -1
- package/dist/treemap.js +1 -1
- package/dist/{value-labels-C7GrhOXJ.js → value-labels-B0VeheyE.js} +5 -4
- package/dist/value-labels-B0VeheyE.js.map +1 -0
- package/dist/{value-labels-DzaKIWKp.cjs → value-labels-Dcyk3GIY.cjs} +5 -4
- package/dist/value-labels-Dcyk3GIY.cjs.map +1 -0
- package/dist/value-labels.cjs +1 -1
- package/dist/value-labels.d.cts +1 -1
- package/dist/value-labels.d.ts +1 -1
- package/dist/value-labels.js +1 -1
- package/dist/zoom.cjs +810 -0
- package/dist/zoom.cjs.map +1 -0
- package/dist/zoom.d.cts +34 -0
- package/dist/zoom.d.ts +34 -0
- package/dist/zoom.js +806 -0
- package/dist/zoom.js.map +1 -0
- package/package.json +27 -2
- package/dist/annotations-BQ8l-qHs.js.map +0 -1
- package/dist/annotations-CpCWA29b.cjs.map +0 -1
- package/dist/area-DYdQ_sMV.cjs.map +0 -1
- package/dist/area-WdtfqvhX.js.map +0 -1
- package/dist/axis-MMaVoSWB.js.map +0 -1
- package/dist/axis-YfAerNBA.cjs.map +0 -1
- package/dist/bar-BOcRcArc.js.map +0 -1
- package/dist/bar-CVkOJ7WA.cjs.map +0 -1
- package/dist/candlestick-BtT9glp9.js.map +0 -1
- package/dist/candlestick-CSmRuZ4v.cjs.map +0 -1
- package/dist/cartesian-BrPqb5Qn.js.map +0 -1
- package/dist/cartesian-DRSXHxWe.cjs.map +0 -1
- package/dist/chart-B6TTY4Kr.js.map +0 -1
- package/dist/chart-D_lyOy-M.cjs.map +0 -1
- package/dist/core-CQ0FaJ4G.js.map +0 -1
- package/dist/core-D2PSked3.cjs.map +0 -1
- package/dist/export-chart-CPtXmZvi.cjs.map +0 -1
- package/dist/export-chart-DoeiAyR2.js.map +0 -1
- package/dist/line-CxR4tg1Q.js.map +0 -1
- package/dist/line-YiCuhVMI.cjs.map +0 -1
- package/dist/map-BqrZ80vT.cjs.map +0 -1
- package/dist/map-C15NC7kW.js.map +0 -1
- package/dist/pie-Bd8wyrtY.js.map +0 -1
- package/dist/pie-BseZlCgP.cjs.map +0 -1
- package/dist/scatter-Bwkblr4L.cjs.map +0 -1
- package/dist/scatter-DCMAtt5L.js.map +0 -1
- package/dist/treemap-C4glsx-g.js.map +0 -1
- package/dist/treemap-CZk8kKFD.cjs.map +0 -1
- package/dist/value-labels-C7GrhOXJ.js.map +0 -1
- package/dist/value-labels-DzaKIWKp.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heatmap-Dcc_bsoQ.cjs","names":["round","resolveLabels","formatNumber","extent","seriesKey","axisSize","estimateTextWidth","plotFrame","band","labelKey","rectPath","h","thinTicks","bandTicks","axis","seriesLegend","cleanData","cleanSeries","seriesTable"],"sources":["../src/charts/heatmap.ts"],"sourcesContent":["import type { ChartType, LegendItem, RenderContext } from '../chart.ts'\nimport { axis, axisSize, bandTicks, thinTicks } from '../components/axis.ts'\nimport { formatNumber, type Locale, type NumberFormat } from '../format.ts'\nimport type { Hit, HitItem, Interaction } from '../interaction.ts'\nimport { estimateTextWidth, type InsetsInput, plotFrame, round } from '../layout.ts'\nimport { band } from '../scales/band.ts'\nimport { extent } from '../scales/extent.ts'\nimport { rectPath } from '../shapes/rect.ts'\nimport { h, type StyleValue } from '../vnode.ts'\nimport {\n type CartesianData,\n type Label,\n labelKey,\n resolveLabels,\n type Series,\n seriesKey,\n seriesLegend,\n seriesTable,\n} from './cartesian.ts'\nimport { cleanData, cleanSeries } from './clean.ts'\n\n/** A band of values drawn in one color, with its own legend entry. */\nexport interface HeatmapRange {\n /** Lowest value in the band (inclusive). Leave it out for \"everything below `to`\". */\n from?: number\n /** Value where the band ends (exclusive). Leave it out on the last band. */\n to?: number\n /**\n * Any CSS color, including `var(--tc-color-3)`.\n * Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.\n */\n color: string\n /** Legend and tooltip name, e.g. `'High'`. Defaults to the range, e.g. `10–30`. */\n name?: string\n}\n\nexport interface HeatmapOptions {\n /** Columns are the labels, rows are the series (first series on top). */\n data: CartesianData\n /** Value shown with the lightest shade (or the first color). Defaults to the smaller of `0` and the data minimum. */\n min?: number\n /** Value shown with the full color (or the last color). Defaults to the data maximum. */\n max?: number\n /**\n * Discrete bands of values, each in its own color and legend entry (which\n * also hides the band's cells). Takes precedence over `colors` and `colorBy`.\n */\n ranges?: readonly HeatmapRange[]\n /**\n * A continuous scale through two or more colors (any CSS color, including\n * `var(--tc-…)`), from `min` to `max`. For values around a reference\n * point, use two hues with a neutral middle, e.g.\n * `['var(--tc-color-1)', 'var(--tc-grid-color)', 'var(--tc-color-8)']`.\n * Values that could inject CSS are ignored, as for series colors.\n */\n colors?: readonly string[]\n /** Value placed on the middle color of `colors` (e.g. `0` for changes). Defaults to halfway. */\n mid?: number\n /**\n * `'series'` shades every row in its own palette color (with a legend of\n * the rows); `'value'` (the default) uses one hue, `--tc-heat-color`.\n */\n colorBy?: 'value' | 'series'\n /** Space between cells in pixels, drawn as surface. Defaults to `2`. */\n gap?: number\n /** Corner radius of the cells. Defaults to `3`. */\n radius?: number\n /** Format of the values (tooltip, table). */\n format?: NumberFormat\n /** Column labels along the bottom. */\n x?: { show?: boolean; format?: (label: Label, index: number) => string }\n /** Row names on the left. */\n y?: { show?: boolean }\n /** Extra space around the grid, in pixels. */\n padding?: InsetsInput\n}\n\n/** Share of the full color at the minimum, so zero still reads as a value, not a gap. */\nconst FLOOR = 0.08\n\nconst EMPTY = 'var(--tc-heat-empty,var(--tc-grid-color))'\n\n/** Cell color at `share` (0…1) of the way from the empty shade to `color`. */\nconst shade = (share: number, color = 'var(--tc-heat-color,var(--tc-color-1))'): string =>\n `color-mix(in oklab,${color} ${round(share * 100)}%,${EMPTY})`\n\n/** Legend key of a range. */\nconst rangeKey = (range: HeatmapRange, index: number): string => range.name ?? `range-${index + 1}`\n\n/** The first range containing `v` (`from` inclusive, `to` exclusive). */\nconst rangeOf = (ranges: readonly HeatmapRange[], v: number): number =>\n ranges.findIndex((r) => (r.from === undefined || v >= r.from) && (r.to === undefined || v < r.to))\n\n/** Color of a palette slot by series index, as the CSS classes would pick it. */\nconst slotColor = (series: Series, index: number): string =>\n series.color ?? (index < 8 ? `var(--tc-color-${index + 1})` : 'var(--tc-color-other)')\n\n/** How one cell is painted: inline style, the tooltip swatch, and whether it is drawn empty. */\ninterface Paint {\n style?: StyleValue\n color: string\n empty?: boolean\n}\n\nfunction renderHeatmap(options: HeatmapOptions, ctx: RenderContext) {\n const { width, fontSize, locale } = ctx\n const { gap = 2, radius = 3 } = options\n const labels = resolveLabels(options.data)\n const formatLabel = options.x?.format ?? ((label: Label) => String(label))\n const value = formatNumber(options.format, locale)\n\n // Color domain.\n const all = options.data.series.flatMap((s) => s.values)\n const [dataMin, dataMax] = extent(all) ?? [0, 1]\n const lo = options.min ?? Math.min(0, dataMin)\n const hi = options.max ?? dataMax\n /** Position of a value in the domain, 0…1 (through `mid` for a scale with a middle). */\n const position = (v: number) => {\n const { mid } = options\n let t: number\n if (mid !== undefined && options.colors && lo < mid && mid < hi) {\n t = v <= mid ? ((v - lo) / (mid - lo)) * 0.5 : 0.5 + ((v - mid) / (hi - mid)) * 0.5\n } else {\n t = hi > lo ? (v - lo) / (hi - lo) : v > lo ? 1 : 0\n }\n return Math.min(1, Math.max(0, t))\n }\n const share = (v: number) => FLOOR + (1 - FLOOR) * position(v)\n\n const ranges = options.ranges?.length ? options.ranges : undefined\n const stops = !ranges && options.colors && options.colors.length >= 2 ? options.colors : undefined\n const bySeries = !ranges && !stops && options.colorBy === 'series'\n // Rows hidden from the legend (rows are legend entries when colored by series).\n const rows = bySeries\n ? options.data.series.filter((s) => !ctx.hidden.has(seriesKey(s)))\n : options.data.series\n const slot = (row: Series) => options.data.series.indexOf(row)\n\n /** How the cell of `row` with value `v` is painted in the active color mode. */\n const paint = (v: number, row: Series): Paint => {\n if (ranges) {\n const index = rangeOf(ranges, v)\n const range = ranges[index]\n if (!range || ctx.hidden.has(rangeKey(range, index))) return { color: EMPTY, empty: true }\n return { style: { '--tc-cell-fill': range.color }, color: range.color }\n }\n if (stops) {\n const at = position(v) * (stops.length - 1)\n const k = Math.min(stops.length - 2, Math.floor(at))\n const u = round((at - k) * 100)\n const from = stops[k] as string\n const color =\n u <= 0\n ? from\n : u >= 100\n ? (stops[k + 1] as string)\n : `color-mix(in oklab,${stops[k + 1]} ${u}%,${from})`\n return { style: { '--tc-cell-fill': color }, color }\n }\n const pct = share(v)\n return {\n style: `--tc-heat:${round(pct * 100)}%`,\n color: bySeries ? shade(pct, slotColor(row, slot(row))) : shade(pct),\n }\n }\n\n // Margins for the labels, then one band per column and per row.\n const { rtl } = ctx\n const showX = options.x?.show !== false && labels.length > 0\n const showY = options.y?.show !== false && rows.length > 0\n const rowTicks = rows.map((s, i) => ({ value: i, position: 0, label: s.name }))\n const left = showY ? axisSize('left', rowTicks, fontSize) : 0\n const bottom = showX ? axisSize('bottom', [{ value: 0, position: 0, label: 'M' }], fontSize) : 0\n // The last column label is centered on its column: what is wider than half a\n // column needs room on the right.\n const lastLabel = showX\n ? estimateTextWidth(\n formatLabel(labels[labels.length - 1] as Label, labels.length - 1),\n fontSize,\n )\n : 0\n const { area, side, range } = plotFrame(ctx, options.padding, (pad) => {\n const halfColumn = (width - pad.start - pad.end - left) / Math.max(1, labels.length) / 2\n return {\n top: pad.top,\n bottom: pad.bottom + bottom,\n start: pad.start + left,\n end: pad.end + Math.max(0, Math.ceil(lastLabel / 2 - halfColumn)),\n }\n })\n const x = band(\n labels.map((_, i) => i),\n range(),\n )\n const y = band(\n rows.map((_, i) => i),\n [area.y, area.y + area.height],\n )\n const cellW = Math.max(0, x.bandwidth - gap)\n const cellH = Math.max(0, y.bandwidth - gap)\n const cellX = (i: number) => x.at(i) + gap / 2\n const cellY = (j: number) => y.at(j) + gap / 2\n const valueAt = (i: number, j: number) => {\n const v = rows[j]?.values[i]\n return v != null && Number.isFinite(v) ? v : null\n }\n\n // One hit per column; every row is an item, the hovered row is active.\n const hitAt = (i: number, row = 0): Hit | null => {\n if (i < 0 || i >= labels.length || rows.length === 0) return null\n const j = Math.max(0, Math.min(rows.length - 1, row))\n const items: HitItem[] = rows.map((s, r) => {\n const v = valueAt(i, r)\n const range = ranges && v !== null ? ranges[rangeOf(ranges, v)] : undefined\n return {\n name: s.name,\n seriesIndex: r,\n value: v,\n // With ranges, the band's name says what the value means.\n text: v === null ? '–' : range?.name ? `${value(v)} · ${range.name}` : value(v),\n x: cellX(i) + cellW / 2,\n y: cellY(r) + cellH / 2,\n box: { x: cellX(i), y: cellY(r), width: cellW, height: cellH },\n color: v === null ? 'var(--tc-grid-color)' : paint(v, s).color,\n }\n })\n return {\n index: i,\n label: labelKey(labels[i] as Label),\n title: formatLabel(labels[i] as Label, i),\n x: cellX(i) + cellW / 2,\n area,\n items,\n seriesIndex: j,\n // A ring just outside the hovered cell.\n highlight: {\n kind: 'halo',\n d: rectPath(cellX(i) - 2, cellY(j) - 2, cellW + 4, cellH + 4, radius + 2),\n },\n }\n }\n\n const interaction: Interaction = {\n count: labels.length,\n reversed: rtl === true,\n hitIndex: (i, row) => hitAt(i, row),\n hitTest(px, py) {\n if (px < area.x || px > area.x + area.width || py < area.y || py > area.y + area.height) {\n return null\n }\n const column = Math.min(labels.length - 1, Math.floor((px - area.x) / (x.step || 1)))\n const i = rtl ? labels.length - 1 - column : column\n const j = Math.min(rows.length - 1, Math.floor((py - area.y) / (y.step || 1)))\n return hitAt(i, j)\n },\n }\n\n const cells = rows.map((s, j) =>\n h(\n 'g',\n {\n key: seriesKey(s),\n // Colored by series, a row takes its palette slot like any series.\n class: ['tc-heatmap-row', bySeries && ['tc-series', `tc-series-${slot(s) + 1}`]],\n 'data-series': s.name,\n style: bySeries ? { '--tc-series-color': s.color } : undefined,\n },\n labels.map((label, i) => {\n const v = valueAt(i, j)\n const painted = v === null ? undefined : paint(v, s)\n return h('rect', {\n key: labelKey(label),\n class: ['tc-cell', (v === null || painted?.empty) && 'tc-cell-empty'],\n x: round(cellX(i)),\n y: round(cellY(j)),\n width: round(cellW),\n height: round(cellH),\n rx: round(Math.min(radius, cellW / 2, cellH / 2)),\n style: painted?.style,\n })\n }),\n ),\n )\n\n const xTicks = showX\n ? thinTicks(\n bandTicks(x, (_, i) => formatLabel(labels[i] as Label, i)),\n 'bottom',\n fontSize,\n )\n : []\n const yTicks = showY ? bandTicks(y, (_, j) => rows[j]?.name ?? '') : []\n\n const content = [\n h('g', { class: 'tc-heatmap-cells' }, cells),\n showX && axis({ position: 'bottom', ticks: xTicks, area }),\n showY && axis({ position: side, ticks: yTicks, area }),\n ]\n return { content, interaction }\n}\n\n/** Legend: the ranges, or the rows when colored by series; none for a single scale. */\nfunction heatmapLegend(options: HeatmapOptions): LegendItem[] {\n const { ranges } = options\n if (ranges?.length) {\n // The legend is asked with the whole config, so the names follow its locale.\n const value = formatNumber(options.format, (options as { locale?: Locale }).locale)\n return ranges.map((range, index) => ({\n key: rangeKey(range, index),\n name:\n range.name ??\n (range.from === undefined\n ? `< ${value(range.to ?? 0)}`\n : range.to === undefined\n ? `≥ ${value(range.from)}`\n : `${value(range.from)}–${value(range.to)}`),\n index,\n color: range.color,\n }))\n }\n if (options.colors && options.colors.length >= 2) return []\n return options.colorBy === 'series' ? seriesLegend(options.data) : []\n}\n\n/**\n * Heatmap: a grid of cells, one row per series and one column per label,\n * shaded from light to the full color by value (a single hue, so it reads\n * as magnitude). Set the hue with `--tc-heat-color`, or color the cells by\n * `ranges` of values, a `colors` scale (with a `mid` for diverging data),\n * or one palette color per row with `colorBy: 'series'`.\n *\n * ```ts\n * new Chart('#el', {\n * type: heatmap,\n * data: { labels: ['W1', 'W2', 'W3'], series: [{ name: 'Mon', values: [2, 4, 0] }] },\n * })\n * ```\n */\nexport const heatmap: ChartType<HeatmapOptions> = {\n name: 'heatmap',\n clean: cleanData(cleanSeries),\n render: renderHeatmap,\n legend: heatmapLegend,\n valueLabels: { marks: 'cell', format: (options) => options.format },\n // Cells are formatted as in the tooltip: `format` is the value format here, not `y.format`.\n table: (options, ctx, limit) =>\n seriesTable(\n { data: options.data, ...(options.x ? { x: options.x } : {}), y: { format: options.format } },\n ctx,\n limit,\n ),\n}\n"],"mappings":";;;;;;;;;;AA8EA,MAAM,QAAQ;AAEd,MAAM,QAAQ;;AAGd,MAAM,SAAS,OAAe,QAAQ,6CACpC,sBAAsB,MAAM,GAAGA,eAAAA,MAAM,QAAQ,GAAG,EAAE,IAAI,MAAM;;AAG9D,MAAM,YAAY,OAAqB,UAA0B,MAAM,QAAQ,SAAS,QAAQ;;AAGhG,MAAM,WAAW,QAAiC,MAChD,OAAO,WAAW,OAAO,EAAE,SAAS,KAAA,KAAa,KAAK,EAAE,UAAU,EAAE,OAAO,KAAA,KAAa,IAAI,EAAE,GAAG;;AAGnG,MAAM,aAAa,QAAgB,UACjC,OAAO,UAAU,QAAQ,IAAI,kBAAkB,QAAQ,EAAE,KAAK;AAShE,SAAS,cAAc,SAAyB,KAAoB;CAClE,MAAM,EAAE,OAAO,UAAU,WAAW;CACpC,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM;CAChC,MAAM,SAASC,kBAAAA,cAAc,QAAQ,IAAI;CACzC,MAAM,cAAc,QAAQ,GAAG,YAAY,UAAiB,OAAO,KAAK;CACxE,MAAM,QAAQC,eAAAA,aAAa,QAAQ,QAAQ,MAAM;CAGjD,MAAM,MAAM,QAAQ,KAAK,OAAO,SAAS,MAAM,EAAE,MAAM;CACvD,MAAM,CAAC,SAAS,WAAWC,eAAAA,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC;CAC/C,MAAM,KAAK,QAAQ,OAAO,KAAK,IAAI,GAAG,OAAO;CAC7C,MAAM,KAAK,QAAQ,OAAO;;CAE1B,MAAM,YAAY,MAAc;EAC9B,MAAM,EAAE,QAA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M,CAAC,MACxB,MAAM,OAAO,KAAA,IACX,KAAK,MAAM,MAAM,IAAI,MACrB,GAAG,MAAM,MAAM,IAAI,EAAE,GAAG,MAAM,MAAM,EAAE;GAC9C;GACA,OAAO,MAAM;EACf,EAAE;CACJ;CACA,IAAI,QAAQ,UAAU,QAAQ,OAAO,UAAU,GAAG,OAAO,CAAC;CAC1D,OAAO,QAAQ,YAAY,WAAWa,kBAAAA,aAAa,QAAQ,IAAI,IAAI,CAAC;AACtE;;;;;;;;;;;;;;;AAgBA,MAAa,UAAqC;CAChD,MAAM;CACN,OAAOC,cAAAA,UAAUC,cAAAA,WAAW;CAC5B,QAAQ;CACR,QAAQ;CACR,aAAa;EAAE,OAAO;EAAQ,SAAS,YAAY,QAAQ;CAAO;CAElE,QAAQ,SAAS,KAAK,UACpBC,kBAAAA,YACE;EAAE,MAAM,QAAQ;EAAM,GAAI,QAAQ,IAAI,EAAE,GAAG,QAAQ,EAAE,IAAI,CAAC;EAAI,GAAG,EAAE,QAAQ,QAAQ,OAAO;CAAE,GAC5F,KACA,KACF;AACJ"}
|
|
1
|
+
{"version":3,"file":"heatmap-Dyzrd4Fd.cjs","names":["round","resolveLabels","formatNumber","extent","seriesKey","axisSize","estimateTextWidth","plotFrame","band","labelKey","rectPath","h","thinTicks","bandTicks","axis","seriesLegend","cleanData","cleanSeries","seriesTable"],"sources":["../src/charts/heatmap.ts"],"sourcesContent":["import type { ChartType, LegendItem, RenderContext } from '../chart.ts'\nimport { axis, axisSize, bandTicks, thinTicks } from '../components/axis.ts'\nimport { formatNumber, type Locale, type NumberFormat } from '../format.ts'\nimport type { Hit, HitItem, Interaction } from '../interaction.ts'\nimport { estimateTextWidth, type InsetsInput, plotFrame, round } from '../layout.ts'\nimport { band } from '../scales/band.ts'\nimport { extent } from '../scales/extent.ts'\nimport { rectPath } from '../shapes/rect.ts'\nimport { h, type StyleValue } from '../vnode.ts'\nimport {\n type CartesianData,\n type Label,\n labelKey,\n resolveLabels,\n type Series,\n seriesKey,\n seriesLegend,\n seriesTable,\n} from './cartesian.ts'\nimport { cleanData, cleanSeries } from './clean.ts'\n\n/** A band of values drawn in one color, with its own legend entry. */\nexport interface HeatmapRange {\n /** Lowest value in the band (inclusive). Leave it out for \"everything below `to`\". */\n from?: number\n /** Value where the band ends (exclusive). Leave it out on the last band. */\n to?: number\n /**\n * Any CSS color, including `var(--tc-color-3)`.\n * Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.\n */\n color: string\n /** Legend and tooltip name, e.g. `'High'`. Defaults to the range, e.g. `10–30`. */\n name?: string\n}\n\nexport interface HeatmapOptions {\n /** Columns are the labels, rows are the series (first series on top). */\n data: CartesianData\n /** Value shown with the lightest shade (or the first color). Defaults to the smaller of `0` and the data minimum. */\n min?: number\n /** Value shown with the full color (or the last color). Defaults to the data maximum. */\n max?: number\n /**\n * Discrete bands of values, each in its own color and legend entry (which\n * also hides the band's cells). Takes precedence over `colors` and `colorBy`.\n */\n ranges?: readonly HeatmapRange[]\n /**\n * A continuous scale through two or more colors (any CSS color, including\n * `var(--tc-…)`), from `min` to `max`. For values around a reference\n * point, use two hues with a neutral middle, e.g.\n * `['var(--tc-color-1)', 'var(--tc-grid-color)', 'var(--tc-color-8)']`.\n * Values that could inject CSS are ignored, as for series colors.\n */\n colors?: readonly string[]\n /** Value placed on the middle color of `colors` (e.g. `0` for changes). Defaults to halfway. */\n mid?: number\n /**\n * `'series'` shades every row in its own palette color (with a legend of\n * the rows); `'value'` (the default) uses one hue, `--tc-heat-color`.\n */\n colorBy?: 'value' | 'series'\n /** Space between cells in pixels, drawn as surface. Defaults to `2`. */\n gap?: number\n /** Corner radius of the cells. Defaults to `3`. */\n radius?: number\n /** Format of the values (tooltip, table). */\n format?: NumberFormat\n /** Column labels along the bottom. */\n x?: { show?: boolean; format?: (label: Label, index: number) => string }\n /** Row names on the left. */\n y?: { show?: boolean }\n /** Extra space around the grid, in pixels. */\n padding?: InsetsInput\n}\n\n/** Share of the full color at the minimum, so zero still reads as a value, not a gap. */\nconst FLOOR = 0.08\n\nconst EMPTY = 'var(--tc-heat-empty,var(--tc-grid-color))'\n\n/** Cell color at `share` (0…1) of the way from the empty shade to `color`. */\nconst shade = (share: number, color = 'var(--tc-heat-color,var(--tc-color-1))'): string =>\n `color-mix(in oklab,${color} ${round(share * 100)}%,${EMPTY})`\n\n/** Legend key of a range. */\nconst rangeKey = (range: HeatmapRange, index: number): string => range.name ?? `range-${index + 1}`\n\n/** The first range containing `v` (`from` inclusive, `to` exclusive). */\nconst rangeOf = (ranges: readonly HeatmapRange[], v: number): number =>\n ranges.findIndex((r) => (r.from === undefined || v >= r.from) && (r.to === undefined || v < r.to))\n\n/** Color of a palette slot by series index, as the CSS classes would pick it. */\nconst slotColor = (series: Series, index: number): string =>\n series.color ?? (index < 8 ? `var(--tc-color-${index + 1})` : 'var(--tc-color-other)')\n\n/** How one cell is painted: inline style, the tooltip swatch, and whether it is drawn empty. */\ninterface Paint {\n style?: StyleValue\n color: string\n empty?: boolean\n}\n\nfunction renderHeatmap(options: HeatmapOptions, ctx: RenderContext) {\n const { width, fontSize, locale } = ctx\n const { gap = 2, radius = 3 } = options\n const labels = resolveLabels(options.data)\n const formatLabel = options.x?.format ?? ((label: Label) => String(label))\n const value = formatNumber(options.format, locale)\n\n // Color domain.\n const all = options.data.series.flatMap((s) => s.values)\n const [dataMin, dataMax] = extent(all) ?? [0, 1]\n const lo = options.min ?? Math.min(0, dataMin)\n const hi = options.max ?? dataMax\n /** Position of a value in the domain, 0…1 (through `mid` for a scale with a middle). */\n const position = (v: number) => {\n const { mid } = options\n let t: number\n if (mid !== undefined && options.colors && lo < mid && mid < hi) {\n t = v <= mid ? ((v - lo) / (mid - lo)) * 0.5 : 0.5 + ((v - mid) / (hi - mid)) * 0.5\n } else {\n t = hi > lo ? (v - lo) / (hi - lo) : v > lo ? 1 : 0\n }\n return Math.min(1, Math.max(0, t))\n }\n const share = (v: number) => FLOOR + (1 - FLOOR) * position(v)\n\n const ranges = options.ranges?.length ? options.ranges : undefined\n const stops = !ranges && options.colors && options.colors.length >= 2 ? options.colors : undefined\n const bySeries = !ranges && !stops && options.colorBy === 'series'\n // Rows hidden from the legend (rows are legend entries when colored by series).\n const rows = bySeries\n ? options.data.series.filter((s) => !ctx.hidden.has(seriesKey(s)))\n : options.data.series\n const slot = (row: Series) => options.data.series.indexOf(row)\n\n /** How the cell of `row` with value `v` is painted in the active color mode. */\n const paint = (v: number, row: Series): Paint => {\n if (ranges) {\n const index = rangeOf(ranges, v)\n const range = ranges[index]\n if (!range || ctx.hidden.has(rangeKey(range, index))) return { color: EMPTY, empty: true }\n return { style: { '--tc-cell-fill': range.color }, color: range.color }\n }\n if (stops) {\n const at = position(v) * (stops.length - 1)\n const k = Math.min(stops.length - 2, Math.floor(at))\n const u = round((at - k) * 100)\n const from = stops[k] as string\n const color =\n u <= 0\n ? from\n : u >= 100\n ? (stops[k + 1] as string)\n : `color-mix(in oklab,${stops[k + 1]} ${u}%,${from})`\n return { style: { '--tc-cell-fill': color }, color }\n }\n const pct = share(v)\n return {\n style: `--tc-heat:${round(pct * 100)}%`,\n color: bySeries ? shade(pct, slotColor(row, slot(row))) : shade(pct),\n }\n }\n\n // Margins for the labels, then one band per column and per row.\n const { rtl } = ctx\n const showX = options.x?.show !== false && labels.length > 0\n const showY = options.y?.show !== false && rows.length > 0\n const rowTicks = rows.map((s, i) => ({ value: i, position: 0, label: s.name }))\n const left = showY ? axisSize('left', rowTicks, fontSize) : 0\n const bottom = showX ? axisSize('bottom', [{ value: 0, position: 0, label: 'M' }], fontSize) : 0\n // The last column label is centered on its column: what is wider than half a\n // column needs room on the right.\n const lastLabel = showX\n ? estimateTextWidth(\n formatLabel(labels[labels.length - 1] as Label, labels.length - 1),\n fontSize,\n )\n : 0\n const { area, side, range } = plotFrame(ctx, options.padding, (pad) => {\n const halfColumn = (width - pad.start - pad.end - left) / Math.max(1, labels.length) / 2\n return {\n top: pad.top,\n bottom: pad.bottom + bottom,\n start: pad.start + left,\n end: pad.end + Math.max(0, Math.ceil(lastLabel / 2 - halfColumn)),\n }\n })\n const x = band(\n labels.map((_, i) => i),\n range(),\n )\n const y = band(\n rows.map((_, i) => i),\n [area.y, area.y + area.height],\n )\n const cellW = Math.max(0, x.bandwidth - gap)\n const cellH = Math.max(0, y.bandwidth - gap)\n const cellX = (i: number) => x.at(i) + gap / 2\n const cellY = (j: number) => y.at(j) + gap / 2\n const valueAt = (i: number, j: number) => {\n const v = rows[j]?.values[i]\n return v != null && Number.isFinite(v) ? v : null\n }\n\n // One hit per column; every row is an item, the hovered row is active.\n const hitAt = (i: number, row = 0): Hit | null => {\n if (i < 0 || i >= labels.length || rows.length === 0) return null\n const j = Math.max(0, Math.min(rows.length - 1, row))\n const items: HitItem[] = rows.map((s, r) => {\n const v = valueAt(i, r)\n const range = ranges && v !== null ? ranges[rangeOf(ranges, v)] : undefined\n return {\n name: s.name,\n seriesIndex: r,\n value: v,\n // With ranges, the band's name says what the value means.\n text: v === null ? '–' : range?.name ? `${value(v)} · ${range.name}` : value(v),\n x: cellX(i) + cellW / 2,\n y: cellY(r) + cellH / 2,\n box: { x: cellX(i), y: cellY(r), width: cellW, height: cellH },\n color: v === null ? 'var(--tc-grid-color)' : paint(v, s).color,\n }\n })\n return {\n index: i,\n label: labelKey(labels[i] as Label),\n title: formatLabel(labels[i] as Label, i),\n x: cellX(i) + cellW / 2,\n area,\n items,\n seriesIndex: j,\n // A ring just outside the hovered cell.\n highlight: {\n kind: 'halo',\n d: rectPath(cellX(i) - 2, cellY(j) - 2, cellW + 4, cellH + 4, radius + 2),\n },\n }\n }\n\n const interaction: Interaction = {\n count: labels.length,\n reversed: rtl === true,\n hitIndex: (i, row) => hitAt(i, row),\n hitTest(px, py) {\n if (px < area.x || px > area.x + area.width || py < area.y || py > area.y + area.height) {\n return null\n }\n const column = Math.min(labels.length - 1, Math.floor((px - area.x) / (x.step || 1)))\n const i = rtl ? labels.length - 1 - column : column\n const j = Math.min(rows.length - 1, Math.floor((py - area.y) / (y.step || 1)))\n return hitAt(i, j)\n },\n }\n\n const cells = rows.map((s, j) =>\n h(\n 'g',\n {\n key: seriesKey(s),\n // Colored by series, a row takes its palette slot like any series.\n class: ['tc-heatmap-row', bySeries && ['tc-series', `tc-series-${slot(s) + 1}`]],\n 'data-series': s.name,\n style: bySeries ? { '--tc-series-color': s.color } : undefined,\n },\n labels.map((label, i) => {\n const v = valueAt(i, j)\n const painted = v === null ? undefined : paint(v, s)\n return h('rect', {\n key: labelKey(label),\n class: ['tc-cell', (v === null || painted?.empty) && 'tc-cell-empty'],\n x: round(cellX(i)),\n y: round(cellY(j)),\n width: round(cellW),\n height: round(cellH),\n rx: round(Math.min(radius, cellW / 2, cellH / 2)),\n style: painted?.style,\n })\n }),\n ),\n )\n\n const xTicks = showX\n ? thinTicks(\n bandTicks(x, (_, i) => formatLabel(labels[i] as Label, i)),\n 'bottom',\n fontSize,\n )\n : []\n const yTicks = showY ? bandTicks(y, (_, j) => rows[j]?.name ?? '') : []\n\n const content = [\n h('g', { class: 'tc-heatmap-cells' }, cells),\n showX && axis({ position: 'bottom', ticks: xTicks, area }),\n showY && axis({ position: side, ticks: yTicks, area }),\n ]\n return { content, interaction }\n}\n\n/** Legend: the ranges, or the rows when colored by series; none for a single scale. */\nfunction heatmapLegend(options: HeatmapOptions): LegendItem[] {\n const { ranges } = options\n if (ranges?.length) {\n // The legend is asked with the whole config, so the names follow its locale.\n const value = formatNumber(options.format, (options as { locale?: Locale }).locale)\n return ranges.map((range, index) => ({\n key: rangeKey(range, index),\n name:\n range.name ??\n (range.from === undefined\n ? `< ${value(range.to ?? 0)}`\n : range.to === undefined\n ? `≥ ${value(range.from)}`\n : `${value(range.from)}–${value(range.to)}`),\n index,\n color: range.color,\n }))\n }\n if (options.colors && options.colors.length >= 2) return []\n return options.colorBy === 'series' ? seriesLegend(options.data) : []\n}\n\n/**\n * Heatmap: a grid of cells, one row per series and one column per label,\n * shaded from light to the full color by value (a single hue, so it reads\n * as magnitude). Set the hue with `--tc-heat-color`, or color the cells by\n * `ranges` of values, a `colors` scale (with a `mid` for diverging data),\n * or one palette color per row with `colorBy: 'series'`.\n *\n * ```ts\n * new Chart('#el', {\n * type: heatmap,\n * data: { labels: ['W1', 'W2', 'W3'], series: [{ name: 'Mon', values: [2, 4, 0] }] },\n * })\n * ```\n */\nexport const heatmap: ChartType<HeatmapOptions> = {\n name: 'heatmap',\n clean: cleanData(cleanSeries),\n render: renderHeatmap,\n legend: heatmapLegend,\n valueLabels: { marks: 'cell', format: (options) => options.format },\n // Cells are formatted as in the tooltip: `format` is the value format here, not `y.format`.\n table: (options, ctx, limit) =>\n seriesTable(\n { data: options.data, ...(options.x ? { x: options.x } : {}), y: { format: options.format } },\n ctx,\n limit,\n ),\n}\n"],"mappings":";;;;;;;;;;AA8EA,MAAM,QAAQ;AAEd,MAAM,QAAQ;;AAGd,MAAM,SAAS,OAAe,QAAQ,6CACpC,sBAAsB,MAAM,GAAGA,eAAAA,MAAM,QAAQ,GAAG,EAAE,IAAI,MAAM;;AAG9D,MAAM,YAAY,OAAqB,UAA0B,MAAM,QAAQ,SAAS,QAAQ;;AAGhG,MAAM,WAAW,QAAiC,MAChD,OAAO,WAAW,OAAO,EAAE,SAAS,KAAA,KAAa,KAAK,EAAE,UAAU,EAAE,OAAO,KAAA,KAAa,IAAI,EAAE,GAAG;;AAGnG,MAAM,aAAa,QAAgB,UACjC,OAAO,UAAU,QAAQ,IAAI,kBAAkB,QAAQ,EAAE,KAAK;AAShE,SAAS,cAAc,SAAyB,KAAoB;CAClE,MAAM,EAAE,OAAO,UAAU,WAAW;CACpC,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM;CAChC,MAAM,SAASC,kBAAAA,cAAc,QAAQ,IAAI;CACzC,MAAM,cAAc,QAAQ,GAAG,YAAY,UAAiB,OAAO,KAAK;CACxE,MAAM,QAAQC,eAAAA,aAAa,QAAQ,QAAQ,MAAM;CAGjD,MAAM,MAAM,QAAQ,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C;CAC5D,MAAM,EAAE,WAAW;CACnB,IAAI,QAAQ,QAAQ;EAElB,MAAM,QAAQZ,eAAAA,aAAa,QAAQ,QAAS,QAAgC,MAAM;EAClF,OAAO,OAAO,KAAK,OAAO,WAAW;GACnC,KAAK,SAAS,OAAO,KAAK;GAC1B,MACE,MAAM,SACL,MAAM,SAAS,KAAA,IACZ,KAAK,MAAM,MAAM,MAAM,CAAC,MACxB,MAAM,OAAO,KAAA,IACX,KAAK,MAAM,MAAM,IAAI,MACrB,GAAG,MAAM,MAAM,IAAI,EAAE,GAAG,MAAM,MAAM,EAAE;GAC9C;GACA,OAAO,MAAM;EACf,EAAE;CACJ;CACA,IAAI,QAAQ,UAAU,QAAQ,OAAO,UAAU,GAAG,OAAO,CAAC;CAC1D,OAAO,QAAQ,YAAY,WAAWa,kBAAAA,aAAa,QAAQ,IAAI,IAAI,CAAC;AACtE;;;;;;;;;;;;;;;AAgBA,MAAa,UAAqC;CAChD,MAAM;CACN,OAAOC,cAAAA,UAAUC,cAAAA,WAAW;CAC5B,QAAQ;CACR,QAAQ;CACR,aAAa;EAAE,OAAO;EAAQ,SAAS,YAAY,QAAQ;CAAO;CAElE,QAAQ,SAAS,KAAK,UACpBC,kBAAAA,YACE;EAAE,MAAM,QAAQ;EAAM,GAAI,QAAQ,IAAI,EAAE,GAAG,QAAQ,EAAE,IAAI,CAAC;EAAI,GAAG,EAAE,QAAQ,QAAQ,OAAO;CAAE,GAC5F,KACA,KACF;AACJ"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as bandTicks, n as axisSize, s as thinTicks, t as axis } from "./axis-
|
|
1
|
+
import { a as bandTicks, n as axisSize, s as thinTicks, t as axis } from "./axis-C5obgdJt.js";
|
|
2
2
|
import { r as formatNumber } from "./format-it1kepFG.js";
|
|
3
3
|
import { n as estimateTextWidth, o as plotFrame, s as round } from "./layout-DqAte3H8.js";
|
|
4
|
-
import { _ as seriesTable, d as resolveLabels, h as seriesLegend, m as seriesKey, o as labelKey
|
|
4
|
+
import { T as band, _ as seriesTable, d as resolveLabels, h as seriesLegend, m as seriesKey, o as labelKey } from "./cartesian-COglz544.js";
|
|
5
5
|
import { t as extent } from "./extent-DOV8rs-6.js";
|
|
6
6
|
import { t as rectPath } from "./rect-CZTNvMlf.js";
|
|
7
7
|
import { t as h } from "./vnode-_EMUqysL.js";
|
|
@@ -239,4 +239,4 @@ const heatmap = {
|
|
|
239
239
|
};
|
|
240
240
|
export { heatmap as t };
|
|
241
241
|
|
|
242
|
-
//# sourceMappingURL=heatmap-
|
|
242
|
+
//# sourceMappingURL=heatmap-J7fxG7MM.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heatmap-C1v8bwpq.js","names":[],"sources":["../src/charts/heatmap.ts"],"sourcesContent":["import type { ChartType, LegendItem, RenderContext } from '../chart.ts'\nimport { axis, axisSize, bandTicks, thinTicks } from '../components/axis.ts'\nimport { formatNumber, type Locale, type NumberFormat } from '../format.ts'\nimport type { Hit, HitItem, Interaction } from '../interaction.ts'\nimport { estimateTextWidth, type InsetsInput, plotFrame, round } from '../layout.ts'\nimport { band } from '../scales/band.ts'\nimport { extent } from '../scales/extent.ts'\nimport { rectPath } from '../shapes/rect.ts'\nimport { h, type StyleValue } from '../vnode.ts'\nimport {\n type CartesianData,\n type Label,\n labelKey,\n resolveLabels,\n type Series,\n seriesKey,\n seriesLegend,\n seriesTable,\n} from './cartesian.ts'\nimport { cleanData, cleanSeries } from './clean.ts'\n\n/** A band of values drawn in one color, with its own legend entry. */\nexport interface HeatmapRange {\n /** Lowest value in the band (inclusive). Leave it out for \"everything below `to`\". */\n from?: number\n /** Value where the band ends (exclusive). Leave it out on the last band. */\n to?: number\n /**\n * Any CSS color, including `var(--tc-color-3)`.\n * Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.\n */\n color: string\n /** Legend and tooltip name, e.g. `'High'`. Defaults to the range, e.g. `10–30`. */\n name?: string\n}\n\nexport interface HeatmapOptions {\n /** Columns are the labels, rows are the series (first series on top). */\n data: CartesianData\n /** Value shown with the lightest shade (or the first color). Defaults to the smaller of `0` and the data minimum. */\n min?: number\n /** Value shown with the full color (or the last color). Defaults to the data maximum. */\n max?: number\n /**\n * Discrete bands of values, each in its own color and legend entry (which\n * also hides the band's cells). Takes precedence over `colors` and `colorBy`.\n */\n ranges?: readonly HeatmapRange[]\n /**\n * A continuous scale through two or more colors (any CSS color, including\n * `var(--tc-…)`), from `min` to `max`. For values around a reference\n * point, use two hues with a neutral middle, e.g.\n * `['var(--tc-color-1)', 'var(--tc-grid-color)', 'var(--tc-color-8)']`.\n * Values that could inject CSS are ignored, as for series colors.\n */\n colors?: readonly string[]\n /** Value placed on the middle color of `colors` (e.g. `0` for changes). Defaults to halfway. */\n mid?: number\n /**\n * `'series'` shades every row in its own palette color (with a legend of\n * the rows); `'value'` (the default) uses one hue, `--tc-heat-color`.\n */\n colorBy?: 'value' | 'series'\n /** Space between cells in pixels, drawn as surface. Defaults to `2`. */\n gap?: number\n /** Corner radius of the cells. Defaults to `3`. */\n radius?: number\n /** Format of the values (tooltip, table). */\n format?: NumberFormat\n /** Column labels along the bottom. */\n x?: { show?: boolean; format?: (label: Label, index: number) => string }\n /** Row names on the left. */\n y?: { show?: boolean }\n /** Extra space around the grid, in pixels. */\n padding?: InsetsInput\n}\n\n/** Share of the full color at the minimum, so zero still reads as a value, not a gap. */\nconst FLOOR = 0.08\n\nconst EMPTY = 'var(--tc-heat-empty,var(--tc-grid-color))'\n\n/** Cell color at `share` (0…1) of the way from the empty shade to `color`. */\nconst shade = (share: number, color = 'var(--tc-heat-color,var(--tc-color-1))'): string =>\n `color-mix(in oklab,${color} ${round(share * 100)}%,${EMPTY})`\n\n/** Legend key of a range. */\nconst rangeKey = (range: HeatmapRange, index: number): string => range.name ?? `range-${index + 1}`\n\n/** The first range containing `v` (`from` inclusive, `to` exclusive). */\nconst rangeOf = (ranges: readonly HeatmapRange[], v: number): number =>\n ranges.findIndex((r) => (r.from === undefined || v >= r.from) && (r.to === undefined || v < r.to))\n\n/** Color of a palette slot by series index, as the CSS classes would pick it. */\nconst slotColor = (series: Series, index: number): string =>\n series.color ?? (index < 8 ? `var(--tc-color-${index + 1})` : 'var(--tc-color-other)')\n\n/** How one cell is painted: inline style, the tooltip swatch, and whether it is drawn empty. */\ninterface Paint {\n style?: StyleValue\n color: string\n empty?: boolean\n}\n\nfunction renderHeatmap(options: HeatmapOptions, ctx: RenderContext) {\n const { width, fontSize, locale } = ctx\n const { gap = 2, radius = 3 } = options\n const labels = resolveLabels(options.data)\n const formatLabel = options.x?.format ?? ((label: Label) => String(label))\n const value = formatNumber(options.format, locale)\n\n // Color domain.\n const all = options.data.series.flatMap((s) => s.values)\n const [dataMin, dataMax] = extent(all) ?? [0, 1]\n const lo = options.min ?? Math.min(0, dataMin)\n const hi = options.max ?? dataMax\n /** Position of a value in the domain, 0…1 (through `mid` for a scale with a middle). */\n const position = (v: number) => {\n const { mid } = options\n let t: number\n if (mid !== undefined && options.colors && lo < mid && mid < hi) {\n t = v <= mid ? ((v - lo) / (mid - lo)) * 0.5 : 0.5 + ((v - mid) / (hi - mid)) * 0.5\n } else {\n t = hi > lo ? (v - lo) / (hi - lo) : v > lo ? 1 : 0\n }\n return Math.min(1, Math.max(0, t))\n }\n const share = (v: number) => FLOOR + (1 - FLOOR) * position(v)\n\n const ranges = options.ranges?.length ? options.ranges : undefined\n const stops = !ranges && options.colors && options.colors.length >= 2 ? options.colors : undefined\n const bySeries = !ranges && !stops && options.colorBy === 'series'\n // Rows hidden from the legend (rows are legend entries when colored by series).\n const rows = bySeries\n ? options.data.series.filter((s) => !ctx.hidden.has(seriesKey(s)))\n : options.data.series\n const slot = (row: Series) => options.data.series.indexOf(row)\n\n /** How the cell of `row` with value `v` is painted in the active color mode. */\n const paint = (v: number, row: Series): Paint => {\n if (ranges) {\n const index = rangeOf(ranges, v)\n const range = ranges[index]\n if (!range || ctx.hidden.has(rangeKey(range, index))) return { color: EMPTY, empty: true }\n return { style: { '--tc-cell-fill': range.color }, color: range.color }\n }\n if (stops) {\n const at = position(v) * (stops.length - 1)\n const k = Math.min(stops.length - 2, Math.floor(at))\n const u = round((at - k) * 100)\n const from = stops[k] as string\n const color =\n u <= 0\n ? from\n : u >= 100\n ? (stops[k + 1] as string)\n : `color-mix(in oklab,${stops[k + 1]} ${u}%,${from})`\n return { style: { '--tc-cell-fill': color }, color }\n }\n const pct = share(v)\n return {\n style: `--tc-heat:${round(pct * 100)}%`,\n color: bySeries ? shade(pct, slotColor(row, slot(row))) : shade(pct),\n }\n }\n\n // Margins for the labels, then one band per column and per row.\n const { rtl } = ctx\n const showX = options.x?.show !== false && labels.length > 0\n const showY = options.y?.show !== false && rows.length > 0\n const rowTicks = rows.map((s, i) => ({ value: i, position: 0, label: s.name }))\n const left = showY ? axisSize('left', rowTicks, fontSize) : 0\n const bottom = showX ? axisSize('bottom', [{ value: 0, position: 0, label: 'M' }], fontSize) : 0\n // The last column label is centered on its column: what is wider than half a\n // column needs room on the right.\n const lastLabel = showX\n ? estimateTextWidth(\n formatLabel(labels[labels.length - 1] as Label, labels.length - 1),\n fontSize,\n )\n : 0\n const { area, side, range } = plotFrame(ctx, options.padding, (pad) => {\n const halfColumn = (width - pad.start - pad.end - left) / Math.max(1, labels.length) / 2\n return {\n top: pad.top,\n bottom: pad.bottom + bottom,\n start: pad.start + left,\n end: pad.end + Math.max(0, Math.ceil(lastLabel / 2 - halfColumn)),\n }\n })\n const x = band(\n labels.map((_, i) => i),\n range(),\n )\n const y = band(\n rows.map((_, i) => i),\n [area.y, area.y + area.height],\n )\n const cellW = Math.max(0, x.bandwidth - gap)\n const cellH = Math.max(0, y.bandwidth - gap)\n const cellX = (i: number) => x.at(i) + gap / 2\n const cellY = (j: number) => y.at(j) + gap / 2\n const valueAt = (i: number, j: number) => {\n const v = rows[j]?.values[i]\n return v != null && Number.isFinite(v) ? v : null\n }\n\n // One hit per column; every row is an item, the hovered row is active.\n const hitAt = (i: number, row = 0): Hit | null => {\n if (i < 0 || i >= labels.length || rows.length === 0) return null\n const j = Math.max(0, Math.min(rows.length - 1, row))\n const items: HitItem[] = rows.map((s, r) => {\n const v = valueAt(i, r)\n const range = ranges && v !== null ? ranges[rangeOf(ranges, v)] : undefined\n return {\n name: s.name,\n seriesIndex: r,\n value: v,\n // With ranges, the band's name says what the value means.\n text: v === null ? '–' : range?.name ? `${value(v)} · ${range.name}` : value(v),\n x: cellX(i) + cellW / 2,\n y: cellY(r) + cellH / 2,\n box: { x: cellX(i), y: cellY(r), width: cellW, height: cellH },\n color: v === null ? 'var(--tc-grid-color)' : paint(v, s).color,\n }\n })\n return {\n index: i,\n label: labelKey(labels[i] as Label),\n title: formatLabel(labels[i] as Label, i),\n x: cellX(i) + cellW / 2,\n area,\n items,\n seriesIndex: j,\n // A ring just outside the hovered cell.\n highlight: {\n kind: 'halo',\n d: rectPath(cellX(i) - 2, cellY(j) - 2, cellW + 4, cellH + 4, radius + 2),\n },\n }\n }\n\n const interaction: Interaction = {\n count: labels.length,\n reversed: rtl === true,\n hitIndex: (i, row) => hitAt(i, row),\n hitTest(px, py) {\n if (px < area.x || px > area.x + area.width || py < area.y || py > area.y + area.height) {\n return null\n }\n const column = Math.min(labels.length - 1, Math.floor((px - area.x) / (x.step || 1)))\n const i = rtl ? labels.length - 1 - column : column\n const j = Math.min(rows.length - 1, Math.floor((py - area.y) / (y.step || 1)))\n return hitAt(i, j)\n },\n }\n\n const cells = rows.map((s, j) =>\n h(\n 'g',\n {\n key: seriesKey(s),\n // Colored by series, a row takes its palette slot like any series.\n class: ['tc-heatmap-row', bySeries && ['tc-series', `tc-series-${slot(s) + 1}`]],\n 'data-series': s.name,\n style: bySeries ? { '--tc-series-color': s.color } : undefined,\n },\n labels.map((label, i) => {\n const v = valueAt(i, j)\n const painted = v === null ? undefined : paint(v, s)\n return h('rect', {\n key: labelKey(label),\n class: ['tc-cell', (v === null || painted?.empty) && 'tc-cell-empty'],\n x: round(cellX(i)),\n y: round(cellY(j)),\n width: round(cellW),\n height: round(cellH),\n rx: round(Math.min(radius, cellW / 2, cellH / 2)),\n style: painted?.style,\n })\n }),\n ),\n )\n\n const xTicks = showX\n ? thinTicks(\n bandTicks(x, (_, i) => formatLabel(labels[i] as Label, i)),\n 'bottom',\n fontSize,\n )\n : []\n const yTicks = showY ? bandTicks(y, (_, j) => rows[j]?.name ?? '') : []\n\n const content = [\n h('g', { class: 'tc-heatmap-cells' }, cells),\n showX && axis({ position: 'bottom', ticks: xTicks, area }),\n showY && axis({ position: side, ticks: yTicks, area }),\n ]\n return { content, interaction }\n}\n\n/** Legend: the ranges, or the rows when colored by series; none for a single scale. */\nfunction heatmapLegend(options: HeatmapOptions): LegendItem[] {\n const { ranges } = options\n if (ranges?.length) {\n // The legend is asked with the whole config, so the names follow its locale.\n const value = formatNumber(options.format, (options as { locale?: Locale }).locale)\n return ranges.map((range, index) => ({\n key: rangeKey(range, index),\n name:\n range.name ??\n (range.from === undefined\n ? `< ${value(range.to ?? 0)}`\n : range.to === undefined\n ? `≥ ${value(range.from)}`\n : `${value(range.from)}–${value(range.to)}`),\n index,\n color: range.color,\n }))\n }\n if (options.colors && options.colors.length >= 2) return []\n return options.colorBy === 'series' ? seriesLegend(options.data) : []\n}\n\n/**\n * Heatmap: a grid of cells, one row per series and one column per label,\n * shaded from light to the full color by value (a single hue, so it reads\n * as magnitude). Set the hue with `--tc-heat-color`, or color the cells by\n * `ranges` of values, a `colors` scale (with a `mid` for diverging data),\n * or one palette color per row with `colorBy: 'series'`.\n *\n * ```ts\n * new Chart('#el', {\n * type: heatmap,\n * data: { labels: ['W1', 'W2', 'W3'], series: [{ name: 'Mon', values: [2, 4, 0] }] },\n * })\n * ```\n */\nexport const heatmap: ChartType<HeatmapOptions> = {\n name: 'heatmap',\n clean: cleanData(cleanSeries),\n render: renderHeatmap,\n legend: heatmapLegend,\n valueLabels: { marks: 'cell', format: (options) => options.format },\n // Cells are formatted as in the tooltip: `format` is the value format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CACR,aAAa;EAAE,OAAO;EAAQ,SAAS,YAAY,QAAQ;CAAO;CAElE,QAAQ,SAAS,KAAK,UACpB,YACE;EAAE,MAAM,QAAQ;EAAM,GAAI,QAAQ,IAAI,EAAE,GAAG,QAAQ,EAAE,IAAI,CAAC;EAAI,GAAG,EAAE,QAAQ,QAAQ,OAAO;CAAE,GAC5F,KACA,KACF;AACJ"}
|
|
1
|
+
{"version":3,"file":"heatmap-J7fxG7MM.js","names":[],"sources":["../src/charts/heatmap.ts"],"sourcesContent":["import type { ChartType, LegendItem, RenderContext } from '../chart.ts'\nimport { axis, axisSize, bandTicks, thinTicks } from '../components/axis.ts'\nimport { formatNumber, type Locale, type NumberFormat } from '../format.ts'\nimport type { Hit, HitItem, Interaction } from '../interaction.ts'\nimport { estimateTextWidth, type InsetsInput, plotFrame, round } from '../layout.ts'\nimport { band } from '../scales/band.ts'\nimport { extent } from '../scales/extent.ts'\nimport { rectPath } from '../shapes/rect.ts'\nimport { h, type StyleValue } from '../vnode.ts'\nimport {\n type CartesianData,\n type Label,\n labelKey,\n resolveLabels,\n type Series,\n seriesKey,\n seriesLegend,\n seriesTable,\n} from './cartesian.ts'\nimport { cleanData, cleanSeries } from './clean.ts'\n\n/** A band of values drawn in one color, with its own legend entry. */\nexport interface HeatmapRange {\n /** Lowest value in the band (inclusive). Leave it out for \"everything below `to`\". */\n from?: number\n /** Value where the band ends (exclusive). Leave it out on the last band. */\n to?: number\n /**\n * Any CSS color, including `var(--tc-color-3)`.\n * Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.\n */\n color: string\n /** Legend and tooltip name, e.g. `'High'`. Defaults to the range, e.g. `10–30`. */\n name?: string\n}\n\nexport interface HeatmapOptions {\n /** Columns are the labels, rows are the series (first series on top). */\n data: CartesianData\n /** Value shown with the lightest shade (or the first color). Defaults to the smaller of `0` and the data minimum. */\n min?: number\n /** Value shown with the full color (or the last color). Defaults to the data maximum. */\n max?: number\n /**\n * Discrete bands of values, each in its own color and legend entry (which\n * also hides the band's cells). Takes precedence over `colors` and `colorBy`.\n */\n ranges?: readonly HeatmapRange[]\n /**\n * A continuous scale through two or more colors (any CSS color, including\n * `var(--tc-…)`), from `min` to `max`. For values around a reference\n * point, use two hues with a neutral middle, e.g.\n * `['var(--tc-color-1)', 'var(--tc-grid-color)', 'var(--tc-color-8)']`.\n * Values that could inject CSS are ignored, as for series colors.\n */\n colors?: readonly string[]\n /** Value placed on the middle color of `colors` (e.g. `0` for changes). Defaults to halfway. */\n mid?: number\n /**\n * `'series'` shades every row in its own palette color (with a legend of\n * the rows); `'value'` (the default) uses one hue, `--tc-heat-color`.\n */\n colorBy?: 'value' | 'series'\n /** Space between cells in pixels, drawn as surface. Defaults to `2`. */\n gap?: number\n /** Corner radius of the cells. Defaults to `3`. */\n radius?: number\n /** Format of the values (tooltip, table). */\n format?: NumberFormat\n /** Column labels along the bottom. */\n x?: { show?: boolean; format?: (label: Label, index: number) => string }\n /** Row names on the left. */\n y?: { show?: boolean }\n /** Extra space around the grid, in pixels. */\n padding?: InsetsInput\n}\n\n/** Share of the full color at the minimum, so zero still reads as a value, not a gap. */\nconst FLOOR = 0.08\n\nconst EMPTY = 'var(--tc-heat-empty,var(--tc-grid-color))'\n\n/** Cell color at `share` (0…1) of the way from the empty shade to `color`. */\nconst shade = (share: number, color = 'var(--tc-heat-color,var(--tc-color-1))'): string =>\n `color-mix(in oklab,${color} ${round(share * 100)}%,${EMPTY})`\n\n/** Legend key of a range. */\nconst rangeKey = (range: HeatmapRange, index: number): string => range.name ?? `range-${index + 1}`\n\n/** The first range containing `v` (`from` inclusive, `to` exclusive). */\nconst rangeOf = (ranges: readonly HeatmapRange[], v: number): number =>\n ranges.findIndex((r) => (r.from === undefined || v >= r.from) && (r.to === undefined || v < r.to))\n\n/** Color of a palette slot by series index, as the CSS classes would pick it. */\nconst slotColor = (series: Series, index: number): string =>\n series.color ?? (index < 8 ? `var(--tc-color-${index + 1})` : 'var(--tc-color-other)')\n\n/** How one cell is painted: inline style, the tooltip swatch, and whether it is drawn empty. */\ninterface Paint {\n style?: StyleValue\n color: string\n empty?: boolean\n}\n\nfunction renderHeatmap(options: HeatmapOptions, ctx: RenderContext) {\n const { width, fontSize, locale } = ctx\n const { gap = 2, radius = 3 } = options\n const labels = resolveLabels(options.data)\n const formatLabel = options.x?.format ?? ((label: Label) => String(label))\n const value = formatNumber(options.format, locale)\n\n // Color domain.\n const all = options.data.series.flatMap((s) => s.values)\n const [dataMin, dataMax] = extent(all) ?? [0, 1]\n const lo = options.min ?? Math.min(0, dataMin)\n const hi = options.max ?? dataMax\n /** Position of a value in the domain, 0…1 (through `mid` for a scale with a middle). */\n const position = (v: number) => {\n const { mid } = options\n let t: number\n if (mid !== undefined && options.colors && lo < mid && mid < hi) {\n t = v <= mid ? ((v - lo) / (mid - lo)) * 0.5 : 0.5 + ((v - mid) / (hi - mid)) * 0.5\n } else {\n t = hi > lo ? (v - lo) / (hi - lo) : v > lo ? 1 : 0\n }\n return Math.min(1, Math.max(0, t))\n }\n const share = (v: number) => FLOOR + (1 - FLOOR) * position(v)\n\n const ranges = options.ranges?.length ? options.ranges : undefined\n const stops = !ranges && options.colors && options.colors.length >= 2 ? options.colors : undefined\n const bySeries = !ranges && !stops && options.colorBy === 'series'\n // Rows hidden from the legend (rows are legend entries when colored by series).\n const rows = bySeries\n ? options.data.series.filter((s) => !ctx.hidden.has(seriesKey(s)))\n : options.data.series\n const slot = (row: Series) => options.data.series.indexOf(row)\n\n /** How the cell of `row` with value `v` is painted in the active color mode. */\n const paint = (v: number, row: Series): Paint => {\n if (ranges) {\n const index = rangeOf(ranges, v)\n const range = ranges[index]\n if (!range || ctx.hidden.has(rangeKey(range, index))) return { color: EMPTY, empty: true }\n return { style: { '--tc-cell-fill': range.color }, color: range.color }\n }\n if (stops) {\n const at = position(v) * (stops.length - 1)\n const k = Math.min(stops.length - 2, Math.floor(at))\n const u = round((at - k) * 100)\n const from = stops[k] as string\n const color =\n u <= 0\n ? from\n : u >= 100\n ? (stops[k + 1] as string)\n : `color-mix(in oklab,${stops[k + 1]} ${u}%,${from})`\n return { style: { '--tc-cell-fill': color }, color }\n }\n const pct = share(v)\n return {\n style: `--tc-heat:${round(pct * 100)}%`,\n color: bySeries ? shade(pct, slotColor(row, slot(row))) : shade(pct),\n }\n }\n\n // Margins for the labels, then one band per column and per row.\n const { rtl } = ctx\n const showX = options.x?.show !== false && labels.length > 0\n const showY = options.y?.show !== false && rows.length > 0\n const rowTicks = rows.map((s, i) => ({ value: i, position: 0, label: s.name }))\n const left = showY ? axisSize('left', rowTicks, fontSize) : 0\n const bottom = showX ? axisSize('bottom', [{ value: 0, position: 0, label: 'M' }], fontSize) : 0\n // The last column label is centered on its column: what is wider than half a\n // column needs room on the right.\n const lastLabel = showX\n ? estimateTextWidth(\n formatLabel(labels[labels.length - 1] as Label, labels.length - 1),\n fontSize,\n )\n : 0\n const { area, side, range } = plotFrame(ctx, options.padding, (pad) => {\n const halfColumn = (width - pad.start - pad.end - left) / Math.max(1, labels.length) / 2\n return {\n top: pad.top,\n bottom: pad.bottom + bottom,\n start: pad.start + left,\n end: pad.end + Math.max(0, Math.ceil(lastLabel / 2 - halfColumn)),\n }\n })\n const x = band(\n labels.map((_, i) => i),\n range(),\n )\n const y = band(\n rows.map((_, i) => i),\n [area.y, area.y + area.height],\n )\n const cellW = Math.max(0, x.bandwidth - gap)\n const cellH = Math.max(0, y.bandwidth - gap)\n const cellX = (i: number) => x.at(i) + gap / 2\n const cellY = (j: number) => y.at(j) + gap / 2\n const valueAt = (i: number, j: number) => {\n const v = rows[j]?.values[i]\n return v != null && Number.isFinite(v) ? v : null\n }\n\n // One hit per column; every row is an item, the hovered row is active.\n const hitAt = (i: number, row = 0): Hit | null => {\n if (i < 0 || i >= labels.length || rows.length === 0) return null\n const j = Math.max(0, Math.min(rows.length - 1, row))\n const items: HitItem[] = rows.map((s, r) => {\n const v = valueAt(i, r)\n const range = ranges && v !== null ? ranges[rangeOf(ranges, v)] : undefined\n return {\n name: s.name,\n seriesIndex: r,\n value: v,\n // With ranges, the band's name says what the value means.\n text: v === null ? '–' : range?.name ? `${value(v)} · ${range.name}` : value(v),\n x: cellX(i) + cellW / 2,\n y: cellY(r) + cellH / 2,\n box: { x: cellX(i), y: cellY(r), width: cellW, height: cellH },\n color: v === null ? 'var(--tc-grid-color)' : paint(v, s).color,\n }\n })\n return {\n index: i,\n label: labelKey(labels[i] as Label),\n title: formatLabel(labels[i] as Label, i),\n x: cellX(i) + cellW / 2,\n area,\n items,\n seriesIndex: j,\n // A ring just outside the hovered cell.\n highlight: {\n kind: 'halo',\n d: rectPath(cellX(i) - 2, cellY(j) - 2, cellW + 4, cellH + 4, radius + 2),\n },\n }\n }\n\n const interaction: Interaction = {\n count: labels.length,\n reversed: rtl === true,\n hitIndex: (i, row) => hitAt(i, row),\n hitTest(px, py) {\n if (px < area.x || px > area.x + area.width || py < area.y || py > area.y + area.height) {\n return null\n }\n const column = Math.min(labels.length - 1, Math.floor((px - area.x) / (x.step || 1)))\n const i = rtl ? labels.length - 1 - column : column\n const j = Math.min(rows.length - 1, Math.floor((py - area.y) / (y.step || 1)))\n return hitAt(i, j)\n },\n }\n\n const cells = rows.map((s, j) =>\n h(\n 'g',\n {\n key: seriesKey(s),\n // Colored by series, a row takes its palette slot like any series.\n class: ['tc-heatmap-row', bySeries && ['tc-series', `tc-series-${slot(s) + 1}`]],\n 'data-series': s.name,\n style: bySeries ? { '--tc-series-color': s.color } : undefined,\n },\n labels.map((label, i) => {\n const v = valueAt(i, j)\n const painted = v === null ? undefined : paint(v, s)\n return h('rect', {\n key: labelKey(label),\n class: ['tc-cell', (v === null || painted?.empty) && 'tc-cell-empty'],\n x: round(cellX(i)),\n y: round(cellY(j)),\n width: round(cellW),\n height: round(cellH),\n rx: round(Math.min(radius, cellW / 2, cellH / 2)),\n style: painted?.style,\n })\n }),\n ),\n )\n\n const xTicks = showX\n ? thinTicks(\n bandTicks(x, (_, i) => formatLabel(labels[i] as Label, i)),\n 'bottom',\n fontSize,\n )\n : []\n const yTicks = showY ? bandTicks(y, (_, j) => rows[j]?.name ?? '') : []\n\n const content = [\n h('g', { class: 'tc-heatmap-cells' }, cells),\n showX && axis({ position: 'bottom', ticks: xTicks, area }),\n showY && axis({ position: side, ticks: yTicks, area }),\n ]\n return { content, interaction }\n}\n\n/** Legend: the ranges, or the rows when colored by series; none for a single scale. */\nfunction heatmapLegend(options: HeatmapOptions): LegendItem[] {\n const { ranges } = options\n if (ranges?.length) {\n // The legend is asked with the whole config, so the names follow its locale.\n const value = formatNumber(options.format, (options as { locale?: Locale }).locale)\n return ranges.map((range, index) => ({\n key: rangeKey(range, index),\n name:\n range.name ??\n (range.from === undefined\n ? `< ${value(range.to ?? 0)}`\n : range.to === undefined\n ? `≥ ${value(range.from)}`\n : `${value(range.from)}–${value(range.to)}`),\n index,\n color: range.color,\n }))\n }\n if (options.colors && options.colors.length >= 2) return []\n return options.colorBy === 'series' ? seriesLegend(options.data) : []\n}\n\n/**\n * Heatmap: a grid of cells, one row per series and one column per label,\n * shaded from light to the full color by value (a single hue, so it reads\n * as magnitude). Set the hue with `--tc-heat-color`, or color the cells by\n * `ranges` of values, a `colors` scale (with a `mid` for diverging data),\n * or one palette color per row with `colorBy: 'series'`.\n *\n * ```ts\n * new Chart('#el', {\n * type: heatmap,\n * data: { labels: ['W1', 'W2', 'W3'], series: [{ name: 'Mon', values: [2, 4, 0] }] },\n * })\n * ```\n */\nexport const heatmap: ChartType<HeatmapOptions> = {\n name: 'heatmap',\n clean: cleanData(cleanSeries),\n render: renderHeatmap,\n legend: heatmapLegend,\n valueLabels: { marks: 'cell', format: (options) => options.format },\n // Cells are formatted as in the tooltip: `format` is the value format here, not `y.format`.\n table: (options, ctx, limit) =>\n seriesTable(\n { data: options.data, ...(options.x ? { x: options.x } : {}), y: { format: options.format } },\n ctx,\n limit,\n ),\n}\n"],"mappings":";;;;;;;;;;AA8EA,MAAM,QAAQ;AAEd,MAAM,QAAQ;;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C;EAAI,GAAG,EAAE,QAAQ,QAAQ,OAAO;CAAE,GAC5F,KACA,KACF;AACJ"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _t as Label, mt as CartesianData, o as ChartType } from "./chart-Dz4geQZy.cjs";
|
|
2
2
|
import { c as NumberFormat } from "./time-B4oxWHQI.cjs";
|
|
3
|
-
import {
|
|
3
|
+
import { n as InsetsInput } from "./layout-CYerDebD.cjs";
|
|
4
4
|
/** A band of values drawn in one color, with its own legend entry. */
|
|
5
5
|
interface HeatmapRange {
|
|
6
6
|
/** Lowest value in the band (inclusive). Leave it out for "everything below `to`". */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as ChartType, pt as Label, ut as CartesianData } from "./chart-CE9EVbfV.js";
|
|
2
2
|
import { c as NumberFormat } from "./time-DRIDgv2a.js";
|
|
3
|
-
import {
|
|
3
|
+
import { n as InsetsInput } from "./layout-CYerDebD.js";
|
|
4
4
|
/** A band of values drawn in one color, with its own legend entry. */
|
|
5
5
|
interface HeatmapRange {
|
|
6
6
|
/** Lowest value in the band (inclusive). Leave it out for "everything below `to`". */
|
package/dist/heatmap.cjs
CHANGED
package/dist/heatmap.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Standalone entry: `import { heatmap } from '@tabler/charts/heatmap'`. */
|
|
2
|
-
import { n as HeatmapRange, r as heatmap, t as HeatmapOptions } from "./heatmap-
|
|
2
|
+
import { n as HeatmapRange, r as heatmap, t as HeatmapOptions } from "./heatmap-Jvwo7iFW.cjs";
|
|
3
3
|
export { type HeatmapOptions, type HeatmapRange, heatmap };
|
package/dist/heatmap.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Standalone entry: `import { heatmap } from '@tabler/charts/heatmap'`. */
|
|
2
|
-
import { n as HeatmapRange, r as heatmap, t as HeatmapOptions } from "./heatmap-
|
|
2
|
+
import { n as HeatmapRange, r as heatmap, t as HeatmapOptions } from "./heatmap-mFCnP6aB.js";
|
|
3
3
|
export { type HeatmapOptions, type HeatmapRange, heatmap };
|
package/dist/heatmap.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as heatmap } from "./heatmap-
|
|
1
|
+
export { t as heatmap } from "./heatmap-J7fxG7MM.js";
|
package/dist/index.cjs
CHANGED
|
@@ -2,44 +2,47 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_layout = require("./layout-Cfg9x1k2.cjs");
|
|
3
3
|
const require_vnode = require("./vnode-ClAiw28x.cjs");
|
|
4
4
|
const require_format = require("./format-CAE5ruy6.cjs");
|
|
5
|
-
const require_axis = require("./axis-
|
|
6
|
-
const require_cartesian = require("./cartesian-
|
|
7
|
-
const require_annotations = require("./annotations-
|
|
5
|
+
const require_axis = require("./axis-BzBkkC5X.cjs");
|
|
6
|
+
const require_cartesian = require("./cartesian-B9CrasFJ.cjs");
|
|
7
|
+
const require_annotations = require("./annotations--m-HzMBM.cjs");
|
|
8
8
|
const require_extent = require("./extent-DuYDcvM9.cjs");
|
|
9
|
-
const require_dates = require("./dates-
|
|
9
|
+
const require_dates = require("./dates-0YNY49KQ.cjs");
|
|
10
|
+
const require_end_labels = require("./end-labels-CS-fnpp-.cjs");
|
|
10
11
|
const require_log_axis = require("./log-axis-DdRNyAq8.cjs");
|
|
11
|
-
const require_patterns = require("./patterns-
|
|
12
|
+
const require_patterns = require("./patterns-BPN1c9qe.cjs");
|
|
12
13
|
const require_point_shapes = require("./point-shapes-BRawRM78.cjs");
|
|
13
14
|
const require_dom = require("./dom-C33zvtPo.cjs");
|
|
14
|
-
const
|
|
15
|
-
const
|
|
15
|
+
const require_slice_labels = require("./slice-labels-CbFiy46l.cjs");
|
|
16
|
+
const require_time_axis = require("./time-axis-CVKjQKSS.cjs");
|
|
17
|
+
const require_value_labels = require("./value-labels-Dcyk3GIY.cjs");
|
|
16
18
|
const require_features = require("./features-DEDP5CEQ.cjs");
|
|
17
19
|
const require_hydrate = require("./hydrate-m0I5m6ue.cjs");
|
|
18
20
|
const require_morph = require("./morph-3I1Nf_tR.cjs");
|
|
19
21
|
const require_decimate = require("./decimate-BS3x8g-f.cjs");
|
|
20
22
|
const require_fade = require("./fade-CRqcKMWY.cjs");
|
|
21
|
-
const require_chart = require("./chart-
|
|
22
|
-
const require_core = require("./core-
|
|
23
|
-
const require_area = require("./area-
|
|
24
|
-
const require_bar = require("./bar-
|
|
23
|
+
const require_chart = require("./chart-GUmmjJ7S.cjs");
|
|
24
|
+
const require_core = require("./core-BZTrsPxc.cjs");
|
|
25
|
+
const require_area = require("./area-D_N8b4Ng.cjs");
|
|
26
|
+
const require_bar = require("./bar-BrmfXugT.cjs");
|
|
25
27
|
const require_bar$1 = require("./bar-wVykm1us.cjs");
|
|
26
|
-
const require_calendar = require("./calendar-
|
|
27
|
-
const require_candlestick = require("./candlestick-
|
|
28
|
+
const require_calendar = require("./calendar-BG_q_NC_.cjs");
|
|
29
|
+
const require_candlestick = require("./candlestick-BwrFKak_.cjs");
|
|
28
30
|
const require_funnel = require("./funnel-CFEEulw_.cjs");
|
|
29
31
|
const require_gauge = require("./gauge-6HfDcLMJ.cjs");
|
|
30
32
|
const require_arc = require("./arc-CYhI62kO.cjs");
|
|
31
|
-
const require_heatmap = require("./heatmap-
|
|
32
|
-
const require_line = require("./line-
|
|
33
|
-
const require_map = require("./map-
|
|
33
|
+
const require_heatmap = require("./heatmap-Dyzrd4Fd.cjs");
|
|
34
|
+
const require_line = require("./line-DHbYCQy4.cjs");
|
|
35
|
+
const require_map = require("./map-ChwSgooH.cjs");
|
|
34
36
|
const require_parliament = require("./parliament-DhxAaIZ3.cjs");
|
|
35
37
|
const require_percentage_bar = require("./percentage-bar-BChkTRoz.cjs");
|
|
36
|
-
const require_pie = require("./pie-
|
|
37
|
-
const require_radar = require("./radar-
|
|
38
|
+
const require_pie = require("./pie-Cll1OrVZ.cjs");
|
|
39
|
+
const require_radar = require("./radar-wDyX17S3.cjs");
|
|
40
|
+
const require_range_bar = require("./range-bar-BnKjJP89.cjs");
|
|
38
41
|
const require_sankey = require("./sankey-0CSp_Er9.cjs");
|
|
39
|
-
const require_scatter = require("./scatter-
|
|
40
|
-
const require_sparkline = require("./sparkline-
|
|
41
|
-
const require_treemap = require("./treemap-
|
|
42
|
-
const require_export_chart = require("./export-chart-
|
|
42
|
+
const require_scatter = require("./scatter-CZ8do3Up.cjs");
|
|
43
|
+
const require_sparkline = require("./sparkline-DjR-V6BI.cjs");
|
|
44
|
+
const require_treemap = require("./treemap-PulGXZv0.cjs");
|
|
45
|
+
const require_export_chart = require("./export-chart-Be4T9J3m.cjs");
|
|
43
46
|
// src/chart-default.ts
|
|
44
47
|
/**
|
|
45
48
|
* A chart with every built-in plugin installed: hover highlight, legend,
|
|
@@ -80,16 +83,18 @@ const types = {
|
|
|
80
83
|
parliament: require_parliament.parliament,
|
|
81
84
|
treemap: require_treemap.treemap,
|
|
82
85
|
"percentage-bar": require_percentage_bar.percentageBar,
|
|
83
|
-
funnel: require_funnel.funnel
|
|
86
|
+
funnel: require_funnel.funnel,
|
|
87
|
+
"range-bar": require_range_bar.rangeBar
|
|
84
88
|
};
|
|
85
89
|
// src/index.ts
|
|
86
90
|
/**
|
|
87
91
|
* `@tabler/charts`: everything from `@tabler/charts/core`, with a `Chart`
|
|
88
92
|
* that installs the built-in plugins (tooltip, legend, keyboard, …) and
|
|
89
93
|
* every optional feature registered (time and log axes, decimation,
|
|
90
|
-
* annotations, pattern fills, value labels, point shapes). The
|
|
91
|
-
*
|
|
92
|
-
* so charts that never offer a
|
|
94
|
+
* annotations, pattern fills, value labels, end labels, slice labels, point shapes). The exceptions
|
|
95
|
+
* are the `download` menu's saver and zoom: `import '@tabler/charts/export'`
|
|
96
|
+
* and `import '@tabler/charts/zoom'` add them, so charts that never offer a
|
|
97
|
+
* download or a zoom do not carry their code.
|
|
93
98
|
*/
|
|
94
99
|
require_features.register({
|
|
95
100
|
time: {
|
|
@@ -112,6 +117,8 @@ require_features.register({
|
|
|
112
117
|
layers: require_annotations.annotationLayers,
|
|
113
118
|
values: require_annotations.annotationValues
|
|
114
119
|
},
|
|
120
|
+
"end-labels": require_end_labels.endLabels,
|
|
121
|
+
"slice-labels": require_slice_labels.sliceLabels,
|
|
115
122
|
patterns: require_patterns.patternFills,
|
|
116
123
|
"point-shapes": require_point_shapes.markerPath,
|
|
117
124
|
swatch: require_point_shapes.markerClip,
|
|
@@ -153,6 +160,7 @@ exports.downloadChart = require_export_chart.downloadChart;
|
|
|
153
160
|
exports.escapeAttr = require_chart.escapeAttr;
|
|
154
161
|
exports.escapeText = require_chart.escapeText;
|
|
155
162
|
exports.estimateTextWidth = require_layout.estimateTextWidth;
|
|
163
|
+
exports.exportCSV = require_export_chart.exportCSV;
|
|
156
164
|
exports.exportImage = require_export_chart.exportImage;
|
|
157
165
|
exports.exportSVG = require_export_chart.exportSVG;
|
|
158
166
|
exports.extent = require_extent.extent;
|
|
@@ -175,6 +183,7 @@ exports.highlight = require_core.highlight;
|
|
|
175
183
|
exports.hitAnchor = require_core.hitAnchor;
|
|
176
184
|
exports.hoverOverlay = require_core.hoverOverlay;
|
|
177
185
|
exports.hoverUnderlay = require_core.hoverUnderlay;
|
|
186
|
+
exports.hoverValue = require_core.hoverValue;
|
|
178
187
|
exports.innerRect = require_layout.innerRect;
|
|
179
188
|
exports.insets = require_layout.insets;
|
|
180
189
|
exports.keyboard = require_core.keyboard;
|
|
@@ -199,6 +208,7 @@ exports.placeTooltip = require_core.placeTooltip;
|
|
|
199
208
|
exports.point = require_cartesian.point;
|
|
200
209
|
exports.pointer = require_core.pointer;
|
|
201
210
|
exports.radar = require_radar.radar;
|
|
211
|
+
exports.rangeBar = require_range_bar.rangeBar;
|
|
202
212
|
exports.register = require_features.register;
|
|
203
213
|
exports.render = require_dom.render;
|
|
204
214
|
exports.renderChart = require_chart.renderChart;
|
|
@@ -226,5 +236,6 @@ exports.tooltip = require_core.tooltip;
|
|
|
226
236
|
exports.tooltipContent = require_core.tooltipContent;
|
|
227
237
|
exports.treemap = require_treemap.treemap;
|
|
228
238
|
exports.types = types;
|
|
239
|
+
exports.zoom = require_core.zoom;
|
|
229
240
|
|
|
230
241
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["CoreChart","defaultPlugins","line","area","bar","pie","donut","scatter","sparkline","gauge","heatmap","calendar","map","candlestick","radar","sankey","parliament","treemap","percentageBar","funnel","register","time","timePointScale","timeAxis","dateLabels","log","logDomain","logTicks","lttbIndices","linePath","areaPath","annotationLayers","annotationValues","patternFills","markerPath","markerClip","hydrate","morph","addPost","labelsStep"],"sources":["../src/chart-default.ts","../src/chart-types.ts","../src/index.ts"],"sourcesContent":["import { type ChartConfig, Chart as CoreChart } from './chart.ts'\nimport { defaultPlugins } from './plugins/index.ts'\n\n/**\n * A chart with every built-in plugin installed: hover highlight, legend,\n * tooltip, data table and keyboard navigation. Each can be switched off in\n * the config (`tooltip: false`, …). For the smallest bundle, use the bare\n * `Chart` from `@tabler/charts/core` and pick plugins explicitly.\n *\n * ```ts\n * const chart = new Chart('#sales', { type: line, data })\n * ```\n */\nexport class Chart<O extends object = object> extends CoreChart<O> {\n constructor(target: HTMLElement | string, config: ChartConfig<O>) {\n super(target, config, defaultPlugins())\n }\n}\n","import type { ChartType } from './chart.ts'\nimport { area } from './charts/area.ts'\nimport { bar } from './charts/bar.ts'\nimport { calendar } from './charts/calendar.ts'\nimport { candlestick } from './charts/candlestick.ts'\nimport { funnel } from './charts/funnel.ts'\nimport { gauge } from './charts/gauge.ts'\nimport { heatmap } from './charts/heatmap.ts'\nimport { line } from './charts/line.ts'\nimport { map } from './charts/map.ts'\nimport { parliament } from './charts/parliament.ts'\nimport { percentageBar } from './charts/percentage-bar.ts'\nimport { donut, pie } from './charts/pie.ts'\nimport { radar } from './charts/radar.ts'\nimport { sankey } from './charts/sankey.ts'\nimport { scatter } from './charts/scatter.ts'\nimport { sparkline } from './charts/sparkline.ts'\nimport { treemap } from './charts/treemap.ts'\n\n/**\n * Every built-in chart type by its name, for charts declared in markup\n * (`<tabler-chart type=\"line\">`, `data-tc-chart=\"line\"`). Importing it\n * brings every type along: code that knows its types imports them directly.\n */\nexport const types: Readonly<Record<string, ChartType<never>>> = {\n line,\n area,\n bar,\n pie,\n donut,\n scatter,\n sparkline,\n gauge,\n heatmap,\n calendar,\n map,\n candlestick,\n radar,\n sankey,\n parliament,\n treemap,\n 'percentage-bar': percentageBar,\n funnel,\n} as Record<string, ChartType<never>>\n","/**\n * `@tabler/charts`: everything from `@tabler/charts/core`, with a `Chart`\n * that installs the built-in plugins (tooltip, legend, keyboard, …) and\n * every optional feature registered (time and log axes, decimation,\n * annotations, pattern fills, value labels, point shapes). The
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["CoreChart","defaultPlugins","line","area","bar","pie","donut","scatter","sparkline","gauge","heatmap","calendar","map","candlestick","radar","sankey","parliament","treemap","percentageBar","funnel","rangeBar","register","time","timePointScale","timeAxis","dateLabels","log","logDomain","logTicks","lttbIndices","linePath","areaPath","annotationLayers","annotationValues","endLabels","sliceLabels","patternFills","markerPath","markerClip","hydrate","morph","addPost","labelsStep"],"sources":["../src/chart-default.ts","../src/chart-types.ts","../src/index.ts"],"sourcesContent":["import { type ChartConfig, Chart as CoreChart } from './chart.ts'\nimport { defaultPlugins } from './plugins/index.ts'\n\n/**\n * A chart with every built-in plugin installed: hover highlight, legend,\n * tooltip, data table and keyboard navigation. Each can be switched off in\n * the config (`tooltip: false`, …). For the smallest bundle, use the bare\n * `Chart` from `@tabler/charts/core` and pick plugins explicitly.\n *\n * ```ts\n * const chart = new Chart('#sales', { type: line, data })\n * ```\n */\nexport class Chart<O extends object = object> extends CoreChart<O> {\n constructor(target: HTMLElement | string, config: ChartConfig<O>) {\n super(target, config, defaultPlugins())\n }\n}\n","import type { ChartType } from './chart.ts'\nimport { area } from './charts/area.ts'\nimport { bar } from './charts/bar.ts'\nimport { calendar } from './charts/calendar.ts'\nimport { candlestick } from './charts/candlestick.ts'\nimport { funnel } from './charts/funnel.ts'\nimport { gauge } from './charts/gauge.ts'\nimport { heatmap } from './charts/heatmap.ts'\nimport { line } from './charts/line.ts'\nimport { map } from './charts/map.ts'\nimport { parliament } from './charts/parliament.ts'\nimport { percentageBar } from './charts/percentage-bar.ts'\nimport { donut, pie } from './charts/pie.ts'\nimport { radar } from './charts/radar.ts'\nimport { rangeBar } from './charts/range-bar.ts'\nimport { sankey } from './charts/sankey.ts'\nimport { scatter } from './charts/scatter.ts'\nimport { sparkline } from './charts/sparkline.ts'\nimport { treemap } from './charts/treemap.ts'\n\n/**\n * Every built-in chart type by its name, for charts declared in markup\n * (`<tabler-chart type=\"line\">`, `data-tc-chart=\"line\"`). Importing it\n * brings every type along: code that knows its types imports them directly.\n */\nexport const types: Readonly<Record<string, ChartType<never>>> = {\n line,\n area,\n bar,\n pie,\n donut,\n scatter,\n sparkline,\n gauge,\n heatmap,\n calendar,\n map,\n candlestick,\n radar,\n sankey,\n parliament,\n treemap,\n 'percentage-bar': percentageBar,\n funnel,\n 'range-bar': rangeBar,\n} as Record<string, ChartType<never>>\n","/**\n * `@tabler/charts`: everything from `@tabler/charts/core`, with a `Chart`\n * that installs the built-in plugins (tooltip, legend, keyboard, …) and\n * every optional feature registered (time and log axes, decimation,\n * annotations, pattern fills, value labels, end labels, slice labels, point shapes). The exceptions\n * are the `download` menu's saver and zoom: `import '@tabler/charts/export'`\n * and `import '@tabler/charts/zoom'` add them, so charts that never offer a\n * download or a zoom do not carry their code.\n */\n\nimport { annotationLayers, annotationValues } from './charts/annotations.ts'\nimport { dateLabels } from './charts/dates.ts'\nimport { endLabels } from './charts/end-labels.ts'\nimport { logDomain, logTicks } from './charts/log-axis.ts'\nimport { patternFills } from './charts/patterns.ts'\nimport { markerClip, markerPath } from './charts/point-shapes.ts'\nimport { sliceLabels } from './charts/slice-labels.ts'\nimport { timeAxis } from './charts/time-axis.ts'\nimport { labelsStep } from './charts/value-labels.ts'\nimport { addPost, register } from './features.ts'\nimport { hydrate } from './render/hydrate.ts'\nimport { morph } from './render/morph.ts'\nimport { log } from './scales/log.ts'\nimport { time, timePointScale } from './scales/time.ts'\nimport { lttb, lttbIndices } from './shapes/decimate.ts'\nimport { areaPath, linePath } from './shapes/path.ts'\n\n// Registered here, in the entry itself, so no bundler can shake it away.\nregister({\n time: { scale: time, points: timePointScale, axis: timeAxis },\n dates: dateLabels,\n log: { scale: log, domain: logDomain, ticks: logTicks },\n decimate: lttbIndices,\n line: { linePath, areaPath },\n annotations: { layers: annotationLayers, values: annotationValues },\n 'end-labels': endLabels,\n 'slice-labels': sliceLabels,\n patterns: patternFills,\n 'point-shapes': markerPath,\n swatch: markerClip,\n hydrate,\n morph,\n})\n\n// The step that finishes the content: value labels over the marks.\naddPost(labelsStep)\n\nexport { Chart } from './chart-default.ts'\nexport { types } from './chart-types.ts'\nexport * from './core.ts'\nexport type {\n CSVOptions,\n DownloadOptions,\n ExportOptions,\n ExportTarget,\n ImageOptions,\n} from './export-chart.ts'\nexport { downloadChart, exportCSV, exportImage, exportSVG } from './export-chart.ts'\nexport type { LogScaleOptions } from './scales/log.ts'\nexport type { TimeScale, TimeScaleOptions, TimeValue } from './scales/time.ts'\nexport { log, lttb, lttbIndices, time, timePointScale }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,IAAa,QAAb,cAAsDA,cAAAA,MAAa;CACjE,YAAY,QAA8B,QAAwB;EAChE,MAAM,QAAQ,QAAQC,aAAAA,eAAe,CAAC;CACxC;AACF;;;;;;;ACQA,MAAa,QAAoD;CAC/DC,MAAAA,aAAAA;CACAC,MAAAA,aAAAA;CACAC,KAAAA,YAAAA;CACAC,KAAAA,YAAAA;CACAC,OAAAA,YAAAA;CACAC,SAAAA,gBAAAA;CACAC,WAAAA,kBAAAA;CACAC,OAAAA,cAAAA;CACAC,SAAAA,gBAAAA;CACAC,UAAAA,iBAAAA;CACAC,KAAAA,YAAAA;CACAC,aAAAA,oBAAAA;CACAC,OAAAA,cAAAA;CACAC,QAAAA,eAAAA;CACAC,YAAAA,mBAAAA;CACAC,SAAAA,gBAAAA;CACA,kBAAkBC,uBAAAA;CAClBC,QAAAA,eAAAA;CACA,aAAaC,kBAAAA;AACf;;;;;;;;;;;ACjBAC,iBAAAA,SAAS;CACP,MAAM;EAAE,OAAOC,kBAAAA;EAAM,QAAQC,kBAAAA;EAAgB,MAAMC,kBAAAA;CAAS;CAC5D,OAAOC,cAAAA;CACP,KAAK;EAAE,OAAOC,iBAAAA;EAAK,QAAQC,iBAAAA;EAAW,OAAOC,iBAAAA;CAAS;CACtD,UAAUC,iBAAAA;CACV,MAAM;EAAEC,UAAAA,aAAAA;EAAUC,UAAAA,aAAAA;CAAS;CAC3B,aAAa;EAAE,QAAQC,oBAAAA;EAAkB,QAAQC,oBAAAA;CAAiB;CAClE,cAAcC,mBAAAA;CACd,gBAAgBC,qBAAAA;CAChB,UAAUC,iBAAAA;CACV,gBAAgBC,qBAAAA;CAChB,QAAQC,qBAAAA;CACRC,SAAAA,gBAAAA;CACAC,OAAAA,cAAAA;AACF,CAAC;AAGDC,iBAAAA,QAAQC,qBAAAA,UAAU"}
|
package/dist/index.d.cts
CHANGED
|
@@ -3,27 +3,29 @@ import { a as timePointScale, c as NumberFormat, d as formatDetail, f as formatN
|
|
|
3
3
|
import { a as point, i as band, n as BandScale, r as BandScaleOptions, t as BandKey } from "./band-CNKvdnTC.cjs";
|
|
4
4
|
import { a as linePath, i as areaPath, n as PathOptions, r as Point, t as Curve } from "./path-YeUiOfG8.cjs";
|
|
5
5
|
import { n as lttbIndices, t as lttb } from "./decimate-BxxYBJJk.cjs";
|
|
6
|
-
import { a as
|
|
7
|
-
import { A as
|
|
6
|
+
import { a as estimateTextWidth, i as Rect, n as InsetsInput, o as innerRect, r as LINE_HEIGHT, s as insets, t as Insets } from "./layout-CYerDebD.cjs";
|
|
7
|
+
import { $ as exportCSV, A as DownloadOption, At as AxisOptions, B as arcCentroid, Bt as describeHit, C as TooltipOptions, Ct as seriesLegend, D as tooltipContent, E as placeTooltip, Et as ZoomOptions, F as Features, Ft as axisSize, G as ChartPlugin, Gt as HitItem, H as padAngleForGap, Ht as Highlight, I as feature, It as bandTicks, J as DownloadOptions, K as PluginInstance, Kt as HitTester, L as features, Lt as linearTicks, Mt as LinearTicksOptions, Nt as Tick, O as DownloadFormat, Pt as axis, Q as downloadChart, R as register, Rt as thinTicks, S as resolveSize, St as seriesKey, T as hitAnchor, Tt as ViewWindow, U as AfterRenderState, Ut as Hit, V as arcPathStable, Vt as tableContent, W as BeforeRenderState, Wt as HitCursor, X as ExportTarget, Y as ExportOptions, Z as ImageOptions, _ as chartModel, _t as Label, a as ChartEvents, b as renderContext, bt as categoryInteraction, c as CrosshairOptions, ct as LegendItem, d as ResolvedLegend, dt as legendContent, et as exportImage, f as Size, g as chartLabel, gt as CategoryAxisOptions, h as chartEvents, ht as CartesianOptions, i as ChartConfig, j as download, jt as AxisPosition, k as DownloadMenuOptions, l as RenderContext, lt as LegendOptions, m as buildChart, mt as CartesianData, n as BuiltChart, o as ChartType, p as TableContext, q as CSVOptions, qt as Interaction, r as Chart$1, s as ContextOptions, t as BaseOptions, tt as exportSVG, u as RenderResult, ut as defaultHidden, v as chartToString, vt as Series, w as TooltipPlacement, wt as seriesTable, x as resolveLegend, xt as domainOf, y as renderChart, yt as ValueAxisOptions, z as ArcOptions, zt as DataTable } from "./chart-Dz4geQZy.cjs";
|
|
8
8
|
import { a as ClassValue, c as StyleValue, d as normalizeClass, f as normalizeStyle, i as ChildInput, l as VNode, n as Attrs, o as Key, r as Child, s as Props, t as AttrValue, u as h } from "./vnode-Du2cC8Fm.cjs";
|
|
9
|
-
import {
|
|
10
|
-
import { n as
|
|
11
|
-
import { n as
|
|
12
|
-
import {
|
|
13
|
-
import { n as
|
|
14
|
-
import { n as
|
|
15
|
-
import { n as
|
|
16
|
-
import { n as
|
|
17
|
-
import {
|
|
18
|
-
import { n as
|
|
19
|
-
import { n as
|
|
20
|
-
import {
|
|
21
|
-
import { n as
|
|
22
|
-
import {
|
|
23
|
-
import { i as
|
|
24
|
-
import { n as
|
|
25
|
-
import { n as
|
|
26
|
-
import {
|
|
9
|
+
import { t as Annotation } from "./annotations-CqZM1z9R.cjs";
|
|
10
|
+
import { n as line, t as LineOptions } from "./line-Cu9ctpbv.cjs";
|
|
11
|
+
import { n as area, t as AreaOptions } from "./area-D6LNLk3r.cjs";
|
|
12
|
+
import { n as bar, t as BarOptions } from "./bar-CEt8YRxf.cjs";
|
|
13
|
+
import { a as calendar, i as CalendarSeries, n as CalendarEntry, r as CalendarOptions, t as CalendarData } from "./calendar-B7843sQu.cjs";
|
|
14
|
+
import { n as CandlestickOptions, r as candlestick, t as Candle } from "./candlestick-B7YXUVVh.cjs";
|
|
15
|
+
import { n as FunnelStage, r as funnel, t as FunnelOptions } from "./funnel-B9ridzNx.cjs";
|
|
16
|
+
import { n as GaugeRing, r as gauge, t as GaugeOptions } from "./gauge-BScJ7U6O.cjs";
|
|
17
|
+
import { n as HeatmapRange, r as heatmap, t as HeatmapOptions } from "./heatmap-Jvwo7iFW.cjs";
|
|
18
|
+
import { a as MapOptions, c as map, i as MapMarker, l as MapLayout, n as MapHit, o as MapRegion, r as MapLine, s as addMap, t as MapData, u as MapView } from "./map-BirylCmT.cjs";
|
|
19
|
+
import { n as ParliamentParty, r as parliament, t as ParliamentOptions } from "./parliament-CsYgh4N2.cjs";
|
|
20
|
+
import { n as PercentageBarSegment, r as percentageBar, t as PercentageBarOptions } from "./percentage-bar-UZHCRvlK.cjs";
|
|
21
|
+
import { i as pie, n as PieSlice, r as donut, t as PieOptions } from "./pie-AFedsDcF.cjs";
|
|
22
|
+
import { n as RadialAxisOptions, r as radar, t as RadarOptions } from "./radar-DxmjXhMc.cjs";
|
|
23
|
+
import { a as RangeRowAxisOptions, i as RangeBarOptions, n as RangeBarAnnotation, o as RangeValue, r as RangeBarItem, s as rangeBar, t as RangeAxisOptions } from "./range-bar-D32dIQOY.cjs";
|
|
24
|
+
import { a as sankey, i as SankeyOptions, n as SankeyLink, r as SankeyNode, t as SankeyData } from "./sankey-D-8ATwBT.cjs";
|
|
25
|
+
import { a as scatter, i as ScatterSeries, n as ScatterOptions, r as ScatterPoint, t as ScatterData } from "./scatter-BUGbnRzM.cjs";
|
|
26
|
+
import { n as sparkline, t as SparklineOptions } from "./sparkline-DwHJfeZz.cjs";
|
|
27
|
+
import { n as TreemapOptions, r as treemap, t as TreemapNode } from "./treemap-C2maqerU.cjs";
|
|
28
|
+
import { A as grid, C as legend, D as hoverUnderlay, E as hoverOverlay, O as hoverValue, S as pointer, T as highlight, _ as defaultPlugins, a as flush, b as dataTable, c as tickIncrement, d as extent, f as RenderToStringOptions, g as render, h as renderToString, i as cancel, k as GridOptions, l as tickStep, m as escapeText, n as barPath, o as schedule, p as escapeAttr, r as hbarPath, s as niceDomain, t as VERSION, u as ticks, v as zoom, w as keyboard, x as sync, y as tooltip } from "./core-Ck5uHcW8.cjs";
|
|
27
29
|
/**
|
|
28
30
|
* A chart with every built-in plugin installed: hover highlight, legend,
|
|
29
31
|
* tooltip, data table and keyboard navigation. Each can be switched off in
|
|
@@ -43,4 +45,4 @@ export declare class Chart<O extends object = object> extends Chart$1<O> {
|
|
|
43
45
|
* brings every type along: code that knows its types imports them directly.
|
|
44
46
|
*/
|
|
45
47
|
export declare const types: Readonly<Record<string, ChartType<never>>>;
|
|
46
|
-
export { type AfterRenderState, type Annotation, type ArcOptions, type AreaOptions, type AttrValue, type Attrs, type AxisOptions, type AxisPosition, type BandKey, type BandScale, type BandScaleOptions, type BarOptions, type BaseOptions, type BeforeRenderState, type BuiltChart, type CalendarData, type CalendarEntry, type CalendarOptions, type CalendarSeries, type Candle, type CandlestickOptions, type CartesianData, type CartesianOptions, type CategoryAxisOptions, type ChartConfig, type ChartEvents, type ChartPlugin, type ChartType, type Child, type ChildInput, type ClassValue, type ContextOptions, type Curve, type DataTable, type DateFormat, type DownloadFormat, type DownloadMenuOptions, type DownloadOption, type DownloadOptions, type ExportOptions, type ExportTarget, type Features, type FunnelOptions, type FunnelStage, type GaugeOptions, type GaugeRing, type GridOptions, type HeatmapOptions, type HeatmapRange, type Highlight, type Hit, type HitItem, type HitTester, type ImageOptions, type Insets, type InsetsInput, type Interaction, type Key, LINE_HEIGHT, type Label, type LegendItem, type LegendOptions, type LineOptions, type LinearScale, type LinearScaleOptions, type LinearTicksOptions, type Locale, type LogScaleOptions, type MapData, type MapHit, type MapLayout, type MapLine, type MapMarker, type MapOptions, type MapRegion, type MapView, type NumberFormat, type NumberFormatOptions, type ParliamentOptions, type ParliamentParty, type PathOptions, type PercentageBarOptions, type PercentageBarSegment, type PieOptions, type PieSlice, type PluginInstance, type Point, type Props, type RadarOptions, type RadialAxisOptions, type Rect, type RenderContext, type RenderResult, type RenderToStringOptions, type ResolvedLegend, type SankeyData, type SankeyLink, type SankeyNode, type SankeyOptions, type ScatterOptions, type ScatterPoint, type ScatterSeries, type Series, type Size, type SparklineOptions, type StyleValue, type TableContext, type Tick, type TimeScale, type TimeScaleOptions, type TimeValue, type TooltipOptions, type TooltipPlacement, type TreemapNode, type TreemapOptions, VERSION, type VNode, type ValueAxisOptions, addMap, arcCentroid, arcPathStable, area, areaPath, axis, axisSize, band, bandTicks, bar, barPath, buildChart, calendar, cancel, candlestick, categoryInteraction, chartEvents, chartLabel, chartModel, chartToString, dataTable, defaultHidden, defaultPlugins, describeHit, domainOf, donut, download, downloadChart, escapeAttr, escapeText, estimateTextWidth, exportImage, exportSVG, extent, feature, features, flush, formatDate, formatDetail, formatNumber, formatTicks, funnel, gauge, getDateFormat, getNumberFormat, grid, h, hbarPath, heatmap, highlight, hitAnchor, hoverOverlay, hoverUnderlay, innerRect, insets, keyboard, legend, legendContent, line, linePath, linear, linearTicks, log, lttb, lttbIndices, map, niceDomain, normalizeClass, normalizeStyle, padAngleForGap, parliament, percentageBar, pie, placeTooltip, point, pointer, radar, register, render, renderChart, renderContext, renderToString, resolveLegend, resolveSize, sankey, scatter, schedule, seriesKey, seriesLegend, seriesTable, sparkline, stepPrecision, sync, tableContent, thinTicks, tickIncrement, tickStep, ticks, time, timePointScale, tooltip, tooltipContent, treemap };
|
|
48
|
+
export { type AfterRenderState, type Annotation, type ArcOptions, type AreaOptions, type AttrValue, type Attrs, type AxisOptions, type AxisPosition, type BandKey, type BandScale, type BandScaleOptions, type BarOptions, type BaseOptions, type BeforeRenderState, type BuiltChart, type CSVOptions, type CalendarData, type CalendarEntry, type CalendarOptions, type CalendarSeries, type Candle, type CandlestickOptions, type CartesianData, type CartesianOptions, type CategoryAxisOptions, type ChartConfig, type ChartEvents, type ChartPlugin, type ChartType, type Child, type ChildInput, type ClassValue, type ContextOptions, type CrosshairOptions, type Curve, type DataTable, type DateFormat, type DownloadFormat, type DownloadMenuOptions, type DownloadOption, type DownloadOptions, type ExportOptions, type ExportTarget, type Features, type FunnelOptions, type FunnelStage, type GaugeOptions, type GaugeRing, type GridOptions, type HeatmapOptions, type HeatmapRange, type Highlight, type Hit, type HitCursor, type HitItem, type HitTester, type ImageOptions, type Insets, type InsetsInput, type Interaction, type Key, LINE_HEIGHT, type Label, type LegendItem, type LegendOptions, type LineOptions, type LinearScale, type LinearScaleOptions, type LinearTicksOptions, type Locale, type LogScaleOptions, type MapData, type MapHit, type MapLayout, type MapLine, type MapMarker, type MapOptions, type MapRegion, type MapView, type NumberFormat, type NumberFormatOptions, type ParliamentOptions, type ParliamentParty, type PathOptions, type PercentageBarOptions, type PercentageBarSegment, type PieOptions, type PieSlice, type PluginInstance, type Point, type Props, type RadarOptions, type RadialAxisOptions, type RangeAxisOptions, type RangeBarAnnotation, type RangeBarItem, type RangeBarOptions, type RangeRowAxisOptions, type RangeValue, type Rect, type RenderContext, type RenderResult, type RenderToStringOptions, type ResolvedLegend, type SankeyData, type SankeyLink, type SankeyNode, type SankeyOptions, type ScatterData, type ScatterOptions, type ScatterPoint, type ScatterSeries, type Series, type Size, type SparklineOptions, type StyleValue, type TableContext, type Tick, type TimeScale, type TimeScaleOptions, type TimeValue, type TooltipOptions, type TooltipPlacement, type TreemapNode, type TreemapOptions, VERSION, type VNode, type ValueAxisOptions, type ViewWindow, type ZoomOptions, addMap, arcCentroid, arcPathStable, area, areaPath, axis, axisSize, band, bandTicks, bar, barPath, buildChart, calendar, cancel, candlestick, categoryInteraction, chartEvents, chartLabel, chartModel, chartToString, dataTable, defaultHidden, defaultPlugins, describeHit, domainOf, donut, download, downloadChart, escapeAttr, escapeText, estimateTextWidth, exportCSV, exportImage, exportSVG, extent, feature, features, flush, formatDate, formatDetail, formatNumber, formatTicks, funnel, gauge, getDateFormat, getNumberFormat, grid, h, hbarPath, heatmap, highlight, hitAnchor, hoverOverlay, hoverUnderlay, hoverValue, innerRect, insets, keyboard, legend, legendContent, line, linePath, linear, linearTicks, log, lttb, lttbIndices, map, niceDomain, normalizeClass, normalizeStyle, padAngleForGap, parliament, percentageBar, pie, placeTooltip, point, pointer, radar, rangeBar, register, render, renderChart, renderContext, renderToString, resolveLegend, resolveSize, sankey, scatter, schedule, seriesKey, seriesLegend, seriesTable, sparkline, stepPrecision, sync, tableContent, thinTicks, tickIncrement, tickStep, ticks, time, timePointScale, tooltip, tooltipContent, treemap, zoom };
|