@unovis/ts 1.1.1-beta.7 → 1.1.1-beta.8
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/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 +102 -0
- package/components/area/index.js.map +1 -0
- package/components/area/style.d.ts +3 -0
- package/{src/components/area/style.ts → components/area/style.js} +10 -9
- package/components/area/style.js.map +1 -0
- package/components/area/types.d.ts +6 -0
- package/components/axis/config.d.ts +71 -0
- package/components/axis/config.js +32 -0
- package/components/axis/config.js.map +1 -0
- package/components/axis/index.d.ts +44 -0
- package/components/axis/index.js +305 -0
- package/components/axis/index.js.map +1 -0
- package/components/axis/style.d.ts +9 -0
- package/{src/components/axis/style.ts → components/axis/style.js} +22 -27
- 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/{src/components/brush/style.ts → components/brush/style.js} +14 -15
- 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 +34 -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/{src/components/bullet-legend/style.ts → components/bullet-legend/style.js} +16 -18
- package/components/bullet-legend/style.js.map +1 -0
- package/components/bullet-legend/types.d.ts +7 -0
- package/components/bullet-legend/types.js +2 -0
- package/components/bullet-legend/types.js.map +1 -0
- package/components/chord-diagram/config.d.ts +44 -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 +42 -0
- package/components/chord-diagram/index.js +305 -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 +115 -0
- package/components/chord-diagram/modules/label.js.map +1 -0
- package/components/chord-diagram/modules/link.d.ts +21 -0
- package/components/chord-diagram/modules/link.js +63 -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/{src/components/chord-diagram/style.ts → components/chord-diagram/style.js} +30 -39
- package/components/chord-diagram/style.js.map +1 -0
- package/components/chord-diagram/types.d.ts +58 -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 +183 -0
- package/components/crosshair/index.js.map +1 -0
- package/components/crosshair/style.d.ts +4 -0
- package/{src/components/crosshair/style.ts → components/crosshair/style.js} +12 -12
- package/components/crosshair/style.js.map +1 -0
- package/components/crosshair/types.d.ts +13 -0
- package/components/crosshair/types.js +2 -0
- package/components/crosshair/types.js.map +1 -0
- package/components/donut/config.d.ts +59 -0
- package/components/donut/config.js +28 -0
- package/components/donut/config.js.map +1 -0
- package/components/donut/index.d.ts +21 -0
- package/components/donut/index.js +107 -0
- package/components/donut/index.js.map +1 -0
- package/components/donut/modules/arc.d.ts +10 -0
- package/components/donut/modules/arc.js +59 -0
- package/components/donut/modules/arc.js.map +1 -0
- package/components/donut/style.d.ts +7 -0
- package/{src/components/donut/style.ts → components/donut/style.js} +18 -20
- package/components/donut/style.js.map +1 -0
- package/components/donut/types.d.ts +20 -0
- package/components/flow-legend/config.d.ts +29 -0
- package/components/flow-legend/config.js +18 -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 +75 -0
- package/components/flow-legend/index.js.map +1 -0
- package/components/flow-legend/style.d.ts +8 -0
- package/{src/components/flow-legend/style.ts → components/flow-legend/style.js} +21 -25
- 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 +192 -0
- package/components/free-brush/index.js.map +1 -0
- package/components/free-brush/style.d.ts +4 -0
- package/{src/components/free-brush/style.ts → components/free-brush/style.js} +12 -12
- 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 +238 -0
- package/components/graph/config.js +84 -0
- package/components/graph/config.js.map +1 -0
- package/components/graph/index.d.ts +126 -0
- package/components/graph/index.js +656 -0
- package/components/graph/index.js.map +1 -0
- package/components/graph/modules/layout-helpers.d.ts +21 -0
- package/components/graph/modules/layout-helpers.js +69 -0
- package/components/graph/modules/layout-helpers.js.map +1 -0
- package/components/graph/modules/layout.d.ts +10 -0
- package/components/graph/modules/layout.js +399 -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 +74 -0
- package/components/graph/modules/link/helper.js.map +1 -0
- package/components/graph/modules/link/index.d.ts +11 -0
- package/components/graph/modules/link/index.js +212 -0
- package/components/graph/modules/link/index.js.map +1 -0
- package/components/graph/modules/link/style.d.ts +15 -0
- package/{src/components/graph/modules/link/style.ts → components/graph/modules/link/style.js} +34 -45
- 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 +126 -0
- package/components/graph/modules/node/helper.js.map +1 -0
- package/components/graph/modules/node/index.d.ts +11 -0
- package/components/graph/modules/node/index.js +252 -0
- package/components/graph/modules/node/index.js.map +1 -0
- package/components/graph/modules/node/style.d.ts +24 -0
- package/{src/components/graph/modules/node/style.ts → components/graph/modules/node/style.js} +52 -72
- package/components/graph/modules/node/style.js.map +1 -0
- package/components/graph/modules/panel/helper.d.ts +18 -0
- package/components/graph/modules/panel/helper.js +111 -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 +98 -0
- package/components/graph/modules/panel/index.js.map +1 -0
- package/components/graph/modules/panel/style.d.ts +14 -0
- package/{src/components/graph/modules/panel/style.ts → components/graph/modules/panel/style.js} +32 -42
- package/components/graph/modules/panel/style.js.map +1 -0
- package/components/graph/modules/shape.d.ts +6 -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 +125 -0
- package/components/graph/types.js +30 -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 +32 -0
- package/components/grouped-bar/index.js +249 -0
- package/components/grouped-bar/index.js.map +1 -0
- package/components/grouped-bar/style.d.ts +5 -0
- package/{src/components/grouped-bar/style.ts → components/grouped-bar/style.js} +14 -15
- 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 +52 -0
- package/components/leaflet-flow-map/index.js +220 -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/{src/components/leaflet-flow-map/shaders.ts → components/leaflet-flow-map/shaders.js} +7 -4
- 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 +193 -0
- package/components/leaflet-map/config.js +71 -0
- package/components/leaflet-map/config.js.map +1 -0
- package/components/leaflet-map/index.d.ts +130 -0
- package/components/leaflet-map/index.js +690 -0
- package/components/leaflet-map/index.js.map +1 -0
- package/components/leaflet-map/leaflet.css.js +5 -0
- package/components/leaflet-map/leaflet.css.js.map +1 -0
- package/components/leaflet-map/modules/clusterBackground.d.ts +5 -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 +14 -0
- package/components/leaflet-map/modules/map.js +154 -0
- package/components/leaflet-map/modules/map.js.map +1 -0
- package/components/leaflet-map/modules/node.d.ts +9 -0
- package/components/leaflet-map/modules/node.js +162 -0
- package/components/leaflet-map/modules/node.js.map +1 -0
- package/components/leaflet-map/modules/selectionRing.d.ts +7 -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 +50 -0
- package/components/leaflet-map/modules/utils.js +210 -0
- package/components/leaflet-map/modules/utils.js.map +1 -0
- package/{src/components → components}/leaflet-map/renderer/leaflet-maplibre-gl.js +78 -76
- 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 +4981 -0
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json.js.map +1 -0
- package/components/leaflet-map/renderer/mapboxgl-layer.d.ts +8 -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 +4 -0
- package/components/leaflet-map/renderer/mapboxgl-utils.js +39 -0
- package/components/leaflet-map/renderer/mapboxgl-utils.js.map +1 -0
- package/{src/components → components}/leaflet-map/renderer/maplibre-gl.css.js +4 -2
- package/components/leaflet-map/renderer/maplibre-gl.css.js.map +1 -0
- package/components/leaflet-map/style.d.ts +52 -0
- package/components/leaflet-map/style.js +183 -0
- package/components/leaflet-map/style.js.map +1 -0
- package/components/leaflet-map/types.d.ts +75 -0
- package/components/leaflet-map/types.js +15 -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 +152 -0
- package/components/line/index.js.map +1 -0
- package/components/line/style.d.ts +6 -0
- package/{src/components/line/style.ts → components/line/style.js} +16 -18
- package/components/line/style.js.map +1 -0
- package/components/line/types.d.ts +12 -0
- package/components/nested-donut/config.d.ts +59 -0
- package/components/nested-donut/config.js +19 -0
- package/components/nested-donut/config.js.map +1 -0
- package/components/nested-donut/index.d.ts +38 -0
- package/components/nested-donut/index.js +133 -0
- package/components/nested-donut/index.js.map +1 -0
- package/components/nested-donut/modules/arc.d.ts +17 -0
- package/components/nested-donut/modules/arc.js +50 -0
- package/components/nested-donut/modules/arc.js.map +1 -0
- package/components/nested-donut/modules/label.d.ts +7 -0
- package/components/nested-donut/modules/label.js +34 -0
- package/components/nested-donut/modules/label.js.map +1 -0
- package/components/nested-donut/style.d.ts +26 -0
- package/components/nested-donut/style.js +70 -0
- package/components/nested-donut/style.js.map +1 -0
- package/components/nested-donut/types.d.ts +24 -0
- package/components/nested-donut/types.js +11 -0
- package/components/nested-donut/types.js.map +1 -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 +306 -0
- package/components/sankey/index.js.map +1 -0
- package/components/sankey/modules/label.d.ts +23 -0
- package/components/sankey/modules/label.js +168 -0
- package/components/sankey/modules/label.js.map +1 -0
- package/components/sankey/modules/link.d.ts +14 -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/{src/components/sankey/style.ts → components/sankey/style.js} +44 -60
- 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 +28 -0
- package/components/scatter/index.js +167 -0
- package/components/scatter/index.js.map +1 -0
- package/components/scatter/modules/point.d.ts +7 -0
- package/components/scatter/modules/point.js +86 -0
- package/components/scatter/modules/point.js.map +1 -0
- package/components/scatter/modules/utils.d.ts +11 -0
- package/components/scatter/modules/utils.js +112 -0
- package/components/scatter/modules/utils.js.map +1 -0
- package/components/scatter/style.d.ts +5 -0
- package/{src/components/scatter/style.ts → components/scatter/style.js} +14 -15
- package/components/scatter/style.js.map +1 -0
- package/components/scatter/types.d.ts +19 -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 +28 -0
- package/components/stacked-bar/index.js +208 -0
- package/components/stacked-bar/index.js.map +1 -0
- package/components/stacked-bar/style.d.ts +5 -0
- package/{src/components/stacked-bar/style.ts → components/stacked-bar/style.js} +14 -15
- 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 +24 -0
- package/components/timeline/config.js.map +1 -0
- package/components/timeline/index.d.ts +41 -0
- package/components/timeline/index.js +244 -0
- package/components/timeline/index.js.map +1 -0
- package/components/timeline/style.d.ts +13 -0
- package/{src/components/timeline/style.ts → components/timeline/style.js} +30 -39
- package/components/timeline/style.js.map +1 -0
- package/components/tooltip/config.d.ts +68 -0
- package/components/tooltip/config.js +20 -0
- package/components/tooltip/config.js.map +1 -0
- package/components/tooltip/index.d.ts +36 -0
- package/components/tooltip/index.js +184 -0
- package/components/tooltip/index.js.map +1 -0
- package/{src/components → components}/tooltip/style.js +14 -11
- 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/{src/components/topojson-map/style.ts → components/topojson-map/style.js} +26 -33
- package/components/topojson-map/style.js.map +1 -0
- package/components/topojson-map/types.d.ts +78 -0
- package/components/topojson-map/types.js +80 -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/{src/components/vis-controls/style.ts → components/vis-controls/style.js} +27 -34
- 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 +87 -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 +107 -0
- package/components/xy-labels/modules/label.js.map +1 -0
- package/components/xy-labels/style.d.ts +5 -0
- package/{src/components/xy-labels/style.ts → components/xy-labels/style.js} +14 -15
- 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 +51 -0
- package/components.js +29 -0
- package/components.js.map +1 -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 +19 -0
- package/containers/single-container/index.js +128 -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 +34 -0
- package/containers/xy-container/index.js +330 -0
- package/containers/xy-container/index.js.map +1 -0
- package/containers.d.ts +6 -0
- package/containers.js +4 -0
- package/containers.js.map +1 -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 +43 -0
- package/core/component/index.js +118 -0
- package/core/component/index.js.map +1 -0
- package/core/component/types.d.ts +2 -0
- package/core/component/types.js +2 -0
- package/core/component/types.js.map +1 -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 +48 -0
- package/core/container/config.js +29 -0
- package/core/container/config.js.map +1 -0
- package/core/container/index.d.ts +26 -0
- package/core/container/index.js +106 -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 +27 -0
- package/core/xy-component/index.js +74 -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 +107 -0
- package/data-models/graph.js.map +1 -0
- package/data-models/map-graph.d.ts +21 -0
- package/data-models/map-graph.js +62 -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 +7 -0
- package/index.js +55 -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 +1 -1
- package/styles/colors.d.ts +7 -0
- package/styles/colors.js +24 -0
- package/styles/colors.js.map +1 -0
- package/styles/index.d.ts +7 -0
- package/styles/index.js +38 -0
- package/styles/index.js.map +1 -0
- package/styles/sizes.d.ts +2 -0
- package/{src/styles/sizes.ts → styles/sizes.js} +8 -6
- package/styles/sizes.js.map +1 -0
- package/types/accessor.d.ts +5 -0
- package/types/accessor.js +2 -0
- package/types/accessor.js.map +1 -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/data.js +2 -0
- package/types/data.js.map +1 -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/graph.js +2 -0
- package/types/graph.js.map +1 -0
- package/types/map.d.ts +4 -0
- package/types/map.js +2 -0
- package/types/map.js.map +1 -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/spacing.js +2 -0
- package/types/spacing.js.map +1 -0
- package/types/svg.d.ts +18 -0
- package/types/svg.js +22 -0
- package/types/svg.js.map +1 -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 +47 -0
- package/types/text.js +26 -0
- package/types/text.js.map +1 -0
- package/types.d.ts +27 -0
- package/types.js +30 -0
- package/types.js.map +1 -0
- package/utils/color.d.ts +10 -0
- package/utils/color.js +32 -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 +45 -0
- package/utils/data.js +274 -0
- package/utils/data.js.map +1 -0
- package/utils/html.d.ts +1 -0
- package/utils/html.js +16 -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 +9 -0
- package/utils/misc.js +47 -0
- package/utils/misc.js.map +1 -0
- package/utils/path.d.ts +23 -0
- package/utils/path.js +144 -0
- package/utils/path.js.map +1 -0
- package/utils/scale.d.ts +1 -0
- package/utils/style.d.ts +6 -0
- package/utils/style.js +24 -0
- package/utils/style.js.map +1 -0
- package/utils/svg.d.ts +3 -0
- package/utils/text.d.ts +139 -0
- package/utils/text.js +443 -0
- package/utils/text.js.map +1 -0
- package/utils/type.d.ts +5 -0
- package/declaration.d.ts +0 -1
- package/index.ts +0 -1
- package/licences.txt +0 -43
- package/maps.ts +0 -1
- package/rollup.config.js +0 -71
- package/rules/ts-getter-setter.js +0 -35
- package/src/components/area/config.ts +0 -29
- package/src/components/area/index.ts +0 -133
- package/src/components/area/types.ts +0 -2
- package/src/components/axis/config.ts +0 -76
- package/src/components/axis/index.ts +0 -363
- package/src/components/axis/types.ts +0 -4
- package/src/components/brush/config.ts +0 -51
- package/src/components/brush/index.ts +0 -233
- package/src/components/brush/types.ts +0 -8
- package/src/components/bullet-legend/config.ts +0 -38
- package/src/components/bullet-legend/index.ts +0 -104
- package/src/components/bullet-legend/types.ts +0 -7
- package/src/components/chord-diagram/config.ts +0 -53
- package/src/components/chord-diagram/index.ts +0 -401
- package/src/components/chord-diagram/modules/label.ts +0 -155
- package/src/components/chord-diagram/modules/link.ts +0 -91
- package/src/components/chord-diagram/modules/node.ts +0 -80
- package/src/components/chord-diagram/types.ts +0 -68
- package/src/components/crosshair/config.ts +0 -48
- package/src/components/crosshair/index.ts +0 -220
- package/src/components/crosshair/types.ts +0 -15
- package/src/components/donut/config.ts +0 -65
- package/src/components/donut/index.ts +0 -148
- package/src/components/donut/modules/arc.ts +0 -86
- package/src/components/donut/types.ts +0 -17
- package/src/components/flow-legend/config.ts +0 -31
- package/src/components/flow-legend/index.ts +0 -103
- package/src/components/flow-legend/types.ts +0 -10
- package/src/components/free-brush/config.ts +0 -54
- package/src/components/free-brush/index.ts +0 -207
- package/src/components/free-brush/types.ts +0 -8
- package/src/components/graph/config.ts +0 -280
- package/src/components/graph/index.ts +0 -809
- package/src/components/graph/modules/layout-helpers.ts +0 -96
- package/src/components/graph/modules/layout.ts +0 -502
- package/src/components/graph/modules/link/helper.ts +0 -105
- package/src/components/graph/modules/link/index.ts +0 -302
- package/src/components/graph/modules/node/helper.ts +0 -162
- package/src/components/graph/modules/node/index.ts +0 -343
- package/src/components/graph/modules/panel/helper.ts +0 -160
- package/src/components/graph/modules/panel/index.ts +0 -137
- package/src/components/graph/modules/shape.ts +0 -108
- package/src/components/graph/modules/zoom-levels.ts +0 -6
- package/src/components/graph/style.ts +0 -72
- package/src/components/graph/types.ts +0 -152
- package/src/components/grouped-bar/config.ts +0 -40
- package/src/components/grouped-bar/index.ts +0 -325
- package/src/components/leaflet-flow-map/config.ts +0 -60
- package/src/components/leaflet-flow-map/index.ts +0 -279
- package/src/components/leaflet-flow-map/renderer-utils.ts +0 -14
- package/src/components/leaflet-flow-map/renderer.ts +0 -146
- package/src/components/leaflet-flow-map/types.ts +0 -18
- package/src/components/leaflet-map/config.ts +0 -234
- package/src/components/leaflet-map/index.ts +0 -808
- package/src/components/leaflet-map/leaflet.css +0 -625
- package/src/components/leaflet-map/modules/clusterBackground.ts +0 -34
- package/src/components/leaflet-map/modules/donut.ts +0 -37
- package/src/components/leaflet-map/modules/map.ts +0 -178
- package/src/components/leaflet-map/modules/node.ts +0 -208
- package/src/components/leaflet-map/modules/selectionRing.ts +0 -63
- package/src/components/leaflet-map/modules/utils.ts +0 -290
- package/src/components/leaflet-map/renderer/map-style.ts +0 -24
- package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json +0 -35
- package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json +0 -35
- package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json +0 -2185
- package/src/components/leaflet-map/renderer/mapboxgl-layer.ts +0 -43
- package/src/components/leaflet-map/renderer/mapboxgl-utils.ts +0 -40
- package/src/components/leaflet-map/style.ts +0 -217
- package/src/components/leaflet-map/types.ts +0 -75
- package/src/components/line/config.ts +0 -34
- package/src/components/line/index.ts +0 -188
- package/src/components/line/types.ts +0 -3
- package/src/components/nested-donut/config.ts +0 -75
- package/src/components/nested-donut/index.ts +0 -176
- package/src/components/nested-donut/modules/arc.ts +0 -78
- package/src/components/nested-donut/modules/label.ts +0 -63
- package/src/components/nested-donut/style.ts +0 -82
- package/src/components/nested-donut/types.ts +0 -29
- package/src/components/sankey/config.ts +0 -195
- package/src/components/sankey/index.ts +0 -387
- package/src/components/sankey/modules/label.ts +0 -228
- package/src/components/sankey/modules/link.ts +0 -141
- package/src/components/sankey/modules/node.ts +0 -221
- package/src/components/sankey/types.ts +0 -95
- package/src/components/scatter/config.ts +0 -49
- package/src/components/scatter/index.ts +0 -220
- package/src/components/scatter/modules/point.ts +0 -123
- package/src/components/scatter/modules/utils.ts +0 -150
- package/src/components/scatter/types.ts +0 -21
- package/src/components/stacked-bar/config.ts +0 -42
- package/src/components/stacked-bar/index.ts +0 -267
- package/src/components/stacked-bar/types.ts +0 -5
- package/src/components/timeline/config.ts +0 -49
- package/src/components/timeline/index.ts +0 -302
- package/src/components/tooltip/config.ts +0 -69
- package/src/components/tooltip/index.ts +0 -220
- package/src/components/topojson-map/config.ts +0 -124
- package/src/components/topojson-map/index.ts +0 -436
- package/src/components/topojson-map/types.ts +0 -123
- package/src/components/topojson-map/utils.ts +0 -29
- package/src/components/vis-controls/config.ts +0 -16
- package/src/components/vis-controls/index.ts +0 -68
- package/src/components/vis-controls/types.ts +0 -14
- package/src/components/xy-labels/config.ts +0 -56
- package/src/components/xy-labels/index.ts +0 -109
- package/src/components/xy-labels/modules/label.ts +0 -140
- package/src/components/xy-labels/types.ts +0 -26
- package/src/components.ts +0 -56
- package/src/containers/single-container/config.ts +0 -15
- package/src/containers/single-container/index.ts +0 -150
- package/src/containers/xy-container/config.ts +0 -112
- package/src/containers/xy-container/index.ts +0 -407
- package/src/containers.ts +0 -6
- package/src/core/component/config.ts +0 -61
- package/src/core/component/index.ts +0 -154
- package/src/core/component/types.ts +0 -9
- package/src/core/config/index.ts +0 -12
- package/src/core/container/config.ts +0 -56
- package/src/core/container/index.ts +0 -136
- package/src/core/xy-component/config.ts +0 -46
- package/src/core/xy-component/index.ts +0 -90
- package/src/data-models/core.ts +0 -15
- package/src/data-models/graph.ts +0 -138
- package/src/data-models/map-graph.ts +0 -72
- package/src/data-models/map.ts +0 -18
- package/src/data-models/series.ts +0 -16
- package/src/index.ts +0 -7
- package/src/maps/china-provinces.json +0 -1
- package/src/maps/fr-regions.json +0 -1
- package/src/maps/germany-regions.json +0 -1
- package/src/maps/ind-regions.json +0 -1
- package/src/maps/uk-regions.json +0 -1
- package/src/maps/us-counties.json +0 -1
- package/src/maps/us-states.json +0 -1
- package/src/maps/world-110m-alpha.json +0 -1
- package/src/maps/world-simple.json +0 -1
- package/src/maps/world-simplest.json +0 -1
- package/src/maps.ts +0 -34
- package/src/styles/colors.ts +0 -28
- package/src/styles/index.ts +0 -38
- package/src/types/accessor.ts +0 -5
- package/src/types/component.ts +0 -15
- package/src/types/curve.ts +0 -62
- package/src/types/data.ts +0 -5
- package/src/types/direction.ts +0 -6
- package/src/types/graph.ts +0 -40
- package/src/types/map.ts +0 -5
- package/src/types/misc.ts +0 -10
- package/src/types/position.ts +0 -23
- package/src/types/scale.ts +0 -47
- package/src/types/shape.ts +0 -7
- package/src/types/spacing.ts +0 -6
- package/src/types/svg.ts +0 -32
- package/src/types/symbol.ts +0 -21
- package/src/types/text.ts +0 -71
- package/src/types.ts +0 -31
- package/src/utils/color.ts +0 -41
- package/src/utils/d3.ts +0 -15
- package/src/utils/data.ts +0 -328
- package/src/utils/html.ts +0 -13
- package/src/utils/map.ts +0 -29
- package/src/utils/misc.ts +0 -54
- package/src/utils/path.ts +0 -196
- package/src/utils/scale.ts +0 -1
- package/src/utils/style.ts +0 -37
- package/src/utils/svg.ts +0 -49
- package/src/utils/text.ts +0 -529
- package/src/utils/type.ts +0 -9
- package/tsconfig.json +0 -29
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import { select, Selection } from 'd3-selection'
|
|
2
|
-
import { ScaleContinuousNumeric } from 'd3-scale'
|
|
3
|
-
import { color } from 'd3-color'
|
|
4
|
-
|
|
5
|
-
// Utils
|
|
6
|
-
import { trimSVGText } from 'utils/text'
|
|
7
|
-
import { smartTransition } from 'utils/d3'
|
|
8
|
-
import { getNumber, getString, getValue } from 'utils/data'
|
|
9
|
-
import { getColor, hexToBrightness } from 'utils/color'
|
|
10
|
-
|
|
11
|
-
// Config
|
|
12
|
-
import { ChordDiagramConfig } from '../config'
|
|
13
|
-
|
|
14
|
-
// Local Types
|
|
15
|
-
import { ChordInputLink, ChordInputNode, ChordLabelAlignment, ChordNode } from '../types'
|
|
16
|
-
|
|
17
|
-
// Styles
|
|
18
|
-
import * as s from '../style'
|
|
19
|
-
|
|
20
|
-
export const LABEL_PADDING = 3
|
|
21
|
-
|
|
22
|
-
function getLabelFillColor<N extends ChordInputNode, L extends ChordInputLink> (
|
|
23
|
-
d: ChordNode<N>,
|
|
24
|
-
config: ChordDiagramConfig<N, L>
|
|
25
|
-
): string {
|
|
26
|
-
const nodeLabelAlignment = getValue(d.data, config.nodeLabelAlignment) ?? ChordLabelAlignment.Along
|
|
27
|
-
switch (nodeLabelAlignment) {
|
|
28
|
-
case ChordLabelAlignment.Perpendicular: {
|
|
29
|
-
return getColor(d.data, config.nodeColor, d.height)
|
|
30
|
-
}
|
|
31
|
-
case ChordLabelAlignment.Along: {
|
|
32
|
-
const c = getColor(d.data, config.nodeColor, d.height)
|
|
33
|
-
const colorParsed = color(c)
|
|
34
|
-
const brightness = colorParsed ? hexToBrightness(colorParsed.hex()) : 0
|
|
35
|
-
return brightness > 0.65 ? 'var(--vis-chord-diagram-label-text-fill-color-dark)' : 'var(--vis-chord-diagram-label-text-fill-color-bright)'
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function getLabelTextAnchor<N extends ChordInputNode, L extends ChordInputLink> (
|
|
41
|
-
d: ChordNode<N>,
|
|
42
|
-
config: ChordDiagramConfig<N, L>
|
|
43
|
-
): string | null {
|
|
44
|
-
const nodeLabelAlignment = getValue(d.data, config.nodeLabelAlignment) ?? ChordLabelAlignment.Along
|
|
45
|
-
switch (nodeLabelAlignment) {
|
|
46
|
-
case ChordLabelAlignment.Perpendicular: {
|
|
47
|
-
const angleCenter = (d.x0 + d.x1) / 2
|
|
48
|
-
const angleDegree = angleCenter * 180 / Math.PI
|
|
49
|
-
return angleDegree < 180 ? 'start' : 'end'
|
|
50
|
-
}
|
|
51
|
-
case ChordLabelAlignment.Along: {
|
|
52
|
-
return null
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function getLabelTransform<N extends ChordInputNode, L extends ChordInputLink> (
|
|
58
|
-
d: ChordNode<N>,
|
|
59
|
-
config: ChordDiagramConfig<N, L>,
|
|
60
|
-
radiusScale: ScaleContinuousNumeric<number, number>
|
|
61
|
-
): string | null {
|
|
62
|
-
const nodeLabelAlignment = getValue(d.data, config.nodeLabelAlignment) ?? ChordLabelAlignment.Along
|
|
63
|
-
switch (nodeLabelAlignment) {
|
|
64
|
-
case ChordLabelAlignment.Perpendicular: {
|
|
65
|
-
const r = radiusScale(d.y1) + LABEL_PADDING
|
|
66
|
-
const angleCenter = (d.x0 + d.x1) / 2
|
|
67
|
-
const angle = angleCenter - Math.PI / 2
|
|
68
|
-
const x = r * Math.cos(angle)
|
|
69
|
-
const y = r * Math.sin(angle)
|
|
70
|
-
return `translate(${x}, ${y})`
|
|
71
|
-
}
|
|
72
|
-
case ChordLabelAlignment.Along:
|
|
73
|
-
return null
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export function createLabel<N extends ChordInputNode, L extends ChordInputLink> (
|
|
78
|
-
selection: Selection<SVGGElement, ChordNode<N>, SVGGElement, unknown>,
|
|
79
|
-
config: ChordDiagramConfig<N, L>,
|
|
80
|
-
radiusScale: ScaleContinuousNumeric<number, number>
|
|
81
|
-
): void {
|
|
82
|
-
selection.style('opacity', 0)
|
|
83
|
-
.attr('transform', d => getLabelTransform(d, config, radiusScale))
|
|
84
|
-
|
|
85
|
-
selection.append('text')
|
|
86
|
-
.attr('class', s.label)
|
|
87
|
-
.style('fill', d => getColor(d.data, config.nodeColor, d.height))
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export function updateLabel<N extends ChordInputNode, L extends ChordInputLink> (
|
|
91
|
-
selection: Selection<SVGGElement, ChordNode<N>, SVGGElement, unknown>,
|
|
92
|
-
config: ChordDiagramConfig<N, L>,
|
|
93
|
-
width: number,
|
|
94
|
-
radiusScale: ScaleContinuousNumeric<number, number>,
|
|
95
|
-
duration: number
|
|
96
|
-
): void {
|
|
97
|
-
const { nodeLabel, nodeLabelColor, nodeWidth } = config
|
|
98
|
-
|
|
99
|
-
smartTransition(selection, duration)
|
|
100
|
-
.attr('transform', d => getLabelTransform(d, config, radiusScale))
|
|
101
|
-
.style('opacity', 1)
|
|
102
|
-
|
|
103
|
-
const label: Selection<SVGTextElement, ChordNode<N>, SVGElement, unknown> = selection.select(`.${s.label}`)
|
|
104
|
-
label.select('textPath').remove()
|
|
105
|
-
label
|
|
106
|
-
.text(d => getString(d.data, nodeLabel))
|
|
107
|
-
.style('fill', d => getColor(d.data, nodeLabelColor) ?? getLabelFillColor(d, config))
|
|
108
|
-
.style('text-anchor', d => getLabelTextAnchor(d, config))
|
|
109
|
-
|
|
110
|
-
label.each((d: ChordNode<N>, i: number, elements) => {
|
|
111
|
-
const nodeLabelAlignment = getValue(d.data, config.nodeLabelAlignment) ?? ChordLabelAlignment.Along
|
|
112
|
-
const radianArcLength = d.x1 - d.x0 - getNumber(d, config.padAngle) * 2
|
|
113
|
-
const radius = radiusScale(d.y1) - getNumber(d, config.nodeWidth) / 2
|
|
114
|
-
const arcLength = radius * radianArcLength
|
|
115
|
-
const maxWidth = (nodeLabelAlignment === ChordLabelAlignment.Along ? arcLength : width) - LABEL_PADDING * 2
|
|
116
|
-
|
|
117
|
-
const textElementSelection = select(elements[i])
|
|
118
|
-
trimSVGText(textElementSelection, maxWidth)
|
|
119
|
-
textElementSelection
|
|
120
|
-
.attr('dx', nodeLabelAlignment === ChordLabelAlignment.Along ? LABEL_PADDING : null)
|
|
121
|
-
.attr('dy', nodeLabelAlignment === ChordLabelAlignment.Along ? getNumber(d.data, nodeWidth) / 2 : null)
|
|
122
|
-
|
|
123
|
-
if (nodeLabelAlignment === ChordLabelAlignment.Along) {
|
|
124
|
-
const textElement = select(elements[i])
|
|
125
|
-
const textWidth = textElement.node().getBoundingClientRect().width
|
|
126
|
-
const labelText = textElement.text()
|
|
127
|
-
|
|
128
|
-
select(elements[i])
|
|
129
|
-
.text('')
|
|
130
|
-
.style('display', textWidth > maxWidth && 'none')
|
|
131
|
-
|
|
132
|
-
select(elements[i]).append('textPath')
|
|
133
|
-
.attr('href', `#${d.uid}`)
|
|
134
|
-
.text(labelText)
|
|
135
|
-
}
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
smartTransition(label, duration)
|
|
139
|
-
.attr('transform', d => {
|
|
140
|
-
const nodeLabelAlignment = getValue(d.data, config.nodeLabelAlignment)
|
|
141
|
-
if (nodeLabelAlignment !== ChordLabelAlignment.Perpendicular) return null
|
|
142
|
-
const angleCenter = (d.x0 + d.x1) / 2
|
|
143
|
-
const angleDegree = angleCenter * 180 / Math.PI
|
|
144
|
-
return `rotate(${angleDegree < 180 ? angleDegree - 90 : angleDegree + 90})`
|
|
145
|
-
})
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export function removeLabel (
|
|
149
|
-
selection: Selection<SVGGElement, unknown, SVGGElement, unknown>,
|
|
150
|
-
duration: number
|
|
151
|
-
): void {
|
|
152
|
-
smartTransition(selection, duration)
|
|
153
|
-
.style('opacity', 0)
|
|
154
|
-
.remove()
|
|
155
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { Selection, select } from 'd3-selection'
|
|
2
|
-
import { path } from 'd3-path'
|
|
3
|
-
import { Line } from 'd3-shape'
|
|
4
|
-
import { Transition } from 'd3-transition'
|
|
5
|
-
import { interpolatePath } from 'd3-interpolate-path'
|
|
6
|
-
|
|
7
|
-
// Utils
|
|
8
|
-
import { getColor } from 'utils/color'
|
|
9
|
-
import { smartTransition } from 'utils/d3'
|
|
10
|
-
|
|
11
|
-
// Local Types
|
|
12
|
-
import { ChordInputLink, ChordInputNode, ChordRibbon, ChordRibbonPoint } from '../types'
|
|
13
|
-
import { ChordDiagramConfig } from '../config'
|
|
14
|
-
|
|
15
|
-
export interface ArcLink extends SVGElement {
|
|
16
|
-
_animState?: {
|
|
17
|
-
source: { y0: number; y1: number };
|
|
18
|
-
target: { x0: number; x1: number; y1: number };
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function emptyPath (): string {
|
|
23
|
-
return 'M0,0 L0,0'
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Creates a path consisting of the inner source arc, node arcs and connecting curves
|
|
27
|
-
function linkGen (points: ChordRibbonPoint[], lineGen: Line<[number, number]>): string {
|
|
28
|
-
const p = path()
|
|
29
|
-
const sourceArc = points[0]
|
|
30
|
-
const targetArc = points[points.length - 1]
|
|
31
|
-
|
|
32
|
-
if (points.length === 2) {
|
|
33
|
-
// Writing a custom curve here since generators won't produce a curved line from only two points
|
|
34
|
-
p.moveTo(sourceArc.x1, sourceArc.y1)
|
|
35
|
-
p.quadraticCurveTo(0, 0, targetArc.x0, targetArc.y0)
|
|
36
|
-
p.arc(0, 0, targetArc.r, targetArc.a0, targetArc.a1)
|
|
37
|
-
p.quadraticCurveTo(0, 0, sourceArc.x0, sourceArc.y0)
|
|
38
|
-
p.arc(0, 0, sourceArc.r, sourceArc.a0, sourceArc.a1)
|
|
39
|
-
} else {
|
|
40
|
-
const inner: [number, number][] = points.map((d, i) => i < points.length / 2 ? [d.x1, d.y1] : [d.x0, d.y0])
|
|
41
|
-
const outer: [number, number][] = points.map((d, i) => i < points.length / 2 ? [d.x0, d.y0] : [d.x1, d.y1])
|
|
42
|
-
|
|
43
|
-
lineGen.context(p as CanvasRenderingContext2D)
|
|
44
|
-
lineGen(inner)
|
|
45
|
-
p.arc(0, 0, targetArc.r, targetArc.a0, targetArc.a1)
|
|
46
|
-
lineGen(outer.reverse())
|
|
47
|
-
p.arc(0, 0, sourceArc.r, sourceArc.a0, sourceArc.a1)
|
|
48
|
-
}
|
|
49
|
-
return p.toString()
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function createLink<N extends ChordInputNode> (
|
|
53
|
-
selection: Selection<SVGPathElement, ChordRibbon<N>, SVGGElement, unknown>,
|
|
54
|
-
lineGen: Line<[number, number]>
|
|
55
|
-
): void {
|
|
56
|
-
selection
|
|
57
|
-
.attr('d', d => linkGen(d.points, lineGen) || emptyPath())
|
|
58
|
-
.style('opacity', 0)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function updateLink<N extends ChordInputNode, L extends ChordInputLink> (
|
|
62
|
-
selection: Selection<SVGPathElement, ChordRibbon<N>, SVGGElement, unknown>,
|
|
63
|
-
config: ChordDiagramConfig<N, L>,
|
|
64
|
-
lineGen: Line<[number, number]>,
|
|
65
|
-
duration: number
|
|
66
|
-
): void {
|
|
67
|
-
const selTransition = smartTransition(selection, duration)
|
|
68
|
-
.style('fill', d => getColor(d.data, config.linkColor))
|
|
69
|
-
.style('stroke', d => getColor(d.data, config.linkColor))
|
|
70
|
-
.style('opacity', 'var(--vis-chord-diagram-link-opacity)')
|
|
71
|
-
|
|
72
|
-
if (duration) {
|
|
73
|
-
const transition = selTransition as Transition<SVGPathElement, ChordRibbon<N>, SVGGElement, unknown>
|
|
74
|
-
transition.attrTween('d', (d, i, el) => {
|
|
75
|
-
const previous = select(el[i]).attr('d')
|
|
76
|
-
const next = linkGen(d.points, lineGen) || emptyPath()
|
|
77
|
-
return interpolatePath(previous, next)
|
|
78
|
-
})
|
|
79
|
-
} else {
|
|
80
|
-
selTransition.attr('d', d => linkGen(d.points, lineGen) || emptyPath())
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export function removeLink (
|
|
85
|
-
selection: Selection<SVGPathElement, unknown, SVGGElement, unknown>,
|
|
86
|
-
duration: number
|
|
87
|
-
): void {
|
|
88
|
-
smartTransition(selection, duration)
|
|
89
|
-
.style('opacity', 0)
|
|
90
|
-
.remove()
|
|
91
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
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,68 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,220 +0,0 @@
|
|
|
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,15 +0,0 @@
|
|
|
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
|
-
}
|