@unovis/ts 1.1.1-beta.5 → 1.1.1-beta.7
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/declaration.d.ts +1 -0
- package/index.ts +1 -0
- package/licences.txt +43 -0
- package/maps.ts +1 -0
- package/package.json +1 -1
- package/rollup.config.js +71 -0
- package/rules/ts-getter-setter.js +35 -0
- package/src/components/area/config.ts +29 -0
- package/src/components/area/index.ts +133 -0
- package/{components/area/style.js → src/components/area/style.ts} +9 -10
- package/src/components/area/types.ts +2 -0
- package/src/components/axis/config.ts +76 -0
- package/src/components/axis/index.ts +363 -0
- package/{components/axis/style.js → src/components/axis/style.ts} +27 -22
- package/src/components/axis/types.ts +4 -0
- package/src/components/brush/config.ts +51 -0
- package/src/components/brush/index.ts +233 -0
- package/{components/brush/style.js → src/components/brush/style.ts} +15 -14
- package/src/components/brush/types.ts +8 -0
- package/src/components/bullet-legend/config.ts +38 -0
- package/src/components/bullet-legend/index.ts +104 -0
- package/{components/bullet-legend/style.js → src/components/bullet-legend/style.ts} +18 -16
- package/src/components/bullet-legend/types.ts +7 -0
- package/src/components/chord-diagram/config.ts +53 -0
- package/src/components/chord-diagram/index.ts +401 -0
- package/src/components/chord-diagram/modules/label.ts +155 -0
- package/src/components/chord-diagram/modules/link.ts +91 -0
- package/src/components/chord-diagram/modules/node.ts +80 -0
- package/{components/chord-diagram/style.js → src/components/chord-diagram/style.ts} +39 -30
- package/src/components/chord-diagram/types.ts +68 -0
- package/src/components/crosshair/config.ts +48 -0
- package/src/components/crosshair/index.ts +220 -0
- package/{components/crosshair/style.js → src/components/crosshair/style.ts} +12 -12
- package/src/components/crosshair/types.ts +15 -0
- package/src/components/donut/config.ts +65 -0
- package/src/components/donut/index.ts +148 -0
- package/src/components/donut/modules/arc.ts +86 -0
- package/{components/donut/style.js → src/components/donut/style.ts} +20 -18
- package/src/components/donut/types.ts +17 -0
- package/src/components/flow-legend/config.ts +31 -0
- package/src/components/flow-legend/index.ts +103 -0
- package/{components/flow-legend/style.js → src/components/flow-legend/style.ts} +25 -21
- package/src/components/flow-legend/types.ts +10 -0
- package/src/components/free-brush/config.ts +54 -0
- package/src/components/free-brush/index.ts +207 -0
- package/{components/free-brush/style.js → src/components/free-brush/style.ts} +12 -12
- package/src/components/free-brush/types.ts +8 -0
- package/src/components/graph/config.ts +280 -0
- package/src/components/graph/index.ts +809 -0
- package/src/components/graph/modules/layout-helpers.ts +96 -0
- package/src/components/graph/modules/layout.ts +502 -0
- package/src/components/graph/modules/link/helper.ts +105 -0
- package/src/components/graph/modules/link/index.ts +302 -0
- package/{components/graph/modules/link/style.js → src/components/graph/modules/link/style.ts} +45 -34
- package/src/components/graph/modules/node/helper.ts +162 -0
- package/src/components/graph/modules/node/index.ts +343 -0
- package/{components/graph/modules/node/style.js → src/components/graph/modules/node/style.ts} +72 -52
- package/src/components/graph/modules/panel/helper.ts +160 -0
- package/src/components/graph/modules/panel/index.ts +137 -0
- package/{components/graph/modules/panel/style.js → src/components/graph/modules/panel/style.ts} +42 -32
- package/src/components/graph/modules/shape.ts +108 -0
- package/src/components/graph/modules/zoom-levels.ts +6 -0
- package/src/components/graph/style.ts +72 -0
- package/src/components/graph/types.ts +152 -0
- package/src/components/grouped-bar/config.ts +40 -0
- package/src/components/grouped-bar/index.ts +325 -0
- package/{components/grouped-bar/style.js → src/components/grouped-bar/style.ts} +15 -14
- package/src/components/leaflet-flow-map/config.ts +60 -0
- package/src/components/leaflet-flow-map/index.ts +279 -0
- package/src/components/leaflet-flow-map/renderer-utils.ts +14 -0
- package/src/components/leaflet-flow-map/renderer.ts +146 -0
- package/{components/leaflet-flow-map/shaders.js → src/components/leaflet-flow-map/shaders.ts} +4 -7
- package/src/components/leaflet-flow-map/types.ts +18 -0
- package/src/components/leaflet-map/config.ts +234 -0
- package/src/components/leaflet-map/index.ts +808 -0
- package/src/components/leaflet-map/leaflet.css +625 -0
- package/src/components/leaflet-map/modules/clusterBackground.ts +34 -0
- package/src/components/leaflet-map/modules/donut.ts +37 -0
- package/src/components/leaflet-map/modules/map.ts +178 -0
- package/src/components/leaflet-map/modules/node.ts +208 -0
- package/src/components/leaflet-map/modules/selectionRing.ts +63 -0
- package/src/components/leaflet-map/modules/utils.ts +290 -0
- package/{components → src/components}/leaflet-map/renderer/leaflet-maplibre-gl.js +76 -78
- package/src/components/leaflet-map/renderer/map-style.ts +24 -0
- package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json +35 -0
- package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json +35 -0
- package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json +2185 -0
- package/src/components/leaflet-map/renderer/mapboxgl-layer.ts +43 -0
- package/src/components/leaflet-map/renderer/mapboxgl-utils.ts +40 -0
- package/{components → src/components}/leaflet-map/renderer/maplibre-gl.css.js +2 -4
- package/src/components/leaflet-map/style.ts +217 -0
- package/src/components/leaflet-map/types.ts +75 -0
- package/src/components/line/config.ts +34 -0
- package/src/components/line/index.ts +188 -0
- package/{components/line/style.js → src/components/line/style.ts} +18 -16
- package/src/components/line/types.ts +3 -0
- package/src/components/nested-donut/config.ts +75 -0
- package/src/components/nested-donut/index.ts +176 -0
- package/src/components/nested-donut/modules/arc.ts +78 -0
- package/src/components/nested-donut/modules/label.ts +63 -0
- package/src/components/nested-donut/style.ts +82 -0
- package/src/components/nested-donut/types.ts +29 -0
- package/src/components/sankey/config.ts +195 -0
- package/src/components/sankey/index.ts +387 -0
- package/src/components/sankey/modules/label.ts +228 -0
- package/src/components/sankey/modules/link.ts +141 -0
- package/src/components/sankey/modules/node.ts +221 -0
- package/{components/sankey/style.js → src/components/sankey/style.ts} +60 -44
- package/src/components/sankey/types.ts +95 -0
- package/src/components/scatter/config.ts +49 -0
- package/src/components/scatter/index.ts +220 -0
- package/src/components/scatter/modules/point.ts +123 -0
- package/src/components/scatter/modules/utils.ts +150 -0
- package/{components/scatter/style.js → src/components/scatter/style.ts} +15 -14
- package/src/components/scatter/types.ts +21 -0
- package/src/components/stacked-bar/config.ts +42 -0
- package/src/components/stacked-bar/index.ts +267 -0
- package/{components/stacked-bar/style.js → src/components/stacked-bar/style.ts} +15 -14
- package/src/components/stacked-bar/types.ts +5 -0
- package/src/components/timeline/config.ts +49 -0
- package/src/components/timeline/index.ts +302 -0
- package/{components/timeline/style.js → src/components/timeline/style.ts} +39 -30
- package/src/components/tooltip/config.ts +69 -0
- package/src/components/tooltip/index.ts +220 -0
- package/{components → src/components}/tooltip/style.js +11 -14
- package/src/components/topojson-map/config.ts +124 -0
- package/src/components/topojson-map/index.ts +436 -0
- package/{components/topojson-map/style.js → src/components/topojson-map/style.ts} +33 -26
- package/src/components/topojson-map/types.ts +123 -0
- package/src/components/topojson-map/utils.ts +29 -0
- package/src/components/vis-controls/config.ts +16 -0
- package/src/components/vis-controls/index.ts +68 -0
- package/{components/vis-controls/style.js → src/components/vis-controls/style.ts} +34 -27
- package/src/components/vis-controls/types.ts +14 -0
- package/src/components/xy-labels/config.ts +56 -0
- package/src/components/xy-labels/index.ts +109 -0
- package/src/components/xy-labels/modules/label.ts +140 -0
- package/{components/xy-labels/style.js → src/components/xy-labels/style.ts} +15 -14
- package/src/components/xy-labels/types.ts +26 -0
- package/src/components.ts +56 -0
- package/src/containers/single-container/config.ts +15 -0
- package/src/containers/single-container/index.ts +150 -0
- package/src/containers/xy-container/config.ts +112 -0
- package/src/containers/xy-container/index.ts +407 -0
- package/src/containers.ts +6 -0
- package/src/core/component/config.ts +61 -0
- package/src/core/component/index.ts +154 -0
- package/src/core/component/types.ts +9 -0
- package/src/core/config/index.ts +12 -0
- package/src/core/container/config.ts +56 -0
- package/src/core/container/index.ts +136 -0
- package/src/core/xy-component/config.ts +46 -0
- package/src/core/xy-component/index.ts +90 -0
- package/src/data-models/core.ts +15 -0
- package/src/data-models/graph.ts +138 -0
- package/src/data-models/map-graph.ts +72 -0
- package/src/data-models/map.ts +18 -0
- package/src/data-models/series.ts +16 -0
- package/src/index.ts +7 -0
- package/src/maps/china-provinces.json +1 -0
- package/src/maps/fr-regions.json +1 -0
- package/src/maps/germany-regions.json +1 -0
- package/src/maps/ind-regions.json +1 -0
- package/src/maps/uk-regions.json +1 -0
- package/src/maps/us-counties.json +1 -0
- package/src/maps/us-states.json +1 -0
- package/src/maps/world-110m-alpha.json +1 -0
- package/src/maps/world-simple.json +1 -0
- package/src/maps/world-simplest.json +1 -0
- package/src/maps.ts +34 -0
- package/src/styles/colors.ts +28 -0
- package/src/styles/index.ts +38 -0
- package/{styles/sizes.js → src/styles/sizes.ts} +6 -8
- package/src/types/accessor.ts +5 -0
- package/src/types/component.ts +15 -0
- package/src/types/curve.ts +62 -0
- package/src/types/data.ts +5 -0
- package/src/types/direction.ts +6 -0
- package/src/types/graph.ts +40 -0
- package/src/types/map.ts +5 -0
- package/src/types/misc.ts +10 -0
- package/src/types/position.ts +23 -0
- package/src/types/scale.ts +47 -0
- package/src/types/shape.ts +7 -0
- package/src/types/spacing.ts +6 -0
- package/src/types/svg.ts +32 -0
- package/src/types/symbol.ts +21 -0
- package/src/types/text.ts +71 -0
- package/src/types.ts +31 -0
- package/src/utils/color.ts +41 -0
- package/src/utils/d3.ts +15 -0
- package/src/utils/data.ts +328 -0
- package/src/utils/html.ts +13 -0
- package/src/utils/map.ts +29 -0
- package/src/utils/misc.ts +54 -0
- package/src/utils/path.ts +196 -0
- package/src/utils/scale.ts +1 -0
- package/src/utils/style.ts +37 -0
- package/src/utils/svg.ts +49 -0
- package/src/utils/text.ts +529 -0
- package/src/utils/type.ts +9 -0
- package/tsconfig.json +29 -0
- package/components/area/config.d.ts +0 -25
- package/components/area/config.js +0 -16
- package/components/area/config.js.map +0 -1
- package/components/area/index.d.ts +0 -19
- package/components/area/index.js +0 -102
- package/components/area/index.js.map +0 -1
- package/components/area/style.d.ts +0 -3
- package/components/area/style.js.map +0 -1
- package/components/area/types.d.ts +0 -6
- package/components/axis/config.d.ts +0 -71
- package/components/axis/config.js +0 -32
- package/components/axis/config.js.map +0 -1
- package/components/axis/index.d.ts +0 -44
- package/components/axis/index.js +0 -305
- package/components/axis/index.js.map +0 -1
- package/components/axis/style.d.ts +0 -9
- package/components/axis/style.js.map +0 -1
- package/components/axis/types.d.ts +0 -4
- package/components/axis/types.js +0 -8
- package/components/axis/types.js.map +0 -1
- package/components/brush/config.d.ts +0 -42
- package/components/brush/config.js +0 -24
- package/components/brush/config.js.map +0 -1
- package/components/brush/index.d.ts +0 -28
- package/components/brush/index.js +0 -199
- package/components/brush/index.js.map +0 -1
- package/components/brush/style.d.ts +0 -5
- package/components/brush/style.js.map +0 -1
- package/components/brush/types.d.ts +0 -7
- package/components/brush/types.js +0 -8
- package/components/brush/types.js.map +0 -1
- package/components/bullet-legend/config.d.ts +0 -34
- package/components/bullet-legend/config.js +0 -16
- package/components/bullet-legend/config.js.map +0 -1
- package/components/bullet-legend/index.d.ts +0 -19
- package/components/bullet-legend/index.js +0 -79
- package/components/bullet-legend/index.js.map +0 -1
- package/components/bullet-legend/style.d.ts +0 -6
- package/components/bullet-legend/style.js.map +0 -1
- package/components/bullet-legend/types.d.ts +0 -7
- package/components/bullet-legend/types.js +0 -2
- package/components/bullet-legend/types.js.map +0 -1
- package/components/chord-diagram/config.d.ts +0 -44
- package/components/chord-diagram/config.js +0 -25
- package/components/chord-diagram/config.js.map +0 -1
- package/components/chord-diagram/index.d.ts +0 -42
- package/components/chord-diagram/index.js +0 -305
- package/components/chord-diagram/index.js.map +0 -1
- package/components/chord-diagram/modules/label.d.ts +0 -8
- package/components/chord-diagram/modules/label.js +0 -115
- package/components/chord-diagram/modules/label.js.map +0 -1
- package/components/chord-diagram/modules/link.d.ts +0 -21
- package/components/chord-diagram/modules/link.js +0 -63
- package/components/chord-diagram/modules/link.js.map +0 -1
- package/components/chord-diagram/modules/node.d.ts +0 -17
- package/components/chord-diagram/modules/node.js +0 -52
- package/components/chord-diagram/modules/node.js.map +0 -1
- package/components/chord-diagram/style.d.ts +0 -13
- package/components/chord-diagram/style.js.map +0 -1
- package/components/chord-diagram/types.d.ts +0 -58
- package/components/chord-diagram/types.js +0 -8
- package/components/chord-diagram/types.js.map +0 -1
- package/components/crosshair/config.d.ts +0 -43
- package/components/crosshair/config.js +0 -19
- package/components/crosshair/config.js.map +0 -1
- package/components/crosshair/index.d.ts +0 -35
- package/components/crosshair/index.js +0 -183
- package/components/crosshair/index.js.map +0 -1
- package/components/crosshair/style.d.ts +0 -4
- package/components/crosshair/style.js.map +0 -1
- package/components/crosshair/types.d.ts +0 -13
- package/components/crosshair/types.js +0 -2
- package/components/crosshair/types.js.map +0 -1
- package/components/donut/config.d.ts +0 -59
- package/components/donut/config.js +0 -28
- package/components/donut/config.js.map +0 -1
- package/components/donut/index.d.ts +0 -21
- package/components/donut/index.js +0 -107
- package/components/donut/index.js.map +0 -1
- package/components/donut/modules/arc.d.ts +0 -10
- package/components/donut/modules/arc.js +0 -59
- package/components/donut/modules/arc.js.map +0 -1
- package/components/donut/style.d.ts +0 -7
- package/components/donut/style.js.map +0 -1
- package/components/donut/types.d.ts +0 -20
- package/components/flow-legend/config.d.ts +0 -29
- package/components/flow-legend/config.js +0 -18
- package/components/flow-legend/config.js.map +0 -1
- package/components/flow-legend/index.d.ts +0 -16
- package/components/flow-legend/index.js +0 -75
- package/components/flow-legend/index.js.map +0 -1
- package/components/flow-legend/style.d.ts +0 -8
- package/components/flow-legend/style.js.map +0 -1
- package/components/flow-legend/types.d.ts +0 -9
- package/components/flow-legend/types.js +0 -8
- package/components/flow-legend/types.js.map +0 -1
- package/components/free-brush/config.d.ts +0 -45
- package/components/free-brush/config.js +0 -24
- package/components/free-brush/config.js.map +0 -1
- package/components/free-brush/index.d.ts +0 -20
- package/components/free-brush/index.js +0 -192
- package/components/free-brush/index.js.map +0 -1
- package/components/free-brush/style.d.ts +0 -4
- package/components/free-brush/style.js.map +0 -1
- package/components/free-brush/types.d.ts +0 -7
- package/components/free-brush/types.js +0 -9
- package/components/free-brush/types.js.map +0 -1
- package/components/graph/config.d.ts +0 -238
- package/components/graph/config.js +0 -84
- package/components/graph/config.js.map +0 -1
- package/components/graph/index.d.ts +0 -126
- package/components/graph/index.js +0 -656
- package/components/graph/index.js.map +0 -1
- package/components/graph/modules/layout-helpers.d.ts +0 -21
- package/components/graph/modules/layout-helpers.js +0 -69
- package/components/graph/modules/layout-helpers.js.map +0 -1
- package/components/graph/modules/layout.d.ts +0 -10
- package/components/graph/modules/layout.js +0 -399
- package/components/graph/modules/layout.js.map +0 -1
- package/components/graph/modules/link/helper.d.ts +0 -25
- package/components/graph/modules/link/helper.js +0 -74
- package/components/graph/modules/link/helper.js.map +0 -1
- package/components/graph/modules/link/index.d.ts +0 -11
- package/components/graph/modules/link/index.js +0 -212
- package/components/graph/modules/link/index.js.map +0 -1
- package/components/graph/modules/link/style.d.ts +0 -15
- package/components/graph/modules/link/style.js.map +0 -1
- package/components/graph/modules/node/helper.d.ts +0 -21
- package/components/graph/modules/node/helper.js +0 -126
- package/components/graph/modules/node/helper.js.map +0 -1
- package/components/graph/modules/node/index.d.ts +0 -11
- package/components/graph/modules/node/index.js +0 -252
- package/components/graph/modules/node/index.js.map +0 -1
- package/components/graph/modules/node/style.d.ts +0 -24
- package/components/graph/modules/node/style.js.map +0 -1
- package/components/graph/modules/panel/helper.d.ts +0 -18
- package/components/graph/modules/panel/helper.js +0 -111
- package/components/graph/modules/panel/helper.js.map +0 -1
- package/components/graph/modules/panel/index.d.ts +0 -7
- package/components/graph/modules/panel/index.js +0 -98
- package/components/graph/modules/panel/index.js.map +0 -1
- package/components/graph/modules/panel/style.d.ts +0 -14
- package/components/graph/modules/panel/style.js.map +0 -1
- package/components/graph/modules/shape.d.ts +0 -6
- package/components/graph/modules/shape.js +0 -80
- package/components/graph/modules/shape.js.map +0 -1
- package/components/graph/modules/zoom-levels.d.ts +0 -6
- package/components/graph/modules/zoom-levels.js +0 -10
- package/components/graph/modules/zoom-levels.js.map +0 -1
- package/components/graph/style.d.ts +0 -6
- package/components/graph/style.js +0 -66
- package/components/graph/style.js.map +0 -1
- package/components/graph/types.d.ts +0 -125
- package/components/graph/types.js +0 -30
- package/components/graph/types.js.map +0 -1
- package/components/grouped-bar/config.d.ts +0 -36
- package/components/grouped-bar/config.js +0 -20
- package/components/grouped-bar/config.js.map +0 -1
- package/components/grouped-bar/index.d.ts +0 -32
- package/components/grouped-bar/index.js +0 -249
- package/components/grouped-bar/index.js.map +0 -1
- package/components/grouped-bar/style.d.ts +0 -5
- package/components/grouped-bar/style.js.map +0 -1
- package/components/leaflet-flow-map/config.d.ts +0 -46
- package/components/leaflet-flow-map/config.js +0 -25
- package/components/leaflet-flow-map/config.js.map +0 -1
- package/components/leaflet-flow-map/index.d.ts +0 -52
- package/components/leaflet-flow-map/index.js +0 -220
- package/components/leaflet-flow-map/index.js.map +0 -1
- package/components/leaflet-flow-map/renderer-utils.d.ts +0 -5
- package/components/leaflet-flow-map/renderer-utils.js +0 -15
- package/components/leaflet-flow-map/renderer-utils.js.map +0 -1
- package/components/leaflet-flow-map/renderer.d.ts +0 -26
- package/components/leaflet-flow-map/renderer.js +0 -117
- package/components/leaflet-flow-map/renderer.js.map +0 -1
- package/components/leaflet-flow-map/shaders.d.ts +0 -2
- package/components/leaflet-flow-map/shaders.js.map +0 -1
- package/components/leaflet-flow-map/types.d.ts +0 -23
- package/components/leaflet-map/config.d.ts +0 -193
- package/components/leaflet-map/config.js +0 -71
- package/components/leaflet-map/config.js.map +0 -1
- package/components/leaflet-map/index.d.ts +0 -130
- package/components/leaflet-map/index.js +0 -690
- package/components/leaflet-map/index.js.map +0 -1
- package/components/leaflet-map/leaflet.css.js +0 -5
- package/components/leaflet-map/leaflet.css.js.map +0 -1
- package/components/leaflet-map/modules/clusterBackground.d.ts +0 -5
- package/components/leaflet-map/modules/clusterBackground.js +0 -27
- package/components/leaflet-map/modules/clusterBackground.js.map +0 -1
- package/components/leaflet-map/modules/donut.d.ts +0 -3
- package/components/leaflet-map/modules/donut.js +0 -25
- package/components/leaflet-map/modules/donut.js.map +0 -1
- package/components/leaflet-map/modules/map.d.ts +0 -14
- package/components/leaflet-map/modules/map.js +0 -154
- package/components/leaflet-map/modules/map.js.map +0 -1
- package/components/leaflet-map/modules/node.d.ts +0 -9
- package/components/leaflet-map/modules/node.js +0 -162
- package/components/leaflet-map/modules/node.js.map +0 -1
- package/components/leaflet-map/modules/selectionRing.d.ts +0 -7
- package/components/leaflet-map/modules/selectionRing.js +0 -41
- package/components/leaflet-map/modules/selectionRing.js.map +0 -1
- package/components/leaflet-map/modules/utils.d.ts +0 -50
- package/components/leaflet-map/modules/utils.js +0 -210
- package/components/leaflet-map/modules/utils.js.map +0 -1
- package/components/leaflet-map/renderer/leaflet-maplibre-gl.js.map +0 -1
- package/components/leaflet-map/renderer/map-style.d.ts +0 -4
- package/components/leaflet-map/renderer/map-style.js +0 -15
- package/components/leaflet-map/renderer/map-style.js.map +0 -1
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json.js +0 -40
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json.js.map +0 -1
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json.js +0 -40
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json.js.map +0 -1
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json.js +0 -4981
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json.js.map +0 -1
- package/components/leaflet-map/renderer/mapboxgl-layer.d.ts +0 -8
- package/components/leaflet-map/renderer/mapboxgl-layer.js +0 -27
- package/components/leaflet-map/renderer/mapboxgl-layer.js.map +0 -1
- package/components/leaflet-map/renderer/mapboxgl-utils.d.ts +0 -4
- package/components/leaflet-map/renderer/mapboxgl-utils.js +0 -39
- package/components/leaflet-map/renderer/mapboxgl-utils.js.map +0 -1
- package/components/leaflet-map/renderer/maplibre-gl.css.js.map +0 -1
- package/components/leaflet-map/style.d.ts +0 -52
- package/components/leaflet-map/style.js +0 -183
- package/components/leaflet-map/style.js.map +0 -1
- package/components/leaflet-map/types.d.ts +0 -75
- package/components/leaflet-map/types.js +0 -15
- package/components/leaflet-map/types.js.map +0 -1
- package/components/line/config.d.ts +0 -30
- package/components/line/config.js +0 -17
- package/components/line/config.js.map +0 -1
- package/components/line/index.d.ts +0 -27
- package/components/line/index.js +0 -152
- package/components/line/index.js.map +0 -1
- package/components/line/style.d.ts +0 -6
- package/components/line/style.js.map +0 -1
- package/components/line/types.d.ts +0 -12
- package/components/nested-donut/config.d.ts +0 -59
- package/components/nested-donut/config.js +0 -19
- package/components/nested-donut/config.js.map +0 -1
- package/components/nested-donut/index.d.ts +0 -38
- package/components/nested-donut/index.js +0 -133
- package/components/nested-donut/index.js.map +0 -1
- package/components/nested-donut/modules/arc.d.ts +0 -17
- package/components/nested-donut/modules/arc.js +0 -50
- package/components/nested-donut/modules/arc.js.map +0 -1
- package/components/nested-donut/modules/label.d.ts +0 -7
- package/components/nested-donut/modules/label.js +0 -34
- package/components/nested-donut/modules/label.js.map +0 -1
- package/components/nested-donut/style.d.ts +0 -26
- package/components/nested-donut/style.js +0 -70
- package/components/nested-donut/style.js.map +0 -1
- package/components/nested-donut/types.d.ts +0 -24
- package/components/nested-donut/types.js +0 -11
- package/components/nested-donut/types.js.map +0 -1
- package/components/sankey/config.d.ts +0 -162
- package/components/sankey/config.js +0 -65
- package/components/sankey/config.js.map +0 -1
- package/components/sankey/index.d.ts +0 -59
- package/components/sankey/index.js +0 -306
- package/components/sankey/index.js.map +0 -1
- package/components/sankey/modules/label.d.ts +0 -23
- package/components/sankey/modules/label.js +0 -168
- package/components/sankey/modules/label.js.map +0 -1
- package/components/sankey/modules/link.d.ts +0 -14
- package/components/sankey/modules/link.js +0 -108
- package/components/sankey/modules/link.js.map +0 -1
- package/components/sankey/modules/node.d.ts +0 -10
- package/components/sankey/modules/node.js +0 -156
- package/components/sankey/modules/node.js.map +0 -1
- package/components/sankey/style.d.ts +0 -20
- package/components/sankey/style.js.map +0 -1
- package/components/sankey/types.d.ts +0 -84
- package/components/sankey/types.js +0 -34
- package/components/sankey/types.js.map +0 -1
- package/components/scatter/config.d.ts +0 -44
- package/components/scatter/config.js +0 -23
- package/components/scatter/config.js.map +0 -1
- package/components/scatter/index.d.ts +0 -28
- package/components/scatter/index.js +0 -167
- package/components/scatter/index.js.map +0 -1
- package/components/scatter/modules/point.d.ts +0 -7
- package/components/scatter/modules/point.js +0 -86
- package/components/scatter/modules/point.js.map +0 -1
- package/components/scatter/modules/utils.d.ts +0 -11
- package/components/scatter/modules/utils.js +0 -112
- package/components/scatter/modules/utils.js.map +0 -1
- package/components/scatter/style.d.ts +0 -5
- package/components/scatter/style.js.map +0 -1
- package/components/scatter/types.d.ts +0 -19
- package/components/stacked-bar/config.d.ts +0 -38
- package/components/stacked-bar/config.js +0 -20
- package/components/stacked-bar/config.js.map +0 -1
- package/components/stacked-bar/index.d.ts +0 -28
- package/components/stacked-bar/index.js +0 -208
- package/components/stacked-bar/index.js.map +0 -1
- package/components/stacked-bar/style.d.ts +0 -5
- package/components/stacked-bar/style.js.map +0 -1
- package/components/stacked-bar/types.d.ts +0 -5
- package/components/timeline/config.d.ts +0 -43
- package/components/timeline/config.js +0 -24
- package/components/timeline/config.js.map +0 -1
- package/components/timeline/index.d.ts +0 -41
- package/components/timeline/index.js +0 -244
- package/components/timeline/index.js.map +0 -1
- package/components/timeline/style.d.ts +0 -13
- package/components/timeline/style.js.map +0 -1
- package/components/tooltip/config.d.ts +0 -68
- package/components/tooltip/config.js +0 -20
- package/components/tooltip/config.js.map +0 -1
- package/components/tooltip/index.d.ts +0 -36
- package/components/tooltip/index.js +0 -184
- package/components/tooltip/index.js.map +0 -1
- package/components/tooltip/style.js.map +0 -1
- package/components/topojson-map/config.d.ts +0 -99
- package/components/topojson-map/config.js +0 -42
- package/components/topojson-map/config.js.map +0 -1
- package/components/topojson-map/index.d.ts +0 -52
- package/components/topojson-map/index.js +0 -355
- package/components/topojson-map/index.js.map +0 -1
- package/components/topojson-map/style.d.ts +0 -11
- package/components/topojson-map/style.js.map +0 -1
- package/components/topojson-map/types.d.ts +0 -78
- package/components/topojson-map/types.js +0 -80
- package/components/topojson-map/types.js.map +0 -1
- package/components/topojson-map/utils.d.ts +0 -3
- package/components/topojson-map/utils.js +0 -30
- package/components/topojson-map/utils.js.map +0 -1
- package/components/vis-controls/config.d.ts +0 -12
- package/components/vis-controls/config.js +0 -13
- package/components/vis-controls/config.js.map +0 -1
- package/components/vis-controls/index.d.ts +0 -14
- package/components/vis-controls/index.js +0 -52
- package/components/vis-controls/index.js.map +0 -1
- package/components/vis-controls/style.d.ts +0 -11
- package/components/vis-controls/style.js.map +0 -1
- package/components/vis-controls/types.d.ts +0 -13
- package/components/vis-controls/types.js +0 -8
- package/components/vis-controls/types.js.map +0 -1
- package/components/xy-labels/config.d.ts +0 -48
- package/components/xy-labels/config.js +0 -25
- package/components/xy-labels/config.js.map +0 -1
- package/components/xy-labels/index.d.ts +0 -15
- package/components/xy-labels/index.js +0 -87
- package/components/xy-labels/index.js.map +0 -1
- package/components/xy-labels/modules/label.d.ts +0 -9
- package/components/xy-labels/modules/label.js +0 -107
- package/components/xy-labels/modules/label.js.map +0 -1
- package/components/xy-labels/style.d.ts +0 -5
- package/components/xy-labels/style.js.map +0 -1
- package/components/xy-labels/types.d.ts +0 -23
- package/components/xy-labels/types.js +0 -9
- package/components/xy-labels/types.js.map +0 -1
- package/components.d.ts +0 -51
- package/components.js +0 -29
- package/components.js.map +0 -1
- package/containers/single-container/config.d.ts +0 -12
- package/containers/single-container/config.js +0 -12
- package/containers/single-container/config.js.map +0 -1
- package/containers/single-container/index.d.ts +0 -19
- package/containers/single-container/index.js +0 -128
- package/containers/single-container/index.js.map +0 -1
- package/containers/xy-container/config.d.ts +0 -99
- package/containers/xy-container/config.js +0 -30
- package/containers/xy-container/config.js.map +0 -1
- package/containers/xy-container/index.d.ts +0 -34
- package/containers/xy-container/index.js +0 -330
- package/containers/xy-container/index.js.map +0 -1
- package/containers.d.ts +0 -6
- package/containers.js +0 -4
- package/containers.js.map +0 -1
- package/core/component/config.d.ts +0 -58
- package/core/component/config.js +0 -14
- package/core/component/config.js.map +0 -1
- package/core/component/index.d.ts +0 -43
- package/core/component/index.js +0 -118
- package/core/component/index.js.map +0 -1
- package/core/component/types.d.ts +0 -2
- package/core/component/types.js +0 -2
- package/core/component/types.js.map +0 -1
- package/core/config/index.d.ts +0 -3
- package/core/config/index.js +0 -16
- package/core/config/index.js.map +0 -1
- package/core/container/config.d.ts +0 -48
- package/core/container/config.js +0 -29
- package/core/container/config.js.map +0 -1
- package/core/container/index.d.ts +0 -26
- package/core/container/index.js +0 -105
- package/core/container/index.js.map +0 -1
- package/core/xy-component/config.d.ts +0 -38
- package/core/xy-component/config.js +0 -20
- package/core/xy-component/config.js.map +0 -1
- package/core/xy-component/index.d.ts +0 -27
- package/core/xy-component/index.js +0 -74
- package/core/xy-component/index.js.map +0 -1
- package/data-models/core.d.ts +0 -6
- package/data-models/core.js +0 -14
- package/data-models/core.js.map +0 -1
- package/data-models/graph.d.ts +0 -24
- package/data-models/graph.js +0 -107
- package/data-models/graph.js.map +0 -1
- package/data-models/map-graph.d.ts +0 -21
- package/data-models/map-graph.js +0 -62
- package/data-models/map-graph.js.map +0 -1
- package/data-models/map.d.ts +0 -5
- package/data-models/map.js +0 -12
- package/data-models/map.js.map +0 -1
- package/data-models/series.d.ts +0 -6
- package/data-models/series.js +0 -19
- package/data-models/series.js.map +0 -1
- package/index.d.ts +0 -7
- package/index.js +0 -55
- package/index.js.map +0 -1
- package/maps/china-provinces.json.js +0 -140373
- package/maps/fr-regions.json.js +0 -14162
- package/maps/germany-regions.json.js +0 -35760
- package/maps/ind-regions.json.js +0 -290584
- package/maps/uk-regions.json.js +0 -96233
- package/maps/us-counties.json.js +0 -206318
- package/maps/us-states.json.js +0 -16345
- package/maps/world-110m-alpha.json.js +0 -251366
- package/maps/world-simple.json.js +0 -89428
- package/maps/world-simplest.json.js +0 -28175
- package/maps.d.ts +0 -60
- package/maps.js +0 -23
- package/styles/colors.d.ts +0 -7
- package/styles/colors.js +0 -24
- package/styles/colors.js.map +0 -1
- package/styles/index.d.ts +0 -7
- package/styles/index.js +0 -38
- package/styles/index.js.map +0 -1
- package/styles/sizes.d.ts +0 -2
- package/styles/sizes.js.map +0 -1
- package/types/accessor.d.ts +0 -5
- package/types/accessor.js +0 -2
- package/types/accessor.js.map +0 -1
- package/types/component.d.ts +0 -13
- package/types/component.js +0 -14
- package/types/component.js.map +0 -1
- package/types/curve.d.ts +0 -40
- package/types/curve.js +0 -46
- package/types/curve.js.map +0 -1
- package/types/data.d.ts +0 -7
- package/types/data.js +0 -2
- package/types/data.js.map +0 -1
- package/types/direction.d.ts +0 -6
- package/types/direction.js +0 -10
- package/types/direction.js.map +0 -1
- package/types/graph.d.ts +0 -35
- package/types/graph.js +0 -2
- package/types/graph.js.map +0 -1
- package/types/map.d.ts +0 -4
- package/types/map.js +0 -2
- package/types/map.js.map +0 -1
- package/types/misc.d.ts +0 -8
- package/types/position.d.ts +0 -20
- package/types/position.js +0 -27
- package/types/position.js.map +0 -1
- package/types/scale.d.ts +0 -23
- package/types/scale.js +0 -27
- package/types/scale.js.map +0 -1
- package/types/shape.d.ts +0 -7
- package/types/shape.js +0 -11
- package/types/shape.js.map +0 -1
- package/types/spacing.d.ts +0 -6
- package/types/spacing.js +0 -2
- package/types/spacing.js.map +0 -1
- package/types/svg.d.ts +0 -18
- package/types/svg.js +0 -22
- package/types/svg.js.map +0 -1
- package/types/symbol.d.ts +0 -18
- package/types/symbol.js +0 -24
- package/types/symbol.js.map +0 -1
- package/types/text.d.ts +0 -46
- package/types/text.js +0 -26
- package/types/text.js.map +0 -1
- package/types.d.ts +0 -27
- package/types.js +0 -30
- package/types.js.map +0 -1
- package/utils/color.d.ts +0 -10
- package/utils/color.js +0 -32
- package/utils/color.js.map +0 -1
- package/utils/d3.d.ts +0 -3
- package/utils/d3.js +0 -16
- package/utils/d3.js.map +0 -1
- package/utils/data.d.ts +0 -45
- package/utils/data.js +0 -274
- package/utils/data.js.map +0 -1
- package/utils/html.d.ts +0 -1
- package/utils/html.js +0 -16
- package/utils/html.js.map +0 -1
- package/utils/map.d.ts +0 -2
- package/utils/map.js +0 -20
- package/utils/map.js.map +0 -1
- package/utils/misc.d.ts +0 -9
- package/utils/misc.js +0 -47
- package/utils/misc.js.map +0 -1
- package/utils/path.d.ts +0 -23
- package/utils/path.js +0 -144
- package/utils/path.js.map +0 -1
- package/utils/scale.d.ts +0 -1
- package/utils/style.d.ts +0 -6
- package/utils/style.js +0 -24
- package/utils/style.js.map +0 -1
- package/utils/svg.d.ts +0 -3
- package/utils/text.d.ts +0 -139
- package/utils/text.js +0 -417
- package/utils/text.js.map +0 -1
- package/utils/type.d.ts +0 -5
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Selection } from 'd3-selection'
|
|
2
|
+
import { Transition } from 'd3-transition'
|
|
3
|
+
import { interpolate } from 'd3-interpolate'
|
|
4
|
+
import { Arc } from 'd3-shape'
|
|
5
|
+
|
|
6
|
+
// Utils
|
|
7
|
+
import { getColor } from 'utils/color'
|
|
8
|
+
import { smartTransition } from 'utils/d3'
|
|
9
|
+
|
|
10
|
+
// Local Types
|
|
11
|
+
import { ChordInputNode, ChordInputLink, ChordNode } from '../types'
|
|
12
|
+
|
|
13
|
+
// Config
|
|
14
|
+
import { ChordDiagramConfig } from '../config'
|
|
15
|
+
|
|
16
|
+
type AnimState = { x0: number; x1: number; y0: number; y1: number }
|
|
17
|
+
export interface ArcNode extends SVGElement {
|
|
18
|
+
_animState?: AnimState;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function createNode<N extends ChordInputNode, L extends ChordInputLink> (
|
|
22
|
+
selection: Selection<SVGPathElement, ChordNode<N>, SVGGElement, unknown>
|
|
23
|
+
): void {
|
|
24
|
+
selection
|
|
25
|
+
.style('opacity', 0)
|
|
26
|
+
.each((d, i, els) => {
|
|
27
|
+
const arcNode: ArcNode = els[i]
|
|
28
|
+
const angleCenter = (d.x0 + d.x1) / 2
|
|
29
|
+
const angleHalfWidth = (d.x1 - d.x0) / 2
|
|
30
|
+
arcNode._animState = {
|
|
31
|
+
x0: angleCenter - angleHalfWidth * 0.8,
|
|
32
|
+
x1: angleCenter + angleHalfWidth * 0.8,
|
|
33
|
+
y0: d.y0,
|
|
34
|
+
y1: d.y1,
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function updateNode<N extends ChordInputNode, L extends ChordInputLink> (
|
|
40
|
+
selection: Selection<SVGPathElement, ChordNode<N>, SVGGElement, unknown>,
|
|
41
|
+
config: ChordDiagramConfig<N, L>,
|
|
42
|
+
arcGen: Arc<unknown, AnimState>,
|
|
43
|
+
duration: number
|
|
44
|
+
): void {
|
|
45
|
+
const nodeColor = (d: ChordNode<N>): string => getColor(d.data, config.nodeColor, d.height)
|
|
46
|
+
|
|
47
|
+
selection
|
|
48
|
+
.attr('id', d => d.uid)
|
|
49
|
+
.style('transition', `fill ${duration}ms`) // Animate color with CSS because we're using CSS-variables
|
|
50
|
+
.style('fill', nodeColor)
|
|
51
|
+
.style('stroke', nodeColor)
|
|
52
|
+
|
|
53
|
+
if (duration) {
|
|
54
|
+
const transition = smartTransition(selection, duration)
|
|
55
|
+
.style('opacity', 1) as Transition<SVGPathElement, ChordNode<N>, SVGGElement, ChordNode<N>>
|
|
56
|
+
|
|
57
|
+
transition.attrTween('d', (d, i, els) => {
|
|
58
|
+
const arcNode: ArcNode = els[i]
|
|
59
|
+
const nextAnimState = { x0: d.x0, x1: d.x1, y0: d.y0, y1: d.y1 }
|
|
60
|
+
const datum = interpolate(arcNode._animState, nextAnimState)
|
|
61
|
+
|
|
62
|
+
return (t: number): string => {
|
|
63
|
+
arcNode._animState = datum(t)
|
|
64
|
+
return arcGen(arcNode._animState)
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
} else {
|
|
68
|
+
selection.attr('d', d => arcGen(d))
|
|
69
|
+
.style('opacity', 1)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function removeNode<N extends ChordInputNode> (
|
|
74
|
+
selection: Selection<SVGPathElement, unknown, SVGGElement, unknown>,
|
|
75
|
+
duration: number
|
|
76
|
+
): void {
|
|
77
|
+
smartTransition(selection, duration)
|
|
78
|
+
.style('opacity', 0)
|
|
79
|
+
.remove()
|
|
80
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { css, injectGlobal } from '@emotion/css'
|
|
1
|
+
import { css, injectGlobal } from '@emotion/css'
|
|
2
2
|
|
|
3
|
-
const root = css
|
|
3
|
+
export const root = css`
|
|
4
4
|
label: chord-diagram-component;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
`
|
|
6
|
+
|
|
7
|
+
export const variables = injectGlobal`
|
|
7
8
|
:root {
|
|
8
9
|
--vis-chord-diagram-link-fill-color: #cad5f6;
|
|
9
10
|
--vis-chord-diagram-link-stroke-color: #777777;
|
|
@@ -19,17 +20,21 @@ const variables = injectGlobal `
|
|
|
19
20
|
body.theme-dark ${`.${root}`} {
|
|
20
21
|
--vis-chord-diagram-link-fill-color: var(--vis-dark-chord-diagram-link-fill-color);
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
`
|
|
24
|
+
|
|
25
|
+
export const nodes = css`
|
|
24
26
|
label: nodes;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
`
|
|
28
|
+
|
|
29
|
+
export const links = css`
|
|
27
30
|
label: links;
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
`
|
|
32
|
+
|
|
33
|
+
export const labels = css`
|
|
30
34
|
label: labels;
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
`
|
|
36
|
+
|
|
37
|
+
export const node = css`
|
|
33
38
|
label: node;
|
|
34
39
|
stroke-width: 0;
|
|
35
40
|
fill: var(--vis-color-main);
|
|
@@ -38,16 +43,19 @@ const node = css `
|
|
|
38
43
|
&:hover {
|
|
39
44
|
stroke-width: 2;
|
|
40
45
|
}
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
`
|
|
47
|
+
|
|
48
|
+
export const hoveredNode = css`
|
|
43
49
|
label: hovered;
|
|
44
50
|
fill-opacity: 1;
|
|
45
51
|
stroke-width: 1.5;
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
`
|
|
53
|
+
|
|
54
|
+
export const gLabel = css`
|
|
48
55
|
label: group-label;
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
`
|
|
57
|
+
|
|
58
|
+
export const label = css`
|
|
51
59
|
label: label;
|
|
52
60
|
|
|
53
61
|
dominant-baseline: middle;
|
|
@@ -57,11 +65,13 @@ const label = css `
|
|
|
57
65
|
> textPath {
|
|
58
66
|
dominant-baseline: central;
|
|
59
67
|
}
|
|
60
|
-
|
|
61
|
-
|
|
68
|
+
`
|
|
69
|
+
|
|
70
|
+
export const labelExit = css`
|
|
62
71
|
label: label-exit;
|
|
63
|
-
|
|
64
|
-
|
|
72
|
+
`
|
|
73
|
+
|
|
74
|
+
export const link = css`
|
|
65
75
|
label: link;
|
|
66
76
|
|
|
67
77
|
fill: var(--vis-chord-diagram-link-fill-color);
|
|
@@ -72,18 +82,17 @@ const link = css `
|
|
|
72
82
|
&:hover {
|
|
73
83
|
fill-opacity: 1;
|
|
74
84
|
}
|
|
75
|
-
|
|
76
|
-
|
|
85
|
+
`
|
|
86
|
+
|
|
87
|
+
export const hoveredLink = css`
|
|
77
88
|
label: hovered;
|
|
78
89
|
fill-opacity: 0.9;
|
|
79
|
-
|
|
80
|
-
|
|
90
|
+
`
|
|
91
|
+
|
|
92
|
+
export const transparent = css`
|
|
81
93
|
fill-opacity: 0.25;
|
|
82
94
|
|
|
83
95
|
text {
|
|
84
96
|
fill-opacity: 1;
|
|
85
97
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
export { gLabel, hoveredLink, hoveredNode, label, labelExit, labels, link, links, node, nodes, root, transparent, variables };
|
|
89
|
-
//# sourceMappingURL=style.js.map
|
|
98
|
+
`
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { HierarchyRectangularNode } from 'd3-hierarchy'
|
|
2
|
+
import { GraphLinkCore, GraphNodeCore } from 'types'
|
|
3
|
+
|
|
4
|
+
// Node data flow in the component:
|
|
5
|
+
// Input data (N extends ChordInputNode, L extends ChordInputLink)
|
|
6
|
+
// => GraphNodeCore<N>[] (we reference it only in a few places when it's needed, to make the code easier to read)
|
|
7
|
+
// => ChordHierarchyNode (nested object representing node hierarchy)
|
|
8
|
+
// => ChordNode[] and ChordLeafNode[] (HierarchyRectangularNode[] from D3 partition)
|
|
9
|
+
|
|
10
|
+
export interface ChordInputNode {
|
|
11
|
+
id?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface ChordInputLink {
|
|
15
|
+
id?: string;
|
|
16
|
+
source: number | string | ChordInputNode;
|
|
17
|
+
target: number | string | ChordInputNode;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type ChordDiagramData<
|
|
21
|
+
N extends ChordInputNode,
|
|
22
|
+
L extends ChordInputLink,
|
|
23
|
+
> = {
|
|
24
|
+
nodes: N[];
|
|
25
|
+
links?: L[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ChordHierarchyNode<N> {
|
|
29
|
+
key: string;
|
|
30
|
+
values: (ChordHierarchyNode<N> | N)[];
|
|
31
|
+
depth?: number;
|
|
32
|
+
height?: number;
|
|
33
|
+
value?: number;
|
|
34
|
+
ancestors?: string[];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type ChordNodeState = {
|
|
38
|
+
_state: {
|
|
39
|
+
hovered?: boolean;
|
|
40
|
+
value?: number;
|
|
41
|
+
};
|
|
42
|
+
_prevX1?: number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type ChordNodeCore<N> = HierarchyRectangularNode<N> & ChordNodeState & {
|
|
46
|
+
data: N;
|
|
47
|
+
uid: string; // Unique id for textPath href
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type ChordNodeDatum<N> = ChordHierarchyNode<N> | N;
|
|
51
|
+
export type ChordNode<N extends ChordInputNode> = ChordNodeCore<ChordNodeDatum<N>>
|
|
52
|
+
export type ChordLeafNode<N extends ChordInputNode> = ChordNodeCore<GraphNodeCore<N, ChordInputLink>>
|
|
53
|
+
|
|
54
|
+
export type ChordRibbonPoint = { x0: number; x1: number; y0: number; y1: number; a0: number; a1: number; r: number }
|
|
55
|
+
export interface ChordRibbon<N extends ChordInputNode> {
|
|
56
|
+
source: ChordLeafNode<N>;
|
|
57
|
+
target: ChordLeafNode<N>;
|
|
58
|
+
points: ChordRibbonPoint[];
|
|
59
|
+
data: GraphLinkCore<N, ChordInputLink>;
|
|
60
|
+
_state: {
|
|
61
|
+
hovered?: boolean;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export enum ChordLabelAlignment {
|
|
66
|
+
Along = 'along',
|
|
67
|
+
Perpendicular = 'perpendicular',
|
|
68
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { XYComponentConfigInterface, XYComponentConfig } from 'core/xy-component/config'
|
|
2
|
+
import { Tooltip } from 'components/tooltip'
|
|
3
|
+
|
|
4
|
+
// Types
|
|
5
|
+
import { NumericAccessor } from 'types/accessor'
|
|
6
|
+
import { ContinuousScale } from 'types/scale'
|
|
7
|
+
import { CrosshairCircle } from './types'
|
|
8
|
+
|
|
9
|
+
// We extend partial XY config interface because x and y properties are optional for Crosshair
|
|
10
|
+
export interface CrosshairConfigInterface<Datum> extends Partial<XYComponentConfigInterface<Datum>> {
|
|
11
|
+
/** Separate array of accessors for stacked components (eg StackedBar, Area). Default: `undefined` */
|
|
12
|
+
yStacked?: NumericAccessor<Datum>[];
|
|
13
|
+
/** Baseline accessor function for stacked values, useful with stacked areas. Default: `null` */
|
|
14
|
+
baseline?: NumericAccessor<Datum>;
|
|
15
|
+
/** An instance of the Tooltip component to be used with Crosshair. Default: `undefined` */
|
|
16
|
+
tooltip?: Tooltip | undefined;
|
|
17
|
+
/** Tooltip template accessor. The function is supposed to return either a valid HTML string or an HTMLElement. Default: `d => ''` */
|
|
18
|
+
template?: (data: Datum, x: number | Date) => string | HTMLElement;
|
|
19
|
+
/** Hide Crosshair when the corresponding element is far from mouse pointer. Default: `true` */
|
|
20
|
+
hideWhenFarFromPointer?: boolean;
|
|
21
|
+
/** Distance in pixels to check in the hideWhenFarFromPointer condition. Default: `100` */
|
|
22
|
+
hideWhenFarFromPointerDistance?: number;
|
|
23
|
+
/** Snap to the nearest data point.
|
|
24
|
+
* If disabled, the tooltip template will receive only the horizontal position of the crosshair and you'll be responsible
|
|
25
|
+
* for getting the underlying data records and crosshair circles (see the `getCircles` configuration option).
|
|
26
|
+
* Default: `true`
|
|
27
|
+
*/
|
|
28
|
+
snapToData?: boolean;
|
|
29
|
+
/** Custom function for setting up the crosshair circles, usually needed when `snapToData` is set to `false`.
|
|
30
|
+
* The function receives the horizontal position of the crosshair (in the data space, not in pixels), the data array
|
|
31
|
+
* and the `yScale` instance to help you calculate the correct vertical position of the circles.
|
|
32
|
+
* It has to return an array of the CrosshairCircle objects: `{ y: number; color: string; opacity?: number }[]`.
|
|
33
|
+
* Default: `undefined`
|
|
34
|
+
*/
|
|
35
|
+
getCircles?: (x: number, data: Datum[], yScale: ContinuousScale) => CrosshairCircle[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export class CrosshairConfig<Datum> extends XYComponentConfig<Datum> implements CrosshairConfigInterface<Datum> {
|
|
39
|
+
yStacked = undefined
|
|
40
|
+
baseline = null
|
|
41
|
+
duration = 100
|
|
42
|
+
tooltip: Tooltip = undefined
|
|
43
|
+
template: ((data: Datum, x: number | Date) => string | HTMLElement) = (d: Datum): string => ''
|
|
44
|
+
hideWhenFarFromPointer = true
|
|
45
|
+
hideWhenFarFromPointerDistance = 100
|
|
46
|
+
snapToData = true
|
|
47
|
+
getCircles = undefined
|
|
48
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { Selection, pointer } from 'd3-selection'
|
|
2
|
+
import { easeLinear } from 'd3-ease'
|
|
3
|
+
|
|
4
|
+
// Core
|
|
5
|
+
import { XYComponentCore } from 'core/xy-component'
|
|
6
|
+
import { Tooltip } from 'components/tooltip'
|
|
7
|
+
|
|
8
|
+
// Utils
|
|
9
|
+
import { isNumber, isArray, getNumber, clamp, getStackedValues, getNearest, isFunction } from 'utils/data'
|
|
10
|
+
import { smartTransition } from 'utils/d3'
|
|
11
|
+
import { getColor } from 'utils/color'
|
|
12
|
+
|
|
13
|
+
// Local Types
|
|
14
|
+
import { CrosshairAccessors, CrosshairCircle } from './types'
|
|
15
|
+
|
|
16
|
+
// Config
|
|
17
|
+
import { CrosshairConfig, CrosshairConfigInterface } from './config'
|
|
18
|
+
|
|
19
|
+
// Styles
|
|
20
|
+
import * as s from './style'
|
|
21
|
+
|
|
22
|
+
export class Crosshair<Datum> extends XYComponentCore<Datum, CrosshairConfig<Datum>, CrosshairConfigInterface<Datum>> {
|
|
23
|
+
static selectors = s
|
|
24
|
+
clippable = true // Don't apply clipping path to this component. See XYContainer
|
|
25
|
+
config: CrosshairConfig<Datum> = new CrosshairConfig()
|
|
26
|
+
container: Selection<SVGSVGElement, any, SVGSVGElement, any>
|
|
27
|
+
line: Selection<SVGLineElement, any, SVGElement, any>
|
|
28
|
+
x = 0
|
|
29
|
+
datum: Datum
|
|
30
|
+
datumIndex: number
|
|
31
|
+
show = false
|
|
32
|
+
private _animFrameId: number = null
|
|
33
|
+
|
|
34
|
+
/** Tooltip component to be used by Crosshair if not provided by the config.
|
|
35
|
+
* This property is supposed to be set externally by a container component like XYContainer. */
|
|
36
|
+
public tooltip: Tooltip
|
|
37
|
+
|
|
38
|
+
/** Accessors passed externally (e.g. from XYContainer) */
|
|
39
|
+
private _accessors: CrosshairAccessors<Datum> = {
|
|
40
|
+
x: undefined,
|
|
41
|
+
y: undefined,
|
|
42
|
+
yStacked: undefined,
|
|
43
|
+
baseline: undefined,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public set accessors (accessors: CrosshairAccessors<Datum>) { this._accessors = accessors }
|
|
47
|
+
public get accessors (): CrosshairAccessors<Datum> {
|
|
48
|
+
const { config } = this
|
|
49
|
+
|
|
50
|
+
const hasConfig = !!(config.x || config.y || config.yStacked)
|
|
51
|
+
const x = hasConfig ? config.x : this._accessors.x
|
|
52
|
+
const yAcc = hasConfig ? config.y : this._accessors.y
|
|
53
|
+
const y = yAcc ? (isArray(yAcc) ? yAcc : [yAcc]) : undefined
|
|
54
|
+
const yStacked = hasConfig ? config.yStacked : this._accessors.yStacked
|
|
55
|
+
const baseline = config.baseline ?? this._accessors.baseline
|
|
56
|
+
|
|
57
|
+
return { x, y, yStacked, baseline }
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
constructor (config?: CrosshairConfigInterface<Datum>) {
|
|
61
|
+
super()
|
|
62
|
+
if (config) this.config.init(config)
|
|
63
|
+
|
|
64
|
+
this.g.style('opacity', this.show ? 1 : 0)
|
|
65
|
+
this.line = this.g.append('line')
|
|
66
|
+
.attr('class', s.line)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
setContainer (containerSvg: Selection<SVGSVGElement, unknown, SVGSVGElement, unknown>): void {
|
|
70
|
+
// Set up mousemove event for Crosshair
|
|
71
|
+
this.container = containerSvg
|
|
72
|
+
this.container.on('mousemove.crosshair', this._onMouseMove.bind(this))
|
|
73
|
+
this.container.on('mouseout.crosshair', this._onMouseOut.bind(this))
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
_render (customDuration?: number): void {
|
|
77
|
+
const { config } = this
|
|
78
|
+
if (config.snapToData && !this.datum) return
|
|
79
|
+
const duration = isNumber(customDuration) ? customDuration : config.duration
|
|
80
|
+
|
|
81
|
+
smartTransition(this.g, duration)
|
|
82
|
+
.style('opacity', this.show ? 1 : 0)
|
|
83
|
+
|
|
84
|
+
this.line
|
|
85
|
+
.attr('y1', 0)
|
|
86
|
+
.attr('y1', this._height)
|
|
87
|
+
|
|
88
|
+
smartTransition(this.line, duration, easeLinear)
|
|
89
|
+
.attr('x1', this.x)
|
|
90
|
+
.attr('x2', this.x)
|
|
91
|
+
|
|
92
|
+
const circleData = this.getCircleData()
|
|
93
|
+
const circles = this.g
|
|
94
|
+
.selectAll<SVGCircleElement, CrosshairCircle>('circle')
|
|
95
|
+
.data(circleData, (d, i) => d.id ?? i)
|
|
96
|
+
|
|
97
|
+
const circlesEnter = circles.enter()
|
|
98
|
+
.append('circle')
|
|
99
|
+
.attr('class', s.circle)
|
|
100
|
+
.attr('r', 0)
|
|
101
|
+
.attr('cx', this.x)
|
|
102
|
+
.attr('cy', d => d.y)
|
|
103
|
+
.style('fill', d => d.color)
|
|
104
|
+
|
|
105
|
+
smartTransition(circlesEnter.merge(circles), duration, easeLinear)
|
|
106
|
+
.attr('cx', this.x)
|
|
107
|
+
.attr('cy', d => d.y)
|
|
108
|
+
.attr('r', 4)
|
|
109
|
+
.style('opacity', d => d.opacity)
|
|
110
|
+
.style('fill', d => d.color)
|
|
111
|
+
|
|
112
|
+
circles.exit().remove()
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
hide (): void {
|
|
116
|
+
this._onMouseOut()
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
_onMouseMove (event: MouseEvent): void {
|
|
120
|
+
const { config, datamodel, element } = this
|
|
121
|
+
if (!this.accessors.x && datamodel.data?.length) {
|
|
122
|
+
console.warn('Unovis | Crosshair: X accessor function has not been configured. Please check if it\'s present in the configuration object')
|
|
123
|
+
}
|
|
124
|
+
const [x] = pointer(event, element)
|
|
125
|
+
const xRange = this.xScale.range()
|
|
126
|
+
|
|
127
|
+
if (config.snapToData) {
|
|
128
|
+
if (!this.accessors.y && !this.accessors.yStacked && datamodel.data?.length) {
|
|
129
|
+
console.warn('Unovis | Crosshair: Y accessors have not been configured. Please check if they\'re present in the configuration object')
|
|
130
|
+
}
|
|
131
|
+
const scaleX = this.xScale
|
|
132
|
+
const valueX = scaleX.invert(x) as number
|
|
133
|
+
|
|
134
|
+
this.datum = getNearest(datamodel.data, valueX, this.accessors.x)
|
|
135
|
+
this.datumIndex = datamodel.data.indexOf(this.datum)
|
|
136
|
+
if (!this.datum) return
|
|
137
|
+
|
|
138
|
+
this.x = clamp(Math.round(scaleX(getNumber(this.datum, this.accessors.x, this.datumIndex))), 0, this._width)
|
|
139
|
+
|
|
140
|
+
// Show the crosshair only if it's in the chart range and not far from mouse pointer (if configured)
|
|
141
|
+
this.show = (this.x >= 0) && (this.x <= this._width) && (!config.hideWhenFarFromPointer || (Math.abs(this.x - x) < config.hideWhenFarFromPointerDistance))
|
|
142
|
+
} else {
|
|
143
|
+
const tolerance = 2 // Show the crosshair when it is at least 2 pixels close to the chart area
|
|
144
|
+
this.x = clamp(x, xRange[0], xRange[1])
|
|
145
|
+
this.show = (x >= (xRange[0] - tolerance)) && (x <= (xRange[1] + tolerance))
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
window.cancelAnimationFrame(this._animFrameId)
|
|
149
|
+
this._animFrameId = window.requestAnimationFrame(() => {
|
|
150
|
+
this._render()
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
if (this.show) this._showTooltip(event)
|
|
154
|
+
else this._hideTooltip()
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
_onMouseOut (): void {
|
|
158
|
+
this.show = false
|
|
159
|
+
|
|
160
|
+
window.cancelAnimationFrame(this._animFrameId)
|
|
161
|
+
this._animFrameId = window.requestAnimationFrame(() => {
|
|
162
|
+
this._render()
|
|
163
|
+
})
|
|
164
|
+
this._hideTooltip()
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
_showTooltip (event: MouseEvent): void {
|
|
168
|
+
const { config } = this
|
|
169
|
+
const tooltip = config.tooltip ?? this.tooltip
|
|
170
|
+
if (!tooltip) return
|
|
171
|
+
|
|
172
|
+
const container = tooltip.getContainer() || this.container.node()
|
|
173
|
+
const [x, y] = tooltip.isContainerBody() ? [event.clientX, event.clientY] : pointer(event, container)
|
|
174
|
+
const content = config.template(this.datum, this.xScale.invert(this.x))
|
|
175
|
+
if (content) tooltip.show(content, { x, y })
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
_hideTooltip (): void {
|
|
179
|
+
const { config } = this
|
|
180
|
+
const tooltip = config.tooltip ?? this.tooltip
|
|
181
|
+
tooltip?.hide()
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// We don't want Crosshair to be be taken in to account in domain calculations
|
|
185
|
+
getYDataExtent (): number[] {
|
|
186
|
+
return [undefined, undefined]
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
private getCircleData (): CrosshairCircle[] {
|
|
190
|
+
const { config, datamodel: { data } } = this
|
|
191
|
+
|
|
192
|
+
if (isFunction(config.getCircles)) return config.getCircles(this.xScale.invert(this.x), data, this.yScale)
|
|
193
|
+
|
|
194
|
+
if (config.snapToData && this.datum) {
|
|
195
|
+
const yAccessors = this.accessors.y ?? []
|
|
196
|
+
const yStackedAccessors = this.accessors.yStacked ?? []
|
|
197
|
+
const baselineValue = getNumber(this.datum, this.accessors.baseline, this.datumIndex) || 0
|
|
198
|
+
const stackedValues: CrosshairCircle[] = getStackedValues(this.datum, this.datumIndex, ...yStackedAccessors)
|
|
199
|
+
.map((value, index, arr) => ({
|
|
200
|
+
y: this.yScale(value + baselineValue),
|
|
201
|
+
opacity: getNumber(this.datum, yStackedAccessors[index]) ? 1 : 0,
|
|
202
|
+
color: getColor(this.datum, config.color, index),
|
|
203
|
+
}))
|
|
204
|
+
|
|
205
|
+
const regularValues: CrosshairCircle[] = yAccessors
|
|
206
|
+
.map((a, index) => {
|
|
207
|
+
const value = getNumber(this.datum, a)
|
|
208
|
+
return {
|
|
209
|
+
y: this.yScale(value),
|
|
210
|
+
opacity: value ? 1 : 0,
|
|
211
|
+
color: getColor(this.datum, config.color, stackedValues.length + index),
|
|
212
|
+
}
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
return stackedValues.concat(regularValues)
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return []
|
|
219
|
+
}
|
|
220
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { css, injectGlobal } from '@emotion/css'
|
|
2
2
|
|
|
3
|
-
const globalStyles = injectGlobal
|
|
3
|
+
export const globalStyles = injectGlobal`
|
|
4
4
|
:root {
|
|
5
5
|
--vis-crosshair-line-stroke-color: #888;
|
|
6
6
|
--vis-crosshair-circle-stroke-color: #fff;
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
`
|
|
9
|
+
|
|
10
|
+
export const root = css`
|
|
10
11
|
label: crosshair-component;
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
`
|
|
13
|
+
|
|
14
|
+
export const line = css`
|
|
13
15
|
stroke: var(--vis-crosshair-line-stroke-color);
|
|
14
16
|
stroke-opacity: 1;
|
|
15
17
|
pointer-events: none;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
`
|
|
19
|
+
|
|
20
|
+
export const circle = css`
|
|
18
21
|
stroke: var(--vis-crosshair-circle-stroke-color);
|
|
19
22
|
stroke-width: 1;
|
|
20
23
|
stroke-opacity: 0.75;
|
|
21
24
|
pointer-events: none;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export { circle, globalStyles, line, root };
|
|
25
|
-
//# sourceMappingURL=style.js.map
|
|
25
|
+
`
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { NumericAccessor } from 'types/accessor'
|
|
2
|
+
|
|
3
|
+
export type CrosshairCircle = {
|
|
4
|
+
y: number;
|
|
5
|
+
color: string;
|
|
6
|
+
opacity?: number;
|
|
7
|
+
id?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type CrosshairAccessors<Datum> = {
|
|
11
|
+
x: NumericAccessor<Datum> | undefined;
|
|
12
|
+
y: NumericAccessor<Datum>[] | undefined;
|
|
13
|
+
yStacked: NumericAccessor<Datum>[] | undefined;
|
|
14
|
+
baseline: NumericAccessor<Datum> | undefined;
|
|
15
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Core
|
|
2
|
+
import { ComponentConfigInterface, ComponentConfig } from 'core/component/config'
|
|
3
|
+
|
|
4
|
+
// Types
|
|
5
|
+
import { ColorAccessor, NumericAccessor } from 'types/accessor'
|
|
6
|
+
|
|
7
|
+
export interface DonutConfigInterface<Datum> extends ComponentConfigInterface {
|
|
8
|
+
/** Accessor function for getting the unique data record id. Used for more persistent data updates. Default: `(d, i) => d.id ?? i` */
|
|
9
|
+
id?: ((d: Datum, i: number, ...any) => string | number);
|
|
10
|
+
/** Value accessor function. Default: `undefined` */
|
|
11
|
+
value: NumericAccessor<Datum>;
|
|
12
|
+
/** Diagram angle range. Default: `[0, 2 * Math.PI]` */
|
|
13
|
+
angleRange?: [number, number];
|
|
14
|
+
/** Pad angle. Default: `0` */
|
|
15
|
+
padAngle?: number;
|
|
16
|
+
/** Custom sort function. Default: `undefined` */
|
|
17
|
+
sortFunction?: (a: Datum, b: Datum) => number;
|
|
18
|
+
/** Corner Radius. Default: `0` */
|
|
19
|
+
cornerRadius?: number;
|
|
20
|
+
/** Color accessor function. Default: `undefined` */
|
|
21
|
+
color?: ColorAccessor<Datum>;
|
|
22
|
+
/** Explicitly set the donut outer radius. Default: `undefined` */
|
|
23
|
+
radius?: number;
|
|
24
|
+
/** Arc width in pixels. Set to `0` if you want to have a pie chart. Default: `20` */
|
|
25
|
+
arcWidth?: number;
|
|
26
|
+
/** Central label accessor function or text. Default: `undefined` */
|
|
27
|
+
centralLabel?: string;
|
|
28
|
+
/** Central sub-label accessor function or text. Default: `undefined` */
|
|
29
|
+
centralSubLabel?: string;
|
|
30
|
+
/** Enables wrapping for the sub-label. Default: `true` */
|
|
31
|
+
centralSubLabelWrap?: boolean;
|
|
32
|
+
/** When true, the component will display empty segments (the ones that have `0` values) as tiny slices.
|
|
33
|
+
* Default: `false`
|
|
34
|
+
*/
|
|
35
|
+
showEmptySegments?: boolean;
|
|
36
|
+
/** Angular size for empty segments in radians. Default: `0.5 * Math.PI / 180` */
|
|
37
|
+
emptySegmentAngle?: number;
|
|
38
|
+
/** Show donut background. The color is configurable via
|
|
39
|
+
* the `--vis-donut-background-color` and `--vis-dark-donut-background-color` CSS variables.
|
|
40
|
+
* Default: `true`
|
|
41
|
+
*/
|
|
42
|
+
showBackground?: boolean;
|
|
43
|
+
/** Background angle range. When undefined, the value will be taken from `angleRange`. Default: `undefined` */
|
|
44
|
+
backgroundAngleRange?: [number, number];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export class DonutConfig<Datum> extends ComponentConfig implements DonutConfigInterface<Datum> {
|
|
48
|
+
// eslint-disable-next-line dot-notation
|
|
49
|
+
id = (d: Datum, i: number): string | number => d['id'] ?? i
|
|
50
|
+
value = undefined
|
|
51
|
+
angleRange: [number, number] = [0, 2 * Math.PI]
|
|
52
|
+
padAngle = 0
|
|
53
|
+
sortFunction = undefined
|
|
54
|
+
cornerRadius = 0
|
|
55
|
+
color = undefined
|
|
56
|
+
radius = undefined
|
|
57
|
+
arcWidth = 20
|
|
58
|
+
centralLabel = undefined
|
|
59
|
+
centralSubLabel = undefined
|
|
60
|
+
centralSubLabelWrap = true
|
|
61
|
+
showEmptySegments = false
|
|
62
|
+
emptySegmentAngle = 0.5 * Math.PI / 180
|
|
63
|
+
showBackground = true
|
|
64
|
+
backgroundAngleRange = undefined
|
|
65
|
+
}
|