@fusedashlabs/widgets 0.3.1 → 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 +22 -0
- package/README.md +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 +17 -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.js +1 -1
- package/dist/components/donut-chart/element/ui9000-donut-chart.js.map +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 +6 -1
- 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/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.map +1 -1
- package/dist/components/network-graph/element/styles.js +177 -57
- package/dist/components/network-graph/element/styles.js.map +1 -1
- package/dist/components/network-graph/element/ui9000-network-graph.d.ts +4 -0
- package/dist/components/network-graph/element/ui9000-network-graph.d.ts.map +1 -1
- package/dist/components/network-graph/element/ui9000-network-graph.js +116 -39
- package/dist/components/network-graph/element/ui9000-network-graph.js.map +1 -1
- package/dist/components/network-graph/lib/domain.d.ts +2 -2
- package/dist/components/network-graph/lib/domain.js.map +1 -1
- package/dist/components/network-graph/lib/index.d.ts +1 -0
- package/dist/components/network-graph/lib/index.d.ts.map +1 -1
- 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/render/draw.d.ts +4 -1
- package/dist/components/network-graph/render/draw.d.ts.map +1 -1
- package/dist/components/network-graph/render/draw.js +34 -9
- package/dist/components/network-graph/render/draw.js.map +1 -1
- 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 +0 -2
- 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 +1 -1
- package/dist/components/polar-area-chart/element/styles.d.ts.map +1 -1
- package/dist/components/{donut-group-chart → polar-area-chart}/element/styles.js +9 -27
- 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.map +1 -1
- package/dist/components/polar-area-chart/element/ui9000-polar-area-chart.js +4 -3
- package/dist/components/polar-area-chart/element/ui9000-polar-area-chart.js.map +1 -1
- package/dist/components/polar-area-chart/index.d.ts +1 -1
- package/dist/components/polar-area-chart/index.d.ts.map +1 -1
- package/dist/components/polar-area-chart/index.js +2 -1
- package/dist/components/polar-area-chart/lib/domain.d.ts +8 -0
- package/dist/components/polar-area-chart/lib/domain.d.ts.map +1 -1
- package/dist/components/polar-area-chart/lib/domain.js +20 -0
- package/dist/components/polar-area-chart/lib/domain.js.map +1 -1
- package/dist/components/polar-area-chart/lib/index.d.ts +1 -1
- package/dist/components/polar-area-chart/lib/index.d.ts.map +1 -1
- package/dist/components/polar-area-chart/lib/normalize.d.ts.map +1 -1
- package/dist/components/polar-area-chart/lib/normalize.js +72 -6
- package/dist/components/polar-area-chart/lib/normalize.js.map +1 -1
- package/dist/components/polar-area-chart/lib/types.d.ts +6 -1
- package/dist/components/polar-area-chart/lib/types.d.ts.map +1 -1
- package/dist/components/polar-area-chart/metadata.json.d.ts +1 -1
- package/dist/components/polar-area-chart/metadata.json.js +1 -1
- package/dist/components/polar-area-chart/render/draw.d.ts.map +1 -1
- package/dist/components/polar-area-chart/render/draw.js +2 -2
- package/dist/components/polar-area-chart/render/draw.js.map +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/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 +5 -5
- package/dist/components/sankey-chart/element/ui9000-sankey-chart.d.ts.map +1 -1
- package/dist/components/sankey-chart/element/ui9000-sankey-chart.js +37 -35
- package/dist/components/sankey-chart/element/ui9000-sankey-chart.js.map +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/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/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/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +73 -39
- package/dist/index.js.map +1 -1
- package/dist/lazy/index.d.ts +4 -2
- package/dist/lazy/index.d.ts.map +1 -1
- package/dist/lazy/index.js +24 -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/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 +28 -0
- package/dist/node_modules/lit-html/directive.js.map +1 -0
- package/dist/node_modules/lit-html/directives/style-map.js +37 -0
- package/dist/node_modules/lit-html/directives/style-map.js.map +1 -0
- package/dist/node_modules/lit-html/lit-html.js +231 -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/chart-helpers.d.ts +4 -6
- package/dist/utils/chart-helpers.d.ts.map +1 -1
- package/dist/utils/chart-helpers.js +16 -15
- package/dist/utils/chart-helpers.js.map +1 -1
- package/dist/utils/format-text.d.ts +5 -0
- package/dist/utils/format-text.d.ts.map +1 -1
- package/dist/utils/format-text.js +7 -0
- package/dist/utils/format-text.js.map +1 -1
- 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 +65 -52
- package/dist/utils/fusedash-visual.d.ts.map +1 -1
- package/dist/utils/fusedash-visual.js +48 -29
- package/dist/utils/fusedash-visual.js.map +1 -1
- package/package.json +38 -11
- 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/components/{donut-group-chart → matrix-chart}/index.js.map +0 -0
- /package/dist/components/{donut-group-chart → treemap-chart}/metadata.json.js.map +0 -0
|
@@ -25,7 +25,6 @@ let Ui9000PieChart = class extends Ui9000ChartElement {
|
|
|
25
25
|
constructor() {
|
|
26
26
|
super(...arguments);
|
|
27
27
|
this.scale = "default";
|
|
28
|
-
this.innerRadiusRatio = 0;
|
|
29
28
|
this.showLegend = true;
|
|
30
29
|
this.showTooltip = true;
|
|
31
30
|
this._tooltip = null;
|
|
@@ -82,13 +81,11 @@ let Ui9000PieChart = class extends Ui9000ChartElement {
|
|
|
82
81
|
}
|
|
83
82
|
readThemeFromElement(this);
|
|
84
83
|
const { width, height } = getPieDimensions(root);
|
|
85
|
-
const plotSize = Math.min(width, height);
|
|
86
|
-
const innerRadius = Math.max(0, Math.min(1, this.innerRadiusRatio)) * (plotSize / 2);
|
|
87
84
|
renderPieChart(root, {
|
|
88
85
|
slices: model.slices,
|
|
89
86
|
width,
|
|
90
87
|
height,
|
|
91
|
-
innerRadius,
|
|
88
|
+
innerRadius: 0,
|
|
92
89
|
showTooltip: this.showTooltip,
|
|
93
90
|
onLayout: (orderedKeys) => {
|
|
94
91
|
this._legendSlices = legendSlicesFromPieOrder(model, orderedKeys);
|
|
@@ -120,8 +117,8 @@ let Ui9000PieChart = class extends Ui9000ChartElement {
|
|
|
120
117
|
<div class="widget-shell" part="shell">
|
|
121
118
|
${this.renderShellHeader(title)}
|
|
122
119
|
<div class="widget-body">
|
|
123
|
-
${this.renderLegend()}
|
|
124
120
|
<div class="chart-root" part="chart" ?hidden=${this._empty}></div>
|
|
121
|
+
${this.renderLegend()}
|
|
125
122
|
${this._empty ? html`<div class="empty" part="empty">No data</div>` : nothing}
|
|
126
123
|
${this._tooltip ? html`<div
|
|
127
124
|
class="tooltip"
|
|
@@ -141,9 +138,6 @@ Ui9000PieChart.styles = [pieChartStyles, chartShellStyles];
|
|
|
141
138
|
__decorateClass([
|
|
142
139
|
property({ type: String, attribute: "scale" })
|
|
143
140
|
], Ui9000PieChart.prototype, "scale", 2);
|
|
144
|
-
__decorateClass([
|
|
145
|
-
property({ type: Number, attribute: "inner-radius-ratio" })
|
|
146
|
-
], Ui9000PieChart.prototype, "innerRadiusRatio", 2);
|
|
147
141
|
__decorateClass([
|
|
148
142
|
property({ type: Boolean, attribute: "show-legend" })
|
|
149
143
|
], Ui9000PieChart.prototype, "showLegend", 2);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui9000-pie-chart.js","sources":["../../../../src/components/pie-chart/element/ui9000-pie-chart.ts"],"sourcesContent":["import { html, nothing, type PropertyValues } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\n\nimport { chartShellStyles, Ui9000ChartElement } from '../../../element/ui9000-chart-base.js';\nimport { renderChartLegend } from '../../../element/chart-legend-render.js';\nimport { readThemeFromElement } from '../../../context/widget-context.js';\nimport type { WidgetScale } from '../../../types/index.js';\nimport { getPieDimensions, parseJsonAttr } from '../../../utils/chart-helpers.js';\nimport { swatchLegendEntries } from '../../../utils/chart-legend.js';\nimport { formatPiePercent } from '../lib/format.js';\nimport {\n legendSlicesFromPieOrder,\n normalizePieData,\n type PieChartData,\n type PieModel,\n type PieSlice,\n} from '../lib/index.js';\nimport { chartPropsChanged } from '../../../utils/lit-draw.js';\nimport { renderPieChart } from '../render/draw.js';\nimport { pieChartStyles } from './styles.js';\n\n@customElement('ui9000-pie-chart')\nexport class Ui9000PieChart extends Ui9000ChartElement {\n static override styles = [pieChartStyles, chartShellStyles];\n\n @property({ type: String, attribute: 'scale' })\n scale: WidgetScale = 'default';\n\n
|
|
1
|
+
{"version":3,"file":"ui9000-pie-chart.js","sources":["../../../../src/components/pie-chart/element/ui9000-pie-chart.ts"],"sourcesContent":["import { html, nothing, type PropertyValues } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\n\nimport { chartShellStyles, Ui9000ChartElement } from '../../../element/ui9000-chart-base.js';\nimport { renderChartLegend } from '../../../element/chart-legend-render.js';\nimport { readThemeFromElement } from '../../../context/widget-context.js';\nimport type { WidgetScale } from '../../../types/index.js';\nimport { getPieDimensions, parseJsonAttr } from '../../../utils/chart-helpers.js';\nimport { swatchLegendEntries } from '../../../utils/chart-legend.js';\nimport { formatPiePercent } from '../lib/format.js';\nimport {\n legendSlicesFromPieOrder,\n normalizePieData,\n type PieChartData,\n type PieModel,\n type PieSlice,\n} from '../lib/index.js';\nimport { chartPropsChanged } from '../../../utils/lit-draw.js';\nimport { renderPieChart } from '../render/draw.js';\nimport { pieChartStyles } from './styles.js';\n\n@customElement('ui9000-pie-chart')\nexport class Ui9000PieChart extends Ui9000ChartElement {\n static override styles = [pieChartStyles, chartShellStyles];\n\n @property({ type: String, attribute: 'scale' })\n scale: WidgetScale = 'default';\n\n @property({ type: Boolean, attribute: 'show-legend' })\n showLegend = true;\n\n @property({ type: Boolean, attribute: 'show-tooltip' })\n showTooltip = true;\n\n @state()\n private _tooltip: {\n x: number;\n y: number;\n xLabel: string;\n yLabel: string;\n } | null = null;\n\n @state()\n private _empty = false;\n\n @state()\n private _legendSlices: PieSlice[] = [];\n\n private _resizeObserver?: ResizeObserver;\n private _raf = 0;\n\n override connectedCallback(): void {\n super.connectedCallback();\n this._resizeObserver = new ResizeObserver(() => this.scheduleDraw());\n this._resizeObserver.observe(this);\n }\n\n override disconnectedCallback(): void {\n this._resizeObserver?.disconnect();\n cancelAnimationFrame(this._raf);\n super.disconnectedCallback();\n }\n\n override updated(changed: PropertyValues): void {\n if (chartPropsChanged(changed)) this.scheduleDraw();\n }\n\n private scheduleDraw(): void {\n cancelAnimationFrame(this._raf);\n this._raf = requestAnimationFrame(() => this.draw());\n }\n\n private parseData(): PieModel {\n const raw = parseJsonAttr<PieChartData>(this.dataJson, null);\n return normalizePieData(raw);\n }\n\n private renderLegend() {\n if (!this.showLegend || !this._legendSlices.length) return nothing;\n const theme = readThemeFromElement(this);\n return renderChartLegend(\n swatchLegendEntries(\n this._legendSlices.map((slice) => `${formatPiePercent(slice.percentage)}% - ${slice.label}`),\n theme,\n (_label, index) => this._legendSlices[index]?.color ?? theme.primary,\n ),\n );\n }\n\n private draw(): void {\n const root = this.shadowRoot?.querySelector('.chart-root') as HTMLElement | null;\n if (!root) return;\n\n const model = this.parseData();\n this._empty = model.slices.length === 0;\n if (this._empty) {\n root.replaceChildren();\n this._legendSlices = [];\n return;\n }\n\n const theme = readThemeFromElement(this);\n const { width, height } = getPieDimensions(root);\n\n renderPieChart(root, {\n slices: model.slices,\n width,\n height,\n theme,\n innerRadius: 0,\n showTooltip: this.showTooltip,\n onLayout: (orderedKeys) => {\n this._legendSlices = legendSlicesFromPieOrder(model, orderedKeys);\n },\n onHover: this.showTooltip\n ? ({ slice, event }) => {\n const rect = this.getBoundingClientRect();\n const xField = model.xField ?? 'Category';\n const yField = model.yField ?? 'Value';\n const xAxeLabel = model.axisDetails?.[xField]?.label ?? xField;\n const yAxeLabel = model.axisDetails?.[yField]?.label ?? yField;\n const symbol = model.axisDetails?.[yField]?.measure_unit_symbol ?? '';\n const valueText = symbol\n ? `${slice.value.toLocaleString()} ${symbol}`.trim()\n : slice.value.toLocaleString();\n this._tooltip = {\n x: event.clientX - rect.left,\n y: event.clientY - rect.top,\n xLabel: `${xAxeLabel}: ${slice.label}`,\n yLabel: `${yAxeLabel}: ${valueText} (${formatPiePercent(slice.percentage)}%)`,\n };\n }\n : undefined,\n onLeave: this.showTooltip ? () => { this._tooltip = null; } : undefined,\n });\n }\n\n override render() {\n const title = this.headerTitle();\n return html`\n <div class=\"widget-shell\" part=\"shell\">\n ${this.renderShellHeader(title)}\n <div class=\"widget-body\">\n <div class=\"chart-root\" part=\"chart\" ?hidden=${this._empty}></div>\n ${this.renderLegend()}\n ${this._empty\n ? html`<div class=\"empty\" part=\"empty\">No data</div>`\n : nothing}\n ${this._tooltip\n ? html`<div\n class=\"tooltip\"\n part=\"tooltip\"\n style=\"left:${this._tooltip.x}px;top:${this._tooltip.y}px\"\n >\n <div>${this._tooltip.xLabel}</div>\n <div>${this._tooltip.yLabel}</div>\n </div>`\n : nothing}\n ${this.renderShellLabelTooltip()}\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ui9000-pie-chart': Ui9000PieChart;\n }\n}\n\nexport function registerPieChart(): void {\n if (!customElements.get('ui9000-pie-chart')) {\n customElements.define('ui9000-pie-chart', Ui9000PieChart);\n }\n}\n\nregisterPieChart();\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsBO,IAAM,iBAAN,cAA6B,mBAAmB;AAAA,EAAhD,cAAA;AAAA,UAAA,GAAA,SAAA;AAIL,SAAA,QAAqB;AAGrB,SAAA,aAAa;AAGb,SAAA,cAAc;AAGd,SAAQ,WAKG;AAGX,SAAQ,SAAS;AAGjB,SAAQ,gBAA4B,CAAA;AAGpC,SAAQ,OAAO;AAAA,EAAA;AAAA,EAEN,oBAA0B;AACjC,UAAM,kBAAA;AACN,SAAK,kBAAkB,IAAI,eAAe,MAAM,KAAK,cAAc;AACnE,SAAK,gBAAgB,QAAQ,IAAI;AAAA,EACnC;AAAA,EAES,uBAA6B;;AACpC,eAAK,oBAAL,mBAAsB;AACtB,yBAAqB,KAAK,IAAI;AAC9B,UAAM,qBAAA;AAAA,EACR;AAAA,EAES,QAAQ,SAA+B;AAC9C,QAAI,kBAAkB,OAAO,EAAG,MAAK,aAAA;AAAA,EACvC;AAAA,EAEQ,eAAqB;AAC3B,yBAAqB,KAAK,IAAI;AAC9B,SAAK,OAAO,sBAAsB,MAAM,KAAK,MAAM;AAAA,EACrD;AAAA,EAEQ,YAAsB;AAC5B,UAAM,MAAM,cAA4B,KAAK,UAAU,IAAI;AAC3D,WAAO,iBAAiB,GAAG;AAAA,EAC7B;AAAA,EAEQ,eAAe;AACrB,QAAI,CAAC,KAAK,cAAc,CAAC,KAAK,cAAc,OAAQ,QAAO;AAC3D,UAAM,QAAQ,qBAAqB,IAAI;AACvC,WAAO;AAAA,MACL;AAAA,QACE,KAAK,cAAc,IAAI,CAAC,UAAU,GAAG,iBAAiB,MAAM,UAAU,CAAC,OAAO,MAAM,KAAK,EAAE;AAAA,QAC3F;AAAA,QACA,CAAC,QAAQ;;AAAU,6B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C,MAAI,CAAC,eAAe,IAAI,kBAAkB,GAAG;AAC3C,mBAAe,OAAO,oBAAoB,cAAc;AAAA,EAC1D;AACF;AAEA,iBAAA;"}
|
|
@@ -2,7 +2,7 @@ declare const _default: {
|
|
|
2
2
|
"id": "pie-chart",
|
|
3
3
|
"tag": "ui9000-pie-chart",
|
|
4
4
|
"title": "Pie Chart",
|
|
5
|
-
"description": "Chat-optimized pie chart rewritten in D3. Full disc
|
|
5
|
+
"description": "Chat-optimized pie chart rewritten in D3. Full disc only — donut is ui9000-donut-chart.",
|
|
6
6
|
"chartTypeKeys": ["pieChart"],
|
|
7
7
|
"source": "client/libs/shared/components/src/Widgets/PieChart/",
|
|
8
8
|
"stack": "d3",
|
|
@@ -46,12 +46,6 @@ declare const _default: {
|
|
|
46
46
|
}
|
|
47
47
|
]
|
|
48
48
|
},
|
|
49
|
-
"inner-radius-ratio": {
|
|
50
|
-
"type": "number",
|
|
51
|
-
"minimum": 0,
|
|
52
|
-
"maximum": 1,
|
|
53
|
-
"description": "0 = pie, >0 = donut hole size relative to outer radius"
|
|
54
|
-
},
|
|
55
49
|
"show-legend": { "type": "boolean" },
|
|
56
50
|
"show-tooltip": { "type": "boolean" },
|
|
57
51
|
"scale": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const id = "pie-chart";
|
|
2
2
|
const tag = "ui9000-pie-chart";
|
|
3
3
|
const title = "Pie Chart";
|
|
4
|
-
const description = "Chat-optimized pie chart rewritten in D3. Full disc
|
|
4
|
+
const description = "Chat-optimized pie chart rewritten in D3. Full disc only — donut is ui9000-donut-chart.";
|
|
5
5
|
const chartTypeKeys = ["pieChart"];
|
|
6
6
|
const source = "client/libs/shared/components/src/Widgets/PieChart/";
|
|
7
7
|
const stack = "d3";
|
|
@@ -9,7 +9,7 @@ const lazyImport = "@ui9000/widgets/lazy/pie-chart";
|
|
|
9
9
|
const entry = "@ui9000/widgets/pie-chart";
|
|
10
10
|
const usageConditions = { "host": "mcp-chat", "notFor": "fusedash-editor", "mapsExcluded": true };
|
|
11
11
|
const allowedActions = ["hover", "resize"];
|
|
12
|
-
const propsSchema = { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "data": { "oneOf": [{ "type": "array", "items": { "type": "object", "required": ["label", "value"], "properties": { "label": { "type": "string" }, "value": { "type": "number" }, "color": { "type": "string" } } } }, { "type": "object", "description": "FuseDash WidgetItem-shaped payload", "properties": { "chartType": { "type": "string" }, "xAxe": { "type": "array", "items": { "type": "string" } }, "yAxe": { "type": "array", "items": { "type": "string" } }, "uniqueValues": { "type": "object" }, "formatting": { "type": "array" }, "data": { "type": "array" } } }] }, "
|
|
12
|
+
const propsSchema = { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "data": { "oneOf": [{ "type": "array", "items": { "type": "object", "required": ["label", "value"], "properties": { "label": { "type": "string" }, "value": { "type": "number" }, "color": { "type": "string" } } } }, { "type": "object", "description": "FuseDash WidgetItem-shaped payload", "properties": { "chartType": { "type": "string" }, "xAxe": { "type": "array", "items": { "type": "string" } }, "yAxe": { "type": "array", "items": { "type": "string" } }, "uniqueValues": { "type": "object" }, "formatting": { "type": "array" }, "data": { "type": "array" } } }] }, "show-legend": { "type": "boolean" }, "show-tooltip": { "type": "boolean" }, "scale": { "type": "string", "enum": ["compact", "default", "comfortable"] } } };
|
|
13
13
|
const pieMeta = {
|
|
14
14
|
id,
|
|
15
15
|
tag,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare const polarAreaChartStyles: import('lit').CSSResult;
|
|
2
2
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/polar-area-chart/element/styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/polar-area-chart/element/styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,yBA0ChC,CAAC"}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { css } from "lit";
|
|
2
|
-
const
|
|
2
|
+
const polarAreaChartStyles = css`
|
|
3
3
|
:host {
|
|
4
4
|
display: block;
|
|
5
5
|
position: relative;
|
|
6
6
|
width: 100%;
|
|
7
7
|
height: 100%;
|
|
8
|
-
min-height:
|
|
8
|
+
min-height: 220px;
|
|
9
9
|
color: var(--ui9000-color-text, #111827);
|
|
10
10
|
font-family: var(--ui9000-font-family, system-ui, sans-serif);
|
|
11
11
|
box-sizing: border-box;
|
|
12
12
|
}
|
|
13
13
|
.chart-root {
|
|
14
|
+
flex: 1;
|
|
15
|
+
min-height: 0;
|
|
14
16
|
width: 100%;
|
|
15
17
|
height: 100%;
|
|
16
|
-
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
17
21
|
}
|
|
18
22
|
.tooltip {
|
|
19
23
|
position: absolute;
|
|
@@ -26,31 +30,9 @@ const donutGroupChartStyles = css`
|
|
|
26
30
|
background: var(--ui9000-color-text, #111827);
|
|
27
31
|
color: #fff;
|
|
28
32
|
box-shadow: 0 4px 12px rgb(0 0 0 / 18%);
|
|
29
|
-
transform: translate(-50%, calc(-100% -
|
|
33
|
+
transform: translate(-50%, calc(-100% - 10px));
|
|
30
34
|
white-space: nowrap;
|
|
31
35
|
}
|
|
32
|
-
.tooltip .title {
|
|
33
|
-
font-weight: 600;
|
|
34
|
-
margin-bottom: 2px;
|
|
35
|
-
}
|
|
36
|
-
.tooltip .row {
|
|
37
|
-
display: flex;
|
|
38
|
-
align-items: center;
|
|
39
|
-
gap: 6px;
|
|
40
|
-
}
|
|
41
|
-
.tooltip .swatch {
|
|
42
|
-
width: 8px;
|
|
43
|
-
height: 8px;
|
|
44
|
-
border-radius: 2px;
|
|
45
|
-
flex: none;
|
|
46
|
-
}
|
|
47
|
-
.tooltip .value {
|
|
48
|
-
margin-left: auto;
|
|
49
|
-
font-variant-numeric: tabular-nums;
|
|
50
|
-
}
|
|
51
|
-
.tooltip .share {
|
|
52
|
-
opacity: 0.75;
|
|
53
|
-
}
|
|
54
36
|
.empty {
|
|
55
37
|
display: grid;
|
|
56
38
|
place-items: center;
|
|
@@ -61,6 +43,6 @@ const donutGroupChartStyles = css`
|
|
|
61
43
|
}
|
|
62
44
|
`;
|
|
63
45
|
export {
|
|
64
|
-
|
|
46
|
+
polarAreaChartStyles
|
|
65
47
|
};
|
|
66
48
|
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/polar-area-chart/element/styles.ts"],"sourcesContent":["import { css } from 'lit';\n\nexport const polarAreaChartStyles = css`\n :host {\n display: block;\n position: relative;\n width: 100%;\n height: 100%;\n min-height: 220px;\n color: var(--ui9000-color-text, #111827);\n font-family: var(--ui9000-font-family, system-ui, sans-serif);\n box-sizing: border-box;\n }\n .chart-root {\n flex: 1;\n min-height: 0;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n .tooltip {\n position: absolute;\n pointer-events: none;\n z-index: 2;\n padding: 6px 10px;\n border-radius: 6px;\n font-size: 12px;\n line-height: 1.35;\n background: var(--ui9000-color-text, #111827);\n color: #fff;\n box-shadow: 0 4px 12px rgb(0 0 0 / 18%);\n transform: translate(-50%, calc(-100% - 10px));\n white-space: nowrap;\n }\n .empty {\n display: grid;\n place-items: center;\n height: 100%;\n min-height: inherit;\n color: var(--ui9000-color-text-muted, #6b7280);\n font-size: 0.875rem;\n }\n`;\n"],"names":[],"mappings":";AAEO,MAAM,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui9000-polar-area-chart.d.ts","sourceRoot":"","sources":["../../../../src/components/polar-area-chart/element/ui9000-polar-area-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAKzD,OAAO,EAAoB,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC7F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAmB3D,qBACa,oBAAqB,SAAQ,kBAAkB;IAC1D,OAAgB,MAAM,4BAA4C;IAGlE,KAAK,EAAE,WAAW,CAAa;IAG/B,QAAQ,UAAQ;IAGhB,UAAU,UAAQ;IAGlB,WAAW,UAAQ;IAGnB,OAAO,CAAC,QAAQ,CAAyE;IAGzF,OAAO,CAAC,MAAM,CAAS;IAEvB,OAAO,CAAC,eAAe,CAAC,CAAiB;IACzC,OAAO,CAAC,IAAI,CAAK;IAER,iBAAiB,IAAI,IAAI;IAMzB,oBAAoB,IAAI,IAAI;IAM5B,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAI/C,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,YAAY;IAYpB,OAAO,CAAC,IAAI;
|
|
1
|
+
{"version":3,"file":"ui9000-polar-area-chart.d.ts","sourceRoot":"","sources":["../../../../src/components/polar-area-chart/element/ui9000-polar-area-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAKzD,OAAO,EAAoB,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC7F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAmB3D,qBACa,oBAAqB,SAAQ,kBAAkB;IAC1D,OAAgB,MAAM,4BAA4C;IAGlE,KAAK,EAAE,WAAW,CAAa;IAG/B,QAAQ,UAAQ;IAGhB,UAAU,UAAQ;IAGlB,WAAW,UAAQ;IAGnB,OAAO,CAAC,QAAQ,CAAyE;IAGzF,OAAO,CAAC,MAAM,CAAS;IAEvB,OAAO,CAAC,eAAe,CAAC,CAAiB;IACzC,OAAO,CAAC,IAAI,CAAK;IAER,iBAAiB,IAAI,IAAI;IAMzB,oBAAoB,IAAI,IAAI;IAM5B,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAI/C,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,YAAY;IAYpB,OAAO,CAAC,IAAI;IAmDH,MAAM;CAwBhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,yBAAyB,EAAE,oBAAoB,CAAC;KACjD;CACF;AAED,wBAAgB,sBAAsB,IAAI,IAAI,CAI7C"}
|
|
@@ -7,8 +7,8 @@ import { parseJsonAttr, getPolarAreaDimensions } from "../../../utils/chart-help
|
|
|
7
7
|
import { swatchLegendEntries } from "../../../utils/chart-legend.js";
|
|
8
8
|
import { chartPropsChanged } from "../../../utils/lit-draw.js";
|
|
9
9
|
import { renderPolarAreaChart } from "../render/draw.js";
|
|
10
|
+
import { polarAreaChartStyles } from "./styles.js";
|
|
10
11
|
import { normalizePolarAreaData } from "../lib/normalize.js";
|
|
11
|
-
import { pieChartStyles } from "../../pie-chart/element/styles.js";
|
|
12
12
|
import { chartShellStyles } from "../../../element/chart-shell-styles.js";
|
|
13
13
|
var __defProp = Object.defineProperty;
|
|
14
14
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -97,10 +97,11 @@ let Ui9000PolarAreaChart = class extends Ui9000ChartElement {
|
|
|
97
97
|
const yField = model.yField ?? "Value";
|
|
98
98
|
const symbol = ((_b = (_a2 = model.axisDetails) == null ? void 0 : _a2[yField]) == null ? void 0 : _b.measure_unit_symbol) ?? "";
|
|
99
99
|
const value = sector.value.toLocaleString();
|
|
100
|
+
const categoryText = sector.group ? `${sector.label} · ${sector.group}` : sector.label;
|
|
100
101
|
this._tooltip = {
|
|
101
102
|
x: event.clientX - rect.left,
|
|
102
103
|
y: event.clientY - rect.top,
|
|
103
|
-
xLabel: `${((_d = (_c = model.axisDetails) == null ? void 0 : _c[xField]) == null ? void 0 : _d.label) ?? xField}: ${
|
|
104
|
+
xLabel: `${((_d = (_c = model.axisDetails) == null ? void 0 : _c[xField]) == null ? void 0 : _d.label) ?? xField}: ${categoryText}`,
|
|
104
105
|
yLabel: `${((_f = (_e = model.axisDetails) == null ? void 0 : _e[yField]) == null ? void 0 : _f.label) ?? yField}: ${symbol ? `${value} ${symbol}` : value}`
|
|
105
106
|
};
|
|
106
107
|
} : void 0,
|
|
@@ -132,7 +133,7 @@ let Ui9000PolarAreaChart = class extends Ui9000ChartElement {
|
|
|
132
133
|
`;
|
|
133
134
|
}
|
|
134
135
|
};
|
|
135
|
-
Ui9000PolarAreaChart.styles = [
|
|
136
|
+
Ui9000PolarAreaChart.styles = [polarAreaChartStyles, chartShellStyles];
|
|
136
137
|
__decorateClass([
|
|
137
138
|
property({ type: String, attribute: "scale" })
|
|
138
139
|
], Ui9000PolarAreaChart.prototype, "scale", 2);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui9000-polar-area-chart.js","sources":["../../../../src/components/polar-area-chart/element/ui9000-polar-area-chart.ts"],"sourcesContent":["import { html, nothing, type PropertyValues } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\n\nimport { readThemeFromElement } from '../../../context/widget-context.js';\nimport { renderChartLegend } from '../../../element/chart-legend-render.js';\nimport { chartShellStyles, Ui9000ChartElement } from '../../../element/ui9000-chart-base.js';\nimport type { WidgetScale } from '../../../types/index.js';\nimport { getPolarAreaDimensions, parseJsonAttr } from '../../../utils/chart-helpers.js';\nimport { swatchLegendEntries } from '../../../utils/chart-legend.js';\nimport { chartPropsChanged } from '../../../utils/lit-draw.js';\nimport {\n normalizePolarAreaData,\n type PolarAreaChartData,\n type PolarAreaModel,\n} from '../lib/index.js';\nimport { renderPolarAreaChart } from '../render/draw.js';\nimport { polarAreaChartStyles } from './styles.js';\n\nconst EMPTY_MODEL: PolarAreaModel = {\n sectors: [],\n categories: [],\n legend: [],\n maxValue: 0,\n};\n\n@customElement('ui9000-polar-area-chart')\nexport class Ui9000PolarAreaChart extends Ui9000ChartElement {\n static override styles = [polarAreaChartStyles, chartShellStyles];\n\n @property({ type: String, attribute: 'scale' })\n scale: WidgetScale = 'default';\n\n @property({ type: Boolean, attribute: 'show-grid' })\n showGrid = true;\n\n @property({ type: Boolean, attribute: 'show-legend' })\n showLegend = true;\n\n @property({ type: Boolean, attribute: 'show-tooltip' })\n showTooltip = true;\n\n @state()\n private _tooltip: { x: number; y: number; xLabel: string; yLabel: string } | null = null;\n\n @state()\n private _empty = false;\n\n private _resizeObserver?: ResizeObserver;\n private _raf = 0;\n\n override connectedCallback(): void {\n super.connectedCallback();\n this._resizeObserver = new ResizeObserver(() => this.scheduleDraw());\n this._resizeObserver.observe(this);\n }\n\n override disconnectedCallback(): void {\n this._resizeObserver?.disconnect();\n cancelAnimationFrame(this._raf);\n super.disconnectedCallback();\n }\n\n override updated(changed: PropertyValues): void {\n if (chartPropsChanged(changed)) this.scheduleDraw();\n }\n\n private scheduleDraw(): void {\n cancelAnimationFrame(this._raf);\n this._raf = requestAnimationFrame(() => this.draw());\n }\n\n private parseData(): PolarAreaModel {\n return normalizePolarAreaData(parseJsonAttr<PolarAreaChartData>(this.dataJson, null));\n }\n\n private renderLegend(model: PolarAreaModel) {\n if (!this.showLegend || !model.legend.length) return nothing;\n const theme = readThemeFromElement(this);\n return renderChartLegend(\n swatchLegendEntries(\n model.legend.map((entry) => entry.label),\n theme,\n (_label, index) => model.legend[index].color,\n ),\n );\n }\n\n private draw(): void {\n const root = this.shadowRoot?.querySelector('.chart-root') as HTMLElement | null;\n if (!root) return;\n\n const model = this.parseData();\n this._empty = model.sectors.length === 0;\n if (this._empty) {\n root.replaceChildren();\n return;\n }\n\n const theme = readThemeFromElement(this);\n const { width, height, margin } = getPolarAreaDimensions(root, this.scale);\n\n renderPolarAreaChart(root, {\n model,\n width,\n height,\n margin,\n theme,\n showGrid: this.showGrid,\n showTooltip: this.showTooltip,\n ...this.axisLabelHandlers(),\n onHover: this.showTooltip\n ? ({ sector, event }) => {\n const rect = this.getBoundingClientRect();\n const xField = model.xField ?? 'Category';\n const yField = model.yField ?? 'Value';\n const symbol = model.axisDetails?.[yField]?.measure_unit_symbol ?? '';\n const value = sector.value.toLocaleString();\n this._tooltip = {\n x: event.clientX - rect.left,\n y: event.clientY - rect.top,\n xLabel: `${model.axisDetails?.[xField]?.label ?? xField}: ${
|
|
1
|
+
{"version":3,"file":"ui9000-polar-area-chart.js","sources":["../../../../src/components/polar-area-chart/element/ui9000-polar-area-chart.ts"],"sourcesContent":["import { html, nothing, type PropertyValues } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\n\nimport { readThemeFromElement } from '../../../context/widget-context.js';\nimport { renderChartLegend } from '../../../element/chart-legend-render.js';\nimport { chartShellStyles, Ui9000ChartElement } from '../../../element/ui9000-chart-base.js';\nimport type { WidgetScale } from '../../../types/index.js';\nimport { getPolarAreaDimensions, parseJsonAttr } from '../../../utils/chart-helpers.js';\nimport { swatchLegendEntries } from '../../../utils/chart-legend.js';\nimport { chartPropsChanged } from '../../../utils/lit-draw.js';\nimport {\n normalizePolarAreaData,\n type PolarAreaChartData,\n type PolarAreaModel,\n} from '../lib/index.js';\nimport { renderPolarAreaChart } from '../render/draw.js';\nimport { polarAreaChartStyles } from './styles.js';\n\nconst EMPTY_MODEL: PolarAreaModel = {\n sectors: [],\n categories: [],\n legend: [],\n maxValue: 0,\n};\n\n@customElement('ui9000-polar-area-chart')\nexport class Ui9000PolarAreaChart extends Ui9000ChartElement {\n static override styles = [polarAreaChartStyles, chartShellStyles];\n\n @property({ type: String, attribute: 'scale' })\n scale: WidgetScale = 'default';\n\n @property({ type: Boolean, attribute: 'show-grid' })\n showGrid = true;\n\n @property({ type: Boolean, attribute: 'show-legend' })\n showLegend = true;\n\n @property({ type: Boolean, attribute: 'show-tooltip' })\n showTooltip = true;\n\n @state()\n private _tooltip: { x: number; y: number; xLabel: string; yLabel: string } | null = null;\n\n @state()\n private _empty = false;\n\n private _resizeObserver?: ResizeObserver;\n private _raf = 0;\n\n override connectedCallback(): void {\n super.connectedCallback();\n this._resizeObserver = new ResizeObserver(() => this.scheduleDraw());\n this._resizeObserver.observe(this);\n }\n\n override disconnectedCallback(): void {\n this._resizeObserver?.disconnect();\n cancelAnimationFrame(this._raf);\n super.disconnectedCallback();\n }\n\n override updated(changed: PropertyValues): void {\n if (chartPropsChanged(changed)) this.scheduleDraw();\n }\n\n private scheduleDraw(): void {\n cancelAnimationFrame(this._raf);\n this._raf = requestAnimationFrame(() => this.draw());\n }\n\n private parseData(): PolarAreaModel {\n return normalizePolarAreaData(parseJsonAttr<PolarAreaChartData>(this.dataJson, null));\n }\n\n private renderLegend(model: PolarAreaModel) {\n if (!this.showLegend || !model.legend.length) return nothing;\n const theme = readThemeFromElement(this);\n return renderChartLegend(\n swatchLegendEntries(\n model.legend.map((entry) => entry.label),\n theme,\n (_label, index) => model.legend[index].color,\n ),\n );\n }\n\n private draw(): void {\n const root = this.shadowRoot?.querySelector('.chart-root') as HTMLElement | null;\n if (!root) return;\n\n const model = this.parseData();\n this._empty = model.sectors.length === 0;\n if (this._empty) {\n root.replaceChildren();\n return;\n }\n\n const theme = readThemeFromElement(this);\n const { width, height, margin } = getPolarAreaDimensions(root, this.scale);\n\n renderPolarAreaChart(root, {\n model,\n width,\n height,\n margin,\n theme,\n showGrid: this.showGrid,\n showTooltip: this.showTooltip,\n ...this.axisLabelHandlers(),\n onHover: this.showTooltip\n ? ({ sector, event }) => {\n const rect = this.getBoundingClientRect();\n const xField = model.xField ?? 'Category';\n const yField = model.yField ?? 'Value';\n const symbol = model.axisDetails?.[yField]?.measure_unit_symbol ?? '';\n const value = sector.value.toLocaleString();\n const categoryText = sector.group\n ? `${sector.label} · ${sector.group}`\n : sector.label;\n this._tooltip = {\n x: event.clientX - rect.left,\n y: event.clientY - rect.top,\n xLabel: `${model.axisDetails?.[xField]?.label ?? xField}: ${categoryText}`,\n yLabel: `${model.axisDetails?.[yField]?.label ?? yField}: ${\n symbol ? `${value} ${symbol}` : value\n }`,\n };\n }\n : undefined,\n onLeave: this.showTooltip\n ? () => {\n this._tooltip = null;\n }\n : undefined,\n });\n }\n\n override render() {\n const model = this._empty ? EMPTY_MODEL : this.parseData();\n return html`\n <div class=\"widget-shell\" part=\"shell\">\n ${this.renderShellHeader(this.headerTitle())}\n <div class=\"widget-body\">\n ${this.renderLegend(model)}\n <div class=\"chart-root\" part=\"chart\" ?hidden=${this._empty}></div>\n ${this._empty ? html`<div class=\"empty\" part=\"empty\">No data</div>` : nothing}\n ${this._tooltip\n ? html`<div\n class=\"tooltip\"\n part=\"tooltip\"\n style=\"left:${this._tooltip.x}px;top:${this._tooltip.y}px\"\n >\n <div>${this._tooltip.xLabel}</div>\n <div>${this._tooltip.yLabel}</div>\n </div>`\n : nothing}\n ${this.renderShellLabelTooltip()}\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ui9000-polar-area-chart': Ui9000PolarAreaChart;\n }\n}\n\nexport function registerPolarAreaChart(): void {\n if (!customElements.get('ui9000-polar-area-chart')) {\n customElements.define('ui9000-polar-area-chart', Ui9000PolarAreaChart);\n }\n}\n\nregisterPolarAreaChart();\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAM,cAA8B;AAAA,EAClC,SAAS,CAAA;AAAA,EACT,YAAY,CAAA;AAAA,EACZ,QAAQ,CAAA;AAAA,EACR,UAAU;AACZ;AAGO,IAAM,uBAAN,cAAmC,mBAAmB;AAAA,EAAtD,cAAA;AAAA,UAAA,GAAA,SAAA;AA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AAK,WACH;AAAA;AAAA;AAAA,8BAGgB,KAAK,SAAS,CAAC,UAAU,KAAK,SAAS,CAAC;AAAA;AAAA,uBAE/C,KAAK,SAAS,MAAM;AAAA,uBACpB,KAAK,SAAS,MAAM;AAAA,wBAE7B,OAAO;AAAA,YACT,KAAK,yBAAyB;AAAA;AAAA;AAAA;AAAA,EAIxC;AACF;AAxIa,qBACK,SAAS,CAAC,sBAAsB,gBAAgB;AAGhE,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,WAAW,SAAS;AAAA,GAHnC,qBAIX,WAAA,SAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,WAAW,aAAa;AAAA,GANxC,qBAOX,WAAA,YAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,WAAW,eAAe;AAAA,GAT1C,qBAUX,WAAA,cAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,WAAW,gBAAgB;AAAA,GAZ3C,qBAaX,WAAA,eAAA,CAAA;AAGQ,gBAAA;AAAA,EADP,MAAA;AAAM,GAfI,qBAgBH,WAAA,YAAA,CAAA;AAGA,gBAAA;AAAA,EADP,MAAA;AAAM,GAlBI,qBAmBH,WAAA,UAAA,CAAA;AAnBG,uBAAN,gBAAA;AAAA,EADN,cAAc,yBAAyB;AAAA,GAC3B,oBAAA;AAgJN,SAAS,yBAA+B;AAC7C,MAAI,CAAC,eAAe,IAAI,yBAAyB,GAAG;AAClD,mBAAe,OAAO,2BAA2B,oBAAoB;AAAA,EACvE;AACF;AAEA,uBAAA;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Ui9000PolarAreaChart, registerPolarAreaChart, } from './element/ui9000-polar-area-chart.js';
|
|
2
2
|
export { renderPolarAreaChart, type RenderPolarAreaChartOptions, } from './render/draw.js';
|
|
3
|
-
export { normalizePolarAreaData, polarLabelAnchor, polarMaxValue, polarRadialTicks, polarSectorAngles, type PolarAreaChartData, type PolarAreaLabelValue, type PolarAreaLegendEntry, type PolarAreaModel, type PolarAreaPoint, type PolarAreaSector, } from './lib/index.js';
|
|
3
|
+
export { normalizePolarAreaData, polarLabelAnchor, polarGroupedSectorAngles, polarMaxValue, polarRadialTicks, polarSectorAngles, type PolarAreaChartData, type PolarAreaLabelValue, type PolarAreaLegendEntry, type PolarAreaModel, type PolarAreaPoint, type PolarAreaSector, } from './lib/index.js';
|
|
4
4
|
export { default as polarAreaChartMetadata } from './metadata.json';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/polar-area-chart/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,oBAAoB,EACpB,KAAK,2BAA2B,GACjC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,eAAe,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/polar-area-chart/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,oBAAoB,EACpB,KAAK,2BAA2B,GACjC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,wBAAwB,EACxB,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,eAAe,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -3,11 +3,12 @@ import { Ui9000PolarAreaChart } from "./element/ui9000-polar-area-chart.js";
|
|
|
3
3
|
import { renderPolarAreaChart } from "./render/draw.js";
|
|
4
4
|
import { default as default2 } from "./metadata.json.js";
|
|
5
5
|
import { normalizePolarAreaData } from "./lib/normalize.js";
|
|
6
|
-
import { polarLabelAnchor, polarMaxValue, polarRadialTicks, polarSectorAngles } from "./lib/domain.js";
|
|
6
|
+
import { polarGroupedSectorAngles, polarLabelAnchor, polarMaxValue, polarRadialTicks, polarSectorAngles } from "./lib/domain.js";
|
|
7
7
|
export {
|
|
8
8
|
Ui9000PolarAreaChart,
|
|
9
9
|
normalizePolarAreaData,
|
|
10
10
|
default2 as polarAreaChartMetadata,
|
|
11
|
+
polarGroupedSectorAngles,
|
|
11
12
|
polarLabelAnchor,
|
|
12
13
|
polarMaxValue,
|
|
13
14
|
polarRadialTicks,
|
|
@@ -9,6 +9,14 @@ export declare function polarSectorAngles(count: number): Array<{
|
|
|
9
9
|
startAngle: number;
|
|
10
10
|
endAngle: number;
|
|
11
11
|
}>;
|
|
12
|
+
/**
|
|
13
|
+
* Split each category's equal slice among the groups that have a value there.
|
|
14
|
+
* Sector order must match `sectors` (category-major, then group order).
|
|
15
|
+
*/
|
|
16
|
+
export declare function polarGroupedSectorAngles(categories: string[], sectors: PolarAreaSector[]): Array<{
|
|
17
|
+
startAngle: number;
|
|
18
|
+
endAngle: number;
|
|
19
|
+
}>;
|
|
12
20
|
/** Radial grid / tick values: `maxValue * step / steps` for step 1…steps. */
|
|
13
21
|
export declare function polarRadialTicks(maxValue: number, steps: number): number[];
|
|
14
22
|
export declare function polarMaxValue(sectors: PolarAreaSector[]): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../../../src/components/polar-area-chart/lib/domain.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,2EAA2E;AAC3E,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAG/E;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,GACZ,KAAK,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAOjD;AAED,6EAA6E;AAC7E,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAG1E;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,MAAM,CAMhE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAQhF;AAED,0EAA0E;AAC1E,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,MAAM,CAKR"}
|
|
1
|
+
{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../../../src/components/polar-area-chart/lib/domain.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,2EAA2E;AAC3E,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAG/E;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,GACZ,KAAK,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAOjD;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,MAAM,EAAE,EACpB,OAAO,EAAE,eAAe,EAAE,GACzB,KAAK,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAkBjD;AAED,6EAA6E;AAC7E,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAG1E;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,MAAM,CAMhE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAQhF;AAED,0EAA0E;AAC1E,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,MAAM,CAKR"}
|
|
@@ -11,6 +11,25 @@ function polarSectorAngles(count) {
|
|
|
11
11
|
endAngle: (i + 1) * slice
|
|
12
12
|
}));
|
|
13
13
|
}
|
|
14
|
+
function polarGroupedSectorAngles(categories, sectors) {
|
|
15
|
+
if (!categories.length || !sectors.length) return [];
|
|
16
|
+
const slice = Math.PI * 2 / categories.length;
|
|
17
|
+
const countByCategory = /* @__PURE__ */ new Map();
|
|
18
|
+
const indexInCategory = /* @__PURE__ */ new Map();
|
|
19
|
+
for (const sector of sectors) {
|
|
20
|
+
const next = countByCategory.get(sector.key) ?? 0;
|
|
21
|
+
indexInCategory.set(sector, next);
|
|
22
|
+
countByCategory.set(sector.key, next + 1);
|
|
23
|
+
}
|
|
24
|
+
return sectors.map((sector) => {
|
|
25
|
+
const categoryIndex = Math.max(0, categories.indexOf(sector.key));
|
|
26
|
+
const members = countByCategory.get(sector.key) ?? 1;
|
|
27
|
+
const offset = indexInCategory.get(sector) ?? 0;
|
|
28
|
+
const inner = slice / members;
|
|
29
|
+
const base = categoryIndex * slice;
|
|
30
|
+
return { startAngle: base + offset * inner, endAngle: base + (offset + 1) * inner };
|
|
31
|
+
});
|
|
32
|
+
}
|
|
14
33
|
function polarRadialTicks(maxValue, steps) {
|
|
15
34
|
if (!Number.isFinite(maxValue) || maxValue <= 0 || steps <= 0) return [];
|
|
16
35
|
return Array.from({ length: steps }, (_v, i) => (i + 1) * maxValue / steps);
|
|
@@ -37,6 +56,7 @@ function polarOuterRadius(plotWidth, plotHeight, labelGutter) {
|
|
|
37
56
|
return Math.max(0, Math.min(byWidth, byHeight));
|
|
38
57
|
}
|
|
39
58
|
export {
|
|
59
|
+
polarGroupedSectorAngles,
|
|
40
60
|
polarLabelAnchor,
|
|
41
61
|
polarLabelGutter,
|
|
42
62
|
polarMaxValue,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain.js","sources":["../../../../src/components/polar-area-chart/lib/domain.ts"],"sourcesContent":["import { FD } from '../../../utils/fusedash-visual.js';\nimport type { PolarAreaSector } from './types.js';\n\n/** Text anchor for a category label, mirroring the client's angle test. */\nexport function polarLabelAnchor(labelAngle: number): 'start' | 'middle' | 'end' {\n if (Math.abs(labelAngle) === Math.PI / 2) return 'middle';\n return labelAngle < Math.PI / 2 && labelAngle > -Math.PI / 2 ? 'start' : 'end';\n}\n\n/**\n * Sector angles — client `xScale = scaleLinear([0, n] → [0, 2π])` evaluated at\n * `i` and `i + 1`. Angle 0 is 12 o'clock (d3 `arc` convention).\n */\nexport function polarSectorAngles(\n count: number,\n): Array<{ startAngle: number; endAngle: number }> {\n if (count <= 0) return [];\n const slice = (Math.PI * 2) / count;\n return Array.from({ length: count }, (_v, i) => ({\n startAngle: i * slice,\n endAngle: (i + 1) * slice,\n }));\n}\n\n/** Radial grid / tick values: `maxValue * step / steps` for step 1…steps. */\nexport function polarRadialTicks(maxValue: number, steps: number): number[] {\n if (!Number.isFinite(maxValue) || maxValue <= 0 || steps <= 0) return [];\n return Array.from({ length: steps }, (_v, i) => ((i + 1) * maxValue) / steps);\n}\n\nexport function polarMaxValue(sectors: PolarAreaSector[]): number {\n let max = 0;\n for (const sector of sectors) {\n if (sector.value > max) max = sector.value;\n }\n return max;\n}\n\n/**\n * Side room reserved for the category labels, measured off the longest one.\n * FuseDash sizes the disc from the raw box and lets long names run past the\n * SVG edge; chat widgets are far narrower, so — as with `punchcardLeftGutter`\n * and the bar-chart label gutter — the gutter is derived from the labels and\n * the disc shrinks into what is left.\n */\nexport function polarLabelGutter(categories: string[], plotWidth: number): number {\n const longest = categories.reduce((max, c) => Math.max(max, String(c).length), 0);\n const estimated = longest * FD.polarCategoryLabelSize * FD.polarLabelCharWidth;\n const ceiling = Math.min(\n FD.polarLabelGutterMax,\n Math.max(0, plotWidth) * FD.polarLabelGutterMaxFraction,\n );\n return Math.max(FD.polarLabelGutterMin, Math.min(estimated, ceiling));\n}\n\n/** Disc radius that leaves room for the labels ring on all four sides. */\nexport function polarOuterRadius(\n plotWidth: number,\n plotHeight: number,\n labelGutter: number,\n): number {\n const byWidth = plotWidth / 2 - labelGutter - FD.polarCategoryLabelOffset;\n const byHeight =\n plotHeight / 2 - FD.polarCategoryLabelOffset - FD.polarCategoryLabelSize / 2;\n return Math.max(0, Math.min(byWidth, byHeight));\n}\n"],"names":[],"mappings":";AAIO,SAAS,iBAAiB,YAAgD;AAC/E,MAAI,KAAK,IAAI,UAAU,MAAM,KAAK,KAAK,EAAG,QAAO;AACjD,SAAO,aAAa,KAAK,KAAK,KAAK,aAAa,CAAC,KAAK,KAAK,IAAI,UAAU;AAC3E;AAMO,SAAS,kBACd,OACiD;AACjD,MAAI,SAAS,EAAG,QAAO,CAAA;AACvB,QAAM,QAAS,KAAK,KAAK,IAAK;AAC9B,SAAO,MAAM,KAAK,EAAE,QAAQ,SAAS,CAAC,IAAI,OAAO;AAAA,IAC/C,YAAY,IAAI;AAAA,IAChB,WAAW,IAAI,KAAK;AAAA,EAAA,EACpB;AACJ;AAGO,SAAS,iBAAiB,UAAkB,OAAyB;AAC1E,MAAI,CAAC,OAAO,SAAS,QAAQ,KAAK,YAAY,KAAK,SAAS,EAAG,QAAO,CAAA;AACtE,SAAO,MAAM,KAAK,EAAE,QAAQ,MAAA,GAAS,CAAC,IAAI,OAAQ,IAAI,KAAK,WAAY,KAAK;AAC9E;AAEO,SAAS,cAAc,SAAoC;AAChE,MAAI,MAAM;AACV,aAAW,UAAU,SAAS;AAC5B,QAAI,OAAO,QAAQ,IAAK,OAAM,OAAO;AAAA,EACvC;AACA,SAAO;AACT;AASO,SAAS,iBAAiB,YAAsB,WAA2B;AAChF,QAAM,UAAU,WAAW,OAAO,CAAC,KAAK,MAAM,KAAK,IAAI,KAAK,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC;AAChF,QAAM,YAAY,UAAU,GAAG,yBAAyB,GAAG;AAC3D,QAAM,UAAU,KAAK;AAAA,IACnB,GAAG;AAAA,IACH,KAAK,IAAI,GAAG,SAAS,IAAI,GAAG;AAAA,EAAA;AAE9B,SAAO,KAAK,IAAI,GAAG,qBAAqB,KAAK,IAAI,WAAW,OAAO,CAAC;AACtE;AAGO,SAAS,iBACd,WACA,YACA,aACQ;AACR,QAAM,UAAU,YAAY,IAAI,cAAc,GAAG;AACjD,QAAM,WACJ,aAAa,IAAI,GAAG,2BAA2B,GAAG,yBAAyB;AAC7E,SAAO,KAAK,IAAI,GAAG,KAAK,IAAI,SAAS,QAAQ,CAAC;AAChD;"}
|
|
1
|
+
{"version":3,"file":"domain.js","sources":["../../../../src/components/polar-area-chart/lib/domain.ts"],"sourcesContent":["import { FD } from '../../../utils/fusedash-visual.js';\nimport type { PolarAreaSector } from './types.js';\n\n/** Text anchor for a category label, mirroring the client's angle test. */\nexport function polarLabelAnchor(labelAngle: number): 'start' | 'middle' | 'end' {\n if (Math.abs(labelAngle) === Math.PI / 2) return 'middle';\n return labelAngle < Math.PI / 2 && labelAngle > -Math.PI / 2 ? 'start' : 'end';\n}\n\n/**\n * Sector angles — client `xScale = scaleLinear([0, n] → [0, 2π])` evaluated at\n * `i` and `i + 1`. Angle 0 is 12 o'clock (d3 `arc` convention).\n */\nexport function polarSectorAngles(\n count: number,\n): Array<{ startAngle: number; endAngle: number }> {\n if (count <= 0) return [];\n const slice = (Math.PI * 2) / count;\n return Array.from({ length: count }, (_v, i) => ({\n startAngle: i * slice,\n endAngle: (i + 1) * slice,\n }));\n}\n\n/**\n * Split each category's equal slice among the groups that have a value there.\n * Sector order must match `sectors` (category-major, then group order).\n */\nexport function polarGroupedSectorAngles(\n categories: string[],\n sectors: PolarAreaSector[],\n): Array<{ startAngle: number; endAngle: number }> {\n if (!categories.length || !sectors.length) return [];\n const slice = (Math.PI * 2) / categories.length;\n const countByCategory = new Map<string, number>();\n const indexInCategory = new Map<PolarAreaSector, number>();\n for (const sector of sectors) {\n const next = countByCategory.get(sector.key) ?? 0;\n indexInCategory.set(sector, next);\n countByCategory.set(sector.key, next + 1);\n }\n return sectors.map((sector) => {\n const categoryIndex = Math.max(0, categories.indexOf(sector.key));\n const members = countByCategory.get(sector.key) ?? 1;\n const offset = indexInCategory.get(sector) ?? 0;\n const inner = slice / members;\n const base = categoryIndex * slice;\n return { startAngle: base + offset * inner, endAngle: base + (offset + 1) * inner };\n });\n}\n\n/** Radial grid / tick values: `maxValue * step / steps` for step 1…steps. */\nexport function polarRadialTicks(maxValue: number, steps: number): number[] {\n if (!Number.isFinite(maxValue) || maxValue <= 0 || steps <= 0) return [];\n return Array.from({ length: steps }, (_v, i) => ((i + 1) * maxValue) / steps);\n}\n\nexport function polarMaxValue(sectors: PolarAreaSector[]): number {\n let max = 0;\n for (const sector of sectors) {\n if (sector.value > max) max = sector.value;\n }\n return max;\n}\n\n/**\n * Side room reserved for the category labels, measured off the longest one.\n * FuseDash sizes the disc from the raw box and lets long names run past the\n * SVG edge; chat widgets are far narrower, so — as with `punchcardLeftGutter`\n * and the bar-chart label gutter — the gutter is derived from the labels and\n * the disc shrinks into what is left.\n */\nexport function polarLabelGutter(categories: string[], plotWidth: number): number {\n const longest = categories.reduce((max, c) => Math.max(max, String(c).length), 0);\n const estimated = longest * FD.polarCategoryLabelSize * FD.polarLabelCharWidth;\n const ceiling = Math.min(\n FD.polarLabelGutterMax,\n Math.max(0, plotWidth) * FD.polarLabelGutterMaxFraction,\n );\n return Math.max(FD.polarLabelGutterMin, Math.min(estimated, ceiling));\n}\n\n/** Disc radius that leaves room for the labels ring on all four sides. */\nexport function polarOuterRadius(\n plotWidth: number,\n plotHeight: number,\n labelGutter: number,\n): number {\n const byWidth = plotWidth / 2 - labelGutter - FD.polarCategoryLabelOffset;\n const byHeight =\n plotHeight / 2 - FD.polarCategoryLabelOffset - FD.polarCategoryLabelSize / 2;\n return Math.max(0, Math.min(byWidth, byHeight));\n}\n"],"names":[],"mappings":";AAIO,SAAS,iBAAiB,YAAgD;AAC/E,MAAI,KAAK,IAAI,UAAU,MAAM,KAAK,KAAK,EAAG,QAAO;AACjD,SAAO,aAAa,KAAK,KAAK,KAAK,aAAa,CAAC,KAAK,KAAK,IAAI,UAAU;AAC3E;AAMO,SAAS,kBACd,OACiD;AACjD,MAAI,SAAS,EAAG,QAAO,CAAA;AACvB,QAAM,QAAS,KAAK,KAAK,IAAK;AAC9B,SAAO,MAAM,KAAK,EAAE,QAAQ,SAAS,CAAC,IAAI,OAAO;AAAA,IAC/C,YAAY,IAAI;AAAA,IAChB,WAAW,IAAI,KAAK;AAAA,EAAA,EACpB;AACJ;AAMO,SAAS,yBACd,YACA,SACiD;AACjD,MAAI,CAAC,WAAW,UAAU,CAAC,QAAQ,eAAe,CAAA;AAClD,QAAM,QAAS,KAAK,KAAK,IAAK,WAAW;AACzC,QAAM,sCAAsB,IAAA;AAC5B,QAAM,sCAAsB,IAAA;AAC5B,aAAW,UAAU,SAAS;AAC5B,UAAM,OAAO,gBAAgB,IAAI,OAAO,GAAG,KAAK;AAChD,oBA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AM,WACJ,aAAa,IAAI,GAAG,2BAA2B,GAAG,yBAAyB;AAC7E,SAAO,KAAK,IAAI,GAAG,KAAK,IAAI,SAAS,QAAQ,CAAC;AAChD;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { normalizePolarAreaData } from './normalize.js';
|
|
2
|
-
export { polarLabelAnchor, polarLabelGutter, polarOuterRadius, polarMaxValue, polarRadialTicks, polarSectorAngles, } from './domain.js';
|
|
2
|
+
export { polarLabelAnchor, polarLabelGutter, polarOuterRadius, polarMaxValue, polarRadialTicks, polarSectorAngles, polarGroupedSectorAngles, } from './domain.js';
|
|
3
3
|
export type { PolarAreaChartData, PolarAreaLabelValue, PolarAreaLegendEntry, PolarAreaModel, PolarAreaPoint, PolarAreaSector, } from './types.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/polar-area-chart/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/polar-area-chart/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,eAAe,GAChB,MAAM,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../../src/components/polar-area-chart/lib/normalize.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../../src/components/polar-area-chart/lib/normalize.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACV,kBAAkB,EAGlB,cAAc,EAGf,MAAM,YAAY,CAAC;AAgOpB,6EAA6E;AAC7E,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,kBAAkB,GAAG,cAAc,CAkBhF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { pickQualitativePalette, resolveFormattingColor } from "../../../utils/fuse-palette.js";
|
|
2
|
-
import { isFuseWidgetPayload, firstField, rowsOf, filterTruthyValues } from "../../../utils/fuse-widget.js";
|
|
2
|
+
import { isFuseWidgetPayload, firstField, rowsOf, resolveUniqueValuesOrder, filterTruthyValues } from "../../../utils/fuse-widget.js";
|
|
3
3
|
import { polarMaxValue } from "./domain.js";
|
|
4
4
|
import { resolveWidgetFormatting } from "../../../utils/chart-formatting/from-fuse-widget.js";
|
|
5
5
|
const EMPTY = { sectors: [], categories: [], legend: [], maxValue: 0 };
|
|
@@ -35,11 +35,75 @@ function modelFromRows(rows, categories, legend, formatting) {
|
|
|
35
35
|
}));
|
|
36
36
|
return { sectors, categories, legend, maxValue: polarMaxValue(sectors) };
|
|
37
37
|
}
|
|
38
|
+
function categoriesOf(widget, xKey, dataKeys) {
|
|
39
|
+
var _a;
|
|
40
|
+
const fromUniqueValues = (((_a = widget.uniqueValues) == null ? void 0 : _a[xKey]) ?? []).map(String).filter((v) => dataKeys.includes(v));
|
|
41
|
+
return fromUniqueValues.length ? fromUniqueValues : dataKeys;
|
|
42
|
+
}
|
|
43
|
+
function fromGroupedFuseWidget(widget, xKey, yKey, groupBy) {
|
|
44
|
+
const parsed = [];
|
|
45
|
+
for (const row of rowsOf(widget)) {
|
|
46
|
+
const x = row[xKey];
|
|
47
|
+
const y = Number(row[yKey]);
|
|
48
|
+
const group = row[groupBy];
|
|
49
|
+
if (x == null || x === "" || group == null || group === "" || !Number.isFinite(y)) {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
parsed.push({ key: String(x), group: String(group), value: y });
|
|
53
|
+
}
|
|
54
|
+
if (!parsed.length) return EMPTY;
|
|
55
|
+
const categories = categoriesOf(
|
|
56
|
+
widget,
|
|
57
|
+
xKey,
|
|
58
|
+
Array.from(new Set(parsed.map((row) => row.key)))
|
|
59
|
+
);
|
|
60
|
+
const groupKeys = resolveUniqueValuesOrder(
|
|
61
|
+
parsed.map((row) => row.group),
|
|
62
|
+
widget.uniqueValues,
|
|
63
|
+
groupBy
|
|
64
|
+
);
|
|
65
|
+
const formatting = resolveWidgetFormatting(widget);
|
|
66
|
+
const colorByGroup = new Map(
|
|
67
|
+
groupKeys.map((key) => [key, resolveFormattingColor(formatting, key, groupKeys.length)])
|
|
68
|
+
);
|
|
69
|
+
const totals = /* @__PURE__ */ new Map();
|
|
70
|
+
for (const row of parsed) {
|
|
71
|
+
const id = `${row.key}\0${row.group}`;
|
|
72
|
+
totals.set(id, (totals.get(id) ?? 0) + row.value);
|
|
73
|
+
}
|
|
74
|
+
const sectors = [];
|
|
75
|
+
for (const category of categories) {
|
|
76
|
+
for (const group of groupKeys) {
|
|
77
|
+
const value = totals.get(`${category}\0${group}`);
|
|
78
|
+
if (value == null) continue;
|
|
79
|
+
sectors.push({
|
|
80
|
+
key: category,
|
|
81
|
+
group,
|
|
82
|
+
label: category,
|
|
83
|
+
value,
|
|
84
|
+
color: colorByGroup.get(group) ?? resolveFormattingColor(formatting, group, groupKeys.length)
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
sectors,
|
|
90
|
+
categories,
|
|
91
|
+
legend: buildLegend(groupKeys, formatting),
|
|
92
|
+
maxValue: polarMaxValue(sectors),
|
|
93
|
+
grouped: true,
|
|
94
|
+
xField: xKey,
|
|
95
|
+
yField: yKey,
|
|
96
|
+
groupField: groupBy,
|
|
97
|
+
axisDetails: widget.axisDetails ?? void 0
|
|
98
|
+
};
|
|
99
|
+
}
|
|
38
100
|
function fromFuseWidget(widget) {
|
|
39
|
-
var _a
|
|
101
|
+
var _a;
|
|
40
102
|
const xKey = firstField(widget.xAxe);
|
|
41
103
|
const yKey = firstField(widget.yAxe);
|
|
42
104
|
if (!xKey || !yKey) return EMPTY;
|
|
105
|
+
const groupBy = firstField(widget.groupBy);
|
|
106
|
+
if (groupBy) return fromGroupedFuseWidget(widget, xKey, yKey, groupBy);
|
|
43
107
|
const parsed = [];
|
|
44
108
|
for (const row of rowsOf(widget)) {
|
|
45
109
|
const x = row[xKey];
|
|
@@ -48,12 +112,14 @@ function fromFuseWidget(widget) {
|
|
|
48
112
|
parsed.push({ key: String(x), value: y });
|
|
49
113
|
}
|
|
50
114
|
if (!parsed.length) return EMPTY;
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
115
|
+
const categories = categoriesOf(
|
|
116
|
+
widget,
|
|
117
|
+
xKey,
|
|
118
|
+
Array.from(new Set(parsed.map((row) => row.key)))
|
|
119
|
+
);
|
|
54
120
|
const formatting = resolveWidgetFormatting(widget);
|
|
55
121
|
let rows = parsed;
|
|
56
|
-
if ((((
|
|
122
|
+
if ((((_a = widget.formatting) == null ? void 0 : _a.length) ?? 0) > 1) {
|
|
57
123
|
const totals = /* @__PURE__ */ new Map();
|
|
58
124
|
for (const row of parsed) {
|
|
59
125
|
totals.set(row.key, (totals.get(row.key) ?? 0) + row.value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.js","sources":["../../../../src/components/polar-area-chart/lib/normalize.ts"],"sourcesContent":["import { resolveWidgetFormatting } from '../../../utils/chart-formatting/index.js';\nimport {\n pickQualitativePalette,\n resolveFormattingColor,\n} from '../../../utils/fuse-palette.js';\nimport {\n filterTruthyValues,\n firstField,\n isFuseWidgetPayload,\n rowsOf,\n type FuseWidgetLike,\n} from '../../../utils/fuse-widget.js';\nimport { polarMaxValue } from './domain.js';\nimport type {\n PolarAreaChartData,\n PolarAreaLabelValue,\n PolarAreaLegendEntry,\n PolarAreaModel,\n PolarAreaPoint,\n PolarAreaSector,\n} from './types.js';\n\nconst EMPTY: PolarAreaModel = { sectors: [], categories: [], legend: [], maxValue: 0 };\n\nfunction isLabelValueArray(input: unknown): input is PolarAreaLabelValue[] {\n if (!Array.isArray(input) || input.length === 0) return false;\n const first = input[0] as Record<string, unknown>;\n return first != null && typeof first === 'object' && 'label' in first && 'value' in first;\n}\n\nfunction isPointsPayload(input: unknown): input is { points: PolarAreaPoint[] } {\n return (\n !!input &&\n typeof input === 'object' &&\n Array.isArray((input as { points?: unknown }).points)\n );\n}\n\n/**\n * Legend keys — client reads `uniqueValues[Object.keys(uniqueValues)[0]]` and\n * drops null-ish entries. On the polar mock that first key is the x-axis field,\n * so legend keys and sector keys line up.\n */\nfunction legendKeysOf(widget: FuseWidgetLike): string[] {\n const uniqueValues = widget.uniqueValues ?? {};\n const firstKey = Object.keys(uniqueValues)[0];\n if (!firstKey) return [];\n return filterTruthyValues((uniqueValues[firstKey] ?? []).map(String));\n}\n\nfunction buildLegend(\n keys: string[],\n formatting: FuseWidgetLike['formatting'],\n): PolarAreaLegendEntry[] {\n return keys.map((key) => ({\n key,\n label: key,\n color: resolveFormattingColor(formatting, key, keys.length),\n }));\n}\n\nfunction modelFromRows(\n rows: Array<{ key: string; value: number }>,\n categories: string[],\n legend: PolarAreaLegendEntry[],\n formatting: FuseWidgetLike['formatting'],\n): PolarAreaModel {\n const colorByKey = new Map(legend.map((entry) => [entry.key, entry.color]));\n const fallbackColor = resolveFormattingColor(formatting, 'default', legend.length || 1);\n\n const sectors: PolarAreaSector[] = rows.map((row) => ({\n key: row.key,\n label: row.key,\n value: row.value,\n color: colorByKey.get(row.key) ?? fallbackColor,\n }));\n\n return { sectors, categories, legend, maxValue: polarMaxValue(sectors) };\n}\n\nfunction fromFuseWidget(widget: FuseWidgetLike): PolarAreaModel {\n const xKey = firstField(widget.xAxe);\n const yKey = firstField(widget.yAxe);\n if (!xKey || !yKey) return EMPTY;\n\n const parsed: Array<{ key: string; value: number }> = [];\n for (const row of rowsOf(widget)) {\n const x = row[xKey];\n const y = Number(row[yKey]);\n if (x == null || x === '' || !Number.isFinite(y)) continue;\n parsed.push({ key: String(x), value: y });\n }\n if (!parsed.length) return EMPTY;\n\n const dataKeys = Array.from(new Set(parsed.map((row) => row.key)));\n const fromUniqueValues = (widget.uniqueValues?.[xKey] ?? [])\n .map(String)\n .filter((v) => dataKeys.includes(v));\n const categories = fromUniqueValues.length ? fromUniqueValues : dataKeys;\n\n // Colors come from resolved formatting so a widget that ships without a\n // `formatting` array still gets the shared default palette (as scatter does).\n const formatting = resolveWidgetFormatting(widget);\n\n // Client aggregates the rows per category once the widget carries more than\n // one formatting entry — otherwise every row keeps its own wedge. This gate\n // reads the widget's own formatting, not the resolved one: generated entries\n // would flip a formatting-less widget into aggregated mode.\n let rows = parsed;\n if ((widget.formatting?.length ?? 0) > 1) {\n const totals = new Map<string, number>();\n for (const row of parsed) {\n totals.set(row.key, (totals.get(row.key) ?? 0) + row.value);\n }\n rows = Array.from(totals, ([key, value]) => ({ key, value }));\n }\n\n // Client `categories.flatMap(...)`: category order first, extras dropped.\n const sorted = categories.flatMap((category) =>\n rows.filter((row) => row.key === category),\n );\n\n const model = modelFromRows(\n sorted,\n categories,\n buildLegend(legendKeysOf(widget), formatting),\n formatting,\n );\n\n return {\n ...model,\n xField: xKey,\n yField: yKey,\n axisDetails: widget.axisDetails ?? undefined,\n };\n}\n\nfunction fromLabelValue(input: PolarAreaLabelValue[]): PolarAreaModel {\n const rows = input\n .map((row) => ({\n key: String(row.label),\n value: Number(row.value),\n color: row.color,\n }))\n .filter((row) => row.key && Number.isFinite(row.value));\n if (!rows.length) return EMPTY;\n\n const palette = pickQualitativePalette(0, rows.length);\n const sectors: PolarAreaSector[] = rows.map((row, index) => ({\n key: row.key,\n label: row.key,\n value: row.value,\n color: row.color ?? palette[index % palette.length],\n }));\n\n return {\n sectors,\n categories: sectors.map((sector) => sector.key),\n legend: sectors.map(({ key, label, color }) => ({ key, label, color })),\n maxValue: polarMaxValue(sectors),\n };\n}\n\n/** Normalize chat / FuseDash WidgetItem payloads into polar-area sectors. */\nexport function normalizePolarAreaData(input: PolarAreaChartData): PolarAreaModel {\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 if (isPointsPayload(input)) {\n return fromLabelValue(\n input.points.map((point) => ({ label: String(point.x), value: Number(point.y) })),\n );\n }\n\n if (Array.isArray((input as PolarAreaModel).sectors)) return input as PolarAreaModel;\n\n return EMPTY;\n}\n"],"names":[],"mappings":";;;;AAsBA,MAAM,QAAwB,EAAE,SAAS,CAAA,GAAI,YAAY,CAAA,GAAI,QAAQ,CAAA,GAAI,UAAU,EAAA;AAEnF,SAAS,kBAAkB,OAAgD;AACzE,MAAI,CAAC,MAAM,QAAQ,KAAK,KAAK,MAAM,WAAW,EAAG,QAAO;AACxD,QAAM,QAAQ,MAAM,CAAC;AACrB,SAAO,SAAS,QAAQ,OAAO,UAAU,YAAY,WAAW,SAAS,WAAW;AACtF;AAEA,SAAS,gBAAgB,OAAuD;AAC9E,SACE,CAAC,CAAC,SACF,OAAO,UAAU,YACjB,MAAM,QAAS,MAA+B,MAAM;AAExD;AAOA,SAAS,aAAa,QAAkC;AACtD,QAAM,eAAe,OAAO,gBAAgB,CAAA;AAC5C,QAAM,WAAW,OAAO,KAAK,YAAY,EAAE,CAAC;AAC5C,MAAI,CAAC,SAAU,QAAO,CAAA;AACtB,SAAO,oBAAoB,aAAa,QAAQ,KAAK,IAAI,IAAI,MAAM,CAAC;AACtE;AAEA,SAAS,YACP,MACA,YACwB;AACxB,SAAO,KAAK,IAAI,CAAC,SAAS;AAAA,IACxB;AAAA,IACA,OA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AQ,IAAI,CAAC,WAAW,OAAO,GAAG;AAAA,IAC9C,QAAQ,QAAQ,IAAI,CAAC,EAAE,KAAK,OAAO,MAAA,OAAa,EAAE,KAAK,OAAO,QAAQ;AAAA,IACtE,UAAU,cAAc,OAAO;AAAA,EAAA;AAEnC;AAGO,SAAS,uBAAuB,OAA2C;AAChF,MAAI,CAAC,MAAO,QAAO;AAEnB,MAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,WAAO,kBAAkB,KAAK,IAAI,eAAe,KAAK,IAAI;AAAA,EAC5D;AAEA,MAAI,oBAAoB,KAAK,EAAG,QAAO,eAAe,KAAK;AAE3D,MAAI,gBAAgB,KAAK,GAAG;AAC1B,WAAO;AAAA,MACL,MAAM,OAAO,IAAI,CAAC,WAAW,EAAE,OAAO,OAAO,MAAM,CAAC,GAAG,OAAO,OAAO,MAAM,CAAC,IAAI;AAAA,IAAA;AAAA,EAEpF;AAEA,MAAI,MAAM,QAAS,MAAyB,OAAO,EAAG,QAAO;AAE7D,SAAO;AACT;"}
|
|
1
|
+
{"version":3,"file":"normalize.js","sources":["../../../../src/components/polar-area-chart/lib/normalize.ts"],"sourcesContent":["import { resolveWidgetFormatting } from '../../../utils/chart-formatting/index.js';\nimport {\n pickQualitativePalette,\n resolveFormattingColor,\n} from '../../../utils/fuse-palette.js';\nimport {\n filterTruthyValues,\n firstField,\n isFuseWidgetPayload,\n resolveUniqueValuesOrder,\n rowsOf,\n type FuseWidgetLike,\n} from '../../../utils/fuse-widget.js';\nimport { polarMaxValue } from './domain.js';\nimport type {\n PolarAreaChartData,\n PolarAreaLabelValue,\n PolarAreaLegendEntry,\n PolarAreaModel,\n PolarAreaPoint,\n PolarAreaSector,\n} from './types.js';\n\nconst EMPTY: PolarAreaModel = { sectors: [], categories: [], legend: [], maxValue: 0 };\n\nfunction isLabelValueArray(input: unknown): input is PolarAreaLabelValue[] {\n if (!Array.isArray(input) || input.length === 0) return false;\n const first = input[0] as Record<string, unknown>;\n return first != null && typeof first === 'object' && 'label' in first && 'value' in first;\n}\n\nfunction isPointsPayload(input: unknown): input is { points: PolarAreaPoint[] } {\n return (\n !!input &&\n typeof input === 'object' &&\n Array.isArray((input as { points?: unknown }).points)\n );\n}\n\n/**\n * Legend keys — client reads `uniqueValues[Object.keys(uniqueValues)[0]]` and\n * drops null-ish entries. On the polar mock that first key is the x-axis field,\n * so legend keys and sector keys line up.\n */\nfunction legendKeysOf(widget: FuseWidgetLike): string[] {\n const uniqueValues = widget.uniqueValues ?? {};\n const firstKey = Object.keys(uniqueValues)[0];\n if (!firstKey) return [];\n return filterTruthyValues((uniqueValues[firstKey] ?? []).map(String));\n}\n\nfunction buildLegend(\n keys: string[],\n formatting: FuseWidgetLike['formatting'],\n): PolarAreaLegendEntry[] {\n return keys.map((key) => ({\n key,\n label: key,\n color: resolveFormattingColor(formatting, key, keys.length),\n }));\n}\n\nfunction modelFromRows(\n rows: Array<{ key: string; value: number }>,\n categories: string[],\n legend: PolarAreaLegendEntry[],\n formatting: FuseWidgetLike['formatting'],\n): PolarAreaModel {\n const colorByKey = new Map(legend.map((entry) => [entry.key, entry.color]));\n const fallbackColor = resolveFormattingColor(formatting, 'default', legend.length || 1);\n\n const sectors: PolarAreaSector[] = rows.map((row) => ({\n key: row.key,\n label: row.key,\n value: row.value,\n color: colorByKey.get(row.key) ?? fallbackColor,\n }));\n\n return { sectors, categories, legend, maxValue: polarMaxValue(sectors) };\n}\n\nfunction categoriesOf(\n widget: FuseWidgetLike,\n xKey: string,\n dataKeys: string[],\n): string[] {\n const fromUniqueValues = (widget.uniqueValues?.[xKey] ?? [])\n .map(String)\n .filter((v) => dataKeys.includes(v));\n return fromUniqueValues.length ? fromUniqueValues : dataKeys;\n}\n\nfunction fromGroupedFuseWidget(\n widget: FuseWidgetLike,\n xKey: string,\n yKey: string,\n groupBy: string,\n): PolarAreaModel {\n const parsed: Array<{ key: string; group: string; value: number }> = [];\n for (const row of rowsOf(widget)) {\n const x = row[xKey];\n const y = Number(row[yKey]);\n const group = row[groupBy];\n if (x == null || x === '' || group == null || group === '' || !Number.isFinite(y)) {\n continue;\n }\n parsed.push({ key: String(x), group: String(group), value: y });\n }\n if (!parsed.length) return EMPTY;\n\n const categories = categoriesOf(\n widget,\n xKey,\n Array.from(new Set(parsed.map((row) => row.key))),\n );\n const groupKeys = resolveUniqueValuesOrder(\n parsed.map((row) => row.group),\n widget.uniqueValues,\n groupBy,\n );\n const formatting = resolveWidgetFormatting(widget);\n const colorByGroup = new Map(\n groupKeys.map((key) => [key, resolveFormattingColor(formatting, key, groupKeys.length)]),\n );\n\n const totals = new Map<string, number>();\n for (const row of parsed) {\n const id = `${row.key}\\0${row.group}`;\n totals.set(id, (totals.get(id) ?? 0) + row.value);\n }\n\n const sectors: PolarAreaSector[] = [];\n for (const category of categories) {\n for (const group of groupKeys) {\n const value = totals.get(`${category}\\0${group}`);\n if (value == null) continue;\n sectors.push({\n key: category,\n group,\n label: category,\n value,\n color: colorByGroup.get(group) ?? resolveFormattingColor(formatting, group, groupKeys.length),\n });\n }\n }\n\n return {\n sectors,\n categories,\n legend: buildLegend(groupKeys, formatting),\n maxValue: polarMaxValue(sectors),\n grouped: true,\n xField: xKey,\n yField: yKey,\n groupField: groupBy,\n axisDetails: widget.axisDetails ?? undefined,\n };\n}\n\nfunction fromFuseWidget(widget: FuseWidgetLike): PolarAreaModel {\n const xKey = firstField(widget.xAxe);\n const yKey = firstField(widget.yAxe);\n if (!xKey || !yKey) return EMPTY;\n\n const groupBy = firstField(widget.groupBy);\n if (groupBy) return fromGroupedFuseWidget(widget, xKey, yKey, groupBy);\n\n const parsed: Array<{ key: string; value: number }> = [];\n for (const row of rowsOf(widget)) {\n const x = row[xKey];\n const y = Number(row[yKey]);\n if (x == null || x === '' || !Number.isFinite(y)) continue;\n parsed.push({ key: String(x), value: y });\n }\n if (!parsed.length) return EMPTY;\n\n const categories = categoriesOf(\n widget,\n xKey,\n Array.from(new Set(parsed.map((row) => row.key))),\n );\n\n // Colors come from resolved formatting so a widget that ships without a\n // `formatting` array still gets the shared default palette (as scatter does).\n const formatting = resolveWidgetFormatting(widget);\n\n // Client aggregates the rows per category once the widget carries more than\n // one formatting entry — otherwise every row keeps its own wedge. This gate\n // reads the widget's own formatting, not the resolved one: generated entries\n // would flip a formatting-less widget into aggregated mode.\n let rows = parsed;\n if ((widget.formatting?.length ?? 0) > 1) {\n const totals = new Map<string, number>();\n for (const row of parsed) {\n totals.set(row.key, (totals.get(row.key) ?? 0) + row.value);\n }\n rows = Array.from(totals, ([key, value]) => ({ key, value }));\n }\n\n // Client `categories.flatMap(...)`: category order first, extras dropped.\n const sorted = categories.flatMap((category) =>\n rows.filter((row) => row.key === category),\n );\n\n const model = modelFromRows(\n sorted,\n categories,\n buildLegend(legendKeysOf(widget), formatting),\n formatting,\n );\n\n return {\n ...model,\n xField: xKey,\n yField: yKey,\n axisDetails: widget.axisDetails ?? undefined,\n };\n}\n\nfunction fromLabelValue(input: PolarAreaLabelValue[]): PolarAreaModel {\n const rows = input\n .map((row) => ({\n key: String(row.label),\n value: Number(row.value),\n color: row.color,\n }))\n .filter((row) => row.key && Number.isFinite(row.value));\n if (!rows.length) return EMPTY;\n\n const palette = pickQualitativePalette(0, rows.length);\n const sectors: PolarAreaSector[] = rows.map((row, index) => ({\n key: row.key,\n label: row.key,\n value: row.value,\n color: row.color ?? palette[index % palette.length],\n }));\n\n return {\n sectors,\n categories: sectors.map((sector) => sector.key),\n legend: sectors.map(({ key, label, color }) => ({ key, label, color })),\n maxValue: polarMaxValue(sectors),\n };\n}\n\n/** Normalize chat / FuseDash WidgetItem payloads into polar-area sectors. */\nexport function normalizePolarAreaData(input: PolarAreaChartData): PolarAreaModel {\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 if (isPointsPayload(input)) {\n return fromLabelValue(\n input.points.map((point) => ({ label: String(point.x), value: Number(point.y) })),\n );\n }\n\n if (Array.isArray((input as PolarAreaModel).sectors)) return input as PolarAreaModel;\n\n return EMPTY;\n}\n"],"names":[],"mappings":";;;;AAuBA,MAAM,QAAwB,EAAE,SAAS,CAAA,GAAI,YAAY,CAAA,GAAI,QAAQ,CAAA,GAAI,UAAU,EAAA;AAEnF,SAAS,kBAAkB,OAAgD;AACzE,MAAI,CAAC,MAAM,QAAQ,KAAK,KAAK,MAAM,WAAW,EAAG,QAAO;AACxD,QAAM,QAAQ,MAAM,CAAC;AACrB,SAAO,SAAS,QAAQ,OAAO,UAAU,YAAY,WAAW,SAAS,WAAW;AACtF;AAEA,SAAS,gBAAgB,OAAuD;AAC9E,SACE,CAAC,CAAC,SACF,OAAO,UAAU,YACjB,MAAM,QAAS,MAA+B,MAAM;AAExD;AAOA,SAAS,aAAa,QAAkC;AACtD,QAAM,eAAe,OAAO,gBAAgB,CAAA;AAC5C,QAAM,WAAW,OAAO,KAAK,YAAY,EAAE,CAAC;AAC5C,MAAI,CAAC,SAAU,QAAO,CAAA;AACtB,SAAO,oBAAoB,aAAa,QAAQ,KAAK,IAAI,IAAI,MAAM,CAAC;AACtE;AAEA,SAAS,YACP,MACA,YACwB;AACxB,SAAO,KAAK,IAAI,CAAC,SAAS;AAAA,IACxB;AAAA,IACA,OAAO;AAAA,IACP,OAAO,uBAAuB,YAAY,KAAK,KAAK,MAAM;AAAA,EAAA,EAC1D;AACJ;AAEA,SAAS,cACP,MACA,YACA,QACA,YACgB;AAChB,QAAM,aAAa,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,KAAK,MAAM,KAAK,CAAC,CAAC;AAC1E,QAAM,gBAAgB,uBAAuB,YAAY,WAAW,OAAO,UAAU,CAAC;AAEtF,QAAM,UAA6B,KAAK,IAAI,CAAC,SAAS;AAAA,IACpD,KAAK,IAAI;AAAA,IACT,OAAO,IAAI;AAAA,IACX,OAAO,IAAI;AAAA,IACX,OAAO,WAAW,IAAI,IAAI,GA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