@fusedashlabs/widgets 0.2.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/CHANGELOG.md +94 -17
- package/README.md +24 -26
- package/dist/components/area-chart/element/ui9000-area-chart.d.ts +1 -1
- package/dist/components/area-grouped-bar-chart/element/ui9000-area-grouped-bar-chart.d.ts +1 -1
- package/dist/components/area-grouped-bar-chart/lib/normalize.js +3 -3
- package/dist/components/area-grouped-bar-chart/lib/normalize.js.map +1 -1
- package/dist/components/bar-chart/element/ui9000-bar-chart.d.ts +1 -1
- package/dist/components/bias-variance-tradeoff-chart/element/styles.d.ts +7 -0
- package/dist/components/bias-variance-tradeoff-chart/element/styles.d.ts.map +1 -0
- package/dist/components/bias-variance-tradeoff-chart/element/styles.js +13 -0
- package/dist/components/bias-variance-tradeoff-chart/element/styles.js.map +1 -0
- package/dist/components/bias-variance-tradeoff-chart/element/ui9000-bias-variance-tradeoff-chart.d.ts +27 -0
- package/dist/components/bias-variance-tradeoff-chart/element/ui9000-bias-variance-tradeoff-chart.d.ts.map +1 -0
- package/dist/components/bias-variance-tradeoff-chart/element/ui9000-bias-variance-tradeoff-chart.js +173 -0
- package/dist/components/bias-variance-tradeoff-chart/element/ui9000-bias-variance-tradeoff-chart.js.map +1 -0
- package/dist/components/bias-variance-tradeoff-chart/index.d.ts +5 -0
- package/dist/components/bias-variance-tradeoff-chart/index.d.ts.map +1 -0
- package/dist/components/bias-variance-tradeoff-chart/index.js +19 -0
- package/dist/components/bias-variance-tradeoff-chart/lib/domain.d.ts +8 -0
- package/dist/components/bias-variance-tradeoff-chart/lib/domain.d.ts.map +1 -0
- package/dist/components/bias-variance-tradeoff-chart/lib/domain.js +37 -0
- package/dist/components/bias-variance-tradeoff-chart/lib/domain.js.map +1 -0
- package/dist/components/bias-variance-tradeoff-chart/lib/format.d.ts +3 -0
- package/dist/components/bias-variance-tradeoff-chart/lib/format.d.ts.map +1 -0
- package/dist/components/bias-variance-tradeoff-chart/lib/format.js +9 -0
- package/dist/components/bias-variance-tradeoff-chart/lib/format.js.map +1 -0
- package/dist/components/bias-variance-tradeoff-chart/lib/index.d.ts +5 -0
- package/dist/components/bias-variance-tradeoff-chart/lib/index.d.ts.map +1 -0
- package/dist/components/bias-variance-tradeoff-chart/lib/normalize.d.ts +4 -0
- package/dist/components/bias-variance-tradeoff-chart/lib/normalize.d.ts.map +1 -0
- package/dist/components/bias-variance-tradeoff-chart/lib/normalize.js +135 -0
- package/dist/components/bias-variance-tradeoff-chart/lib/normalize.js.map +1 -0
- package/dist/components/bias-variance-tradeoff-chart/lib/types.d.ts +47 -0
- package/dist/components/bias-variance-tradeoff-chart/lib/types.d.ts.map +1 -0
- package/dist/components/bias-variance-tradeoff-chart/metadata.json.d.ts +41 -0
- package/dist/components/bias-variance-tradeoff-chart/metadata.json.js +42 -0
- package/dist/components/bias-variance-tradeoff-chart/metadata.json.js.map +1 -0
- package/dist/components/bias-variance-tradeoff-chart/render/draw.d.ts +31 -0
- package/dist/components/bias-variance-tradeoff-chart/render/draw.d.ts.map +1 -0
- package/dist/components/bias-variance-tradeoff-chart/render/draw.js +203 -0
- package/dist/components/bias-variance-tradeoff-chart/render/draw.js.map +1 -0
- package/dist/components/bias-variance-tradeoff-chart/render/index.d.ts +2 -0
- package/dist/components/bias-variance-tradeoff-chart/render/index.d.ts.map +1 -0
- package/dist/components/box-plot-chart/element/ui9000-box-plot-chart.d.ts +1 -1
- package/dist/components/bubble-chart/element/ui9000-bubble-chart.d.ts +1 -1
- package/dist/components/chart-renderer/element/ui9000-chart-renderer.d.ts +1 -0
- package/dist/components/chart-renderer/element/ui9000-chart-renderer.d.ts.map +1 -1
- package/dist/components/chart-renderer/element/ui9000-chart-renderer.js +12 -1
- package/dist/components/chart-renderer/element/ui9000-chart-renderer.js.map +1 -1
- package/dist/components/chart-renderer/lib/registry.d.ts.map +1 -1
- package/dist/components/chart-renderer/lib/registry.js +29 -4
- package/dist/components/chart-renderer/lib/registry.js.map +1 -1
- package/dist/components/chart-renderer/lib/types.d.ts +5 -0
- package/dist/components/chart-renderer/lib/types.d.ts.map +1 -1
- package/dist/components/donut-chart/element/ui9000-donut-chart.d.ts +1 -1
- package/dist/components/donut-chart/element/ui9000-donut-chart.js +1 -1
- package/dist/components/donut-chart/element/ui9000-donut-chart.js.map +1 -1
- package/dist/components/gini-impurity-entropy-chart/element/styles.d.ts +2 -0
- package/dist/components/gini-impurity-entropy-chart/element/styles.d.ts.map +1 -0
- package/dist/components/{donut-group-chart → gini-impurity-entropy-chart}/element/styles.js +17 -11
- package/dist/components/gini-impurity-entropy-chart/element/styles.js.map +1 -0
- package/dist/components/gini-impurity-entropy-chart/element/ui9000-gini-impurity-entropy-chart.d.ts +36 -0
- package/dist/components/gini-impurity-entropy-chart/element/ui9000-gini-impurity-entropy-chart.d.ts.map +1 -0
- package/dist/components/gini-impurity-entropy-chart/element/ui9000-gini-impurity-entropy-chart.js +186 -0
- package/dist/components/gini-impurity-entropy-chart/element/ui9000-gini-impurity-entropy-chart.js.map +1 -0
- package/dist/components/gini-impurity-entropy-chart/index.d.ts +5 -0
- package/dist/components/gini-impurity-entropy-chart/index.d.ts.map +1 -0
- package/dist/components/gini-impurity-entropy-chart/index.js +32 -0
- package/dist/components/gini-impurity-entropy-chart/index.js.map +1 -0
- package/dist/components/gini-impurity-entropy-chart/lib/domain.d.ts +9 -0
- package/dist/components/gini-impurity-entropy-chart/lib/domain.d.ts.map +1 -0
- package/dist/components/gini-impurity-entropy-chart/lib/domain.js +32 -0
- package/dist/components/gini-impurity-entropy-chart/lib/domain.js.map +1 -0
- package/dist/components/gini-impurity-entropy-chart/lib/format.d.ts +10 -0
- package/dist/components/gini-impurity-entropy-chart/lib/format.d.ts.map +1 -0
- package/dist/components/gini-impurity-entropy-chart/lib/format.js +22 -0
- package/dist/components/gini-impurity-entropy-chart/lib/format.js.map +1 -0
- package/dist/components/gini-impurity-entropy-chart/lib/index.d.ts +7 -0
- package/dist/components/gini-impurity-entropy-chart/lib/index.d.ts.map +1 -0
- package/dist/components/gini-impurity-entropy-chart/lib/normalize.d.ts +7 -0
- package/dist/components/gini-impurity-entropy-chart/lib/normalize.d.ts.map +1 -0
- package/dist/components/gini-impurity-entropy-chart/lib/normalize.js +117 -0
- package/dist/components/gini-impurity-entropy-chart/lib/normalize.js.map +1 -0
- package/dist/components/gini-impurity-entropy-chart/lib/overlays.d.ts +19 -0
- package/dist/components/gini-impurity-entropy-chart/lib/overlays.d.ts.map +1 -0
- package/dist/components/gini-impurity-entropy-chart/lib/overlays.js +63 -0
- package/dist/components/gini-impurity-entropy-chart/lib/overlays.js.map +1 -0
- package/dist/components/gini-impurity-entropy-chart/lib/series.d.ts +12 -0
- package/dist/components/gini-impurity-entropy-chart/lib/series.d.ts.map +1 -0
- package/dist/components/gini-impurity-entropy-chart/lib/series.js +45 -0
- package/dist/components/gini-impurity-entropy-chart/lib/series.js.map +1 -0
- package/dist/components/gini-impurity-entropy-chart/lib/types.d.ts +83 -0
- package/dist/components/gini-impurity-entropy-chart/lib/types.d.ts.map +1 -0
- package/dist/components/gini-impurity-entropy-chart/lib/types.js +19 -0
- package/dist/components/gini-impurity-entropy-chart/lib/types.js.map +1 -0
- package/dist/components/gini-impurity-entropy-chart/metadata.json.d.ts +115 -0
- package/dist/components/gini-impurity-entropy-chart/metadata.json.js +42 -0
- package/dist/components/gini-impurity-entropy-chart/metadata.json.js.map +1 -0
- package/dist/components/gini-impurity-entropy-chart/render/draw.d.ts +40 -0
- package/dist/components/gini-impurity-entropy-chart/render/draw.d.ts.map +1 -0
- package/dist/components/gini-impurity-entropy-chart/render/draw.js +160 -0
- package/dist/components/gini-impurity-entropy-chart/render/draw.js.map +1 -0
- package/dist/components/gini-impurity-entropy-chart/render/index.d.ts +2 -0
- package/dist/components/gini-impurity-entropy-chart/render/index.d.ts.map +1 -0
- package/dist/components/histogram-chart/element/ui9000-histogram-chart.d.ts +1 -1
- package/dist/components/kpi-widget/element/ui9000-kpi-widget.d.ts +1 -1
- package/dist/components/kpi-widget/element/ui9000-kpi-widget.js +1 -1
- package/dist/components/line-chart/element/ui9000-line-chart.d.ts +1 -1
- package/dist/components/lollipop/element/styles.d.ts.map +1 -1
- package/dist/components/lollipop/element/styles.js +19 -1
- package/dist/components/lollipop/element/styles.js.map +1 -1
- package/dist/components/lollipop/element/ui9000-lollipop.d.ts +7 -2
- package/dist/components/lollipop/element/ui9000-lollipop.d.ts.map +1 -1
- package/dist/components/lollipop/element/ui9000-lollipop.js +68 -7
- package/dist/components/lollipop/element/ui9000-lollipop.js.map +1 -1
- package/dist/components/lollipop/index.d.ts +1 -1
- package/dist/components/lollipop/index.d.ts.map +1 -1
- package/dist/components/lollipop/index.js +2 -0
- package/dist/components/lollipop/index.js.map +1 -1
- package/dist/components/lollipop/lib/domain.d.ts +16 -1
- package/dist/components/lollipop/lib/domain.d.ts.map +1 -1
- package/dist/components/lollipop/lib/domain.js +56 -1
- package/dist/components/lollipop/lib/domain.js.map +1 -1
- package/dist/components/lollipop/lib/index.d.ts +3 -2
- package/dist/components/lollipop/lib/index.d.ts.map +1 -1
- package/dist/components/lollipop/lib/layout.d.ts +16 -0
- package/dist/components/lollipop/lib/layout.d.ts.map +1 -0
- package/dist/components/lollipop/lib/layout.js +16 -0
- package/dist/components/lollipop/lib/layout.js.map +1 -0
- package/dist/components/lollipop/lib/types.d.ts +5 -0
- package/dist/components/lollipop/lib/types.d.ts.map +1 -1
- package/dist/components/lollipop/metadata.json.d.ts +10 -0
- package/dist/components/lollipop/metadata.json.js +4 -1
- package/dist/components/lollipop/metadata.json.js.map +1 -1
- package/dist/components/lollipop/render/draw.d.ts +8 -1
- package/dist/components/lollipop/render/draw.d.ts.map +1 -1
- package/dist/components/lollipop/render/draw.js +155 -84
- package/dist/components/lollipop/render/draw.js.map +1 -1
- package/dist/components/map-chart/element/styles.d.ts +2 -0
- package/dist/components/map-chart/element/styles.d.ts.map +1 -0
- package/dist/components/map-chart/element/styles.js +372 -0
- package/dist/components/map-chart/element/styles.js.map +1 -0
- package/dist/components/map-chart/element/ui9000-map-chart.d.ts +54 -0
- package/dist/components/map-chart/element/ui9000-map-chart.d.ts.map +1 -0
- package/dist/components/map-chart/element/ui9000-map-chart.js +539 -0
- package/dist/components/map-chart/element/ui9000-map-chart.js.map +1 -0
- package/dist/components/map-chart/index.d.ts +5 -0
- package/dist/components/map-chart/index.d.ts.map +1 -0
- package/dist/components/map-chart/index.js +29 -0
- package/dist/components/map-chart/index.js.map +1 -0
- package/dist/components/map-chart/lib/constants.d.ts +34 -0
- package/dist/components/map-chart/lib/constants.d.ts.map +1 -0
- package/dist/components/map-chart/lib/constants.js +122 -0
- package/dist/components/map-chart/lib/constants.js.map +1 -0
- package/dist/components/map-chart/lib/domain.d.ts +12 -0
- package/dist/components/map-chart/lib/domain.d.ts.map +1 -0
- package/dist/components/map-chart/lib/domain.js +105 -0
- package/dist/components/map-chart/lib/domain.js.map +1 -0
- package/dist/components/map-chart/lib/format.d.ts +8 -0
- package/dist/components/map-chart/lib/format.d.ts.map +1 -0
- package/dist/components/map-chart/lib/format.js +45 -0
- package/dist/components/map-chart/lib/format.js.map +1 -0
- package/dist/components/map-chart/lib/geo-index.d.ts +7 -0
- package/dist/components/map-chart/lib/geo-index.d.ts.map +1 -0
- package/dist/components/map-chart/lib/geo-index.js +200 -0
- package/dist/components/map-chart/lib/geo-index.js.map +1 -0
- package/dist/components/map-chart/lib/geojson.d.ts +5 -0
- package/dist/components/map-chart/lib/geojson.d.ts.map +1 -0
- package/dist/components/map-chart/lib/geojson.js +47 -0
- package/dist/components/map-chart/lib/geojson.js.map +1 -0
- package/dist/components/map-chart/lib/index.d.ts +13 -0
- package/dist/components/map-chart/lib/index.d.ts.map +1 -0
- package/dist/components/map-chart/lib/join.d.ts +7 -0
- package/dist/components/map-chart/lib/join.d.ts.map +1 -0
- package/dist/components/map-chart/lib/join.js +156 -0
- package/dist/components/map-chart/lib/join.js.map +1 -0
- package/dist/components/map-chart/lib/legend.d.ts +45 -0
- package/dist/components/map-chart/lib/legend.d.ts.map +1 -0
- package/dist/components/map-chart/lib/legend.js +108 -0
- package/dist/components/map-chart/lib/legend.js.map +1 -0
- package/dist/components/map-chart/lib/normalize.d.ts +3 -0
- package/dist/components/map-chart/lib/normalize.d.ts.map +1 -0
- package/dist/components/map-chart/lib/normalize.js +177 -0
- package/dist/components/map-chart/lib/normalize.js.map +1 -0
- package/dist/components/map-chart/lib/pmtiles.d.ts +41 -0
- package/dist/components/map-chart/lib/pmtiles.d.ts.map +1 -0
- package/dist/components/map-chart/lib/pmtiles.js +112 -0
- package/dist/components/map-chart/lib/pmtiles.js.map +1 -0
- package/dist/components/map-chart/lib/types.d.ts +128 -0
- package/dist/components/map-chart/lib/types.d.ts.map +1 -0
- package/dist/components/map-chart/metadata.json.d.ts +83 -0
- package/dist/components/map-chart/metadata.json.js +42 -0
- package/dist/components/map-chart/metadata.json.js.map +1 -0
- package/dist/components/map-chart/render/draw.d.ts +24 -0
- package/dist/components/map-chart/render/draw.d.ts.map +1 -0
- package/dist/components/map-chart/render/draw.js +455 -0
- package/dist/components/map-chart/render/draw.js.map +1 -0
- package/dist/components/map-chart/render/index.d.ts +2 -0
- package/dist/components/map-chart/render/index.d.ts.map +1 -0
- package/dist/components/matrix-chart/element/styles.d.ts +2 -0
- package/dist/components/matrix-chart/element/styles.d.ts.map +1 -0
- package/dist/components/matrix-chart/element/styles.js +97 -0
- package/dist/components/matrix-chart/element/styles.js.map +1 -0
- package/dist/components/matrix-chart/element/ui9000-matrix-chart.d.ts +39 -0
- package/dist/components/matrix-chart/element/ui9000-matrix-chart.d.ts.map +1 -0
- package/dist/components/matrix-chart/element/ui9000-matrix-chart.js +238 -0
- package/dist/components/matrix-chart/element/ui9000-matrix-chart.js.map +1 -0
- package/dist/components/matrix-chart/index.d.ts +5 -0
- package/dist/components/matrix-chart/index.d.ts.map +1 -0
- package/dist/components/matrix-chart/index.js +20 -0
- package/dist/components/matrix-chart/index.js.map +1 -0
- package/dist/components/matrix-chart/lib/domain.d.ts +7 -0
- package/dist/components/matrix-chart/lib/domain.d.ts.map +1 -0
- package/dist/components/matrix-chart/lib/domain.js +58 -0
- package/dist/components/matrix-chart/lib/domain.js.map +1 -0
- package/dist/components/matrix-chart/lib/format.d.ts +5 -0
- package/dist/components/matrix-chart/lib/format.d.ts.map +1 -0
- package/dist/components/matrix-chart/lib/format.js +16 -0
- package/dist/components/matrix-chart/lib/format.js.map +1 -0
- package/dist/components/matrix-chart/lib/index.d.ts +5 -0
- package/dist/components/matrix-chart/lib/index.d.ts.map +1 -0
- package/dist/components/matrix-chart/lib/normalize.d.ts +5 -0
- package/dist/components/matrix-chart/lib/normalize.d.ts.map +1 -0
- package/dist/components/matrix-chart/lib/normalize.js +165 -0
- package/dist/components/matrix-chart/lib/normalize.js.map +1 -0
- package/dist/components/matrix-chart/lib/types.d.ts +33 -0
- package/dist/components/matrix-chart/lib/types.d.ts.map +1 -0
- package/dist/components/matrix-chart/metadata.json.d.ts +110 -0
- package/dist/components/matrix-chart/metadata.json.js +42 -0
- package/dist/components/matrix-chart/metadata.json.js.map +1 -0
- package/dist/components/matrix-chart/render/draw.d.ts +63 -0
- package/dist/components/matrix-chart/render/draw.d.ts.map +1 -0
- package/dist/components/matrix-chart/render/draw.js +225 -0
- package/dist/components/matrix-chart/render/draw.js.map +1 -0
- package/dist/components/matrix-chart/render/index.d.ts +2 -0
- package/dist/components/matrix-chart/render/index.d.ts.map +1 -0
- package/dist/components/network-graph/element/styles.d.ts +2 -0
- package/dist/components/network-graph/element/styles.d.ts.map +1 -0
- package/dist/components/network-graph/element/styles.js +272 -0
- package/dist/components/network-graph/element/styles.js.map +1 -0
- package/dist/components/network-graph/element/ui9000-network-graph.d.ts +47 -0
- package/dist/components/network-graph/element/ui9000-network-graph.d.ts.map +1 -0
- package/dist/components/network-graph/element/ui9000-network-graph.js +307 -0
- package/dist/components/network-graph/element/ui9000-network-graph.js.map +1 -0
- package/dist/components/network-graph/index.d.ts +5 -0
- package/dist/components/network-graph/index.d.ts.map +1 -0
- package/dist/components/network-graph/index.js +37 -0
- package/dist/components/network-graph/index.js.map +1 -0
- package/dist/components/network-graph/lib/domain.d.ts +96 -0
- package/dist/components/network-graph/lib/domain.d.ts.map +1 -0
- package/dist/components/network-graph/lib/domain.js +211 -0
- package/dist/components/network-graph/lib/domain.js.map +1 -0
- package/dist/components/network-graph/lib/format.d.ts +7 -0
- package/dist/components/network-graph/lib/format.d.ts.map +1 -0
- package/dist/components/network-graph/lib/format.js +29 -0
- package/dist/components/network-graph/lib/format.js.map +1 -0
- package/dist/components/network-graph/lib/index.d.ts +6 -0
- package/dist/components/network-graph/lib/index.d.ts.map +1 -0
- package/dist/components/network-graph/lib/legend.d.ts +15 -0
- package/dist/components/network-graph/lib/legend.d.ts.map +1 -0
- package/dist/components/network-graph/lib/legend.js +35 -0
- package/dist/components/network-graph/lib/legend.js.map +1 -0
- package/dist/components/network-graph/lib/normalize.d.ts +10 -0
- package/dist/components/network-graph/lib/normalize.d.ts.map +1 -0
- package/dist/components/network-graph/lib/normalize.js +140 -0
- package/dist/components/network-graph/lib/normalize.js.map +1 -0
- package/dist/components/network-graph/lib/types.d.ts +56 -0
- package/dist/components/network-graph/lib/types.d.ts.map +1 -0
- package/dist/components/network-graph/metadata.json.d.ts +91 -0
- package/dist/components/network-graph/metadata.json.js +42 -0
- package/dist/components/network-graph/metadata.json.js.map +1 -0
- package/dist/components/network-graph/render/draw.d.ts +49 -0
- package/dist/components/network-graph/render/draw.d.ts.map +1 -0
- package/dist/components/network-graph/render/draw.js +493 -0
- package/dist/components/network-graph/render/draw.js.map +1 -0
- package/dist/components/network-graph/render/index.d.ts +2 -0
- package/dist/components/network-graph/render/index.d.ts.map +1 -0
- package/dist/components/parallel-coordinates-chart/element/styles.d.ts +2 -0
- package/dist/components/parallel-coordinates-chart/element/styles.d.ts.map +1 -0
- package/dist/components/parallel-coordinates-chart/element/styles.js +71 -0
- package/dist/components/parallel-coordinates-chart/element/styles.js.map +1 -0
- package/dist/components/parallel-coordinates-chart/element/ui9000-parallel-coordinates-chart.d.ts +33 -0
- package/dist/components/parallel-coordinates-chart/element/ui9000-parallel-coordinates-chart.d.ts.map +1 -0
- package/dist/components/parallel-coordinates-chart/element/ui9000-parallel-coordinates-chart.js +182 -0
- package/dist/components/parallel-coordinates-chart/element/ui9000-parallel-coordinates-chart.js.map +1 -0
- package/dist/components/parallel-coordinates-chart/index.d.ts +5 -0
- package/dist/components/parallel-coordinates-chart/index.d.ts.map +1 -0
- package/dist/components/parallel-coordinates-chart/index.js +23 -0
- package/dist/components/parallel-coordinates-chart/index.js.map +1 -0
- package/dist/components/parallel-coordinates-chart/lib/domain.d.ts +14 -0
- package/dist/components/parallel-coordinates-chart/lib/domain.d.ts.map +1 -0
- package/dist/components/parallel-coordinates-chart/lib/domain.js +28 -0
- package/dist/components/parallel-coordinates-chart/lib/domain.js.map +1 -0
- package/dist/components/parallel-coordinates-chart/lib/format.d.ts +12 -0
- package/dist/components/parallel-coordinates-chart/lib/format.d.ts.map +1 -0
- package/dist/components/parallel-coordinates-chart/lib/format.js +18 -0
- package/dist/components/parallel-coordinates-chart/lib/format.js.map +1 -0
- package/dist/components/parallel-coordinates-chart/lib/index.d.ts +5 -0
- package/dist/components/parallel-coordinates-chart/lib/index.d.ts.map +1 -0
- package/dist/components/parallel-coordinates-chart/lib/normalize.d.ts +23 -0
- package/dist/components/parallel-coordinates-chart/lib/normalize.d.ts.map +1 -0
- package/dist/components/parallel-coordinates-chart/lib/normalize.js +156 -0
- package/dist/components/parallel-coordinates-chart/lib/normalize.js.map +1 -0
- package/dist/components/parallel-coordinates-chart/lib/types.d.ts +48 -0
- package/dist/components/parallel-coordinates-chart/lib/types.d.ts.map +1 -0
- package/dist/components/parallel-coordinates-chart/metadata.json.d.ts +103 -0
- package/dist/components/parallel-coordinates-chart/metadata.json.js +45 -0
- package/dist/components/parallel-coordinates-chart/render/draw.d.ts +30 -0
- package/dist/components/parallel-coordinates-chart/render/draw.d.ts.map +1 -0
- package/dist/components/parallel-coordinates-chart/render/draw.js +160 -0
- package/dist/components/parallel-coordinates-chart/render/draw.js.map +1 -0
- package/dist/components/parallel-coordinates-chart/render/index.d.ts +2 -0
- package/dist/components/parallel-coordinates-chart/render/index.d.ts.map +1 -0
- package/dist/components/pie-chart/element/styles.d.ts.map +1 -1
- package/dist/components/pie-chart/element/styles.js +34 -1
- package/dist/components/pie-chart/element/styles.js.map +1 -1
- package/dist/components/pie-chart/element/ui9000-pie-chart.d.ts +1 -3
- package/dist/components/pie-chart/element/ui9000-pie-chart.d.ts.map +1 -1
- package/dist/components/pie-chart/element/ui9000-pie-chart.js +2 -8
- package/dist/components/pie-chart/element/ui9000-pie-chart.js.map +1 -1
- package/dist/components/pie-chart/metadata.json.d.ts +1 -7
- package/dist/components/pie-chart/metadata.json.js +2 -2
- package/dist/components/polar-area-chart/element/styles.d.ts +2 -0
- package/dist/components/polar-area-chart/element/styles.d.ts.map +1 -0
- package/dist/components/polar-area-chart/element/styles.js +48 -0
- package/dist/components/polar-area-chart/element/styles.js.map +1 -0
- package/dist/components/polar-area-chart/element/ui9000-polar-area-chart.d.ts +29 -0
- package/dist/components/polar-area-chart/element/ui9000-polar-area-chart.d.ts.map +1 -0
- package/dist/components/polar-area-chart/element/ui9000-polar-area-chart.js +168 -0
- package/dist/components/polar-area-chart/element/ui9000-polar-area-chart.js.map +1 -0
- package/dist/components/polar-area-chart/index.d.ts +5 -0
- package/dist/components/polar-area-chart/index.d.ts.map +1 -0
- package/dist/components/polar-area-chart/index.js +19 -0
- package/dist/components/polar-area-chart/index.js.map +1 -0
- package/dist/components/polar-area-chart/lib/domain.d.ts +33 -0
- package/dist/components/polar-area-chart/lib/domain.d.ts.map +1 -0
- package/dist/components/polar-area-chart/lib/domain.js +67 -0
- package/dist/components/polar-area-chart/lib/domain.js.map +1 -0
- package/dist/components/polar-area-chart/lib/index.d.ts +4 -0
- package/dist/components/polar-area-chart/lib/index.d.ts.map +1 -0
- package/dist/components/polar-area-chart/lib/normalize.d.ts +4 -0
- package/dist/components/polar-area-chart/lib/normalize.d.ts.map +1 -0
- package/dist/components/polar-area-chart/lib/normalize.js +183 -0
- package/dist/components/polar-area-chart/lib/normalize.js.map +1 -0
- package/dist/components/polar-area-chart/lib/types.d.ts +48 -0
- package/dist/components/polar-area-chart/lib/types.d.ts.map +1 -0
- package/dist/components/polar-area-chart/metadata.json.d.ts +79 -0
- package/dist/components/polar-area-chart/metadata.json.js +42 -0
- package/dist/components/polar-area-chart/metadata.json.js.map +1 -0
- package/dist/components/polar-area-chart/render/draw.d.ts +25 -0
- package/dist/components/polar-area-chart/render/draw.d.ts.map +1 -0
- package/dist/components/polar-area-chart/render/draw.js +127 -0
- package/dist/components/polar-area-chart/render/draw.js.map +1 -0
- package/dist/components/polar-area-chart/render/index.d.ts +2 -0
- package/dist/components/polar-area-chart/render/index.d.ts.map +1 -0
- package/dist/components/punchcard-chart/element/ui9000-punchcard-chart.d.ts +1 -1
- package/dist/components/punchcard-chart/metadata.json.d.ts +1 -1
- package/dist/components/punchcard-chart/metadata.json.js +1 -1
- package/dist/components/radar-chart/element/ui9000-radar-chart.d.ts +1 -1
- package/dist/components/radial-bar-chart/element/styles.d.ts +2 -0
- package/dist/components/radial-bar-chart/element/styles.d.ts.map +1 -0
- package/dist/components/radial-bar-chart/element/styles.js +53 -0
- package/dist/components/radial-bar-chart/element/styles.js.map +1 -0
- package/dist/components/radial-bar-chart/element/ui9000-radial-bar-chart.d.ts +35 -0
- package/dist/components/radial-bar-chart/element/ui9000-radial-bar-chart.d.ts.map +1 -0
- package/dist/components/radial-bar-chart/element/ui9000-radial-bar-chart.js +174 -0
- package/dist/components/radial-bar-chart/element/ui9000-radial-bar-chart.js.map +1 -0
- package/dist/components/radial-bar-chart/index.d.ts +5 -0
- package/dist/components/radial-bar-chart/index.d.ts.map +1 -0
- package/dist/components/radial-bar-chart/index.js +21 -0
- package/dist/components/radial-bar-chart/index.js.map +1 -0
- package/dist/components/radial-bar-chart/lib/domain.d.ts +47 -0
- package/dist/components/radial-bar-chart/lib/domain.d.ts.map +1 -0
- package/dist/components/radial-bar-chart/lib/domain.js +50 -0
- package/dist/components/radial-bar-chart/lib/domain.js.map +1 -0
- package/dist/components/radial-bar-chart/lib/format.d.ts +6 -0
- package/dist/components/radial-bar-chart/lib/format.d.ts.map +1 -0
- package/dist/components/radial-bar-chart/lib/format.js +12 -0
- package/dist/components/radial-bar-chart/lib/format.js.map +1 -0
- package/dist/components/radial-bar-chart/lib/index.d.ts +5 -0
- package/dist/components/radial-bar-chart/lib/index.d.ts.map +1 -0
- package/dist/components/radial-bar-chart/lib/normalize.d.ts +4 -0
- package/dist/components/radial-bar-chart/lib/normalize.d.ts.map +1 -0
- package/dist/components/radial-bar-chart/lib/normalize.js +92 -0
- package/dist/components/radial-bar-chart/lib/normalize.js.map +1 -0
- package/dist/components/radial-bar-chart/lib/types.d.ts +34 -0
- package/dist/components/radial-bar-chart/lib/types.d.ts.map +1 -0
- package/dist/components/radial-bar-chart/metadata.json.d.ts +62 -0
- package/dist/components/radial-bar-chart/metadata.json.js +42 -0
- package/dist/components/radial-bar-chart/metadata.json.js.map +1 -0
- package/dist/components/radial-bar-chart/render/draw.d.ts +29 -0
- package/dist/components/radial-bar-chart/render/draw.d.ts.map +1 -0
- package/dist/components/radial-bar-chart/render/draw.js +92 -0
- package/dist/components/radial-bar-chart/render/draw.js.map +1 -0
- package/dist/components/radial-bar-chart/render/index.d.ts +2 -0
- package/dist/components/radial-bar-chart/render/index.d.ts.map +1 -0
- package/dist/components/sankey-chart/element/styles.d.ts.map +1 -1
- package/dist/components/sankey-chart/element/styles.js +7 -27
- package/dist/components/sankey-chart/element/styles.js.map +1 -1
- package/dist/components/sankey-chart/element/ui9000-sankey-chart.d.ts +6 -6
- package/dist/components/sankey-chart/element/ui9000-sankey-chart.d.ts.map +1 -1
- package/dist/components/sankey-chart/element/ui9000-sankey-chart.js +39 -36
- package/dist/components/sankey-chart/element/ui9000-sankey-chart.js.map +1 -1
- package/dist/components/sankey-chart/index.js +4 -2
- package/dist/components/sankey-chart/index.js.map +1 -1
- package/dist/components/sankey-chart/lib/domain.d.ts +2 -2
- package/dist/components/sankey-chart/lib/domain.d.ts.map +1 -1
- package/dist/components/sankey-chart/lib/domain.js +1 -13
- package/dist/components/sankey-chart/lib/domain.js.map +1 -1
- package/dist/components/sankey-chart/lib/format.d.ts +1 -2
- package/dist/components/sankey-chart/lib/format.d.ts.map +1 -1
- package/dist/components/sankey-chart/lib/format.js +3 -7
- package/dist/components/sankey-chart/lib/format.js.map +1 -1
- package/dist/components/scatter-plot-chart/element/ui9000-scatter-plot.d.ts +1 -1
- package/dist/components/scatter-sparkline-chart/element/ui9000-scatter-sparkline-chart.d.ts +1 -1
- package/dist/components/spark-area-chart/element/ui9000-spark-area-chart.d.ts +1 -1
- package/dist/components/spark-line-chart/element/ui9000-spark-line-chart.d.ts +1 -1
- package/dist/components/step-line-chart/element/ui9000-step-line-chart.d.ts +1 -1
- package/dist/components/treemap-chart/element/styles.d.ts +2 -0
- package/dist/components/treemap-chart/element/styles.d.ts.map +1 -0
- package/dist/components/treemap-chart/element/styles.js +141 -0
- package/dist/components/treemap-chart/element/styles.js.map +1 -0
- package/dist/components/treemap-chart/element/ui9000-treemap-chart.d.ts +35 -0
- package/dist/components/treemap-chart/element/ui9000-treemap-chart.d.ts.map +1 -0
- package/dist/components/treemap-chart/element/ui9000-treemap-chart.js +177 -0
- package/dist/components/treemap-chart/element/ui9000-treemap-chart.js.map +1 -0
- package/dist/components/treemap-chart/index.d.ts +5 -0
- package/dist/components/treemap-chart/index.d.ts.map +1 -0
- package/dist/components/treemap-chart/index.js +22 -0
- package/dist/components/treemap-chart/index.js.map +1 -0
- package/dist/components/treemap-chart/lib/color.d.ts +25 -0
- package/dist/components/treemap-chart/lib/color.d.ts.map +1 -0
- package/dist/components/treemap-chart/lib/color.js +67 -0
- package/dist/components/treemap-chart/lib/color.js.map +1 -0
- package/dist/components/treemap-chart/lib/format.d.ts +7 -0
- package/dist/components/treemap-chart/lib/format.d.ts.map +1 -0
- package/dist/components/treemap-chart/lib/format.js +9 -0
- package/dist/components/treemap-chart/lib/format.js.map +1 -0
- package/dist/components/treemap-chart/lib/index.d.ts +6 -0
- package/dist/components/treemap-chart/lib/index.d.ts.map +1 -0
- package/dist/components/treemap-chart/lib/layout.d.ts +18 -0
- package/dist/components/treemap-chart/lib/layout.d.ts.map +1 -0
- package/dist/components/treemap-chart/lib/layout.js +31 -0
- package/dist/components/treemap-chart/lib/layout.js.map +1 -0
- package/dist/components/treemap-chart/lib/normalize.d.ts +4 -0
- package/dist/components/treemap-chart/lib/normalize.d.ts.map +1 -0
- package/dist/components/treemap-chart/lib/normalize.js +182 -0
- package/dist/components/treemap-chart/lib/normalize.js.map +1 -0
- package/dist/components/treemap-chart/lib/types.d.ts +63 -0
- package/dist/components/treemap-chart/lib/types.d.ts.map +1 -0
- package/dist/components/treemap-chart/metadata.json.d.ts +126 -0
- package/dist/components/treemap-chart/metadata.json.js +45 -0
- package/dist/components/treemap-chart/metadata.json.js.map +1 -0
- package/dist/components/treemap-chart/render/draw.d.ts +24 -0
- package/dist/components/treemap-chart/render/draw.d.ts.map +1 -0
- package/dist/components/treemap-chart/render/draw.js +124 -0
- package/dist/components/treemap-chart/render/draw.js.map +1 -0
- package/dist/components/treemap-chart/render/index.d.ts +2 -0
- package/dist/components/treemap-chart/render/index.d.ts.map +1 -0
- package/dist/components/violin-chart/element/ui9000-violin-chart.d.ts +1 -1
- package/dist/components/waterfall-chart/element/ui9000-waterfall-chart.d.ts +1 -1
- package/dist/element/chart-legend-render.d.ts +5 -0
- package/dist/element/chart-legend-render.d.ts.map +1 -1
- package/dist/element/chart-legend-render.js +19 -1
- package/dist/element/chart-legend-render.js.map +1 -1
- package/dist/element/chart-shell-styles.d.ts.map +1 -1
- package/dist/element/chart-shell-styles.js +35 -0
- package/dist/element/chart-shell-styles.js.map +1 -1
- package/dist/element/ui9000-chart-base.d.ts +2 -2
- package/dist/index.d.ts +20 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +178 -47
- package/dist/index.js.map +1 -1
- package/dist/lazy/bias-variance-tradeoff-chart.d.ts +4 -0
- package/dist/lazy/bias-variance-tradeoff-chart.d.ts.map +1 -0
- package/dist/lazy/bias-variance-tradeoff-chart.js +5 -0
- package/dist/lazy/bias-variance-tradeoff-chart.js.map +1 -0
- package/dist/lazy/gini-impurity-entropy-chart.d.ts +4 -0
- package/dist/lazy/gini-impurity-entropy-chart.d.ts.map +1 -0
- package/dist/lazy/gini-impurity-entropy-chart.js +5 -0
- package/dist/lazy/gini-impurity-entropy-chart.js.map +1 -0
- package/dist/lazy/index.d.ts +10 -2
- package/dist/lazy/index.d.ts.map +1 -1
- package/dist/lazy/index.js +72 -8
- package/dist/lazy/index.js.map +1 -1
- package/dist/lazy/map-chart.d.ts +4 -0
- package/dist/lazy/map-chart.d.ts.map +1 -0
- package/dist/lazy/map-chart.js +5 -0
- package/dist/lazy/map-chart.js.map +1 -0
- package/dist/lazy/matrix-chart.d.ts +4 -0
- package/dist/lazy/matrix-chart.d.ts.map +1 -0
- package/dist/lazy/matrix-chart.js +5 -0
- package/dist/lazy/matrix-chart.js.map +1 -0
- package/dist/lazy/network-graph.d.ts +4 -0
- package/dist/lazy/network-graph.d.ts.map +1 -0
- package/dist/lazy/network-graph.js +5 -0
- package/dist/lazy/network-graph.js.map +1 -0
- package/dist/lazy/parallel-coordinates-chart.d.ts +4 -0
- package/dist/lazy/parallel-coordinates-chart.d.ts.map +1 -0
- package/dist/lazy/parallel-coordinates-chart.js +5 -0
- package/dist/lazy/parallel-coordinates-chart.js.map +1 -0
- package/dist/lazy/polar-area-chart.d.ts +4 -0
- package/dist/lazy/polar-area-chart.d.ts.map +1 -0
- package/dist/lazy/polar-area-chart.js +5 -0
- package/dist/lazy/polar-area-chart.js.map +1 -0
- package/dist/lazy/radial-bar-chart.d.ts +4 -0
- package/dist/lazy/radial-bar-chart.d.ts.map +1 -0
- package/dist/lazy/radial-bar-chart.js +5 -0
- package/dist/lazy/radial-bar-chart.js.map +1 -0
- package/dist/lazy/treemap-chart.d.ts +4 -0
- package/dist/lazy/treemap-chart.d.ts.map +1 -0
- package/dist/lazy/treemap-chart.js +5 -0
- package/dist/lazy/treemap-chart.js.map +1 -0
- package/dist/node_modules/lit-html/directive.js.map +1 -0
- package/dist/node_modules/lit-html/directives/style-map.js.map +1 -0
- package/dist/node_modules/lit-html/lit-html.js.map +1 -0
- package/dist/utils/axis-units.d.ts +15 -0
- package/dist/utils/axis-units.d.ts.map +1 -0
- package/dist/utils/axis-units.js +27 -0
- package/dist/utils/axis-units.js.map +1 -0
- package/dist/utils/breakpoints.d.ts +7 -0
- package/dist/utils/breakpoints.d.ts.map +1 -0
- package/dist/utils/breakpoints.js +17 -0
- package/dist/utils/breakpoints.js.map +1 -0
- package/dist/utils/chart-helpers.d.ts +25 -6
- package/dist/utils/chart-helpers.d.ts.map +1 -1
- package/dist/utils/chart-helpers.js +70 -15
- package/dist/utils/chart-helpers.js.map +1 -1
- package/dist/utils/format-text.d.ts +22 -0
- package/dist/utils/format-text.d.ts.map +1 -0
- package/dist/utils/format-text.js +33 -0
- package/dist/utils/format-text.js.map +1 -0
- package/dist/utils/fuse-palette.d.ts +12 -0
- package/dist/utils/fuse-palette.d.ts.map +1 -1
- package/dist/utils/fuse-palette.js +23 -1
- package/dist/utils/fuse-palette.js.map +1 -1
- package/dist/utils/fuse-widget.d.ts +13 -4
- package/dist/utils/fuse-widget.d.ts.map +1 -1
- package/dist/utils/fuse-widget.js.map +1 -1
- package/dist/utils/fusedash-visual.d.ts +208 -52
- package/dist/utils/fusedash-visual.d.ts.map +1 -1
- package/dist/utils/fusedash-visual.js +162 -30
- package/dist/utils/fusedash-visual.js.map +1 -1
- package/package.json +91 -12
- package/dist/components/donut-group-chart/element/styles.d.ts +0 -2
- package/dist/components/donut-group-chart/element/styles.d.ts.map +0 -1
- package/dist/components/donut-group-chart/element/styles.js.map +0 -1
- package/dist/components/donut-group-chart/element/ui9000-donut-group-chart.d.ts +0 -34
- package/dist/components/donut-group-chart/element/ui9000-donut-group-chart.d.ts.map +0 -1
- package/dist/components/donut-group-chart/element/ui9000-donut-group-chart.js +0 -169
- package/dist/components/donut-group-chart/element/ui9000-donut-group-chart.js.map +0 -1
- package/dist/components/donut-group-chart/index.d.ts +0 -5
- package/dist/components/donut-group-chart/index.d.ts.map +0 -1
- package/dist/components/donut-group-chart/index.js +0 -23
- package/dist/components/donut-group-chart/lib/domain.d.ts +0 -39
- package/dist/components/donut-group-chart/lib/domain.d.ts.map +0 -1
- package/dist/components/donut-group-chart/lib/domain.js +0 -51
- package/dist/components/donut-group-chart/lib/domain.js.map +0 -1
- package/dist/components/donut-group-chart/lib/format.d.ts +0 -7
- package/dist/components/donut-group-chart/lib/format.d.ts.map +0 -1
- package/dist/components/donut-group-chart/lib/format.js +0 -21
- package/dist/components/donut-group-chart/lib/format.js.map +0 -1
- package/dist/components/donut-group-chart/lib/index.d.ts +0 -5
- package/dist/components/donut-group-chart/lib/index.d.ts.map +0 -1
- package/dist/components/donut-group-chart/lib/normalize.d.ts +0 -14
- package/dist/components/donut-group-chart/lib/normalize.d.ts.map +0 -1
- package/dist/components/donut-group-chart/lib/normalize.js +0 -98
- package/dist/components/donut-group-chart/lib/normalize.js.map +0 -1
- package/dist/components/donut-group-chart/lib/types.d.ts +0 -49
- package/dist/components/donut-group-chart/lib/types.d.ts.map +0 -1
- package/dist/components/donut-group-chart/metadata.json.d.ts +0 -113
- package/dist/components/donut-group-chart/metadata.json.js +0 -45
- package/dist/components/donut-group-chart/render/draw.d.ts +0 -44
- package/dist/components/donut-group-chart/render/draw.d.ts.map +0 -1
- package/dist/components/donut-group-chart/render/draw.js +0 -194
- package/dist/components/donut-group-chart/render/draw.js.map +0 -1
- package/dist/components/donut-group-chart/render/index.d.ts +0 -2
- package/dist/components/donut-group-chart/render/index.d.ts.map +0 -1
- package/dist/components/donut-group-chart/tests/fixtures.d.ts +0 -33
- package/dist/components/donut-group-chart/tests/fixtures.d.ts.map +0 -1
- package/dist/lazy/donut-group-chart.d.ts +0 -4
- package/dist/lazy/donut-group-chart.d.ts.map +0 -1
- package/dist/lazy/donut-group-chart.js +0 -5
- package/dist/lazy/donut-group-chart.js.map +0 -1
- package/dist/node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/directive.js.map +0 -1
- package/dist/node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/directives/style-map.js.map +0 -1
- package/dist/node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/lit-html.js.map +0 -1
- /package/dist/components/{donut-group-chart → bias-variance-tradeoff-chart}/index.js.map +0 -0
- /package/dist/components/{donut-group-chart → parallel-coordinates-chart}/metadata.json.js.map +0 -0
- /package/dist/node_modules/{.pnpm/lit-html@3.3.3/node_modules/lit-html → lit-html}/directive.js +0 -0
- /package/dist/node_modules/{.pnpm/lit-html@3.3.3/node_modules/lit-html → lit-html}/directives/style-map.js +0 -0
- /package/dist/node_modules/{.pnpm/lit-html@3.3.3/node_modules/lit-html → lit-html}/lit-html.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.js","sources":["../../../../src/components/treemap-chart/lib/normalize.ts"],"sourcesContent":["import { resolveFormattingColor, type FuseFormattingEntry } from '../../../utils/fuse-palette.js';\nimport { seriesColor } from '../../../utils/fusedash-visual.js';\nimport {\n firstField,\n isFuseWidgetPayload,\n rowsOf,\n type FuseWidgetLike,\n} from '../../../utils/fuse-widget.js';\nimport {\n hasLightColor,\n treemapColorForValue,\n treemapRangeColors,\n treemapValueRanges,\n} from './color.js';\nimport type {\n TreemapChartData,\n TreemapGroupCard,\n TreemapLabelValue,\n TreemapModel,\n TreemapPoint,\n TreemapSeries,\n TreemapTile,\n} from './types.js';\n\ntype RawRow = Record<string, unknown>;\n\nconst EMPTY: TreemapModel = { mode: 'single', tiles: [], groups: [], rangeColors: [] };\n\n/** Client `normalizeCategoryKey` — case- and whitespace-insensitive group key. */\nfunction normalizeKey(raw: unknown): string {\n return displayLabel(raw).toLowerCase();\n}\n\n/** First-seen trimmed spelling, kept for display (client `aggregateByCategory`). */\nfunction displayLabel(raw: unknown): string {\n return String(raw ?? '')\n .trim()\n .replace(/\\s+/g, ' ');\n}\n\ntype Aggregate = { key: string; label: string; value: number };\n\n/**\n * Mirrors client `aggregateByCategory`: one entry per normalized category with\n * the metric summed, sorted by value desc then label asc so the layout is\n * stable whatever order the payload arrives in (FUS-3836 / FUS-3868).\n */\nfunction aggregateByCategory(\n rows: RawRow[],\n categoryKey: string | undefined,\n getValue: (row: RawRow) => number,\n): Aggregate[] {\n const byKey = new Map<string, Aggregate>();\n for (const row of rows) {\n const raw = categoryKey ? row?.[categoryKey] : '';\n const key = normalizeKey(raw);\n const existing = byKey.get(key);\n if (existing) {\n existing.value += getValue(row);\n } else {\n byKey.set(key, { key, label: displayLabel(raw), value: getValue(row) });\n }\n }\n return [...byKey.values()].sort((a, b) => b.value - a.value || a.label.localeCompare(b.label));\n}\n\n/** Paint one set of leaves with the seven magnitude bands of `baseColor`. */\nfunction tilesFrom(\n entries: Aggregate[],\n baseColor: string,\n paletteRange?: number[] | null,\n): { tiles: TreemapTile[]; rangeColors: string[] } {\n const rangeColors = treemapRangeColors(baseColor);\n const ranges = treemapValueRanges(\n entries.map((entry) => entry.value),\n paletteRange,\n );\n const tiles = entries.map((entry) => {\n const color = treemapColorForValue(entry.value, ranges, rangeColors, baseColor);\n return {\n key: entry.key,\n label: entry.label,\n value: entry.value,\n color,\n lightFill: hasLightColor(color),\n };\n });\n return { tiles, rangeColors };\n}\n\n/**\n * Client `TreemapSingle` reads the widget's own formatting and asks for the\n * `default` key, so a single-dimension treemap always ramps one palette color.\n */\nfunction singleBaseColor(formatting: FuseFormattingEntry[] | null | undefined): string {\n return resolveFormattingColor(formatting, 'default', formatting?.length ?? 1);\n}\n\n/**\n * Client `getFormattingByGroupName` narrows formatting to the entry matching the\n * group, so each card ramps its own qualitative color. A group with no matching\n * entry falls back to the default palette color (the client's own fallback there\n * is a raw blue, which reads as a rendering bug in chat).\n */\nfunction groupBaseColor(\n formatting: FuseFormattingEntry[] | null | undefined,\n groupLabel: string,\n): string {\n if (!formatting?.length || !groupLabel) {\n return resolveFormattingColor([{ key: 'default', color: '1' }], 'default', 1);\n }\n const matched = formatting.filter((entry) => String(entry.key) === groupLabel);\n if (!matched.length) return resolveFormattingColor(undefined, 'default', 1);\n return resolveFormattingColor(matched, String(matched[0].key ?? 'default'), 1);\n}\n\nfunction toNumber(value: unknown): number {\n const n = Number(value);\n return Number.isFinite(n) ? n : 0;\n}\n\nfunction fromFuseWidget(widget: FuseWidgetLike): TreemapModel {\n const categoryField = firstField(widget.groupBy ?? undefined) ?? firstField(widget.xAxe ?? undefined);\n const valueField = firstField(widget.metric ?? undefined) ?? firstField(widget.yAxe ?? undefined);\n const rawSubgroup = widget.subgroup ? String(widget.subgroup) : undefined;\n // Grouped only makes sense with a *second*, distinct dimension to nest —\n // otherwise the area-by-value encoding is lost to equal-height bands (FUS-3868).\n const subgroupField =\n rawSubgroup && rawSubgroup !== categoryField ? rawSubgroup : undefined;\n\n const rows = rowsOf(widget);\n const getValue = (row: RawRow) => (valueField ? toNumber(row?.[valueField]) : 0);\n const axisDetails = widget.axisDetails ?? undefined;\n const paletteRange = widget.palette?.range;\n\n if (!subgroupField) {\n const entries = categoryField\n ? aggregateByCategory(rows, categoryField, getValue)\n : // Without a category dimension the client keeps the raw per-row nodes.\n rows.map((row, i) => ({ key: String(i), label: '', value: getValue(row) }));\n const { tiles, rangeColors } = tilesFrom(entries, singleBaseColor(widget.formatting), paletteRange);\n return {\n mode: 'single',\n tiles,\n groups: [],\n rangeColors,\n categoryField,\n valueField,\n axisDetails,\n };\n }\n\n const grouped = new Map<string, { label: string; rows: RawRow[] }>();\n for (const row of rows) {\n if (!categoryField) continue;\n const label = displayLabel(row?.[categoryField]);\n if (!label) continue;\n const key = label.toLowerCase();\n const bucket = grouped.get(key);\n if (bucket) bucket.rows.push(row);\n else grouped.set(key, { label, rows: [row] });\n }\n\n const groups: TreemapGroupCard[] = [...grouped.entries()]\n .sort(([, a], [, b]) => a.label.localeCompare(b.label))\n .map(([key, { label, rows: groupRows }]) => ({\n key,\n label,\n tiles: tilesFrom(\n aggregateByCategory(groupRows, subgroupField, getValue),\n groupBaseColor(widget.formatting, label),\n paletteRange,\n ).tiles,\n }));\n\n return {\n mode: 'grouped',\n tiles: [],\n groups,\n rangeColors: [],\n categoryField,\n valueField,\n subgroupField,\n axisDetails,\n };\n}\n\nfunction fromLabelValue(rows: TreemapLabelValue[]): TreemapModel {\n const entries = rows\n .map((row) => ({\n key: normalizeKey(row.label),\n label: displayLabel(row.label),\n value: Number(row.value),\n }))\n .filter((row) => Number.isFinite(row.value));\n if (!entries.length) return EMPTY;\n\n const { tiles, rangeColors } = tilesFrom(\n entries.sort((a, b) => b.value - a.value || a.label.localeCompare(b.label)),\n singleBaseColor(undefined),\n );\n // An explicit per-row color wins over the magnitude band.\n const overrides = new Map(\n rows\n .filter((row) => row.color)\n .map((row) => [normalizeKey(row.label), row.color as string]),\n );\n return {\n mode: 'single',\n tiles: tiles.map((tile) => {\n const override = overrides.get(tile.key);\n return override ? { ...tile, color: override, lightFill: hasLightColor(override) } : tile;\n }),\n groups: [],\n rangeColors,\n };\n}\n\nfunction fromPoints(points: TreemapPoint[]): TreemapModel {\n return fromLabelValue(points.map((point) => ({ label: String(point.x), value: Number(point.y) })));\n}\n\nfunction fromSeries(series: TreemapSeries[]): TreemapModel {\n const groups = series\n .map((entry, index): TreemapGroupCard => {\n const label = entry.name ?? entry.id;\n const entries = aggregateByCategory(\n (entry.points ?? []) as unknown as RawRow[],\n 'x',\n (row) => toNumber(row.y),\n );\n return {\n key: normalizeKey(label),\n label: displayLabel(label),\n tiles: tilesFrom(entries, entry.color ?? seriesColor(index)).tiles,\n };\n })\n .filter((group) => group.tiles.length > 0);\n\n if (!groups.length) return EMPTY;\n return { mode: 'grouped', tiles: [], groups, rangeColors: [] };\n}\n\nfunction isLabelValueArray(input: unknown): input is TreemapLabelValue[] {\n if (!Array.isArray(input) || !input.length) return false;\n const first = input[0] as RawRow;\n return first != null && typeof first === 'object' && 'label' in first && 'value' in first;\n}\n\n/** Normalize chat payloads and FuseDash widget mocks into treemap leaves. */\nexport function normalizeTreemapData(input: TreemapChartData): TreemapModel {\n if (!input) return EMPTY;\n\n if (Array.isArray(input)) {\n return isLabelValueArray(input) ? fromLabelValue(input) : EMPTY;\n }\n\n if (isFuseWidgetPayload(input)) return fromFuseWidget(input);\n\n const shorthand = input as { points?: TreemapPoint[]; series?: TreemapSeries[] };\n if (Array.isArray(shorthand.series) && shorthand.series.length) {\n return fromSeries(shorthand.series);\n }\n if (Array.isArray(shorthand.points) && shorthand.points.length) {\n return fromPoints(shorthand.points);\n }\n\n return EMPTY;\n}\n"],"names":[],"mappings":";;;;AA0BA,MAAM,QAAsB,EAAE,MAAM,UAAU,OAAO,CAAA,GAAI,QAAQ,CAAA,GAAI,aAAa,GAAC;AAGnF,SAAS,aAAa,KAAsB;AAC1C,SAAO,aAAa,GAAG,EAAE,YAAA;AAC3B;AAGA,SAAS,aAAa,KAAsB;AAC1C,SAAO,OAAO,OAAO,EAAE,EACpB,OACA,QAAQ,QAAQ,GAAG;AACxB;AASA,SAAS,oBACP,MACA,aACA,UACa;AACb,QAAM,4BAAY,IAAA;AAClB,aAAW,OAAO,MAAM;AACtB,UAAM,MAAM,cAAc,2BAAM,eAAe;AAC/C,UAAM,MAAM,aAAa,GAAG;AAC5B,UAAM,WAAW,MAAM,IAAI,GAAG;AAC9B,QAAI,UAAU;AACZ,eAAS,SAAS,SAAS,GAAG;AAAA,IAChC,OAAO;AACL,YAAM,IAAI,KAAK,EAAE,KAAK,OAAO,aAAa,GAAG,GAAG,OAAO,SAAS,GAAG,EAAA,CAAG;AAAA,IACxE;AAAA,EACF;AACA,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UAAU,OAAO,QAAQ;AAC9D,WAAO,WAAW,UAAU,MAAM;AAAA,EACpC;AACA,MAAI,MAAM,QAAQ,UAAU,MAAM,KAAK,UAAU,OAAO,QAAQ;AAC9D,WAAO,WAAW,UAAU,MAAM;AAAA,EACpC;AAEA,SAAO;AACT;"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { FuseAxisDetail, FuseWidgetLike } from '../../../utils/fuse-widget.js';
|
|
2
|
+
/**
|
|
3
|
+
* FuseDash routes on a *second* dimension: `subgroup` distinct from
|
|
4
|
+
* `groupBy[0]` renders one card per group (`TreemapGroup`), anything else
|
|
5
|
+
* renders a single area-proportional treemap (`TreemapSingle`). See FUS-3868.
|
|
6
|
+
*/
|
|
7
|
+
export type TreemapMode = 'single' | 'grouped';
|
|
8
|
+
/** One leaf rectangle — area encodes `value`, fill encodes its magnitude band. */
|
|
9
|
+
export interface TreemapTile {
|
|
10
|
+
/** Case/whitespace-normalized grouping key */
|
|
11
|
+
key: string;
|
|
12
|
+
/** Display label (first-seen trimmed spelling) */
|
|
13
|
+
label: string;
|
|
14
|
+
value: number;
|
|
15
|
+
color: string;
|
|
16
|
+
/** True when `color` is bright enough to need dark text (client `hasLightColor`) */
|
|
17
|
+
lightFill: boolean;
|
|
18
|
+
}
|
|
19
|
+
/** One card of the grouped treemap: a group header plus its subgroup tiles. */
|
|
20
|
+
export interface TreemapGroupCard {
|
|
21
|
+
key: string;
|
|
22
|
+
label: string;
|
|
23
|
+
tiles: TreemapTile[];
|
|
24
|
+
}
|
|
25
|
+
export interface TreemapModel {
|
|
26
|
+
mode: TreemapMode;
|
|
27
|
+
/** Single mode leaves; empty in grouped mode */
|
|
28
|
+
tiles: TreemapTile[];
|
|
29
|
+
/** Grouped mode cards; empty in single mode */
|
|
30
|
+
groups: TreemapGroupCard[];
|
|
31
|
+
/** Sequential band colors, low → high — the palette legend in single mode */
|
|
32
|
+
rangeColors: string[];
|
|
33
|
+
/** FuseDash `groupBy[0] ?? xAxe[0]` — the category dimension */
|
|
34
|
+
categoryField?: string;
|
|
35
|
+
/** FuseDash `metric[0] ?? yAxe[0]` — the measured column */
|
|
36
|
+
valueField?: string;
|
|
37
|
+
/** FuseDash `subgroup` — the nested dimension, and each card's caption */
|
|
38
|
+
subgroupField?: string;
|
|
39
|
+
axisDetails?: Record<string, FuseAxisDetail>;
|
|
40
|
+
}
|
|
41
|
+
/** Chat shorthand: one tile per point. */
|
|
42
|
+
export interface TreemapPoint {
|
|
43
|
+
x: string;
|
|
44
|
+
y: number;
|
|
45
|
+
}
|
|
46
|
+
/** Chat shorthand: one card per series, one tile per point. */
|
|
47
|
+
export interface TreemapSeries {
|
|
48
|
+
id: string;
|
|
49
|
+
name?: string;
|
|
50
|
+
color?: string;
|
|
51
|
+
points: TreemapPoint[];
|
|
52
|
+
}
|
|
53
|
+
export type TreemapLabelValue = {
|
|
54
|
+
label: string;
|
|
55
|
+
value: number;
|
|
56
|
+
color?: string;
|
|
57
|
+
};
|
|
58
|
+
export type TreemapChartData = TreemapLabelValue[] | {
|
|
59
|
+
points: TreemapPoint[];
|
|
60
|
+
} | {
|
|
61
|
+
series: TreemapSeries[];
|
|
62
|
+
} | FuseWidgetLike | null | undefined;
|
|
63
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/treemap-chart/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpF;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE/C,kFAAkF;AAClF,MAAM,WAAW,WAAW;IAC1B,8CAA8C;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAA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,SAAS,CAAC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
"id": "treemap-chart",
|
|
3
|
+
"tag": "ui9000-treemap-chart",
|
|
4
|
+
"title": "Treemap",
|
|
5
|
+
"description": "Chat-optimized treemap rewritten in D3 (Visx → D3). One area-proportional `treemapBinary` layout when the widget has a single category dimension, or the FuseDash card mosaic with a nested treemap per group when `subgroup` adds a second dimension. Tiles are colored by magnitude across seven shades of the group color. No Redux.",
|
|
6
|
+
"chartTypeKeys": ["treemapChart"],
|
|
7
|
+
"chartTypeMap": {
|
|
8
|
+
"treemapChart": { "showLegend": true, "showTooltip": true }
|
|
9
|
+
},
|
|
10
|
+
"source": "client/libs/shared/components/src/Widgets/Treemap/",
|
|
11
|
+
"stack": "d3",
|
|
12
|
+
"lazyImport": "@fusedashlabs/widgets/lazy/treemap-chart",
|
|
13
|
+
"entry": "@fusedashlabs/widgets/treemap-chart",
|
|
14
|
+
"usageConditions": {
|
|
15
|
+
"host": "mcp-chat",
|
|
16
|
+
"notFor": "fusedash-editor",
|
|
17
|
+
"mapsExcluded": true,
|
|
18
|
+
"context": "theme, scale, styleId and mode come from WidgetContext CSS custom properties, not props"
|
|
19
|
+
},
|
|
20
|
+
"allowedActions": ["hover", "resize"],
|
|
21
|
+
"propsSchema": {
|
|
22
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
23
|
+
"type": "object",
|
|
24
|
+
"properties": {
|
|
25
|
+
"data": {
|
|
26
|
+
"oneOf": [
|
|
27
|
+
{
|
|
28
|
+
"type": "array",
|
|
29
|
+
"description": "Chat shorthand — one tile per row, area proportional to `value`.",
|
|
30
|
+
"items": {
|
|
31
|
+
"type": "object",
|
|
32
|
+
"required": ["label", "value"],
|
|
33
|
+
"properties": {
|
|
34
|
+
"label": { "type": "string" },
|
|
35
|
+
"value": { "type": "number" },
|
|
36
|
+
"color": { "type": "string" }
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"type": "object",
|
|
42
|
+
"properties": {
|
|
43
|
+
"points": {
|
|
44
|
+
"type": "array",
|
|
45
|
+
"items": {
|
|
46
|
+
"type": "object",
|
|
47
|
+
"required": ["x", "y"],
|
|
48
|
+
"properties": {
|
|
49
|
+
"x": { "type": "string" },
|
|
50
|
+
"y": { "type": "number" }
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"series": {
|
|
55
|
+
"type": "array",
|
|
56
|
+
"description": "One card per series — the grouped treemap.",
|
|
57
|
+
"items": {
|
|
58
|
+
"type": "object",
|
|
59
|
+
"required": ["id", "points"],
|
|
60
|
+
"properties": {
|
|
61
|
+
"id": { "type": "string" },
|
|
62
|
+
"name": { "type": "string" },
|
|
63
|
+
"color": { "type": "string" },
|
|
64
|
+
"points": {
|
|
65
|
+
"type": "array",
|
|
66
|
+
"items": {
|
|
67
|
+
"type": "object",
|
|
68
|
+
"required": ["x", "y"],
|
|
69
|
+
"properties": {
|
|
70
|
+
"x": { "type": "string" },
|
|
71
|
+
"y": { "type": "number" }
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"type": "object",
|
|
82
|
+
"description": "FuseDash WidgetItem — `data` rows plus `groupBy` / `subgroup` / `metric` / `yAxe` / `formatting`.",
|
|
83
|
+
"required": ["data"],
|
|
84
|
+
"properties": {
|
|
85
|
+
"name": { "type": "string" },
|
|
86
|
+
"data": { "type": "array", "items": { "type": "object" } },
|
|
87
|
+
"xAxe": { "type": "array", "items": { "type": "string" } },
|
|
88
|
+
"yAxe": { "type": "array", "items": { "type": "string" } },
|
|
89
|
+
"groupBy": { "type": "array", "items": { "type": "string" } },
|
|
90
|
+
"metric": { "type": "array", "items": { "type": "string" } },
|
|
91
|
+
"subgroup": {
|
|
92
|
+
"type": "string",
|
|
93
|
+
"description": "Second dimension; when set and distinct from `groupBy[0]` the chart renders one card per group."
|
|
94
|
+
},
|
|
95
|
+
"formatting": { "type": "array", "items": { "type": "object" } },
|
|
96
|
+
"palette": {
|
|
97
|
+
"type": "object",
|
|
98
|
+
"properties": {
|
|
99
|
+
"range": {
|
|
100
|
+
"type": "array",
|
|
101
|
+
"items": { "type": "number" },
|
|
102
|
+
"description": "Pins the color break points instead of deriving them from the values."
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"uniqueValues": { "type": "object" },
|
|
107
|
+
"axisDetails": { "type": "object" }
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
"chartTitle": { "type": "string" },
|
|
113
|
+
"showHeader": { "type": "boolean", "default": true },
|
|
114
|
+
"showLegend": {
|
|
115
|
+
"type": "boolean",
|
|
116
|
+
"default": true,
|
|
117
|
+
"description": "Low→High palette strip; single-dimension treemaps only."
|
|
118
|
+
},
|
|
119
|
+
"showTooltip": { "type": "boolean", "default": true }
|
|
120
|
+
},
|
|
121
|
+
"required": ["data"]
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
;
|
|
125
|
+
|
|
126
|
+
export default _default;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const id = "treemap-chart";
|
|
2
|
+
const tag = "ui9000-treemap-chart";
|
|
3
|
+
const title = "Treemap";
|
|
4
|
+
const description = "Chat-optimized treemap rewritten in D3 (Visx → D3). One area-proportional `treemapBinary` layout when the widget has a single category dimension, or the FuseDash card mosaic with a nested treemap per group when `subgroup` adds a second dimension. Tiles are colored by magnitude across seven shades of the group color. No Redux.";
|
|
5
|
+
const chartTypeKeys = ["treemapChart"];
|
|
6
|
+
const chartTypeMap = { "treemapChart": { "showLegend": true, "showTooltip": true } };
|
|
7
|
+
const source = "client/libs/shared/components/src/Widgets/Treemap/";
|
|
8
|
+
const stack = "d3";
|
|
9
|
+
const lazyImport = "@fusedashlabs/widgets/lazy/treemap-chart";
|
|
10
|
+
const entry = "@fusedashlabs/widgets/treemap-chart";
|
|
11
|
+
const usageConditions = { "host": "mcp-chat", "notFor": "fusedash-editor", "mapsExcluded": true, "context": "theme, scale, styleId and mode come from WidgetContext CSS custom properties, not props" };
|
|
12
|
+
const allowedActions = ["hover", "resize"];
|
|
13
|
+
const propsSchema = { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "data": { "oneOf": [{ "type": "array", "description": "Chat shorthand — one tile per row, area proportional to `value`.", "items": { "type": "object", "required": ["label", "value"], "properties": { "label": { "type": "string" }, "value": { "type": "number" }, "color": { "type": "string" } } } }, { "type": "object", "properties": { "points": { "type": "array", "items": { "type": "object", "required": ["x", "y"], "properties": { "x": { "type": "string" }, "y": { "type": "number" } } } }, "series": { "type": "array", "description": "One card per series — the grouped treemap.", "items": { "type": "object", "required": ["id", "points"], "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "color": { "type": "string" }, "points": { "type": "array", "items": { "type": "object", "required": ["x", "y"], "properties": { "x": { "type": "string" }, "y": { "type": "number" } } } } } } } } }, { "type": "object", "description": "FuseDash WidgetItem — `data` rows plus `groupBy` / `subgroup` / `metric` / `yAxe` / `formatting`.", "required": ["data"], "properties": { "name": { "type": "string" }, "data": { "type": "array", "items": { "type": "object" } }, "xAxe": { "type": "array", "items": { "type": "string" } }, "yAxe": { "type": "array", "items": { "type": "string" } }, "groupBy": { "type": "array", "items": { "type": "string" } }, "metric": { "type": "array", "items": { "type": "string" } }, "subgroup": { "type": "string", "description": "Second dimension; when set and distinct from `groupBy[0]` the chart renders one card per group." }, "formatting": { "type": "array", "items": { "type": "object" } }, "palette": { "type": "object", "properties": { "range": { "type": "array", "items": { "type": "number" }, "description": "Pins the color break points instead of deriving them from the values." } } }, "uniqueValues": { "type": "object" }, "axisDetails": { "type": "object" } } }] }, "chartTitle": { "type": "string" }, "showHeader": { "type": "boolean", "default": true }, "showLegend": { "type": "boolean", "default": true, "description": "Low→High palette strip; single-dimension treemaps only." }, "showTooltip": { "type": "boolean", "default": true } }, "required": ["data"] };
|
|
14
|
+
const treemapMeta = {
|
|
15
|
+
id,
|
|
16
|
+
tag,
|
|
17
|
+
title,
|
|
18
|
+
description,
|
|
19
|
+
chartTypeKeys,
|
|
20
|
+
chartTypeMap,
|
|
21
|
+
source,
|
|
22
|
+
stack,
|
|
23
|
+
lazyImport,
|
|
24
|
+
entry,
|
|
25
|
+
usageConditions,
|
|
26
|
+
allowedActions,
|
|
27
|
+
propsSchema
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
allowedActions,
|
|
31
|
+
chartTypeKeys,
|
|
32
|
+
chartTypeMap,
|
|
33
|
+
treemapMeta as default,
|
|
34
|
+
description,
|
|
35
|
+
entry,
|
|
36
|
+
id,
|
|
37
|
+
lazyImport,
|
|
38
|
+
propsSchema,
|
|
39
|
+
source,
|
|
40
|
+
stack,
|
|
41
|
+
tag,
|
|
42
|
+
title,
|
|
43
|
+
usageConditions
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=metadata.json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { WidgetTheme } from '../../../types/index.js';
|
|
2
|
+
import { TreemapGroupCard, TreemapModel, TreemapTile } from '../lib/types.js';
|
|
3
|
+
export interface TreemapHoverPayload {
|
|
4
|
+
tile: TreemapTile;
|
|
5
|
+
/** The card the tile belongs to, in grouped mode */
|
|
6
|
+
group?: TreemapGroupCard;
|
|
7
|
+
event: MouseEvent;
|
|
8
|
+
}
|
|
9
|
+
export interface RenderTreemapChartOptions {
|
|
10
|
+
model: TreemapModel;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
theme: WidgetTheme;
|
|
14
|
+
showTooltip?: boolean;
|
|
15
|
+
onHover?: (payload: TreemapHoverPayload) => void;
|
|
16
|
+
onLeave?: () => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* FuseDash Treemap — D3 rewrite of the Visx `TreemapSingle` / `TreemapGroup`.
|
|
20
|
+
* Single mode is one area-proportional `treemapBinary` layout; grouped mode is
|
|
21
|
+
* the client's card mosaic with a nested treemap per group.
|
|
22
|
+
*/
|
|
23
|
+
export declare function renderTreemapChart(container: HTMLElement, options: RenderTreemapChartOptions): void;
|
|
24
|
+
//# sourceMappingURL=draw.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draw.d.ts","sourceRoot":"","sources":["../../../../src/components/treemap-chart/render/draw.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAI3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,WAAW,CAAC;IAClB,oDAAoD;IACpD,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,UAAU,CAAC;CACnB;AAED,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,WAAW,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACjD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAsLD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,WAAW,EACtB,OAAO,EAAE,yBAAyB,GACjC,IAAI,CAyDN"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { hierarchy, treemap, treemapBinary } from "d3-hierarchy";
|
|
2
|
+
import { select } from "d3-selection";
|
|
3
|
+
import { FD } from "../../../utils/fusedash-visual.js";
|
|
4
|
+
import { formatTreemapValue } from "../lib/format.js";
|
|
5
|
+
import { treemapGridTemplate } from "../lib/layout.js";
|
|
6
|
+
function gradientIds(svg, colors, prefix) {
|
|
7
|
+
const defs = svg.append("defs");
|
|
8
|
+
const ids = /* @__PURE__ */ new Map();
|
|
9
|
+
let index = 0;
|
|
10
|
+
for (const color of new Set(colors)) {
|
|
11
|
+
const id = `${prefix}-fill-${index++}`;
|
|
12
|
+
const gradient = defs.append("linearGradient").attr("id", id).attr("x1", "0").attr("y1", "0").attr("x2", "0").attr("y2", "1");
|
|
13
|
+
gradient.append("stop").attr("offset", "0%").attr("stop-color", color).attr("stop-opacity", 1);
|
|
14
|
+
gradient.append("stop").attr("offset", "100%").attr("stop-color", color).attr("stop-opacity", FD.treemapGradientBottomOpacity);
|
|
15
|
+
ids.set(color, id);
|
|
16
|
+
}
|
|
17
|
+
return ids;
|
|
18
|
+
}
|
|
19
|
+
function appendStripes(parent, width, height, clipId) {
|
|
20
|
+
const count = Math.floor(height / FD.treemapStripeSpacing);
|
|
21
|
+
if (count <= 0) return;
|
|
22
|
+
const clip = parent.append("clipPath").attr("id", clipId);
|
|
23
|
+
clip.append("rect").attr("width", width).attr("height", height).attr("rx", FD.treemapTileRadius).attr("ry", FD.treemapTileRadius);
|
|
24
|
+
const stripes = parent.append("g").attr("clip-path", `url(#${clipId})`);
|
|
25
|
+
for (let i = 0; i < count; i++) {
|
|
26
|
+
const y = Math.round((i + 1) * FD.treemapStripeSpacing) + 0.5;
|
|
27
|
+
const progress = y / height;
|
|
28
|
+
const opacity = Math.max(0, FD.treemapStripeOpacity * (1 - progress * FD.treemapStripeFalloff));
|
|
29
|
+
stripes.append("line").attr("x1", 0).attr("x2", width).attr("y1", y).attr("y2", y).attr("stroke", FD.treemapStripeColor).attr("stroke-opacity", opacity).attr("stroke-width", 1).attr("shape-rendering", "crispEdges");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function appendLabel(parent, tile, width, height, mode) {
|
|
33
|
+
if (width <= FD.treemapMinLabelWidth || height <= FD.treemapMinLabelHeight) return;
|
|
34
|
+
const box = parent.append("foreignObject").attr("width", width).attr("height", height).append("xhtml:div").attr("class", "tile-label").style("color", tile.lightFill ? FD.treemapLabelOnLight : FD.treemapLabelOnDark);
|
|
35
|
+
box.append("xhtml:span").attr("class", "tile-name").text(tile.label);
|
|
36
|
+
if (height > FD.treemapMinValueHeight && tile.value) {
|
|
37
|
+
box.append("xhtml:span").attr("class", "tile-value").text(formatTreemapValue(tile.value, mode));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function drawTiles(host, tiles, width, height, options, layer, prefix, group) {
|
|
41
|
+
if (!tiles.length || width <= 0 || height <= 0) return;
|
|
42
|
+
const root = hierarchy({ children: tiles.map((tile) => ({ tile })) }).sum((d) => {
|
|
43
|
+
var _a;
|
|
44
|
+
return ((_a = d.tile) == null ? void 0 : _a.value) ?? 0;
|
|
45
|
+
}).sort((a, b) => (b.value ?? 0) - (a.value ?? 0));
|
|
46
|
+
const layout = treemap().tile(treemapBinary).size([width, height]).paddingInner(FD.treemapPaddingInner).round(true)(root);
|
|
47
|
+
const svg = select(host).append("svg").attr("width", width).attr("height", height).attr("viewBox", `0 0 ${width} ${height}`);
|
|
48
|
+
const fills = gradientIds(
|
|
49
|
+
svg,
|
|
50
|
+
tiles.map((tile) => tile.color),
|
|
51
|
+
prefix
|
|
52
|
+
);
|
|
53
|
+
layout.leaves().forEach((leaf, index) => {
|
|
54
|
+
const tile = leaf.data.tile;
|
|
55
|
+
if (!tile) return;
|
|
56
|
+
const tileWidth = leaf.x1 - leaf.x0;
|
|
57
|
+
const tileHeight = leaf.y1 - leaf.y0;
|
|
58
|
+
if (tileWidth <= 0 || tileHeight <= 0) return;
|
|
59
|
+
const node = svg.append("g").attr("class", "treemap-tile").attr("transform", `translate(${leaf.x0}, ${leaf.y0})`);
|
|
60
|
+
node.append("rect").attr("width", tileWidth).attr("height", tileHeight).attr("rx", FD.treemapTileRadius).attr("ry", FD.treemapTileRadius).attr("fill", `url(#${fills.get(tile.color)})`);
|
|
61
|
+
appendStripes(node, tileWidth, tileHeight, `${prefix}-clip-${index}`);
|
|
62
|
+
appendLabel(node, tile, tileWidth, tileHeight, options.model.mode);
|
|
63
|
+
layer.nodes.push(node.node());
|
|
64
|
+
if (options.showTooltip && options.onHover) {
|
|
65
|
+
const dim = (hovered) => {
|
|
66
|
+
for (const other of layer.nodes) {
|
|
67
|
+
other.style.opacity = hovered == null || other === hovered ? "1" : String(FD.treemapDimOpacity);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
node.style("cursor", "pointer").on("mouseenter", (event) => {
|
|
71
|
+
var _a;
|
|
72
|
+
dim(node.node());
|
|
73
|
+
(_a = options.onHover) == null ? void 0 : _a.call(options, { tile, group, event });
|
|
74
|
+
}).on("mousemove", (event) => {
|
|
75
|
+
var _a;
|
|
76
|
+
(_a = options.onHover) == null ? void 0 : _a.call(options, { tile, group, event });
|
|
77
|
+
}).on("mouseleave", () => {
|
|
78
|
+
var _a;
|
|
79
|
+
dim(null);
|
|
80
|
+
(_a = options.onLeave) == null ? void 0 : _a.call(options);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function renderTreemapChart(container, options) {
|
|
86
|
+
const { model, width, height, theme } = options;
|
|
87
|
+
container.replaceChildren();
|
|
88
|
+
if (width <= 0 || height <= 0) return;
|
|
89
|
+
const layer = { nodes: [] };
|
|
90
|
+
if (model.mode === "single") {
|
|
91
|
+
drawTiles(container, model.tiles, width, height, options, layer, "tm");
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const template = treemapGridTemplate(model.groups.length);
|
|
95
|
+
const grid = select(container).append("div").attr("class", "treemap-groups");
|
|
96
|
+
grid.style("grid-template-areas", template.areas).style("grid-template-rows", template.rows);
|
|
97
|
+
const plots = [];
|
|
98
|
+
model.groups.forEach((group, index) => {
|
|
99
|
+
const card = grid.append("div").attr("class", "treemap-card").style("grid-area", `_${index + 1}`);
|
|
100
|
+
const header = card.append("div").attr("class", "treemap-card-header");
|
|
101
|
+
header.append("span").attr("class", "treemap-card-title").attr("title", group.label).style("color", theme.text).text(group.label);
|
|
102
|
+
if (model.subgroupField) {
|
|
103
|
+
header.append("span").attr("class", "treemap-card-subtitle").attr("title", model.subgroupField).style("color", theme.textMuted).text(model.subgroupField);
|
|
104
|
+
}
|
|
105
|
+
const host = card.append("div").attr("class", "treemap-card-plot").node();
|
|
106
|
+
plots.push({ host, group, index });
|
|
107
|
+
});
|
|
108
|
+
for (const { host, group, index } of plots) {
|
|
109
|
+
drawTiles(
|
|
110
|
+
host,
|
|
111
|
+
group.tiles,
|
|
112
|
+
host.clientWidth,
|
|
113
|
+
host.clientHeight,
|
|
114
|
+
options,
|
|
115
|
+
layer,
|
|
116
|
+
`tm-${index}`,
|
|
117
|
+
group
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
renderTreemapChart
|
|
123
|
+
};
|
|
124
|
+
//# sourceMappingURL=draw.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draw.js","sources":["../../../../src/components/treemap-chart/render/draw.ts"],"sourcesContent":["import { hierarchy, treemap, treemapBinary } from 'd3-hierarchy';\nimport { select, type Selection } from 'd3-selection';\n\nimport type { WidgetTheme } from '../../../types/index.js';\nimport { FD } from '../../../utils/fusedash-visual.js';\nimport { formatTreemapValue } from '../lib/format.js';\nimport { treemapGridTemplate } from '../lib/layout.js';\nimport type { TreemapGroupCard, TreemapModel, TreemapTile } from '../lib/types.js';\n\nexport interface TreemapHoverPayload {\n tile: TreemapTile;\n /** The card the tile belongs to, in grouped mode */\n group?: TreemapGroupCard;\n event: MouseEvent;\n}\n\nexport interface RenderTreemapChartOptions {\n model: TreemapModel;\n width: number;\n height: number;\n theme: WidgetTheme;\n showTooltip?: boolean;\n onHover?: (payload: TreemapHoverPayload) => void;\n onLeave?: () => void;\n}\n\ntype HierarchyDatum = { tile?: TreemapTile; children?: HierarchyDatum[] };\n\ninterface TileLayer {\n /** Every tile group drawn for this widget — hover dims all but one */\n nodes: SVGGElement[];\n}\n\n/** One vertical gradient per distinct band color, shared by every tile using it. */\nfunction gradientIds(\n svg: Selection<SVGSVGElement, unknown, null, undefined>,\n colors: string[],\n prefix: string,\n): Map<string, string> {\n const defs = svg.append('defs');\n const ids = new Map<string, string>();\n let index = 0;\n for (const color of new Set(colors)) {\n const id = `${prefix}-fill-${index++}`;\n const gradient = defs\n .append('linearGradient')\n .attr('id', id)\n .attr('x1', '0')\n .attr('y1', '0')\n .attr('x2', '0')\n .attr('y2', '1');\n gradient.append('stop').attr('offset', '0%').attr('stop-color', color).attr('stop-opacity', 1);\n gradient\n .append('stop')\n .attr('offset', '100%')\n .attr('stop-color', color)\n .attr('stop-opacity', FD.treemapGradientBottomOpacity);\n ids.set(color, id);\n }\n return ids;\n}\n\n/** White scanlines fading toward the bottom, clipped to the rounded tile. */\nfunction appendStripes(\n parent: Selection<SVGGElement, unknown, null, undefined>,\n width: number,\n height: number,\n clipId: string,\n): void {\n const count = Math.floor(height / FD.treemapStripeSpacing);\n if (count <= 0) return;\n\n const clip = parent.append('clipPath').attr('id', clipId);\n clip\n .append('rect')\n .attr('width', width)\n .attr('height', height)\n .attr('rx', FD.treemapTileRadius)\n .attr('ry', FD.treemapTileRadius);\n\n const stripes = parent.append('g').attr('clip-path', `url(#${clipId})`);\n for (let i = 0; i < count; i++) {\n const y = Math.round((i + 1) * FD.treemapStripeSpacing) + 0.5;\n const progress = y / height;\n const opacity = Math.max(0, FD.treemapStripeOpacity * (1 - progress * FD.treemapStripeFalloff));\n stripes\n .append('line')\n .attr('x1', 0)\n .attr('x2', width)\n .attr('y1', y)\n .attr('y2', y)\n .attr('stroke', FD.treemapStripeColor)\n .attr('stroke-opacity', opacity)\n .attr('stroke-width', 1)\n .attr('shape-rendering', 'crispEdges');\n }\n}\n\n/** Name (+ value on taller tiles) as HTML so long labels ellipsize like the client. */\nfunction appendLabel(\n parent: Selection<SVGGElement, unknown, null, undefined>,\n tile: TreemapTile,\n width: number,\n height: number,\n mode: TreemapModel['mode'],\n): void {\n if (width <= FD.treemapMinLabelWidth || height <= FD.treemapMinLabelHeight) return;\n\n const box = parent\n .append('foreignObject')\n .attr('width', width)\n .attr('height', height)\n .append('xhtml:div')\n .attr('class', 'tile-label')\n .style('color', tile.lightFill ? FD.treemapLabelOnLight : FD.treemapLabelOnDark);\n\n box.append('xhtml:span').attr('class', 'tile-name').text(tile.label);\n\n if (height > FD.treemapMinValueHeight && tile.value) {\n box.append('xhtml:span').attr('class', 'tile-value').text(formatTreemapValue(tile.value, mode));\n }\n}\n\nfunction drawTiles(\n host: HTMLElement,\n tiles: TreemapTile[],\n width: number,\n height: number,\n options: RenderTreemapChartOptions,\n layer: TileLayer,\n prefix: string,\n group?: TreemapGroupCard,\n): void {\n if (!tiles.length || width <= 0 || height <= 0) return;\n\n const root = hierarchy<HierarchyDatum>({ children: tiles.map((tile) => ({ tile })) })\n .sum((d) => d.tile?.value ?? 0)\n .sort((a, b) => (b.value ?? 0) - (a.value ?? 0));\n\n const layout = treemap<HierarchyDatum>()\n .tile(treemapBinary)\n .size([width, height])\n .paddingInner(FD.treemapPaddingInner)\n .round(true)(root);\n\n const svg = select(host)\n .append('svg')\n .attr('width', width)\n .attr('height', height)\n .attr('viewBox', `0 0 ${width} ${height}`);\n\n const fills = gradientIds(\n svg,\n tiles.map((tile) => tile.color),\n prefix,\n );\n\n layout.leaves().forEach((leaf, index) => {\n const tile = leaf.data.tile;\n if (!tile) return;\n const tileWidth = leaf.x1 - leaf.x0;\n const tileHeight = leaf.y1 - leaf.y0;\n if (tileWidth <= 0 || tileHeight <= 0) return;\n\n const node = svg\n .append('g')\n .attr('class', 'treemap-tile')\n .attr('transform', `translate(${leaf.x0}, ${leaf.y0})`);\n\n node\n .append('rect')\n .attr('width', tileWidth)\n .attr('height', tileHeight)\n .attr('rx', FD.treemapTileRadius)\n .attr('ry', FD.treemapTileRadius)\n .attr('fill', `url(#${fills.get(tile.color)})`);\n\n appendStripes(node, tileWidth, tileHeight, `${prefix}-clip-${index}`);\n appendLabel(node, tile, tileWidth, tileHeight, options.model.mode);\n\n layer.nodes.push(node.node() as SVGGElement);\n\n if (options.showTooltip && options.onHover) {\n const dim = (hovered: SVGGElement | null) => {\n for (const other of layer.nodes) {\n other.style.opacity =\n hovered == null || other === hovered ? '1' : String(FD.treemapDimOpacity);\n }\n };\n node\n .style('cursor', 'pointer')\n .on('mouseenter', (event: MouseEvent) => {\n dim(node.node() as SVGGElement);\n options.onHover?.({ tile, group, event });\n })\n .on('mousemove', (event: MouseEvent) => {\n options.onHover?.({ tile, group, event });\n })\n .on('mouseleave', () => {\n dim(null);\n options.onLeave?.();\n });\n }\n });\n}\n\n/**\n * FuseDash Treemap — D3 rewrite of the Visx `TreemapSingle` / `TreemapGroup`.\n * Single mode is one area-proportional `treemapBinary` layout; grouped mode is\n * the client's card mosaic with a nested treemap per group.\n */\nexport function renderTreemapChart(\n container: HTMLElement,\n options: RenderTreemapChartOptions,\n): void {\n const { model, width, height, theme } = options;\n container.replaceChildren();\n if (width <= 0 || height <= 0) return;\n\n const layer: TileLayer = { nodes: [] };\n\n if (model.mode === 'single') {\n drawTiles(container, model.tiles, width, height, options, layer, 'tm');\n return;\n }\n\n const template = treemapGridTemplate(model.groups.length);\n const grid = select(container).append('div').attr('class', 'treemap-groups');\n grid.style('grid-template-areas', template.areas).style('grid-template-rows', template.rows);\n\n const plots: Array<{ host: HTMLElement; group: TreemapGroupCard; index: number }> = [];\n\n model.groups.forEach((group, index) => {\n const card = grid\n .append('div')\n .attr('class', 'treemap-card')\n .style('grid-area', `_${index + 1}`);\n\n const header = card.append('div').attr('class', 'treemap-card-header');\n header\n .append('span')\n .attr('class', 'treemap-card-title')\n .attr('title', group.label)\n .style('color', theme.text)\n .text(group.label);\n if (model.subgroupField) {\n header\n .append('span')\n .attr('class', 'treemap-card-subtitle')\n .attr('title', model.subgroupField)\n .style('color', theme.textMuted)\n .text(model.subgroupField);\n }\n\n const host = card.append('div').attr('class', 'treemap-card-plot').node() as HTMLElement;\n plots.push({ host, group, index });\n });\n\n // One layout flush, then each card draws into the box the grid gave it.\n for (const { host, group, index } of plots) {\n drawTiles(\n host,\n group.tiles,\n host.clientWidth,\n host.clientHeight,\n options,\n layer,\n `tm-${index}`,\n group,\n );\n }\n}\n"],"names":[],"mappings":";;;;;AAkCA,SAAS,YACP,KACA,QACA,QACqB;AACrB,QAAM,OAAO,IAAI,OAAO,MAAM;AAC9B,QAAM,0BAAU,IAAA;AAChB,MAAI,QAAQ;AACZ,aAAW,SAAS,IAAI,IAAI,MAAM,GAAG;AACnC,UAAM,KAAK,GAAG,MAAM,SAAS,OAAO;AACpC,UAAM,WAAW,KACd,OAAO,gBAAgB,EACvB,KAAK,MAAM,EAAE,EACb,KAAK,MAAM,GAAG,EACd,KAAK,MAAM,GAAG,EACd,KAAK,MAAM,GAAG,EACd,KAAK,MAAM,GAAG;AACjB,aAAS,OAAO,MAAM,EAAE,KAAK,UAAU,IAAI,EAAE,KAAK,cAAc,KAAK,EAAE,KAAK,gBAAgB,CAAC;AAC7F,aACG,OAAO,MAAM,EACb,KAAK,UAAU,MAAM,EACrB,KAAK,cAAc,KAAK,EACxB,KAAK,gBAAgB,GAAG,4BAA4B;AACvD,QAAI,IAAI,OAAO,EAAE;AAAA,EACnB;AACA,SAAO;AACT;AAGA,SAAS,cACP,QACA,OACA,QACA,QACM;AACN,QAAM,QAAQ,KAAK,MAAM,SAAS,GAAG,oBAAoB;AACzD,MAAI,SAAS,EAAG;AAEhB,QAAM,OAAO,OAAO,OAAO,UAAU,EAAE,KAAK,MAAM,MAAM;AACxD,OACG,OAAO,MAAM,EACb,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AAS,cAAc,EAC5B,MAAM,aAAa,IAAI,QAAQ,CAAC,EAAE;AAErC,UAAM,SAAS,KAAK,OAAO,KAAK,EAAE,KAAK,SAAS,qBAAqB;AACrE,WACG,OAAO,MAAM,EACb,KAAK,SAAS,oBAAoB,EAClC,KAAK,SAAS,MAAM,KAAK,EACzB,MAAM,SAAS,MAAM,IAAI,EACzB,KAAK,MAAM,KAAK;AACnB,QAAI,MAAM,eAAe;AACvB,aACG,OAAO,MAAM,EACb,KAAK,SAAS,uBAAuB,EACrC,KAAK,SAAS,MAAM,aAAa,EACjC,MAAM,SAAS,MAAM,SAAS,EAC9B,KAAK,MAAM,aAAa;AAAA,IAC7B;AAEA,UAAM,OAAO,KAAK,OAAO,KAAK,EAAE,KAAK,SAAS,mBAAmB,EAAE,KAAA;AACnE,UAAM,KAAK,EAAE,MAAM,OAAO,OAAO;AAAA,EACnC,CAAC;AAGD,aAAW,EAAE,MAAM,OAAO,MAAA,KAAW,OAAO;AAC1C;AAAA,MACE;AAAA,MACA,MAAM;AAAA,MACN,KAAK;AAAA,MACL,KAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA,MAAM,KAAK;AAAA,MACX;AAAA,IAAA;AAAA,EAEJ;AACF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/treemap-chart/render/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,yBAAyB,EAAE,KAAK,mBAAmB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -21,7 +21,7 @@ export declare class Ui9000ViolinChart extends Ui9000ChartElement {
|
|
|
21
21
|
private scheduleDraw;
|
|
22
22
|
private parseData;
|
|
23
23
|
private draw;
|
|
24
|
-
render(): import('lit').TemplateResult<1>;
|
|
24
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
25
25
|
}
|
|
26
26
|
declare global {
|
|
27
27
|
interface HTMLElementTagNameMap {
|
|
@@ -22,7 +22,7 @@ export declare class Ui9000WaterfallChart extends Ui9000ChartElement {
|
|
|
22
22
|
private parseData;
|
|
23
23
|
private renderLegend;
|
|
24
24
|
private draw;
|
|
25
|
-
render(): import('lit').TemplateResult<1>;
|
|
25
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
26
26
|
}
|
|
27
27
|
declare global {
|
|
28
28
|
interface HTMLElementTagNameMap {
|
|
@@ -16,4 +16,9 @@ export type ChartLegendEntry = {
|
|
|
16
16
|
};
|
|
17
17
|
/** HTML legend row above the plot (MCP shell — not SVG). */
|
|
18
18
|
export declare function renderChartLegend(entries: ChartLegendEntry[]): TemplateResult | typeof nothing;
|
|
19
|
+
/**
|
|
20
|
+
* FuseDash `legendType="palette"` — Low + sequential swatches + High.
|
|
21
|
+
* Used by Sankey / treemap (and any sequential-ramp chart) in the shell.
|
|
22
|
+
*/
|
|
23
|
+
export declare function renderPaletteLegend(colors: string[]): TemplateResult | typeof nothing;
|
|
19
24
|
//# sourceMappingURL=chart-legend-render.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-legend-render.d.ts","sourceRoot":"","sources":["../../src/element/chart-legend-render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAEzD,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GACnD;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,iBAAiB,CAAC;CAC3B,CAAC;AAsBF,4DAA4D;AAC5D,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,gBAAgB,EAAE,GAC1B,cAAc,GAAG,OAAO,OAAO,CAcjC"}
|
|
1
|
+
{"version":3,"file":"chart-legend-render.d.ts","sourceRoot":"","sources":["../../src/element/chart-legend-render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAEzD,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GACnD;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,iBAAiB,CAAC;CAC3B,CAAC;AAsBF,4DAA4D;AAC5D,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,gBAAgB,EAAE,GAC1B,cAAc,GAAG,OAAO,OAAO,CAcjC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EAAE,GACf,cAAc,GAAG,OAAO,OAAO,CAiBjC"}
|
|
@@ -33,7 +33,25 @@ function renderChartLegend(entries) {
|
|
|
33
33
|
</div>
|
|
34
34
|
`;
|
|
35
35
|
}
|
|
36
|
+
function renderPaletteLegend(colors) {
|
|
37
|
+
if (!colors.length) return nothing;
|
|
38
|
+
return html`
|
|
39
|
+
<div class="legend-palette" part="legend">
|
|
40
|
+
<span>Low</span>
|
|
41
|
+
<div class="legend-palette-swatches">
|
|
42
|
+
${colors.map(
|
|
43
|
+
(color) => html`<div
|
|
44
|
+
class="legend-palette-swatch"
|
|
45
|
+
style="background-color:${color}"
|
|
46
|
+
></div>`
|
|
47
|
+
)}
|
|
48
|
+
</div>
|
|
49
|
+
<span>High</span>
|
|
50
|
+
</div>
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
36
53
|
export {
|
|
37
|
-
renderChartLegend
|
|
54
|
+
renderChartLegend,
|
|
55
|
+
renderPaletteLegend
|
|
38
56
|
};
|
|
39
57
|
//# sourceMappingURL=chart-legend-render.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-legend-render.js","sources":["../../src/element/chart-legend-render.ts"],"sourcesContent":["import { html, nothing, type TemplateResult } from 'lit';\n\nexport type ChartLegendSwatch =\n | { kind: 'line'; color: string }\n | { kind: 'swatch'; color: string; opacity?: number }\n | { kind: 'dashed-line'; color: string };\n\nexport type ChartLegendEntry = {\n label: string;\n swatch: ChartLegendSwatch;\n};\n\nfunction renderSwatch(swatch: ChartLegendSwatch): TemplateResult {\n if (swatch.kind === 'swatch') {\n const opacity = swatch.opacity ?? 1;\n return html`<span\n class=\"legend-swatch\"\n style=\"background:${swatch.color};opacity:${opacity}\"\n ></span>`;\n }\n if (swatch.kind === 'dashed-line') {\n return html`<span\n class=\"legend-line legend-line--dashed\"\n style=\"--legend-color:${swatch.color}\"\n ></span>`;\n }\n return html`<span\n class=\"legend-line\"\n style=\"--legend-color:${swatch.color}\"\n ><span class=\"legend-dot\" style=\"background:${swatch.color}\"></span></span>`;\n}\n\n/** HTML legend row above the plot (MCP shell — not SVG). */\nexport function renderChartLegend(\n entries: ChartLegendEntry[],\n): TemplateResult | typeof nothing {\n if (!entries.length) return nothing;\n return html`\n <div class=\"chart-legend\" part=\"legend\">\n ${entries.map(\n (entry) => html`\n <span class=\"legend-item\">\n ${renderSwatch(entry.swatch)}\n <span class=\"legend-label\">${entry.label}</span>\n </span>\n `,\n )}\n </div>\n `;\n}\n"],"names":[],"mappings":";AAYA,SAAS,aAAa,QAA2C;AAC/D,MAAI,OAAO,SAAS,UAAU;AAC5B,UAAM,UAAU,OAAO,WAAW;AAClC,WAAO;AAAA;AAAA,0BAEe,OAAO,KAAK,YAAY,OAAO;AAAA;AAAA,EAEvD;AACA,MAAI,OAAO,SAAS,eAAe;AACjC,WAAO;AAAA;AAAA,8BAEmB,OAAO,KAAK;AAAA;AAAA,EAExC;AACA,SAAO;AAAA;AAAA,4BAEmB,OAAO,KAAK;AAAA,gDACQ,OAAO,KAAK;AAC5D;AAGO,SAAS,kBACd,SACiC;AACjC,MAAI,CAAC,QAAQ,OAAQ,QAAO;AAC5B,SAAO;AAAA;AAAA,QAED,QAAQ;AAAA,IACR,CAAC,UAAU;AAAA;AAAA,cAEL,aAAa,MAAM,MAAM,CAAC;AAAA,yCACC,MAAM,KAAK;AAAA;AAAA;AAAA,EAAA,CAG7C;AAAA;AAAA;AAGP;"}
|
|
1
|
+
{"version":3,"file":"chart-legend-render.js","sources":["../../src/element/chart-legend-render.ts"],"sourcesContent":["import { html, nothing, type TemplateResult } from 'lit';\n\nexport type ChartLegendSwatch =\n | { kind: 'line'; color: string }\n | { kind: 'swatch'; color: string; opacity?: number }\n | { kind: 'dashed-line'; color: string };\n\nexport type ChartLegendEntry = {\n label: string;\n swatch: ChartLegendSwatch;\n};\n\nfunction renderSwatch(swatch: ChartLegendSwatch): TemplateResult {\n if (swatch.kind === 'swatch') {\n const opacity = swatch.opacity ?? 1;\n return html`<span\n class=\"legend-swatch\"\n style=\"background:${swatch.color};opacity:${opacity}\"\n ></span>`;\n }\n if (swatch.kind === 'dashed-line') {\n return html`<span\n class=\"legend-line legend-line--dashed\"\n style=\"--legend-color:${swatch.color}\"\n ></span>`;\n }\n return html`<span\n class=\"legend-line\"\n style=\"--legend-color:${swatch.color}\"\n ><span class=\"legend-dot\" style=\"background:${swatch.color}\"></span></span>`;\n}\n\n/** HTML legend row above the plot (MCP shell — not SVG). */\nexport function renderChartLegend(\n entries: ChartLegendEntry[],\n): TemplateResult | typeof nothing {\n if (!entries.length) return nothing;\n return html`\n <div class=\"chart-legend\" part=\"legend\">\n ${entries.map(\n (entry) => html`\n <span class=\"legend-item\">\n ${renderSwatch(entry.swatch)}\n <span class=\"legend-label\">${entry.label}</span>\n </span>\n `,\n )}\n </div>\n `;\n}\n\n/**\n * FuseDash `legendType=\"palette\"` — Low + sequential swatches + High.\n * Used by Sankey / treemap (and any sequential-ramp chart) in the shell.\n */\nexport function renderPaletteLegend(\n colors: string[],\n): TemplateResult | typeof nothing {\n if (!colors.length) return nothing;\n return html`\n <div class=\"legend-palette\" part=\"legend\">\n <span>Low</span>\n <div class=\"legend-palette-swatches\">\n ${colors.map(\n (color) =>\n html`<div\n class=\"legend-palette-swatch\"\n style=\"background-color:${color}\"\n ></div>`,\n )}\n </div>\n <span>High</span>\n </div>\n `;\n}\n"],"names":[],"mappings":";AAYA,SAAS,aAAa,QAA2C;AAC/D,MAAI,OAAO,SAAS,UAAU;AAC5B,UAAM,UAAU,OAAO,WAAW;AAClC,WAAO;AAAA;AAAA,0BAEe,OAAO,KAAK,YAAY,OAAO;AAAA;AAAA,EAEvD;AACA,MAAI,OAAO,SAAS,eAAe;AACjC,WAAO;AAAA;AAAA,8BAEmB,OAAO,KAAK;AAAA;AAAA,EAExC;AACA,SAAO;AAAA;AAAA,4BAEmB,OAAO,KAAK;AAAA,gDACQ,OAAO,KAAK;AAC5D;AAGO,SAAS,kBACd,SACiC;AACjC,MAAI,CAAC,QAAQ,OAAQ,QAAO;AAC5B,SAAO;AAAA;AAAA,QAED,QAAQ;AAAA,IACR,CAAC,UAAU;AAAA;AAAA,cAEL,aAAa,MAAM,MAAM,CAAC;AAAA,yCACC,MAAM,KAAK;AAAA;AAAA;AAAA,EAAA,CAG7C;AAAA;AAAA;AAGP;AAMO,SAAS,oBACd,QACiC;AACjC,MAAI,CAAC,OAAO,OAAQ,QAAO;AAC3B,SAAO;AAAA;AAAA;AAAA;AAAA,UAIC,OAAO;AAAA,IACP,CAAC,UACC;AAAA;AAAA,wCAE4B,KAAK;AAAA;AAAA,EAAA,CAEpC;AAAA;AAAA;AAAA;AAAA;AAKT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-shell-styles.d.ts","sourceRoot":"","sources":["../../src/element/chart-shell-styles.ts"],"names":[],"mappings":"AAEA,oFAAoF;AACpF,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"chart-shell-styles.d.ts","sourceRoot":"","sources":["../../src/element/chart-shell-styles.ts"],"names":[],"mappings":"AAEA,oFAAoF;AACpF,eAAO,MAAM,gBAAgB,yBAyN5B,CAAC"}
|
|
@@ -165,6 +165,41 @@ const chartShellStyles = css`
|
|
|
165
165
|
transform: translate(-50%, -50%);
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
+
/* FuseDash ChartLegend legendType="palette" — Low / High sequential ramp. */
|
|
169
|
+
.legend-palette {
|
|
170
|
+
display: flex;
|
|
171
|
+
align-items: center;
|
|
172
|
+
gap: 8px;
|
|
173
|
+
flex-shrink: 0;
|
|
174
|
+
padding-top: 8px;
|
|
175
|
+
padding-bottom: 12px;
|
|
176
|
+
font-size: 12px;
|
|
177
|
+
font-weight: 400;
|
|
178
|
+
line-height: 1.2;
|
|
179
|
+
color: var(--ui9000-color-text-muted, #6c7584);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.legend-palette-swatches {
|
|
183
|
+
display: flex;
|
|
184
|
+
align-items: center;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.legend-palette-swatch {
|
|
188
|
+
width: 14px;
|
|
189
|
+
height: 8px;
|
|
190
|
+
flex-shrink: 0;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.legend-palette-swatch:first-child {
|
|
194
|
+
border-top-left-radius: 8px;
|
|
195
|
+
border-bottom-left-radius: 8px;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.legend-palette-swatch:last-child {
|
|
199
|
+
border-top-right-radius: 8px;
|
|
200
|
+
border-bottom-right-radius: 8px;
|
|
201
|
+
}
|
|
202
|
+
|
|
168
203
|
.label-tooltip {
|
|
169
204
|
position: absolute;
|
|
170
205
|
pointer-events: none;
|