@unovis/ts 1.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +193 -0
- package/components/area/config.d.ts +25 -0
- package/components/area/config.js +16 -0
- package/components/area/config.js.map +1 -0
- package/components/area/index.d.ts +19 -0
- package/components/area/index.js +103 -0
- package/components/area/index.js.map +1 -0
- package/components/area/style.d.ts +3 -0
- package/components/area/style.js +32 -0
- package/components/area/style.js.map +1 -0
- package/components/area/types.d.ts +6 -0
- package/components/axis/config.d.ts +74 -0
- package/components/axis/config.js +33 -0
- package/components/axis/config.js.map +1 -0
- package/components/axis/index.d.ts +51 -0
- package/components/axis/index.js +291 -0
- package/components/axis/index.js.map +1 -0
- package/components/axis/modules/tick.d.ts +5 -0
- package/components/axis/modules/tick.js +48 -0
- package/components/axis/modules/tick.js.map +1 -0
- package/components/axis/style.d.ts +9 -0
- package/components/axis/style.js +95 -0
- package/components/axis/style.js.map +1 -0
- package/components/axis/types.d.ts +4 -0
- package/components/axis/types.js +8 -0
- package/components/axis/types.js.map +1 -0
- package/components/brush/config.d.ts +42 -0
- package/components/brush/config.js +24 -0
- package/components/brush/config.js.map +1 -0
- package/components/brush/index.d.ts +28 -0
- package/components/brush/index.js +199 -0
- package/components/brush/index.js.map +1 -0
- package/components/brush/style.d.ts +5 -0
- package/components/brush/style.js +63 -0
- package/components/brush/style.js.map +1 -0
- package/components/brush/types.d.ts +7 -0
- package/components/brush/types.js +8 -0
- package/components/brush/types.js.map +1 -0
- package/components/bullet-legend/config.d.ts +24 -0
- package/components/bullet-legend/config.js +16 -0
- package/components/bullet-legend/config.js.map +1 -0
- package/components/bullet-legend/index.d.ts +19 -0
- package/components/bullet-legend/index.js +79 -0
- package/components/bullet-legend/index.js.map +1 -0
- package/components/bullet-legend/style.d.ts +6 -0
- package/components/bullet-legend/style.js +66 -0
- package/components/bullet-legend/style.js.map +1 -0
- package/components/bullet-legend/types.d.ts +7 -0
- package/components/chord-diagram/config.d.ts +42 -0
- package/components/chord-diagram/config.js +25 -0
- package/components/chord-diagram/config.js.map +1 -0
- package/components/chord-diagram/index.d.ts +52 -0
- package/components/chord-diagram/index.js +280 -0
- package/components/chord-diagram/index.js.map +1 -0
- package/components/chord-diagram/modules/label.d.ts +8 -0
- package/components/chord-diagram/modules/label.js +128 -0
- package/components/chord-diagram/modules/label.js.map +1 -0
- package/components/chord-diagram/modules/link.d.ts +20 -0
- package/components/chord-diagram/modules/link.js +35 -0
- package/components/chord-diagram/modules/link.js.map +1 -0
- package/components/chord-diagram/modules/node.d.ts +17 -0
- package/components/chord-diagram/modules/node.js +52 -0
- package/components/chord-diagram/modules/node.js.map +1 -0
- package/components/chord-diagram/style.d.ts +13 -0
- package/components/chord-diagram/style.js +88 -0
- package/components/chord-diagram/style.js.map +1 -0
- package/components/chord-diagram/types.d.ts +40 -0
- package/components/chord-diagram/types.js +8 -0
- package/components/chord-diagram/types.js.map +1 -0
- package/components/crosshair/config.d.ts +43 -0
- package/components/crosshair/config.js +19 -0
- package/components/crosshair/config.js.map +1 -0
- package/components/crosshair/index.d.ts +35 -0
- package/components/crosshair/index.js +180 -0
- package/components/crosshair/index.js.map +1 -0
- package/components/crosshair/style.d.ts +4 -0
- package/components/crosshair/style.js +25 -0
- package/components/crosshair/style.js.map +1 -0
- package/components/crosshair/types.d.ts +13 -0
- package/components/donut/config.d.ts +45 -0
- package/components/donut/config.js +25 -0
- package/components/donut/config.js.map +1 -0
- package/components/donut/index.d.ts +20 -0
- package/components/donut/index.js +84 -0
- package/components/donut/index.js.map +1 -0
- package/components/donut/modules/arc.d.ts +10 -0
- package/components/donut/modules/arc.js +53 -0
- package/components/donut/modules/arc.js.map +1 -0
- package/components/donut/style.d.ts +6 -0
- package/components/donut/style.js +53 -0
- package/components/donut/style.js.map +1 -0
- package/components/donut/types.d.ts +12 -0
- package/components/flow-legend/config.d.ts +26 -0
- package/components/flow-legend/config.js +17 -0
- package/components/flow-legend/config.js.map +1 -0
- package/components/flow-legend/index.d.ts +16 -0
- package/components/flow-legend/index.js +73 -0
- package/components/flow-legend/index.js.map +1 -0
- package/components/flow-legend/style.d.ts +8 -0
- package/components/flow-legend/style.js +80 -0
- package/components/flow-legend/style.js.map +1 -0
- package/components/flow-legend/types.d.ts +9 -0
- package/components/flow-legend/types.js +8 -0
- package/components/flow-legend/types.js.map +1 -0
- package/components/free-brush/config.d.ts +45 -0
- package/components/free-brush/config.js +24 -0
- package/components/free-brush/config.js.map +1 -0
- package/components/free-brush/index.d.ts +20 -0
- package/components/free-brush/index.js +191 -0
- package/components/free-brush/index.js.map +1 -0
- package/components/free-brush/style.d.ts +4 -0
- package/components/free-brush/style.js +50 -0
- package/components/free-brush/style.js.map +1 -0
- package/components/free-brush/types.d.ts +7 -0
- package/components/free-brush/types.js +9 -0
- package/components/free-brush/types.js.map +1 -0
- package/components/graph/config.d.ts +207 -0
- package/components/graph/config.js +75 -0
- package/components/graph/config.js.map +1 -0
- package/components/graph/index.d.ts +125 -0
- package/components/graph/index.js +653 -0
- package/components/graph/index.js.map +1 -0
- package/components/graph/modules/layout-helpers.d.ts +2 -0
- package/components/graph/modules/layout-helpers.js +11 -0
- package/components/graph/modules/layout-helpers.js.map +1 -0
- package/components/graph/modules/layout.d.ts +9 -0
- package/components/graph/modules/layout.js +343 -0
- package/components/graph/modules/layout.js.map +1 -0
- package/components/graph/modules/link/helper.d.ts +25 -0
- package/components/graph/modules/link/helper.js +78 -0
- package/components/graph/modules/link/helper.js.map +1 -0
- package/components/graph/modules/link/index.d.ts +12 -0
- package/components/graph/modules/link/index.js +201 -0
- package/components/graph/modules/link/index.js.map +1 -0
- package/components/graph/modules/link/style.d.ts +15 -0
- package/components/graph/modules/link/style.js +112 -0
- package/components/graph/modules/link/style.js.map +1 -0
- package/components/graph/modules/node/helper.d.ts +21 -0
- package/components/graph/modules/node/helper.js +127 -0
- package/components/graph/modules/node/helper.js.map +1 -0
- package/components/graph/modules/node/index.d.ts +12 -0
- package/components/graph/modules/node/index.js +248 -0
- package/components/graph/modules/node/index.js.map +1 -0
- package/components/graph/modules/node/style.d.ts +24 -0
- package/components/graph/modules/node/style.js +273 -0
- package/components/graph/modules/node/style.js.map +1 -0
- package/components/graph/modules/panel/helper.d.ts +16 -0
- package/components/graph/modules/panel/helper.js +110 -0
- package/components/graph/modules/panel/helper.js.map +1 -0
- package/components/graph/modules/panel/index.d.ts +7 -0
- package/components/graph/modules/panel/index.js +103 -0
- package/components/graph/modules/panel/index.js.map +1 -0
- package/components/graph/modules/panel/style.d.ts +14 -0
- package/components/graph/modules/panel/style.js +123 -0
- package/components/graph/modules/panel/style.js.map +1 -0
- package/components/graph/modules/shape.d.ts +7 -0
- package/components/graph/modules/shape.js +80 -0
- package/components/graph/modules/shape.js.map +1 -0
- package/components/graph/modules/zoom-levels.d.ts +6 -0
- package/components/graph/modules/zoom-levels.js +10 -0
- package/components/graph/modules/zoom-levels.js.map +1 -0
- package/components/graph/style.d.ts +6 -0
- package/components/graph/style.js +66 -0
- package/components/graph/style.js.map +1 -0
- package/components/graph/types.d.ts +120 -0
- package/components/graph/types.js +29 -0
- package/components/graph/types.js.map +1 -0
- package/components/grouped-bar/config.d.ts +36 -0
- package/components/grouped-bar/config.js +20 -0
- package/components/grouped-bar/config.js.map +1 -0
- package/components/grouped-bar/index.d.ts +30 -0
- package/components/grouped-bar/index.js +231 -0
- package/components/grouped-bar/index.js.map +1 -0
- package/components/grouped-bar/style.d.ts +5 -0
- package/components/grouped-bar/style.js +36 -0
- package/components/grouped-bar/style.js.map +1 -0
- package/components/leaflet-flow-map/config.d.ts +46 -0
- package/components/leaflet-flow-map/config.js +25 -0
- package/components/leaflet-flow-map/config.js.map +1 -0
- package/components/leaflet-flow-map/index.d.ts +51 -0
- package/components/leaflet-flow-map/index.js +219 -0
- package/components/leaflet-flow-map/index.js.map +1 -0
- package/components/leaflet-flow-map/renderer-utils.d.ts +5 -0
- package/components/leaflet-flow-map/renderer-utils.js +15 -0
- package/components/leaflet-flow-map/renderer-utils.js.map +1 -0
- package/components/leaflet-flow-map/renderer.d.ts +26 -0
- package/components/leaflet-flow-map/renderer.js +117 -0
- package/components/leaflet-flow-map/renderer.js.map +1 -0
- package/components/leaflet-flow-map/shaders.d.ts +2 -0
- package/components/leaflet-flow-map/shaders.js +27 -0
- package/components/leaflet-flow-map/shaders.js.map +1 -0
- package/components/leaflet-flow-map/types.d.ts +23 -0
- package/components/leaflet-map/config.d.ts +175 -0
- package/components/leaflet-map/config.js +67 -0
- package/components/leaflet-map/config.js.map +1 -0
- package/components/leaflet-map/index.d.ts +95 -0
- package/components/leaflet-map/index.js +648 -0
- package/components/leaflet-map/index.js.map +1 -0
- package/components/leaflet-map/leaflet.css.js +4 -0
- package/components/leaflet-map/leaflet.css.js.map +1 -0
- package/components/leaflet-map/modules/clusterBackground.d.ts +4 -0
- package/components/leaflet-map/modules/clusterBackground.js +27 -0
- package/components/leaflet-map/modules/clusterBackground.js.map +1 -0
- package/components/leaflet-map/modules/donut.d.ts +3 -0
- package/components/leaflet-map/modules/donut.js +25 -0
- package/components/leaflet-map/modules/donut.js.map +1 -0
- package/components/leaflet-map/modules/map.d.ts +13 -0
- package/components/leaflet-map/modules/map.js +143 -0
- package/components/leaflet-map/modules/map.js.map +1 -0
- package/components/leaflet-map/modules/node.d.ts +8 -0
- package/components/leaflet-map/modules/node.js +148 -0
- package/components/leaflet-map/modules/node.js.map +1 -0
- package/components/leaflet-map/modules/selectionRing.d.ts +6 -0
- package/components/leaflet-map/modules/selectionRing.js +41 -0
- package/components/leaflet-map/modules/selectionRing.js.map +1 -0
- package/components/leaflet-map/modules/utils.d.ts +49 -0
- package/components/leaflet-map/modules/utils.js +206 -0
- package/components/leaflet-map/modules/utils.js.map +1 -0
- package/components/leaflet-map/renderer/leaflet-maplibre-gl.js +273 -0
- package/components/leaflet-map/renderer/leaflet-maplibre-gl.js.map +1 -0
- package/components/leaflet-map/renderer/map-style.d.ts +4 -0
- package/components/leaflet-map/renderer/map-style.js +15 -0
- package/components/leaflet-map/renderer/map-style.js.map +1 -0
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json.js +40 -0
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json.js.map +1 -0
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json.js +40 -0
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json.js.map +1 -0
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json.js +4987 -0
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json.js.map +1 -0
- package/components/leaflet-map/renderer/mapboxgl-layer.d.ts +7 -0
- package/components/leaflet-map/renderer/mapboxgl-layer.js +27 -0
- package/components/leaflet-map/renderer/mapboxgl-layer.js.map +1 -0
- package/components/leaflet-map/renderer/mapboxgl-utils.d.ts +5 -0
- package/components/leaflet-map/renderer/mapboxgl-utils.js +39 -0
- package/components/leaflet-map/renderer/mapboxgl-utils.js.map +1 -0
- package/components/leaflet-map/renderer/maplibre-gl.css.js +4 -0
- package/components/leaflet-map/renderer/maplibre-gl.css.js.map +1 -0
- package/components/leaflet-map/style.d.ts +19 -0
- package/components/leaflet-map/style.js +192 -0
- package/components/leaflet-map/style.js.map +1 -0
- package/components/leaflet-map/types.d.ts +70 -0
- package/components/leaflet-map/types.js +10 -0
- package/components/leaflet-map/types.js.map +1 -0
- package/components/line/config.d.ts +30 -0
- package/components/line/config.js +17 -0
- package/components/line/config.js.map +1 -0
- package/components/line/index.d.ts +27 -0
- package/components/line/index.js +139 -0
- package/components/line/index.js.map +1 -0
- package/components/line/style.d.ts +6 -0
- package/components/line/style.js +35 -0
- package/components/line/style.js.map +1 -0
- package/components/line/types.d.ts +12 -0
- package/components/radial-dendrogram/config.d.ts +34 -0
- package/components/radial-dendrogram/config.js +20 -0
- package/components/radial-dendrogram/config.js.map +1 -0
- package/components/radial-dendrogram/index.d.ts +22 -0
- package/components/radial-dendrogram/index.js +98 -0
- package/components/radial-dendrogram/index.js.map +1 -0
- package/components/radial-dendrogram/modules/label.d.ts +8 -0
- package/components/radial-dendrogram/modules/label.js +70 -0
- package/components/radial-dendrogram/modules/label.js.map +1 -0
- package/components/radial-dendrogram/modules/link.d.ts +19 -0
- package/components/radial-dendrogram/modules/link.js +59 -0
- package/components/radial-dendrogram/modules/link.js.map +1 -0
- package/components/radial-dendrogram/modules/node.d.ts +16 -0
- package/components/radial-dendrogram/modules/node.js +51 -0
- package/components/radial-dendrogram/modules/node.js.map +1 -0
- package/components/radial-dendrogram/style.d.ts +6 -0
- package/components/radial-dendrogram/style.js +54 -0
- package/components/radial-dendrogram/style.js.map +1 -0
- package/components/radial-dendrogram/types.d.ts +34 -0
- package/components/sankey/config.d.ts +162 -0
- package/components/sankey/config.js +65 -0
- package/components/sankey/config.js.map +1 -0
- package/components/sankey/index.d.ts +59 -0
- package/components/sankey/index.js +299 -0
- package/components/sankey/index.js.map +1 -0
- package/components/sankey/modules/label.d.ts +23 -0
- package/components/sankey/modules/label.js +164 -0
- package/components/sankey/modules/label.js.map +1 -0
- package/components/sankey/modules/link.d.ts +13 -0
- package/components/sankey/modules/link.js +108 -0
- package/components/sankey/modules/link.js.map +1 -0
- package/components/sankey/modules/node.d.ts +10 -0
- package/components/sankey/modules/node.js +156 -0
- package/components/sankey/modules/node.js.map +1 -0
- package/components/sankey/style.d.ts +20 -0
- package/components/sankey/style.js +164 -0
- package/components/sankey/style.js.map +1 -0
- package/components/sankey/types.d.ts +84 -0
- package/components/sankey/types.js +34 -0
- package/components/sankey/types.js.map +1 -0
- package/components/scatter/config.d.ts +44 -0
- package/components/scatter/config.js +23 -0
- package/components/scatter/config.js.map +1 -0
- package/components/scatter/index.d.ts +19 -0
- package/components/scatter/index.js +123 -0
- package/components/scatter/index.js.map +1 -0
- package/components/scatter/modules/point.d.ts +7 -0
- package/components/scatter/modules/point.js +98 -0
- package/components/scatter/modules/point.js.map +1 -0
- package/components/scatter/style.d.ts +5 -0
- package/components/scatter/style.js +53 -0
- package/components/scatter/style.js.map +1 -0
- package/components/scatter/types.d.ts +13 -0
- package/components/stacked-bar/config.d.ts +38 -0
- package/components/stacked-bar/config.js +20 -0
- package/components/stacked-bar/config.js.map +1 -0
- package/components/stacked-bar/index.d.ts +27 -0
- package/components/stacked-bar/index.js +193 -0
- package/components/stacked-bar/index.js.map +1 -0
- package/components/stacked-bar/style.d.ts +5 -0
- package/components/stacked-bar/style.js +36 -0
- package/components/stacked-bar/style.js.map +1 -0
- package/components/stacked-bar/types.d.ts +5 -0
- package/components/timeline/config.d.ts +43 -0
- package/components/timeline/config.js +23 -0
- package/components/timeline/config.js.map +1 -0
- package/components/timeline/index.d.ts +43 -0
- package/components/timeline/index.js +235 -0
- package/components/timeline/index.js.map +1 -0
- package/components/timeline/style.d.ts +12 -0
- package/components/timeline/style.js +86 -0
- package/components/timeline/style.js.map +1 -0
- package/components/tooltip/config.d.ts +46 -0
- package/components/tooltip/config.js +19 -0
- package/components/tooltip/config.js.map +1 -0
- package/components/tooltip/index.d.ts +34 -0
- package/components/tooltip/index.js +147 -0
- package/components/tooltip/index.js.map +1 -0
- package/components/tooltip/style.js +72 -0
- package/components/tooltip/style.js.map +1 -0
- package/components/topojson-map/config.d.ts +99 -0
- package/components/topojson-map/config.js +42 -0
- package/components/topojson-map/config.js.map +1 -0
- package/components/topojson-map/index.d.ts +52 -0
- package/components/topojson-map/index.js +355 -0
- package/components/topojson-map/index.js.map +1 -0
- package/components/topojson-map/style.d.ts +11 -0
- package/components/topojson-map/style.js +97 -0
- package/components/topojson-map/style.js.map +1 -0
- package/components/topojson-map/types.d.ts +48 -0
- package/components/topojson-map/types.js +45 -0
- package/components/topojson-map/types.js.map +1 -0
- package/components/topojson-map/utils.d.ts +3 -0
- package/components/topojson-map/utils.js +30 -0
- package/components/topojson-map/utils.js.map +1 -0
- package/components/vis-controls/config.d.ts +12 -0
- package/components/vis-controls/config.js +13 -0
- package/components/vis-controls/config.js.map +1 -0
- package/components/vis-controls/index.d.ts +14 -0
- package/components/vis-controls/index.js +52 -0
- package/components/vis-controls/index.js.map +1 -0
- package/components/vis-controls/style.d.ts +11 -0
- package/components/vis-controls/style.js +75 -0
- package/components/vis-controls/style.js.map +1 -0
- package/components/vis-controls/types.d.ts +13 -0
- package/components/vis-controls/types.js +8 -0
- package/components/vis-controls/types.js.map +1 -0
- package/components/xy-labels/config.d.ts +48 -0
- package/components/xy-labels/config.js +25 -0
- package/components/xy-labels/config.js.map +1 -0
- package/components/xy-labels/index.d.ts +15 -0
- package/components/xy-labels/index.js +86 -0
- package/components/xy-labels/index.js.map +1 -0
- package/components/xy-labels/modules/label.d.ts +9 -0
- package/components/xy-labels/modules/label.js +105 -0
- package/components/xy-labels/modules/label.js.map +1 -0
- package/components/xy-labels/style.d.ts +5 -0
- package/components/xy-labels/style.js +53 -0
- package/components/xy-labels/style.js.map +1 -0
- package/components/xy-labels/types.d.ts +23 -0
- package/components/xy-labels/types.js +9 -0
- package/components/xy-labels/types.js.map +1 -0
- package/components.d.ts +52 -0
- package/containers/single-container/config.d.ts +12 -0
- package/containers/single-container/config.js +12 -0
- package/containers/single-container/config.js.map +1 -0
- package/containers/single-container/index.d.ts +17 -0
- package/containers/single-container/index.js +115 -0
- package/containers/single-container/index.js.map +1 -0
- package/containers/xy-container/config.d.ts +99 -0
- package/containers/xy-container/config.js +30 -0
- package/containers/xy-container/config.js.map +1 -0
- package/containers/xy-container/index.d.ts +33 -0
- package/containers/xy-container/index.js +322 -0
- package/containers/xy-container/index.js.map +1 -0
- package/containers.d.ts +6 -0
- package/core/component/config.d.ts +58 -0
- package/core/component/config.js +14 -0
- package/core/component/config.js.map +1 -0
- package/core/component/index.d.ts +38 -0
- package/core/component/index.js +112 -0
- package/core/component/index.js.map +1 -0
- package/core/component/types.d.ts +2 -0
- package/core/config/index.d.ts +3 -0
- package/core/config/index.js +16 -0
- package/core/config/index.js.map +1 -0
- package/core/container/config.d.ts +38 -0
- package/core/container/config.js +29 -0
- package/core/container/config.js.map +1 -0
- package/core/container/index.d.ts +25 -0
- package/core/container/index.js +92 -0
- package/core/container/index.js.map +1 -0
- package/core/xy-component/config.d.ts +38 -0
- package/core/xy-component/config.js +20 -0
- package/core/xy-component/config.js.map +1 -0
- package/core/xy-component/index.d.ts +25 -0
- package/core/xy-component/index.js +65 -0
- package/core/xy-component/index.js.map +1 -0
- package/data-models/core.d.ts +6 -0
- package/data-models/core.js +14 -0
- package/data-models/core.js.map +1 -0
- package/data-models/graph.d.ts +24 -0
- package/data-models/graph.js +101 -0
- package/data-models/graph.js.map +1 -0
- package/data-models/map-graph.d.ts +23 -0
- package/data-models/map-graph.js +59 -0
- package/data-models/map-graph.js.map +1 -0
- package/data-models/map.d.ts +5 -0
- package/data-models/map.js +12 -0
- package/data-models/map.js.map +1 -0
- package/data-models/series.d.ts +6 -0
- package/data-models/series.js +19 -0
- package/data-models/series.js.map +1 -0
- package/index.d.ts +4 -0
- package/index.js +49 -0
- package/index.js.map +1 -0
- package/maps/china-provinces.json.js +140373 -0
- package/maps/fr-regions.json.js +14162 -0
- package/maps/germany-regions.json.js +35760 -0
- package/maps/ind-regions.json.js +290584 -0
- package/maps/uk-regions.json.js +96233 -0
- package/maps/us-counties.json.js +206318 -0
- package/maps/us-states.json.js +16345 -0
- package/maps/world-110m-alpha.json.js +251366 -0
- package/maps/world-simple.json.js +89428 -0
- package/maps/world-simplest.json.js +28175 -0
- package/maps.d.ts +60 -0
- package/maps.js +23 -0
- package/package.json +58 -0
- package/styles/colors.d.ts +4 -0
- package/styles/colors.js +11 -0
- package/styles/colors.js.map +1 -0
- package/styles/css-variables.d.ts +2 -0
- package/styles/css-variables.js +16 -0
- package/styles/css-variables.js.map +1 -0
- package/types/accessor.d.ts +5 -0
- package/types/component.d.ts +13 -0
- package/types/component.js +14 -0
- package/types/component.js.map +1 -0
- package/types/curve.d.ts +40 -0
- package/types/curve.js +46 -0
- package/types/curve.js.map +1 -0
- package/types/data.d.ts +7 -0
- package/types/direction.d.ts +6 -0
- package/types/direction.js +10 -0
- package/types/direction.js.map +1 -0
- package/types/graph.d.ts +35 -0
- package/types/map.d.ts +4 -0
- package/types/misc.d.ts +8 -0
- package/types/position.d.ts +20 -0
- package/types/position.js +27 -0
- package/types/position.js.map +1 -0
- package/types/scale.d.ts +23 -0
- package/types/scale.js +27 -0
- package/types/scale.js.map +1 -0
- package/types/shape.d.ts +7 -0
- package/types/shape.js +11 -0
- package/types/shape.js.map +1 -0
- package/types/spacing.d.ts +6 -0
- package/types/symbol.d.ts +18 -0
- package/types/symbol.js +24 -0
- package/types/symbol.js.map +1 -0
- package/types/text.d.ts +38 -0
- package/types/text.js +31 -0
- package/types/text.js.map +1 -0
- package/types.d.ts +28 -0
- package/utils/color.d.ts +9 -0
- package/utils/color.js +26 -0
- package/utils/color.js.map +1 -0
- package/utils/d3.d.ts +3 -0
- package/utils/d3.js +16 -0
- package/utils/d3.js.map +1 -0
- package/utils/data.d.ts +123 -0
- package/utils/data.js +193 -0
- package/utils/data.js.map +1 -0
- package/utils/html.d.ts +1 -0
- package/utils/html.js +15 -0
- package/utils/html.js.map +1 -0
- package/utils/map.d.ts +2 -0
- package/utils/map.js +20 -0
- package/utils/map.js.map +1 -0
- package/utils/misc.d.ts +16 -0
- package/utils/misc.js +42 -0
- package/utils/misc.js.map +1 -0
- package/utils/path.d.ts +21 -0
- package/utils/path.js +144 -0
- package/utils/path.js.map +1 -0
- package/utils/scale.d.ts +1 -0
- package/utils/text.d.ts +17 -0
- package/utils/text.js +196 -0
- package/utils/text.js.map +1 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { ComponentConfigInterface, ComponentConfig } from "../../core/component/config";
|
|
2
|
+
import { ColorAccessor, GenericAccessor, NumericAccessor, StringAccessor } from "../../types/accessor";
|
|
3
|
+
import { TrimMode, VerticalAlign, FitMode } from "../../types/text";
|
|
4
|
+
import { Position } from "../../types/position";
|
|
5
|
+
import { SankeyInputLink, SankeyInputNode, SankeyNodeAlign, SankeySubLabelPlacement, SankeyExitTransitionType, SankeyEnterTransitionType, SankeyLink, SankeyNode } from './types';
|
|
6
|
+
export interface SankeyConfigInterface<N extends SankeyInputNode, L extends SankeyInputLink> extends ComponentConfigInterface {
|
|
7
|
+
/** Node / Link id accessor function. Used for mapping of data updates to corresponding SVG objects. Default: `(d, i) => d.id ?? i.toString()` */
|
|
8
|
+
id?: (d: SankeyInputNode | SankeyInputLink, i?: number, ...any: any[]) => string;
|
|
9
|
+
/** Coefficient to scale the height of the diagram when the amount of links is low: `C * links.length`, clamped to `[height / 2, height]`. Default: `1/16` */
|
|
10
|
+
heightNormalizationCoeff?: number;
|
|
11
|
+
/** Type of animation on removing nodes. Default: `ExitTransitionType.Default` */
|
|
12
|
+
exitTransitionType?: SankeyExitTransitionType;
|
|
13
|
+
/** Type of animation on creating nodes. Default: `EnterTransitionType.Default` */
|
|
14
|
+
enterTransitionType?: SankeyEnterTransitionType;
|
|
15
|
+
/** Highlight the corresponding subtree on node / link hover. Default: `false` */
|
|
16
|
+
highlightSubtreeOnHover?: boolean;
|
|
17
|
+
/** Highlight animation duration, ms. Default: `400` */
|
|
18
|
+
highlightDuration?: number;
|
|
19
|
+
/** Highlight delay, ms. Default: `1000` */
|
|
20
|
+
highlightDelay?: number;
|
|
21
|
+
/** Sankey algorithm iterations. Default: `32` */
|
|
22
|
+
iterations?: number;
|
|
23
|
+
/** Sankey node sorting function. Default: `undefined`.
|
|
24
|
+
* Node sorting is applied to nodes in one layer (column). Layer by layer.
|
|
25
|
+
* Options: `undefined` - the order is determined by the layout;
|
|
26
|
+
* `null` - the order is fixed by the input;
|
|
27
|
+
* sort function - the order is determined by the function.
|
|
28
|
+
*/
|
|
29
|
+
nodeSort?: ((node1: N, node2: N) => number) | null | undefined;
|
|
30
|
+
/** Sankey link sorting function. Default: `(link2, link1) => link1.value - link2.value`.
|
|
31
|
+
* Link sorting is applied to the source (exiting) links within one node.
|
|
32
|
+
* Options: `undefined` - the order is determined by the layout;
|
|
33
|
+
* `null` - the order is fixed by the input;
|
|
34
|
+
* sort function - the order is determined by the function.
|
|
35
|
+
*/
|
|
36
|
+
linkSort?: ((link1: L, link2: L) => number) | null | undefined;
|
|
37
|
+
/** Sankey node width in pixels */
|
|
38
|
+
nodeWidth?: number;
|
|
39
|
+
/** Sankey node alignment method */
|
|
40
|
+
nodeAlign?: SankeyNodeAlign;
|
|
41
|
+
/** Horizontal space between the nodes. Extended Sizing property only. Default: `150` */
|
|
42
|
+
nodeHorizontalSpacing?: number;
|
|
43
|
+
/** Minimum node height. Extended Sizing property only. Default: `20` */
|
|
44
|
+
nodeMinHeight?: number;
|
|
45
|
+
/** Maximum node height. Extended Sizing property only. Default: `100` */
|
|
46
|
+
nodeMaxHeight?: number;
|
|
47
|
+
/** Sankey vertical separation between nodes in pixels. Default: `2` */
|
|
48
|
+
nodePadding?: number;
|
|
49
|
+
/** Display the graph when data has just one element */
|
|
50
|
+
showSingleNode?: boolean;
|
|
51
|
+
/** Node cursor on hover. Default: `undefined` */
|
|
52
|
+
nodeCursor?: StringAccessor<SankeyNode<N, L>>;
|
|
53
|
+
/** Node icon accessor function or value. Default: `undefined` */
|
|
54
|
+
nodeIcon?: StringAccessor<SankeyNode<N, L>>;
|
|
55
|
+
/** Node color accessor function or value. Default: `undefined` */
|
|
56
|
+
nodeColor?: ColorAccessor<SankeyNode<N, L>>;
|
|
57
|
+
/** Node `fixedValue` accessor function or constant. It defines the node value that will be used to calculate
|
|
58
|
+
* the height of the nodes by d3-sankey (by default the height will be based on aggregated `linkValue`).
|
|
59
|
+
* Default: `n => n.fixedValue`
|
|
60
|
+
*/
|
|
61
|
+
nodeFixedValue?: NumericAccessor<N>;
|
|
62
|
+
/** Icon color accessor function or value. Default: `undefined` */
|
|
63
|
+
nodeIconColor?: ColorAccessor<SankeyNode<N, L>>;
|
|
64
|
+
/** Link color accessor function or value. Default: `l => l.color` */
|
|
65
|
+
linkColor?: StringAccessor<SankeyLink<N, L>>;
|
|
66
|
+
/** Link flow accessor function or value. Default: `l => l.value` */
|
|
67
|
+
linkValue?: NumericAccessor<L>;
|
|
68
|
+
/** Link cursor on hover. Default: `undefined` */
|
|
69
|
+
linkCursor?: StringAccessor<SankeyLink<N, L>>;
|
|
70
|
+
/** Node label accessor function or value. Default: `n => n.label` */
|
|
71
|
+
label?: StringAccessor<SankeyNode<N, L>>;
|
|
72
|
+
/** Node sub-label accessor function or value. Default: `undefined` */
|
|
73
|
+
subLabel?: StringAccessor<SankeyNode<N, L>>;
|
|
74
|
+
/** Label position relative to the Node. Default: `Position.AUTO` */
|
|
75
|
+
labelPosition?: GenericAccessor<Position.Auto | Position.Left | Position.Right | string, SankeyNode<N, L>>;
|
|
76
|
+
/** Label vertical alignment */
|
|
77
|
+
labelVerticalAlign?: VerticalAlign | string;
|
|
78
|
+
/** Label background */
|
|
79
|
+
labelBackground?: boolean;
|
|
80
|
+
/** Label fit mode (wrap or trim). Default: `FitMode.TRIM` **/
|
|
81
|
+
labelFit?: FitMode;
|
|
82
|
+
/** Maximum label with in pixels. Default: `70` */
|
|
83
|
+
labelMaxWidth?: number;
|
|
84
|
+
/** Expand trimmed label on hover. Default: `true` */
|
|
85
|
+
labelExpandTrimmedOnHover?: boolean;
|
|
86
|
+
/** Label trimming mode. Default: `TrimMode.MIDDLE` */
|
|
87
|
+
labelTrimMode?: TrimMode;
|
|
88
|
+
/** Label font size in pixel. Default: `12` */
|
|
89
|
+
labelFontSize?: number;
|
|
90
|
+
/** Label text separators for wrapping. Default: `[' ', '-']` */
|
|
91
|
+
labelTextSeparator?: string[];
|
|
92
|
+
/** Force break words to fit long labels. Default: `true` */
|
|
93
|
+
labelForceWordBreak?: boolean;
|
|
94
|
+
/** Label color. Default: `undefined` */
|
|
95
|
+
labelColor?: ColorAccessor<SankeyNode<N, L>>;
|
|
96
|
+
/** Label cursor on hover. Default: `undefined` */
|
|
97
|
+
labelCursor?: StringAccessor<SankeyNode<N, L>>;
|
|
98
|
+
/** Custom function to set the label visibility. Default: `undefined` */
|
|
99
|
+
labelVisibility?: ((d: SankeyNode<N, L>, bbox: {
|
|
100
|
+
x: number;
|
|
101
|
+
y: number;
|
|
102
|
+
width: number;
|
|
103
|
+
height: number;
|
|
104
|
+
}, hovered: boolean) => boolean) | undefined;
|
|
105
|
+
/** Sub-label font size in pixel. Default: `10` */
|
|
106
|
+
subLabelFontSize?: number;
|
|
107
|
+
/** Sub-label color. Default: `undefined` */
|
|
108
|
+
subLabelColor?: ColorAccessor<SankeyNode<N, L>>;
|
|
109
|
+
/** Sub-label position. Default: `SankeySubLabelPlacement.Below` */
|
|
110
|
+
subLabelPlacement?: SankeySubLabelPlacement | string;
|
|
111
|
+
/**
|
|
112
|
+
* Sub-label to label width ratio when `subLabelPlacement` is set to `SankeySubLabelPlacement.Inline`
|
|
113
|
+
* Default: `0.4`, which means that 40% of `labelMaxWidth` will be given to sub-label, and 60% to the main label.
|
|
114
|
+
*/
|
|
115
|
+
subLabelToLabelInlineWidthRatio?: number;
|
|
116
|
+
}
|
|
117
|
+
export declare class SankeyConfig<N extends SankeyInputNode, L extends SankeyInputLink> extends ComponentConfig implements SankeyConfigInterface<N, L> {
|
|
118
|
+
heightNormalizationCoeff: number;
|
|
119
|
+
exitTransitionType: SankeyExitTransitionType;
|
|
120
|
+
enterTransitionType: SankeyEnterTransitionType;
|
|
121
|
+
id: (d: SankeyInputNode | SankeyInputLink, i: number) => string;
|
|
122
|
+
highlightSubtreeOnHover: boolean;
|
|
123
|
+
highlightDuration: number;
|
|
124
|
+
highlightDelay: number;
|
|
125
|
+
iterations: number;
|
|
126
|
+
linkSort: (link2: L, link1: L) => number;
|
|
127
|
+
nodeSort: any;
|
|
128
|
+
nodeWidth: number;
|
|
129
|
+
nodeAlign: SankeyNodeAlign;
|
|
130
|
+
nodeHorizontalSpacing: number;
|
|
131
|
+
nodeMinHeight: number;
|
|
132
|
+
nodeMaxHeight: number;
|
|
133
|
+
nodePadding: number;
|
|
134
|
+
nodeColor: (d: SankeyNode<N, L>) => string;
|
|
135
|
+
nodeFixedValue: (d: N) => number;
|
|
136
|
+
showSingleNode: boolean;
|
|
137
|
+
nodeCursor: any;
|
|
138
|
+
nodeIcon: any;
|
|
139
|
+
nodeIconColor: any;
|
|
140
|
+
label: (d: SankeyNode<N, L>) => string;
|
|
141
|
+
labelPosition: Position;
|
|
142
|
+
labelVerticalAlign: VerticalAlign;
|
|
143
|
+
labelBackground: boolean;
|
|
144
|
+
labelTextSeparator: string[];
|
|
145
|
+
labelFit: FitMode;
|
|
146
|
+
labelTrimMode: TrimMode;
|
|
147
|
+
labelForceWordBreak: boolean;
|
|
148
|
+
labelFontSize: number;
|
|
149
|
+
labelCursor: any;
|
|
150
|
+
labelColor: any;
|
|
151
|
+
labelMaxWidth: number;
|
|
152
|
+
labelExpandTrimmedOnHover: boolean;
|
|
153
|
+
labelVisibility: any;
|
|
154
|
+
subLabel: any;
|
|
155
|
+
subLabelFontSize: number;
|
|
156
|
+
subLabelColor: any;
|
|
157
|
+
subLabelPlacement: SankeySubLabelPlacement;
|
|
158
|
+
subLabelToLabelInlineWidthRatio: number;
|
|
159
|
+
linkValue: (d: L) => number;
|
|
160
|
+
linkColor: (d: SankeyLink<N, L>) => string;
|
|
161
|
+
linkCursor: any;
|
|
162
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ComponentConfig } from '../../core/component/config.js';
|
|
2
|
+
import { getNumber } from '../../utils/data.js';
|
|
3
|
+
import { VerticalAlign, FitMode, TrimMode } from '../../types/text.js';
|
|
4
|
+
import { Position } from '../../types/position.js';
|
|
5
|
+
import { SankeyExitTransitionType, SankeyEnterTransitionType, SankeyNodeAlign, SankeySubLabelPlacement } from './types.js';
|
|
6
|
+
|
|
7
|
+
/* eslint-disable dot-notation */
|
|
8
|
+
class SankeyConfig extends ComponentConfig {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
// General
|
|
12
|
+
this.heightNormalizationCoeff = 1 / 16;
|
|
13
|
+
this.exitTransitionType = SankeyExitTransitionType.Default;
|
|
14
|
+
this.enterTransitionType = SankeyEnterTransitionType.Default;
|
|
15
|
+
// eslint-disable-next-line dot-notation
|
|
16
|
+
this.id = (d, i) => { var _a; return (_a = d['_id']) !== null && _a !== void 0 ? _a : `${i}`; };
|
|
17
|
+
this.highlightSubtreeOnHover = false;
|
|
18
|
+
this.highlightDuration = 300;
|
|
19
|
+
this.highlightDelay = 1000;
|
|
20
|
+
this.iterations = 32;
|
|
21
|
+
// Sorting
|
|
22
|
+
this.linkSort = (link2, link1) => getNumber(link1, this.linkValue) - getNumber(link2, this.linkValue);
|
|
23
|
+
this.nodeSort = undefined;
|
|
24
|
+
// Nodes
|
|
25
|
+
this.nodeWidth = 25;
|
|
26
|
+
this.nodeAlign = SankeyNodeAlign.Justify;
|
|
27
|
+
this.nodeHorizontalSpacing = 150;
|
|
28
|
+
this.nodeMinHeight = 20;
|
|
29
|
+
this.nodeMaxHeight = 100;
|
|
30
|
+
this.nodePadding = 2;
|
|
31
|
+
this.nodeColor = (d) => d['color'];
|
|
32
|
+
this.nodeFixedValue = (d) => d['fixedValue'];
|
|
33
|
+
this.showSingleNode = true;
|
|
34
|
+
this.nodeCursor = undefined;
|
|
35
|
+
this.nodeIcon = undefined;
|
|
36
|
+
this.nodeIconColor = undefined;
|
|
37
|
+
// Labels
|
|
38
|
+
this.label = (d) => d['label'];
|
|
39
|
+
this.labelPosition = Position.Auto;
|
|
40
|
+
this.labelVerticalAlign = VerticalAlign.Middle;
|
|
41
|
+
this.labelBackground = false;
|
|
42
|
+
this.labelTextSeparator = [' ', '-'];
|
|
43
|
+
this.labelFit = FitMode.Trim;
|
|
44
|
+
this.labelTrimMode = TrimMode.Middle;
|
|
45
|
+
this.labelForceWordBreak = true;
|
|
46
|
+
this.labelFontSize = 12;
|
|
47
|
+
this.labelCursor = undefined;
|
|
48
|
+
this.labelColor = undefined;
|
|
49
|
+
this.labelMaxWidth = 70;
|
|
50
|
+
this.labelExpandTrimmedOnHover = true;
|
|
51
|
+
this.labelVisibility = undefined;
|
|
52
|
+
this.subLabel = undefined;
|
|
53
|
+
this.subLabelFontSize = 10;
|
|
54
|
+
this.subLabelColor = undefined;
|
|
55
|
+
this.subLabelPlacement = SankeySubLabelPlacement.Below;
|
|
56
|
+
this.subLabelToLabelInlineWidthRatio = 0.4;
|
|
57
|
+
// Links
|
|
58
|
+
this.linkValue = (d) => d['value'];
|
|
59
|
+
this.linkColor = (d) => d['color'];
|
|
60
|
+
this.linkCursor = undefined;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { SankeyConfig };
|
|
65
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../../src/components/sankey/config.ts"],"sourcesContent":["/* eslint-disable dot-notation */\n\n// Config\nimport { ComponentConfigInterface, ComponentConfig } from 'core/component/config'\n\n// Utils\nimport { getNumber } from 'utils/data'\n\n// Types\nimport { ColorAccessor, GenericAccessor, NumericAccessor, StringAccessor } from 'types/accessor'\nimport { TrimMode, VerticalAlign, FitMode } from 'types/text'\nimport { Position } from 'types/position'\nimport {\n SankeyInputLink,\n SankeyInputNode,\n SankeyNodeAlign,\n SankeySubLabelPlacement,\n SankeyExitTransitionType,\n SankeyEnterTransitionType,\n SankeyLink,\n SankeyNode,\n} from './types'\n\nexport interface SankeyConfigInterface<N extends SankeyInputNode, L extends SankeyInputLink> extends ComponentConfigInterface {\n // General\n /** Node / Link id accessor function. Used for mapping of data updates to corresponding SVG objects. Default: `(d, i) => d.id ?? i.toString()` */\n id?: (d: SankeyInputNode | SankeyInputLink, i?: number, ...any) => string;\n /** Coefficient to scale the height of the diagram when the amount of links is low: `C * links.length`, clamped to `[height / 2, height]`. Default: `1/16` */\n heightNormalizationCoeff?: number;\n /** Type of animation on removing nodes. Default: `ExitTransitionType.Default` */\n exitTransitionType?: SankeyExitTransitionType;\n /** Type of animation on creating nodes. Default: `EnterTransitionType.Default` */\n enterTransitionType?: SankeyEnterTransitionType;\n /** Highlight the corresponding subtree on node / link hover. Default: `false` */\n highlightSubtreeOnHover?: boolean;\n /** Highlight animation duration, ms. Default: `400` */\n highlightDuration?: number;\n /** Highlight delay, ms. Default: `1000` */\n highlightDelay?: number;\n /** Sankey algorithm iterations. Default: `32` */\n iterations?: number;\n\n // Sorting\n /** Sankey node sorting function. Default: `undefined`.\n * Node sorting is applied to nodes in one layer (column). Layer by layer.\n * Options: `undefined` - the order is determined by the layout;\n * `null` - the order is fixed by the input;\n * sort function - the order is determined by the function.\n */\n nodeSort?: ((node1: N, node2: N) => number) | null | undefined;\n /** Sankey link sorting function. Default: `(link2, link1) => link1.value - link2.value`.\n * Link sorting is applied to the source (exiting) links within one node.\n * Options: `undefined` - the order is determined by the layout;\n * `null` - the order is fixed by the input;\n * sort function - the order is determined by the function.\n */\n linkSort?: ((link1: L, link2: L) => number) | null | undefined;\n\n // Nodes\n /** Sankey node width in pixels */\n nodeWidth?: number;\n /** Sankey node alignment method */\n nodeAlign?: SankeyNodeAlign;\n /** Horizontal space between the nodes. Extended Sizing property only. Default: `150` */\n nodeHorizontalSpacing?: number;\n /** Minimum node height. Extended Sizing property only. Default: `20` */\n nodeMinHeight?: number;\n /** Maximum node height. Extended Sizing property only. Default: `100` */\n nodeMaxHeight?: number;\n /** Sankey vertical separation between nodes in pixels. Default: `2` */\n nodePadding?: number;\n /** Display the graph when data has just one element */\n showSingleNode?: boolean;\n /** Node cursor on hover. Default: `undefined` */\n nodeCursor?: StringAccessor<SankeyNode<N, L>>;\n /** Node icon accessor function or value. Default: `undefined` */\n nodeIcon?: StringAccessor<SankeyNode<N, L>>;\n /** Node color accessor function or value. Default: `undefined` */\n nodeColor?: ColorAccessor<SankeyNode<N, L>>;\n /** Node `fixedValue` accessor function or constant. It defines the node value that will be used to calculate\n * the height of the nodes by d3-sankey (by default the height will be based on aggregated `linkValue`).\n * Default: `n => n.fixedValue`\n */\n nodeFixedValue?: NumericAccessor<N>;\n /** Icon color accessor function or value. Default: `undefined` */\n nodeIconColor?: ColorAccessor<SankeyNode<N, L>>;\n\n // Links\n /** Link color accessor function or value. Default: `l => l.color` */\n linkColor?: StringAccessor<SankeyLink<N, L>>;\n /** Link flow accessor function or value. Default: `l => l.value` */\n linkValue?: NumericAccessor<L>;\n /** Link cursor on hover. Default: `undefined` */\n linkCursor?: StringAccessor<SankeyLink<N, L>>;\n\n // Labels\n /** Node label accessor function or value. Default: `n => n.label` */\n label?: StringAccessor<SankeyNode<N, L>>;\n /** Node sub-label accessor function or value. Default: `undefined` */\n subLabel?: StringAccessor<SankeyNode<N, L>>;\n /** Label position relative to the Node. Default: `Position.AUTO` */\n labelPosition?: GenericAccessor<Position.Auto | Position.Left | Position.Right | string, SankeyNode<N, L>>;\n /** Label vertical alignment */\n labelVerticalAlign?: VerticalAlign | string;\n /** Label background */\n labelBackground?: boolean;\n /** Label fit mode (wrap or trim). Default: `FitMode.TRIM` **/\n labelFit?: FitMode;\n /** Maximum label with in pixels. Default: `70` */\n labelMaxWidth?: number;\n /** Expand trimmed label on hover. Default: `true` */\n labelExpandTrimmedOnHover?: boolean;\n /** Label trimming mode. Default: `TrimMode.MIDDLE` */\n labelTrimMode?: TrimMode;\n /** Label font size in pixel. Default: `12` */\n labelFontSize?: number;\n /** Label text separators for wrapping. Default: `[' ', '-']` */\n labelTextSeparator?: string[];\n /** Force break words to fit long labels. Default: `true` */\n labelForceWordBreak?: boolean;\n /** Label color. Default: `undefined` */\n labelColor?: ColorAccessor<SankeyNode<N, L>>;\n /** Label cursor on hover. Default: `undefined` */\n labelCursor?: StringAccessor<SankeyNode<N, L>>;\n /** Custom function to set the label visibility. Default: `undefined` */\n labelVisibility?: ((d: SankeyNode<N, L>, bbox: { x: number; y: number; width: number; height: number }, hovered: boolean) => boolean) | undefined;\n /** Sub-label font size in pixel. Default: `10` */\n subLabelFontSize?: number;\n /** Sub-label color. Default: `undefined` */\n subLabelColor?: ColorAccessor<SankeyNode<N, L>>;\n /** Sub-label position. Default: `SankeySubLabelPlacement.Below` */\n subLabelPlacement?: SankeySubLabelPlacement | string;\n /**\n * Sub-label to label width ratio when `subLabelPlacement` is set to `SankeySubLabelPlacement.Inline`\n * Default: `0.4`, which means that 40% of `labelMaxWidth` will be given to sub-label, and 60% to the main label.\n */\n subLabelToLabelInlineWidthRatio?: number;\n}\n\nexport class SankeyConfig<N extends SankeyInputNode, L extends SankeyInputLink> extends ComponentConfig implements SankeyConfigInterface<N, L> {\n // General\n heightNormalizationCoeff = 1 / 16\n exitTransitionType = SankeyExitTransitionType.Default\n enterTransitionType = SankeyEnterTransitionType.Default\n // eslint-disable-next-line dot-notation\n id = (d: SankeyInputNode | SankeyInputLink, i: number): string => d['_id'] ?? `${i}`\n highlightSubtreeOnHover = false\n highlightDuration = 300\n highlightDelay = 1000\n iterations = 32\n\n // Sorting\n linkSort = (link2: L, link1: L): number => getNumber(link1, this.linkValue) - getNumber(link2, this.linkValue)\n nodeSort = undefined\n\n // Nodes\n nodeWidth = 25\n nodeAlign = SankeyNodeAlign.Justify\n nodeHorizontalSpacing = 150\n nodeMinHeight = 20\n nodeMaxHeight = 100\n nodePadding = 2\n nodeColor = (d: SankeyNode<N, L>): string => d['color']\n nodeFixedValue = (d: N): number => d['fixedValue']\n showSingleNode = true\n nodeCursor = undefined\n nodeIcon = undefined\n nodeIconColor = undefined\n\n // Labels\n label = (d: SankeyNode<N, L>): string => d['label']\n labelPosition = Position.Auto\n labelVerticalAlign = VerticalAlign.Middle\n labelBackground = false\n labelTextSeparator = [' ', '-']\n labelFit = FitMode.Trim\n labelTrimMode = TrimMode.Middle\n labelForceWordBreak = true\n labelFontSize = 12\n labelCursor = undefined\n labelColor = undefined\n labelMaxWidth = 70\n labelExpandTrimmedOnHover = true\n labelVisibility = undefined\n subLabel = undefined\n subLabelFontSize = 10\n subLabelColor = undefined\n subLabelPlacement = SankeySubLabelPlacement.Below\n subLabelToLabelInlineWidthRatio = 0.4\n\n // Links\n linkValue = (d: L): number => d['value']\n linkColor = (d: SankeyLink<N, L>): string => d['color']\n linkCursor = undefined\n}\n"],"names":[],"mappings":";;;;;;AAAA;AA2IM,MAAO,YAAmE,SAAQ,eAAe,CAAA;AAAvG,IAAA,WAAA,GAAA;;;AAEE,QAAA,IAAA,CAAA,wBAAwB,GAAG,CAAC,GAAG,EAAE,CAAA;AACjC,QAAA,IAAA,CAAA,kBAAkB,GAAG,wBAAwB,CAAC,OAAO,CAAA;AACrD,QAAA,IAAA,CAAA,mBAAmB,GAAG,yBAAyB,CAAC,OAAO,CAAA;;QAEvD,IAAE,CAAA,EAAA,GAAG,CAAC,CAAoC,EAAE,CAAS,eAAa,OAAA,CAAA,EAAA,GAAA,CAAC,CAAC,KAAK,CAAC,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,CAAA,EAAG,CAAC,CAAE,CAAA,CAAA,EAAA,CAAA;QACpF,IAAuB,CAAA,uBAAA,GAAG,KAAK,CAAA;QAC/B,IAAiB,CAAA,iBAAA,GAAG,GAAG,CAAA;QACvB,IAAc,CAAA,cAAA,GAAG,IAAI,CAAA;QACrB,IAAU,CAAA,UAAA,GAAG,EAAE,CAAA;;QAGf,IAAQ,CAAA,QAAA,GAAG,CAAC,KAAQ,EAAE,KAAQ,KAAa,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;QAC9G,IAAQ,CAAA,QAAA,GAAG,SAAS,CAAA;;QAGpB,IAAS,CAAA,SAAA,GAAG,EAAE,CAAA;AACd,QAAA,IAAA,CAAA,SAAS,GAAG,eAAe,CAAC,OAAO,CAAA;QACnC,IAAqB,CAAA,qBAAA,GAAG,GAAG,CAAA;QAC3B,IAAa,CAAA,aAAA,GAAG,EAAE,CAAA;QAClB,IAAa,CAAA,aAAA,GAAG,GAAG,CAAA;QACnB,IAAW,CAAA,WAAA,GAAG,CAAC,CAAA;QACf,IAAS,CAAA,SAAA,GAAG,CAAC,CAAmB,KAAa,CAAC,CAAC,OAAO,CAAC,CAAA;QACvD,IAAc,CAAA,cAAA,GAAG,CAAC,CAAI,KAAa,CAAC,CAAC,YAAY,CAAC,CAAA;QAClD,IAAc,CAAA,cAAA,GAAG,IAAI,CAAA;QACrB,IAAU,CAAA,UAAA,GAAG,SAAS,CAAA;QACtB,IAAQ,CAAA,QAAA,GAAG,SAAS,CAAA;QACpB,IAAa,CAAA,aAAA,GAAG,SAAS,CAAA;;QAGzB,IAAK,CAAA,KAAA,GAAG,CAAC,CAAmB,KAAa,CAAC,CAAC,OAAO,CAAC,CAAA;AACnD,QAAA,IAAA,CAAA,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAA;AAC7B,QAAA,IAAA,CAAA,kBAAkB,GAAG,aAAa,CAAC,MAAM,CAAA;QACzC,IAAe,CAAA,eAAA,GAAG,KAAK,CAAA;AACvB,QAAA,IAAA,CAAA,kBAAkB,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;AAC/B,QAAA,IAAA,CAAA,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAA;AACvB,QAAA,IAAA,CAAA,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAA;QAC/B,IAAmB,CAAA,mBAAA,GAAG,IAAI,CAAA;QAC1B,IAAa,CAAA,aAAA,GAAG,EAAE,CAAA;QAClB,IAAW,CAAA,WAAA,GAAG,SAAS,CAAA;QACvB,IAAU,CAAA,UAAA,GAAG,SAAS,CAAA;QACtB,IAAa,CAAA,aAAA,GAAG,EAAE,CAAA;QAClB,IAAyB,CAAA,yBAAA,GAAG,IAAI,CAAA;QAChC,IAAe,CAAA,eAAA,GAAG,SAAS,CAAA;QAC3B,IAAQ,CAAA,QAAA,GAAG,SAAS,CAAA;QACpB,IAAgB,CAAA,gBAAA,GAAG,EAAE,CAAA;QACrB,IAAa,CAAA,aAAA,GAAG,SAAS,CAAA;AACzB,QAAA,IAAA,CAAA,iBAAiB,GAAG,uBAAuB,CAAC,KAAK,CAAA;QACjD,IAA+B,CAAA,+BAAA,GAAG,GAAG,CAAA;;QAGrC,IAAS,CAAA,SAAA,GAAG,CAAC,CAAI,KAAa,CAAC,CAAC,OAAO,CAAC,CAAA;QACxC,IAAS,CAAA,SAAA,GAAG,CAAC,CAAmB,KAAa,CAAC,CAAC,OAAO,CAAC,CAAA;QACvD,IAAU,CAAA,UAAA,GAAG,SAAS,CAAA;KACvB;AAAA;;;;"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ComponentCore } from "../../core/component";
|
|
2
|
+
import { GraphDataModel } from "../../data-models/graph";
|
|
3
|
+
import { ExtendedSizeComponent } from "../../types/component";
|
|
4
|
+
import { Spacing } from "../../types/spacing";
|
|
5
|
+
import { SankeyConfig, SankeyConfigInterface } from './config';
|
|
6
|
+
import * as s from './style';
|
|
7
|
+
import { SankeyInputLink, SankeyInputNode, SankeyLink, SankeyNode } from './types';
|
|
8
|
+
export declare class Sankey<N extends SankeyInputNode, L extends SankeyInputLink> extends ComponentCore<{
|
|
9
|
+
nodes: N[];
|
|
10
|
+
links?: L[];
|
|
11
|
+
}> implements ExtendedSizeComponent {
|
|
12
|
+
static selectors: typeof s;
|
|
13
|
+
config: SankeyConfig<N, L>;
|
|
14
|
+
datamodel: GraphDataModel<N, L, SankeyNode<N, L>, SankeyLink<N, L>>;
|
|
15
|
+
private _extendedWidth;
|
|
16
|
+
private _extendedHeight;
|
|
17
|
+
private _extendedHeightIncreased;
|
|
18
|
+
private _linksGroup;
|
|
19
|
+
private _nodesGroup;
|
|
20
|
+
private _backgroundRect;
|
|
21
|
+
private _sankey;
|
|
22
|
+
private _highlightTimeoutId;
|
|
23
|
+
private _highlightActive;
|
|
24
|
+
events: {
|
|
25
|
+
[x: string]: {
|
|
26
|
+
mouseenter: (d: SankeyNode<N, L>, event: MouseEvent) => void;
|
|
27
|
+
mouseleave: (d: SankeyNode<N, L>, event: MouseEvent) => void;
|
|
28
|
+
} | {
|
|
29
|
+
mouseenter: (d: SankeyLink<N, L>, event: MouseEvent) => void;
|
|
30
|
+
mouseleave: (d: SankeyLink<N, L>, event: MouseEvent) => void;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
constructor(config?: SankeyConfigInterface<N, L>);
|
|
34
|
+
get bleed(): Spacing;
|
|
35
|
+
setData(data: {
|
|
36
|
+
nodes: N[];
|
|
37
|
+
links?: L[];
|
|
38
|
+
}): void;
|
|
39
|
+
setConfig(config: SankeyConfigInterface<N, L>): void;
|
|
40
|
+
_render(customDuration?: number): void;
|
|
41
|
+
private _populateLinkAndNodeValues;
|
|
42
|
+
private _preCalculateComponentSize;
|
|
43
|
+
private _prepareLayout;
|
|
44
|
+
getWidth(): number;
|
|
45
|
+
getHeight(): number;
|
|
46
|
+
getLayoutWidth(): number;
|
|
47
|
+
getLayoutHeight(): number;
|
|
48
|
+
getColumnCenters(): number[];
|
|
49
|
+
highlightSubtree(node: SankeyNode<N, L>): void;
|
|
50
|
+
recursiveSetSubtreeState(node: SankeyNode<N, L>, linksKey: 'sourceLinks' | 'targetLinks', nodeKey: 'source' | 'target', key: string, value: any): void;
|
|
51
|
+
disableHighlight(): void;
|
|
52
|
+
private _hasLinks;
|
|
53
|
+
private _onNodeMouseOver;
|
|
54
|
+
private _onNodeMouseOut;
|
|
55
|
+
private _onNodeRectMouseOver;
|
|
56
|
+
private _onNodeRectMouseOut;
|
|
57
|
+
private _onLinkMouseOver;
|
|
58
|
+
private _onLinkMouseOut;
|
|
59
|
+
}
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { select } from 'd3-selection';
|
|
2
|
+
import { sankey } from 'd3-sankey';
|
|
3
|
+
import { max, extent, sum } from 'd3-array';
|
|
4
|
+
import { scaleLinear } from 'd3-scale';
|
|
5
|
+
import { ComponentCore } from '../../core/component/index.js';
|
|
6
|
+
import { GraphDataModel } from '../../data-models/graph.js';
|
|
7
|
+
import { Sizing } from '../../types/component.js';
|
|
8
|
+
import { Position } from '../../types/position.js';
|
|
9
|
+
import { VerticalAlign } from '../../types/text.js';
|
|
10
|
+
import { isNumber, getNumber, groupBy, getString } from '../../utils/data.js';
|
|
11
|
+
import { SankeyConfig } from './config.js';
|
|
12
|
+
import * as style from './style.js';
|
|
13
|
+
import { background, links, nodes, link, nodeGroup, nodeExit } from './style.js';
|
|
14
|
+
import { SankeyLayout } from './types.js';
|
|
15
|
+
import { removeLinks, createLinks, updateLinks } from './modules/link.js';
|
|
16
|
+
import { removeNodes, createNodes, updateNodes, onNodeMouseOver, onNodeMouseOut } from './modules/node.js';
|
|
17
|
+
import { requiredLabelSpace, getLabelOrientation } from './modules/label.js';
|
|
18
|
+
|
|
19
|
+
class Sankey extends ComponentCore {
|
|
20
|
+
constructor(config) {
|
|
21
|
+
super();
|
|
22
|
+
this.config = new SankeyConfig();
|
|
23
|
+
this.datamodel = new GraphDataModel();
|
|
24
|
+
this._extendedWidth = undefined;
|
|
25
|
+
this._extendedHeight = undefined;
|
|
26
|
+
this._extendedHeightIncreased = undefined;
|
|
27
|
+
this._sankey = sankey();
|
|
28
|
+
this._highlightTimeoutId = null;
|
|
29
|
+
this._highlightActive = false;
|
|
30
|
+
this.events = {
|
|
31
|
+
[Sankey.selectors.nodeGroup]: {
|
|
32
|
+
mouseenter: this._onNodeMouseOver.bind(this),
|
|
33
|
+
mouseleave: this._onNodeMouseOut.bind(this),
|
|
34
|
+
},
|
|
35
|
+
[Sankey.selectors.node]: {
|
|
36
|
+
mouseenter: this._onNodeRectMouseOver.bind(this),
|
|
37
|
+
mouseleave: this._onNodeRectMouseOut.bind(this),
|
|
38
|
+
},
|
|
39
|
+
[Sankey.selectors.link]: {
|
|
40
|
+
mouseenter: this._onLinkMouseOver.bind(this),
|
|
41
|
+
mouseleave: this._onLinkMouseOut.bind(this),
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
if (config)
|
|
45
|
+
this.setConfig(config);
|
|
46
|
+
this._backgroundRect = this.g.append('rect').attr('class', background);
|
|
47
|
+
this._linksGroup = this.g.append('g').attr('class', links);
|
|
48
|
+
this._nodesGroup = this.g.append('g').attr('class', nodes);
|
|
49
|
+
}
|
|
50
|
+
get bleed() {
|
|
51
|
+
const { config, datamodel: { nodes, links } } = this;
|
|
52
|
+
const labelSize = requiredLabelSpace(config.labelMaxWidth, config.labelFontSize);
|
|
53
|
+
let left = 0;
|
|
54
|
+
let right = 0;
|
|
55
|
+
// We pre-calculate sankey layout to get information about node labels placement and calculate bleed properly
|
|
56
|
+
// Potentially it can be a performance bottleneck for large layouts, but generally rendering of such layouts is much more computationally heavy
|
|
57
|
+
if (nodes.length) {
|
|
58
|
+
const sankeyProbeSize = 1000;
|
|
59
|
+
this._populateLinkAndNodeValues();
|
|
60
|
+
this._sankey.size([sankeyProbeSize, sankeyProbeSize]);
|
|
61
|
+
this._sankey({ nodes, links });
|
|
62
|
+
const maxDepth = max(nodes, d => d.depth);
|
|
63
|
+
const zeroDepthNodes = nodes.filter(d => d.depth === 0);
|
|
64
|
+
const maxDepthNodes = nodes.filter(d => d.depth === maxDepth);
|
|
65
|
+
left = zeroDepthNodes.some(d => getLabelOrientation(d, sankeyProbeSize, config.labelPosition) === Position.Left) ? labelSize.width : 0;
|
|
66
|
+
right = maxDepthNodes.some(d => getLabelOrientation(d, sankeyProbeSize, config.labelPosition) === Position.Right) ? labelSize.width : 0;
|
|
67
|
+
}
|
|
68
|
+
const top = config.labelVerticalAlign === VerticalAlign.Top ? 0
|
|
69
|
+
: config.labelVerticalAlign === VerticalAlign.Bottom ? labelSize.height
|
|
70
|
+
: labelSize.height / 2;
|
|
71
|
+
const bottom = config.labelVerticalAlign === VerticalAlign.Top ? labelSize.height
|
|
72
|
+
: config.labelVerticalAlign === VerticalAlign.Bottom ? 0
|
|
73
|
+
: labelSize.height / 2;
|
|
74
|
+
return { top, bottom, left, right };
|
|
75
|
+
}
|
|
76
|
+
setData(data) {
|
|
77
|
+
super.setData(data);
|
|
78
|
+
// Pre-calculate component size for Sizing.EXTEND
|
|
79
|
+
if ((this.sizing !== Sizing.Fit) || !this._hasLinks())
|
|
80
|
+
this._preCalculateComponentSize();
|
|
81
|
+
}
|
|
82
|
+
setConfig(config) {
|
|
83
|
+
super.setConfig(config);
|
|
84
|
+
// Pre-calculate component size for Sizing.EXTEND
|
|
85
|
+
if ((this.sizing !== Sizing.Fit) || !this._hasLinks())
|
|
86
|
+
this._preCalculateComponentSize();
|
|
87
|
+
// Using "as any" because typings are not full ("@types/d3-sankey": "^0.11.2")
|
|
88
|
+
const nodeId = ((d, i) => getString(d, this.config.id, i));
|
|
89
|
+
this._sankey.linkSort(this.config.linkSort);
|
|
90
|
+
this._sankey
|
|
91
|
+
.nodeId(nodeId)
|
|
92
|
+
.nodeWidth(this.config.nodeWidth)
|
|
93
|
+
.nodePadding(this.config.nodePadding)
|
|
94
|
+
.nodeAlign(SankeyLayout[this.config.nodeAlign])
|
|
95
|
+
.nodeSort(this.config.nodeSort)
|
|
96
|
+
.iterations(this.config.iterations);
|
|
97
|
+
}
|
|
98
|
+
_render(customDuration) {
|
|
99
|
+
const { config, bleed, datamodel: { nodes, links } } = this;
|
|
100
|
+
const duration = isNumber(customDuration) ? customDuration : config.duration;
|
|
101
|
+
if ((nodes.length === 0) ||
|
|
102
|
+
(nodes.length === 1 && links.length > 0) ||
|
|
103
|
+
(nodes.length === 1 && !config.showSingleNode) ||
|
|
104
|
+
(nodes.length > 1 && links.length === 0)) {
|
|
105
|
+
this._linksGroup.selectAll(`.${link}`).call(removeLinks, duration);
|
|
106
|
+
this._nodesGroup.selectAll(`.${nodeGroup}`).call(removeNodes, config, duration);
|
|
107
|
+
}
|
|
108
|
+
// Prepare Layout
|
|
109
|
+
this._prepareLayout();
|
|
110
|
+
// Links
|
|
111
|
+
this._linksGroup.attr('transform', `translate(${bleed.left},${bleed.top})`);
|
|
112
|
+
const linkSelection = this._linksGroup.selectAll(`.${link}`)
|
|
113
|
+
.data(links, (d, i) => { var _a; return (_a = config.id(d, i)) !== null && _a !== void 0 ? _a : i; });
|
|
114
|
+
const linkSelectionEnter = linkSelection.enter().append('g').attr('class', link);
|
|
115
|
+
linkSelectionEnter.call(createLinks);
|
|
116
|
+
linkSelection.merge(linkSelectionEnter).call(updateLinks, config, duration);
|
|
117
|
+
linkSelection.exit().call(removeLinks);
|
|
118
|
+
// Nodes
|
|
119
|
+
this._nodesGroup.attr('transform', `translate(${bleed.left},${bleed.top})`);
|
|
120
|
+
const nodeSelection = this._nodesGroup.selectAll(`.${nodeGroup}`)
|
|
121
|
+
.data(nodes, (d, i) => { var _a; return (_a = config.id(d, i)) !== null && _a !== void 0 ? _a : i; });
|
|
122
|
+
const nodeSelectionEnter = nodeSelection.enter().append('g').attr('class', nodeGroup);
|
|
123
|
+
nodeSelectionEnter.call(createNodes, this.config, this._width, bleed);
|
|
124
|
+
nodeSelection.merge(nodeSelectionEnter).call(updateNodes, config, this._width, bleed, this._hasLinks(), duration);
|
|
125
|
+
nodeSelection.exit()
|
|
126
|
+
.attr('class', nodeExit)
|
|
127
|
+
.call(removeNodes, config, duration);
|
|
128
|
+
// Background
|
|
129
|
+
this._backgroundRect
|
|
130
|
+
.attr('width', this.getWidth())
|
|
131
|
+
.attr('height', this.getHeight())
|
|
132
|
+
.attr('opacity', 0);
|
|
133
|
+
}
|
|
134
|
+
_populateLinkAndNodeValues() {
|
|
135
|
+
const { config, datamodel } = this;
|
|
136
|
+
const nodes = datamodel.nodes;
|
|
137
|
+
const links = datamodel.links;
|
|
138
|
+
// For d3-sankey each link must be an object with the `value` property
|
|
139
|
+
links.forEach((link, i) => {
|
|
140
|
+
link.value = getNumber(link, d => getNumber(d, config.linkValue, i));
|
|
141
|
+
});
|
|
142
|
+
// Populating node.fixedValue for d3-sankey
|
|
143
|
+
nodes.forEach((node, i) => {
|
|
144
|
+
node.fixedValue = getNumber(node, config.nodeFixedValue, i);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
_preCalculateComponentSize() {
|
|
148
|
+
const { bleed, config, datamodel } = this;
|
|
149
|
+
const nodes = datamodel.nodes;
|
|
150
|
+
if (nodes.length) {
|
|
151
|
+
this._populateLinkAndNodeValues();
|
|
152
|
+
this._sankey(datamodel);
|
|
153
|
+
}
|
|
154
|
+
const scaleExtent = extent(nodes, d => d.value || undefined);
|
|
155
|
+
const scaleRange = [config.nodeMinHeight, config.nodeMaxHeight];
|
|
156
|
+
const scale = scaleLinear().domain(scaleExtent).range(scaleRange).clamp(true);
|
|
157
|
+
nodes.forEach(n => { n._state.precalculatedHeight = scale(n.value) || config.nodeMinHeight; });
|
|
158
|
+
const groupedByColumn = groupBy(nodes, d => d.layer);
|
|
159
|
+
const values = Object.values(groupedByColumn)
|
|
160
|
+
.map((group) => sum(group.map(n => n._state.precalculatedHeight + config.nodePadding)) - config.nodePadding);
|
|
161
|
+
const height = max(values) || config.nodeMinHeight;
|
|
162
|
+
this._extendedHeight = height + bleed.top + bleed.bottom;
|
|
163
|
+
this._extendedWidth = (config.nodeWidth + config.nodeHorizontalSpacing) * Object.keys(groupedByColumn).length - config.nodeHorizontalSpacing + bleed.left + bleed.right;
|
|
164
|
+
}
|
|
165
|
+
_prepareLayout() {
|
|
166
|
+
var _a, _b;
|
|
167
|
+
const { config, bleed, datamodel } = this;
|
|
168
|
+
const isExtendedSize = this.sizing === Sizing.Extend;
|
|
169
|
+
const sankeyHeight = this.sizing === Sizing.Fit ? this._height : this._extendedHeight;
|
|
170
|
+
const sankeyWidth = this.sizing === Sizing.Fit ? this._width : this._extendedWidth;
|
|
171
|
+
this._sankey
|
|
172
|
+
.size([sankeyWidth - bleed.left - bleed.right, sankeyHeight - bleed.top - bleed.bottom]);
|
|
173
|
+
const nodes = datamodel.nodes;
|
|
174
|
+
const links = datamodel.links;
|
|
175
|
+
// If there are no links we manually calculate the visualization layout
|
|
176
|
+
if (!this._hasLinks()) {
|
|
177
|
+
let y = 0;
|
|
178
|
+
const nodesTotalHeight = sum(nodes, n => n._state.precalculatedHeight || 1);
|
|
179
|
+
for (const node of nodes) {
|
|
180
|
+
const sankeyHeight = this.getHeight() - bleed.top - bleed.bottom;
|
|
181
|
+
const nodeHeight = node._state.precalculatedHeight || 1;
|
|
182
|
+
const h = isExtendedSize ? nodeHeight : (sankeyHeight - config.nodePadding * (nodes.length - 1)) * nodeHeight / nodesTotalHeight;
|
|
183
|
+
node.width = Math.max(10, config.nodeWidth);
|
|
184
|
+
node.x0 = 0;
|
|
185
|
+
node.x1 = node.width;
|
|
186
|
+
node.y0 = y;
|
|
187
|
+
node.y1 = y + Math.max(1, h);
|
|
188
|
+
node.layer = 0;
|
|
189
|
+
y = node.y1 + config.nodePadding;
|
|
190
|
+
}
|
|
191
|
+
this._extendedHeightIncreased = undefined;
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
// Calculate sankey
|
|
195
|
+
this._populateLinkAndNodeValues();
|
|
196
|
+
this._sankey({ nodes, links });
|
|
197
|
+
// Setting minimum node height
|
|
198
|
+
// Default: 1px
|
|
199
|
+
// Extended size nodes that have no links: config.nodeMinHeight
|
|
200
|
+
for (const node of nodes) {
|
|
201
|
+
const singleExtendedSize = isExtendedSize && !((_a = node.sourceLinks) === null || _a === void 0 ? void 0 : _a.length) && !((_b = node.targetLinks) === null || _b === void 0 ? void 0 : _b.length);
|
|
202
|
+
const h = Math.max(singleExtendedSize ? config.nodeMinHeight : 1, node.y1 - node.y0);
|
|
203
|
+
const y = (node.y0 + node.y1) / 2;
|
|
204
|
+
node.y0 = y - h / 2;
|
|
205
|
+
node.y1 = y + h / 2;
|
|
206
|
+
}
|
|
207
|
+
if (isExtendedSize) {
|
|
208
|
+
const height = max(nodes, d => d.y1);
|
|
209
|
+
this._extendedHeightIncreased = height + bleed.top + bleed.bottom;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
getWidth() {
|
|
213
|
+
return Math.max(this._extendedWidth || 0, this._width);
|
|
214
|
+
}
|
|
215
|
+
getHeight() {
|
|
216
|
+
return Math.max(this._extendedHeightIncreased || 0, this._extendedHeight || 0, this._height);
|
|
217
|
+
}
|
|
218
|
+
getLayoutWidth() {
|
|
219
|
+
return this.sizing === Sizing.Fit ? this._width : this._extendedWidth;
|
|
220
|
+
}
|
|
221
|
+
getLayoutHeight() {
|
|
222
|
+
return this.sizing === Sizing.Fit ? this._height : (this._extendedHeightIncreased || this._extendedHeight);
|
|
223
|
+
}
|
|
224
|
+
getColumnCenters() {
|
|
225
|
+
const { datamodel } = this;
|
|
226
|
+
const nodes = datamodel.nodes;
|
|
227
|
+
const centers = nodes.reduce((pos, node) => {
|
|
228
|
+
const idx = node.layer;
|
|
229
|
+
if (!isFinite(pos[idx])) {
|
|
230
|
+
pos[idx] = (node.x0 + node.x1) / 2;
|
|
231
|
+
}
|
|
232
|
+
return pos;
|
|
233
|
+
}, []);
|
|
234
|
+
return centers;
|
|
235
|
+
}
|
|
236
|
+
highlightSubtree(node) {
|
|
237
|
+
const { config, datamodel } = this;
|
|
238
|
+
clearTimeout(this._highlightTimeoutId);
|
|
239
|
+
this._highlightTimeoutId = setTimeout(() => {
|
|
240
|
+
for (const n of datamodel.nodes)
|
|
241
|
+
n._state.greyout = true;
|
|
242
|
+
for (const l of datamodel.links)
|
|
243
|
+
l._state.greyout = true;
|
|
244
|
+
this.recursiveSetSubtreeState(node, 'sourceLinks', 'target', 'greyout', false);
|
|
245
|
+
this.recursiveSetSubtreeState(node, 'targetLinks', 'source', 'greyout', false);
|
|
246
|
+
this._render(config.highlightDuration);
|
|
247
|
+
this._highlightActive = true;
|
|
248
|
+
}, config.highlightDelay);
|
|
249
|
+
}
|
|
250
|
+
recursiveSetSubtreeState(node, linksKey, nodeKey, key, value) {
|
|
251
|
+
node._state[key] = value;
|
|
252
|
+
for (const l of node[linksKey]) {
|
|
253
|
+
l._state[key] = value;
|
|
254
|
+
this.recursiveSetSubtreeState(l[nodeKey], linksKey, nodeKey, key, value);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
disableHighlight() {
|
|
258
|
+
const { config, datamodel } = this;
|
|
259
|
+
clearTimeout(this._highlightTimeoutId);
|
|
260
|
+
if (this._highlightActive) {
|
|
261
|
+
this._highlightActive = false;
|
|
262
|
+
for (const n of datamodel.nodes)
|
|
263
|
+
n._state.greyout = false;
|
|
264
|
+
for (const l of datamodel.links)
|
|
265
|
+
l._state.greyout = false;
|
|
266
|
+
this._render(config.highlightDuration);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
_hasLinks() {
|
|
270
|
+
const { datamodel } = this;
|
|
271
|
+
return datamodel.links.length > 0;
|
|
272
|
+
}
|
|
273
|
+
_onNodeMouseOver(d, event) {
|
|
274
|
+
onNodeMouseOver(d, select(event.currentTarget), this.config, this._width);
|
|
275
|
+
}
|
|
276
|
+
_onNodeMouseOut(d, event) {
|
|
277
|
+
onNodeMouseOut(d, select(event.currentTarget), this.config, this._width);
|
|
278
|
+
}
|
|
279
|
+
_onNodeRectMouseOver(d) {
|
|
280
|
+
const { config } = this;
|
|
281
|
+
if (config.highlightSubtreeOnHover)
|
|
282
|
+
this.highlightSubtree(d);
|
|
283
|
+
}
|
|
284
|
+
_onNodeRectMouseOut(d) {
|
|
285
|
+
this.disableHighlight();
|
|
286
|
+
}
|
|
287
|
+
_onLinkMouseOver(d, event) {
|
|
288
|
+
const { config } = this;
|
|
289
|
+
if (config.highlightSubtreeOnHover)
|
|
290
|
+
this.highlightSubtree(d.target);
|
|
291
|
+
}
|
|
292
|
+
_onLinkMouseOut(d, event) {
|
|
293
|
+
this.disableHighlight();
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
Sankey.selectors = style;
|
|
297
|
+
|
|
298
|
+
export { Sankey };
|
|
299
|
+
//# sourceMappingURL=index.js.map
|