@unovis/ts 1.1.1-beta.7 → 1.1.1-beta.9
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,267 +0,0 @@
|
|
|
1
|
-
import { min, max } from 'd3-array'
|
|
2
|
-
|
|
3
|
-
// Core
|
|
4
|
-
import { XYComponentCore } from 'core/xy-component'
|
|
5
|
-
|
|
6
|
-
// Utils
|
|
7
|
-
import { isNumber, isArray, isEmpty, clamp, getStackedExtent, getString, getNumber, getStackedData, getExtent } from 'utils/data'
|
|
8
|
-
import { roundedRectPath } from 'utils/path'
|
|
9
|
-
import { smartTransition } from 'utils/d3'
|
|
10
|
-
import { getColor } from 'utils/color'
|
|
11
|
-
|
|
12
|
-
// Types
|
|
13
|
-
import { ContinuousScale } from 'types/scale'
|
|
14
|
-
import { NumericAccessor } from 'types/accessor'
|
|
15
|
-
import { Spacing } from 'types/spacing'
|
|
16
|
-
import { Orientation } from 'types/position'
|
|
17
|
-
|
|
18
|
-
// Local Types
|
|
19
|
-
import { StackedBarDataRecord } from './types'
|
|
20
|
-
|
|
21
|
-
// Config
|
|
22
|
-
import { StackedBarConfig, StackedBarConfigInterface } from './config'
|
|
23
|
-
|
|
24
|
-
// Styles
|
|
25
|
-
import * as s from './style'
|
|
26
|
-
|
|
27
|
-
export class StackedBar<Datum> extends XYComponentCore<Datum, StackedBarConfig<Datum>, StackedBarConfigInterface<Datum>> {
|
|
28
|
-
static selectors = s
|
|
29
|
-
config: StackedBarConfig<Datum> = new StackedBarConfig()
|
|
30
|
-
getAccessors = (): NumericAccessor<Datum>[] => (isArray(this.config.y) ? this.config.y : [this.config.y])
|
|
31
|
-
stacked = true
|
|
32
|
-
events = {}
|
|
33
|
-
private _prevNegative: boolean[] | undefined // To help guessing the bar direction when an accessor was set to null or 0
|
|
34
|
-
private _barData: Datum[] = []
|
|
35
|
-
|
|
36
|
-
constructor (config?: StackedBarConfigInterface<Datum>) {
|
|
37
|
-
super()
|
|
38
|
-
if (config) this.config.init(config)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
get bleed (): Spacing {
|
|
42
|
-
this._barData = this._getVisibleData()
|
|
43
|
-
if (this._barData.length === 0) return { top: 0, bottom: 0, left: 0, right: 0 }
|
|
44
|
-
|
|
45
|
-
// By default, horizontal orientation is "flipped", i.e. the `yDirection` of `XYContainer` is set to `Direction.North`
|
|
46
|
-
const isHorizontalAndFlipped = !this.isVertical() && (this.dataScale.range()[0] > this.dataScale.range()[1])
|
|
47
|
-
const dataDomain = this.dataScale.domain()
|
|
48
|
-
const halfGroupWidth = this._getBarWidth() / 2
|
|
49
|
-
|
|
50
|
-
const dataScaleValues = this._barData.map((d, i) => getNumber(d, this.config.x, i))
|
|
51
|
-
const firstDataValue = min(dataScaleValues)
|
|
52
|
-
const lastDataValue = max(dataScaleValues)
|
|
53
|
-
const firstValuePx = this.dataScale(firstDataValue)
|
|
54
|
-
const lastValuePx = this.dataScale(lastDataValue)
|
|
55
|
-
|
|
56
|
-
const dataDomainRequiredStart = this.dataScale.invert(firstValuePx + (isHorizontalAndFlipped ? halfGroupWidth : -halfGroupWidth))
|
|
57
|
-
const dataDomainRequiredEnd = this.dataScale.invert(lastValuePx + (isHorizontalAndFlipped ? -halfGroupWidth : halfGroupWidth))
|
|
58
|
-
const bleedPxStart = dataDomainRequiredStart <= dataDomain[0] ? this.dataScale(dataDomain[0]) - this.dataScale(dataDomainRequiredStart) : 0
|
|
59
|
-
const bleedPxEnd = dataDomainRequiredEnd > dataDomain[1] ? this.dataScale(dataDomainRequiredEnd) - this.dataScale(dataDomain[1]) : 0
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
top: this.isVertical() ? 0 : (isHorizontalAndFlipped ? -bleedPxEnd : bleedPxStart),
|
|
63
|
-
bottom: this.isVertical() ? 0 : (isHorizontalAndFlipped ? -bleedPxStart : bleedPxEnd),
|
|
64
|
-
left: this.isVertical() ? bleedPxStart : 0,
|
|
65
|
-
right: this.isVertical() ? bleedPxEnd : 0,
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
private get dataScale (): ContinuousScale {
|
|
70
|
-
return this.isVertical() ? this.xScale : this.yScale
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
private get valueScale (): ContinuousScale {
|
|
74
|
-
return this.isVertical() ? this.yScale : this.xScale
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
private isVertical (): boolean {
|
|
78
|
-
return this.config.orientation === Orientation.Vertical
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
_render (customDuration?: number): void {
|
|
82
|
-
const { config } = this
|
|
83
|
-
const duration = isNumber(customDuration) ? customDuration : config.duration
|
|
84
|
-
|
|
85
|
-
const yAccessors = this.getAccessors()
|
|
86
|
-
const stacked = getStackedData(this._barData, 0, yAccessors, this._prevNegative)
|
|
87
|
-
this._prevNegative = stacked.map(s => !!s.negative)
|
|
88
|
-
|
|
89
|
-
const barGroups = this.g
|
|
90
|
-
.selectAll<SVGGElement, Datum>(`.${s.barGroup}`)
|
|
91
|
-
.data(this._barData, (d, i) => `${getString(d, config.id, i) ?? i}`)
|
|
92
|
-
|
|
93
|
-
const getBarGroupsTransform = (d: Datum, i: number): string => {
|
|
94
|
-
const v = this.dataScale(getNumber(d, config.x, i))
|
|
95
|
-
const x = this.isVertical() ? v : 0
|
|
96
|
-
const y = this.isVertical() ? 0 : v
|
|
97
|
-
return `translate(${x},${y})`
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const barGroupsEnter = barGroups.enter().append('g')
|
|
101
|
-
.attr('class', s.barGroup)
|
|
102
|
-
.attr('transform', getBarGroupsTransform)
|
|
103
|
-
.style('opacity', 1)
|
|
104
|
-
|
|
105
|
-
const barGroupsMerged = barGroupsEnter.merge(barGroups)
|
|
106
|
-
smartTransition(barGroupsMerged, duration)
|
|
107
|
-
.attr('transform', getBarGroupsTransform)
|
|
108
|
-
.style('opacity', 1)
|
|
109
|
-
|
|
110
|
-
const barGroupExit = barGroups.exit()
|
|
111
|
-
.attr('class', s.barGroupExit)
|
|
112
|
-
|
|
113
|
-
smartTransition(barGroupExit, duration)
|
|
114
|
-
.style('opacity', 0)
|
|
115
|
-
.remove()
|
|
116
|
-
|
|
117
|
-
// Animate bars from exiting groups going down
|
|
118
|
-
smartTransition(barGroupExit.selectAll(`.${s.bar}`), duration)
|
|
119
|
-
.attr('transform', this.isVertical()
|
|
120
|
-
? `translate(0,${this._height / 3})`
|
|
121
|
-
: `translate(${this._width / 6},0)`
|
|
122
|
-
)
|
|
123
|
-
|
|
124
|
-
// Render Bars
|
|
125
|
-
const bars = barGroupsMerged
|
|
126
|
-
.selectAll<SVGPathElement, StackedBarDataRecord<Datum>>(`.${s.bar}`)
|
|
127
|
-
.data((d, j) => stacked.map((s) =>
|
|
128
|
-
({ ...d, _stacked: s[j], _negative: s.negative, _ending: s.ending }))
|
|
129
|
-
)
|
|
130
|
-
|
|
131
|
-
const barsEnter = bars.enter().append('path')
|
|
132
|
-
.attr('class', s.bar)
|
|
133
|
-
.attr('d', (d, j) => this._getBarPath(d, j, true))
|
|
134
|
-
.style('fill', (d, j) => getColor(d, config.color, j))
|
|
135
|
-
|
|
136
|
-
const barsMerged = barsEnter.merge(bars)
|
|
137
|
-
|
|
138
|
-
smartTransition(barsMerged, duration)
|
|
139
|
-
.attr('d', (d, j) => this._getBarPath(d, j))
|
|
140
|
-
.style('fill', (d, j) => getColor(d, config.color, j))
|
|
141
|
-
.style('cursor', (d, j) => getString(d, config.cursor, j))
|
|
142
|
-
|
|
143
|
-
smartTransition(bars.exit(), duration)
|
|
144
|
-
.style('opacity', 0)
|
|
145
|
-
.remove()
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
_getBarWidth (): number {
|
|
149
|
-
const { config, datamodel: { data } } = this
|
|
150
|
-
if (isEmpty(data)) return 0
|
|
151
|
-
if (config.barWidth) return min([config.barWidth, config.barMaxWidth])
|
|
152
|
-
|
|
153
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
154
|
-
// @ts-ignore
|
|
155
|
-
const isOrdinal = this.dataScale.bandwidth
|
|
156
|
-
const domain = (this.dataScale.domain ? this.dataScale.domain() : []) as number[]
|
|
157
|
-
const domainLength = isOrdinal ? domain.length : domain[1] - domain[0]
|
|
158
|
-
|
|
159
|
-
// If the dataStep property is provided the amount of data elements is calculates as domainLength / dataStep
|
|
160
|
-
// otherwise we get the number of data elements within the domain range
|
|
161
|
-
// Or if the scale is ordinal we use data.length
|
|
162
|
-
let dataSize = (1 + domainLength / config.dataStep) ||
|
|
163
|
-
(!isOrdinal && data.filter((d, i) => {
|
|
164
|
-
const value = getNumber(d, config.x, i)
|
|
165
|
-
return (value >= domain[0]) && (value <= domain[1])
|
|
166
|
-
}).length) ||
|
|
167
|
-
data.length
|
|
168
|
-
|
|
169
|
-
// We increase the dataSize by 1 to take into account possible additional domain space
|
|
170
|
-
if (!isOrdinal && dataSize >= 2) dataSize += 1
|
|
171
|
-
|
|
172
|
-
const c = dataSize < 2 ? 1 : 1 - config.barPadding
|
|
173
|
-
const barWidth = c * (this.isVertical() ? this._width : this._height) / dataSize
|
|
174
|
-
|
|
175
|
-
return min([barWidth, config.barMaxWidth])
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
_getVisibleData (): Datum[] {
|
|
179
|
-
const { config, datamodel: { data } } = this
|
|
180
|
-
|
|
181
|
-
const groupWidth = this._getBarWidth()
|
|
182
|
-
const halfGroupWidthPx = data.length < 2 ? 0 : groupWidth / 2
|
|
183
|
-
|
|
184
|
-
const scale = this.dataScale
|
|
185
|
-
const halfGroupWidth = Math.abs((scale.invert(halfGroupWidthPx) as number) - (scale.invert(0) as number))
|
|
186
|
-
const filtered = data?.filter((d, i) => {
|
|
187
|
-
const v = getNumber(d, config.x, i)
|
|
188
|
-
const domain: number[] | Date[] = scale.domain()
|
|
189
|
-
const domainMin = +domain[0]
|
|
190
|
-
const domainMax = +domain[1]
|
|
191
|
-
return (v >= (domainMin - halfGroupWidth)) && (v <= (domainMax + halfGroupWidth))
|
|
192
|
-
})
|
|
193
|
-
|
|
194
|
-
return filtered
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
_getBarPath (d: StackedBarDataRecord<Datum>, accessorIndex: number, isEntering = false): string {
|
|
198
|
-
const { config } = this
|
|
199
|
-
const yAccessors = this.getAccessors()
|
|
200
|
-
const barWidth = this._getBarWidth()
|
|
201
|
-
|
|
202
|
-
const isNegative = d._negative
|
|
203
|
-
const isEnding = d._ending // The most top bar or, if the value is negative, the most bottom bar
|
|
204
|
-
// Todo: Find a way to pass the datum index to `getNumber` below
|
|
205
|
-
const value = getNumber(d, yAccessors[accessorIndex])
|
|
206
|
-
|
|
207
|
-
const height = isEntering ? 0 : Math.abs(this.valueScale(d._stacked[0]) - this.valueScale(d._stacked[1]))
|
|
208
|
-
const h = !isEntering && config.barMinHeight1Px && (height < 1) && isFinite(value) && (value !== config.barMinHeightZeroValue) ? 1 : height
|
|
209
|
-
const y = isEntering
|
|
210
|
-
? this.valueScale(0)
|
|
211
|
-
: this.valueScale(isNegative ? d._stacked[0] : d._stacked[1]) - (height < 1 && config.barMinHeight1Px ? 1 : 0)
|
|
212
|
-
|
|
213
|
-
const x = -barWidth / 2
|
|
214
|
-
const width = barWidth
|
|
215
|
-
|
|
216
|
-
const cornerRadius = config.roundedCorners
|
|
217
|
-
? isNumber(config.roundedCorners) ? +config.roundedCorners : width / 2
|
|
218
|
-
: 0
|
|
219
|
-
const cornerRadiusClamped = clamp(cornerRadius, 0, Math.min(height, width) / 2)
|
|
220
|
-
const isNorthDirected = this.yScale.range()[0] > this.yScale.range()[1]
|
|
221
|
-
|
|
222
|
-
return roundedRectPath({
|
|
223
|
-
x: this.isVertical() ? x : y - h,
|
|
224
|
-
y: this.isVertical() ? y + (isNorthDirected ? 0 : -h) : x,
|
|
225
|
-
w: this.isVertical() ? width : h,
|
|
226
|
-
h: this.isVertical() ? h : width,
|
|
227
|
-
tl: isEnding && (this.isVertical()
|
|
228
|
-
? (!isNegative && isNorthDirected) || (isNegative && !isNorthDirected)
|
|
229
|
-
: isNegative
|
|
230
|
-
),
|
|
231
|
-
tr: isEnding && (this.isVertical()
|
|
232
|
-
? (!isNegative && isNorthDirected) || (isNegative && !isNorthDirected)
|
|
233
|
-
: !isNegative
|
|
234
|
-
),
|
|
235
|
-
br: isEnding && (this.isVertical()
|
|
236
|
-
? (isNegative && isNorthDirected) || (!isNegative && !isNorthDirected)
|
|
237
|
-
: !isNegative
|
|
238
|
-
),
|
|
239
|
-
bl: isEnding && (this.isVertical()
|
|
240
|
-
? (isNegative && isNorthDirected) || (!isNegative && !isNorthDirected)
|
|
241
|
-
: isNegative
|
|
242
|
-
),
|
|
243
|
-
r: cornerRadiusClamped,
|
|
244
|
-
})
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
getValueScaleExtent (scaleByVisibleData: boolean): number[] {
|
|
248
|
-
const { datamodel } = this
|
|
249
|
-
const yAccessors = this.getAccessors()
|
|
250
|
-
|
|
251
|
-
const data = scaleByVisibleData ? this._getVisibleData() : datamodel.data
|
|
252
|
-
return getStackedExtent(data, ...yAccessors)
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
getDataScaleExtent (): number[] {
|
|
256
|
-
const { config, datamodel } = this
|
|
257
|
-
return getExtent(datamodel.data, config.x)
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
getYDataExtent (scaleByVisibleData: boolean): number[] {
|
|
261
|
-
return this.isVertical() ? this.getValueScaleExtent(scaleByVisibleData) : this.getDataScaleExtent()
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
getXDataExtent (): number[] {
|
|
265
|
-
return this.isVertical() ? this.getDataScaleExtent() : this.getValueScaleExtent(false)
|
|
266
|
-
}
|
|
267
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { XYComponentConfigInterface, XYComponentConfig } from 'core/xy-component/config'
|
|
2
|
-
|
|
3
|
-
// Types
|
|
4
|
-
import { WithOptional } from 'types/misc'
|
|
5
|
-
import { NumericAccessor, StringAccessor } from 'types/accessor'
|
|
6
|
-
|
|
7
|
-
export interface TimelineConfigInterface<Datum> extends WithOptional<XYComponentConfigInterface<Datum>, 'y'> {
|
|
8
|
-
/** Width of the timeline items. Default: `8` */
|
|
9
|
-
lineWidth?: NumericAccessor<Datum>;
|
|
10
|
-
/** Display rounded ends for timeline items. Default: `true` */
|
|
11
|
-
lineCap?: boolean;
|
|
12
|
-
/** Timeline row height. Default: `22` */
|
|
13
|
-
rowHeight?: number;
|
|
14
|
-
/** Timeline item length accessor function. Default: `d => d.length` */
|
|
15
|
-
length?: NumericAccessor<Datum>;
|
|
16
|
-
/** Timeline item type accessor function. Records of one type will be plotted in one row. Default: `d => d.type` */
|
|
17
|
-
type?: StringAccessor<Datum>;
|
|
18
|
-
/** Configurable Timeline item cursor when hovering over. Default: `null` */
|
|
19
|
-
cursor?: StringAccessor<Datum>;
|
|
20
|
-
/** Show item type labels when set to `true`. Default: `false` */
|
|
21
|
-
showLabels?: boolean;
|
|
22
|
-
/** Fixed label width in pixels. Labels longer than the specified value will be trimmed. Default: `undefined` */
|
|
23
|
-
labelWidth?: number;
|
|
24
|
-
/** Maximum label width in pixels. Labels longer than the specified value will be trimmed. Default: `120` */
|
|
25
|
-
maxLabelWidth?: number;
|
|
26
|
-
/** Alternating row colors. Default: `true` */
|
|
27
|
-
alternatingRowColors?: boolean;
|
|
28
|
-
/** Scrolling callback function: `(scrollTop: number) => void`. Default: `undefined` */
|
|
29
|
-
onScroll?: (scrollTop: number) => void;
|
|
30
|
-
/** Sets the minimum line length to 1 pixel for better visibility of small values. Default: `false` */
|
|
31
|
-
showEmptySegments?: boolean;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export class TimelineConfig<Datum> extends XYComponentConfig<Datum> implements TimelineConfigInterface<Datum> {
|
|
35
|
-
lineWidth = 8
|
|
36
|
-
lineCap = false
|
|
37
|
-
rowHeight = 22
|
|
38
|
-
// eslint-disable-next-line dot-notation
|
|
39
|
-
length: NumericAccessor<Datum> = d => d['length']
|
|
40
|
-
// eslint-disable-next-line dot-notation
|
|
41
|
-
type: StringAccessor<Datum> = d => d['type']
|
|
42
|
-
cursor = null
|
|
43
|
-
labelWidth = undefined
|
|
44
|
-
showLabels = false
|
|
45
|
-
maxLabelWidth = 120
|
|
46
|
-
alternatingRowColors = true
|
|
47
|
-
onScroll = undefined
|
|
48
|
-
showEmptySegments = false
|
|
49
|
-
}
|
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
import { select, Selection } from 'd3-selection'
|
|
2
|
-
import { Transition } from 'd3-transition'
|
|
3
|
-
import { scaleOrdinal, ScaleOrdinal } from 'd3-scale'
|
|
4
|
-
import { drag, D3DragEvent } from 'd3-drag'
|
|
5
|
-
import { max } from 'd3-array'
|
|
6
|
-
|
|
7
|
-
// Core
|
|
8
|
-
import { XYComponentCore } from 'core/xy-component'
|
|
9
|
-
|
|
10
|
-
// Utils
|
|
11
|
-
import { isNumber, unique, arrayOfIndices, getMin, getMax, getString, getNumber } from 'utils/data'
|
|
12
|
-
import { smartTransition } from 'utils/d3'
|
|
13
|
-
import { getColor } from 'utils/color'
|
|
14
|
-
import { trimSVGText } from 'utils/text'
|
|
15
|
-
|
|
16
|
-
// Config
|
|
17
|
-
import { TimelineConfig, TimelineConfigInterface } from './config'
|
|
18
|
-
|
|
19
|
-
// Styles
|
|
20
|
-
import * as s from './style'
|
|
21
|
-
|
|
22
|
-
export class Timeline<Datum> extends XYComponentCore<Datum, TimelineConfig<Datum>, TimelineConfigInterface<Datum>> {
|
|
23
|
-
static selectors = s
|
|
24
|
-
config: TimelineConfig<Datum> = new TimelineConfig()
|
|
25
|
-
events = {
|
|
26
|
-
[Timeline.selectors.rows]: {
|
|
27
|
-
wheel: this._onMouseWheel.bind(this),
|
|
28
|
-
},
|
|
29
|
-
[Timeline.selectors.line]: {
|
|
30
|
-
wheel: this._onMouseWheel.bind(this),
|
|
31
|
-
},
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
private _background: Selection<SVGRectElement, unknown, SVGGElement, unknown>
|
|
35
|
-
private _rowsGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>
|
|
36
|
-
private _linesGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>
|
|
37
|
-
private _labelsGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>
|
|
38
|
-
private _scrollBarGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>
|
|
39
|
-
private _scrollBarBackground: Selection<SVGRectElement, unknown, SVGGElement, unknown>
|
|
40
|
-
private _scrollBarHandle: Selection<SVGRectElement, unknown, SVGGElement, unknown>
|
|
41
|
-
private _scrollBarWidth = 5
|
|
42
|
-
private _scrollDistance = 0
|
|
43
|
-
private _scrollBarMargin = 5
|
|
44
|
-
private _maxScroll = 0
|
|
45
|
-
private _scrollbarHeight = 0
|
|
46
|
-
private _labelMargin = 5
|
|
47
|
-
|
|
48
|
-
constructor (config?: TimelineConfigInterface<Datum>) {
|
|
49
|
-
super()
|
|
50
|
-
if (config) this.config.init(config)
|
|
51
|
-
|
|
52
|
-
// Invisible background rect to track events
|
|
53
|
-
this._background = this.g.append('rect').attr('class', s.background)
|
|
54
|
-
|
|
55
|
-
// Group for content
|
|
56
|
-
this._rowsGroup = this.g.append('g').attr('class', s.rows)
|
|
57
|
-
this._linesGroup = this.g.append('g').attr('class', s.lines)
|
|
58
|
-
this._labelsGroup = this.g.append('g').attr('class', s.labels)
|
|
59
|
-
this._scrollBarGroup = this.g.append('g').attr('class', s.scrollbar)
|
|
60
|
-
|
|
61
|
-
// Scroll bar
|
|
62
|
-
this._scrollBarBackground = this._scrollBarGroup.append('rect')
|
|
63
|
-
.attr('class', s.scrollbarBackground)
|
|
64
|
-
|
|
65
|
-
this._scrollBarHandle = this._scrollBarGroup.append('rect')
|
|
66
|
-
.attr('class', s.scrollbarHandle)
|
|
67
|
-
|
|
68
|
-
// Set up scrollbar drag event
|
|
69
|
-
const dragBehaviour = drag<SVGRectElement, unknown>()
|
|
70
|
-
.on('drag', this._onScrollbarDrag.bind(this))
|
|
71
|
-
|
|
72
|
-
this._scrollBarHandle.call(dragBehaviour)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
get bleed (): { top: number; bottom: number; left: number; right: number } {
|
|
76
|
-
const { config, datamodel: { data } } = this
|
|
77
|
-
|
|
78
|
-
// We calculate the longest label width to set the bleed values accordingly
|
|
79
|
-
let labelsBleed = 0
|
|
80
|
-
if (config.showLabels) {
|
|
81
|
-
if (config.labelWidth) labelsBleed = config.labelWidth + this._labelMargin
|
|
82
|
-
else {
|
|
83
|
-
const recordLabels = this._getRecordLabels(data)
|
|
84
|
-
const longestLabel = recordLabels.reduce((acc, val) => acc.length > val.length ? acc : val, '')
|
|
85
|
-
const label = this._labelsGroup.append('text')
|
|
86
|
-
.attr('class', s.label)
|
|
87
|
-
.text(longestLabel)
|
|
88
|
-
.call(trimSVGText, config.maxLabelWidth)
|
|
89
|
-
const labelWidth = label.node().getBBox().width
|
|
90
|
-
this._labelsGroup.empty()
|
|
91
|
-
|
|
92
|
-
const tolerance = 1.15 // Some characters are wider than others so we add a little of extra space to take that into account
|
|
93
|
-
labelsBleed = labelWidth ? tolerance * labelWidth + this._labelMargin : 0
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const maxLineWidth = this._getMaxLineWidth()
|
|
98
|
-
return {
|
|
99
|
-
top: 0,
|
|
100
|
-
bottom: 0,
|
|
101
|
-
left: maxLineWidth / 2 + labelsBleed,
|
|
102
|
-
right: maxLineWidth / 2 + this._scrollBarWidth + this._scrollBarMargin,
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
_render (customDuration?: number): void {
|
|
107
|
-
super._render(customDuration)
|
|
108
|
-
const { config, datamodel: { data } } = this
|
|
109
|
-
const duration = isNumber(customDuration) ? customDuration : config.duration
|
|
110
|
-
const xRange = this.xScale.range()
|
|
111
|
-
const yRange = this.yScale.range()
|
|
112
|
-
const yStart = Math.min(...yRange)
|
|
113
|
-
const yHeight = Math.abs(yRange[1] - yRange[0])
|
|
114
|
-
const maxLineWidth = this._getMaxLineWidth()
|
|
115
|
-
const recordLabels = this._getRecordLabels(data)
|
|
116
|
-
const recordLabelsUnique = unique(recordLabels)
|
|
117
|
-
const numUniqueRecords = recordLabelsUnique.length
|
|
118
|
-
|
|
119
|
-
// Ordinal scale to handle records on the same type
|
|
120
|
-
const ordinalScale: ScaleOrdinal<string, number> = scaleOrdinal()
|
|
121
|
-
ordinalScale.range(arrayOfIndices(numUniqueRecords))
|
|
122
|
-
|
|
123
|
-
// Invisible Background rect to track events
|
|
124
|
-
this._background
|
|
125
|
-
.attr('width', this._width)
|
|
126
|
-
.attr('height', this._height)
|
|
127
|
-
.attr('opacity', 0)
|
|
128
|
-
|
|
129
|
-
// Labels
|
|
130
|
-
const labels = this._labelsGroup.selectAll<SVGTextElement, string>(`.${s.label}`)
|
|
131
|
-
.data(config.showLabels ? recordLabelsUnique : [])
|
|
132
|
-
|
|
133
|
-
const labelsEnter = labels.enter().append('text')
|
|
134
|
-
.attr('class', s.label)
|
|
135
|
-
|
|
136
|
-
labelsEnter.merge(labels)
|
|
137
|
-
.attr('x', xRange[0] - maxLineWidth / 2 - this._labelMargin)
|
|
138
|
-
.attr('y', (label, i) => yStart + (ordinalScale(label) + 0.5) * config.rowHeight)
|
|
139
|
-
.text(label => label)
|
|
140
|
-
.each((label, i, els) => {
|
|
141
|
-
trimSVGText(select(els[i]), config.labelWidth || config.maxLabelWidth)
|
|
142
|
-
})
|
|
143
|
-
|
|
144
|
-
labels.exit().remove()
|
|
145
|
-
|
|
146
|
-
// Row background rects
|
|
147
|
-
const xStart = xRange[0]
|
|
148
|
-
const numRows = Math.max(Math.floor(yHeight / config.rowHeight), numUniqueRecords)
|
|
149
|
-
const recordTypes: (string | undefined)[] = Array(numRows).fill(null).map((_, i) => recordLabelsUnique[i])
|
|
150
|
-
const rects = this._rowsGroup.selectAll<SVGRectElement, number>(`.${s.row}`)
|
|
151
|
-
.data(recordTypes)
|
|
152
|
-
|
|
153
|
-
const rectsEnter = rects.enter().append('rect')
|
|
154
|
-
.attr('class', s.row)
|
|
155
|
-
|
|
156
|
-
rectsEnter.merge(rects)
|
|
157
|
-
.classed(s.rowOdd, config.alternatingRowColors ? (_, i) => !(i % 2) : null)
|
|
158
|
-
.attr('x', xStart - maxLineWidth / 2)
|
|
159
|
-
.attr('width', xRange[1] - xStart + maxLineWidth)
|
|
160
|
-
.attr('y', (_, i) => yStart + i * config.rowHeight)
|
|
161
|
-
.attr('height', config.rowHeight)
|
|
162
|
-
|
|
163
|
-
rects.exit().remove()
|
|
164
|
-
|
|
165
|
-
// Lines
|
|
166
|
-
const lines = this._linesGroup.selectAll<SVGRectElement, Datum>(`.${s.line}`)
|
|
167
|
-
.data(data, (d: Datum, i) => `${getString(d, config.id, i) ?? i}`)
|
|
168
|
-
const linesEnter = lines.enter().append('rect')
|
|
169
|
-
.attr('class', s.line)
|
|
170
|
-
.classed(s.rowOdd, config.alternatingRowColors
|
|
171
|
-
? (d, i) => !(recordLabelsUnique.indexOf(this._getRecordType(d, i)) % 2)
|
|
172
|
-
: null)
|
|
173
|
-
.style('fill', (d, i) => getColor(d, config.color, i))
|
|
174
|
-
.attr('transform', 'translate(0, 10)')
|
|
175
|
-
.style('opacity', 0)
|
|
176
|
-
this._positionLines(linesEnter, ordinalScale)
|
|
177
|
-
|
|
178
|
-
const linesMerged = smartTransition(linesEnter.merge(lines), duration)
|
|
179
|
-
.style('fill', (d, i) => getColor(d, config.color, ordinalScale(this._getRecordType(d, i))))
|
|
180
|
-
.attr('transform', 'translate(0, 0)')
|
|
181
|
-
.style('cursor', (d, i) => getString(d, config.cursor, i))
|
|
182
|
-
.style('opacity', 1)
|
|
183
|
-
|
|
184
|
-
this._positionLines(linesMerged, ordinalScale)
|
|
185
|
-
|
|
186
|
-
smartTransition(lines.exit(), duration)
|
|
187
|
-
.style('opacity', 0)
|
|
188
|
-
.remove()
|
|
189
|
-
|
|
190
|
-
// Scroll Bar
|
|
191
|
-
const contentBBox = this._rowsGroup.node().getBBox() // We determine content size using the rects group because lines are animated
|
|
192
|
-
const absoluteContentHeight = contentBBox.height
|
|
193
|
-
this._scrollbarHeight = yHeight * yHeight / absoluteContentHeight || 0
|
|
194
|
-
this._maxScroll = Math.max(absoluteContentHeight - yHeight, 0)
|
|
195
|
-
|
|
196
|
-
this._scrollBarGroup
|
|
197
|
-
.attr('transform', `translate(${this._width - this._scrollBarWidth}, ${yStart})`)
|
|
198
|
-
.attr('opacity', this._maxScroll ? 1 : 0)
|
|
199
|
-
|
|
200
|
-
this._scrollBarBackground
|
|
201
|
-
.attr('width', this._scrollBarWidth)
|
|
202
|
-
.attr('height', this._height)
|
|
203
|
-
.attr('rx', this._scrollBarWidth / 2)
|
|
204
|
-
.attr('ry', this._scrollBarWidth / 2)
|
|
205
|
-
|
|
206
|
-
this._scrollBarHandle
|
|
207
|
-
.attr('width', this._scrollBarWidth)
|
|
208
|
-
.attr('height', this._scrollbarHeight)
|
|
209
|
-
.attr('rx', this._scrollBarWidth / 2)
|
|
210
|
-
.attr('ry', this._scrollBarWidth / 2)
|
|
211
|
-
|
|
212
|
-
this._updateScrollPosition(0)
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
private _positionLines (
|
|
216
|
-
selection: Selection<SVGRectElement, Datum, SVGGElement, unknown> | Transition<SVGRectElement, Datum, SVGGElement, unknown>,
|
|
217
|
-
ordinalScale: ScaleOrdinal<string, number>
|
|
218
|
-
): void {
|
|
219
|
-
const { config, xScale, yScale } = this
|
|
220
|
-
const yRange = yScale.range()
|
|
221
|
-
const yStart = Math.min(...yRange)
|
|
222
|
-
|
|
223
|
-
selection.each((d, i, elements) => {
|
|
224
|
-
const x = getNumber(d, config.x, i)
|
|
225
|
-
const y = ordinalScale(this._getRecordType(d, i)) * config.rowHeight
|
|
226
|
-
const length = getNumber(d, config.length, i) ?? 0
|
|
227
|
-
|
|
228
|
-
// Rect dimensions
|
|
229
|
-
const height = getNumber(d, config.lineWidth, i)
|
|
230
|
-
const width = xScale(x + length) - xScale(x)
|
|
231
|
-
|
|
232
|
-
if (width < 0) {
|
|
233
|
-
console.warn('Unovis | Timeline: Line segments should not have negative lengths. Setting to 0.')
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
select(elements[i])
|
|
237
|
-
.attr('x', xScale(x))
|
|
238
|
-
.attr('y', yStart + y + (config.rowHeight - height) / 2)
|
|
239
|
-
.attr('width', config.showEmptySegments
|
|
240
|
-
? Math.max(config.lineCap ? height : 1, width)
|
|
241
|
-
: Math.max(0, width))
|
|
242
|
-
.attr('height', height)
|
|
243
|
-
.attr('rx', config.lineCap ? height / 2 : null)
|
|
244
|
-
.style('opacity', 1)
|
|
245
|
-
})
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
private _onScrollbarDrag (event: D3DragEvent<any, any, any>): void {
|
|
249
|
-
const yRange = this.yScale.range()
|
|
250
|
-
const yHeight = Math.abs(yRange[1] - yRange[0])
|
|
251
|
-
this._updateScrollPosition(event.dy * this._maxScroll / (yHeight - this._scrollbarHeight))
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
private _onMouseWheel (d: unknown, event: WheelEvent): void {
|
|
255
|
-
const { config } = this
|
|
256
|
-
|
|
257
|
-
this._updateScrollPosition(event?.deltaY)
|
|
258
|
-
if (this._scrollDistance > 0 && this._scrollDistance < this._maxScroll) event?.preventDefault()
|
|
259
|
-
|
|
260
|
-
config.onScroll?.(this._scrollDistance)
|
|
261
|
-
|
|
262
|
-
// Programmatically trigger a mousemove event to update Tooltip or Crosshair if they were set up
|
|
263
|
-
const e = new Event('mousemove')
|
|
264
|
-
this.element.dispatchEvent(e)
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
private _updateScrollPosition (diff: number): void {
|
|
268
|
-
const yRange = this.yScale.range()
|
|
269
|
-
const yHeight = Math.abs(yRange[1] - yRange[0])
|
|
270
|
-
|
|
271
|
-
this._scrollDistance += diff
|
|
272
|
-
this._scrollDistance = Math.max(0, this._scrollDistance)
|
|
273
|
-
this._scrollDistance = Math.min(this._maxScroll, this._scrollDistance)
|
|
274
|
-
|
|
275
|
-
this._linesGroup.attr('transform', `translate(0,${-this._scrollDistance})`)
|
|
276
|
-
this._rowsGroup.attr('transform', `translate(0,${-this._scrollDistance})`)
|
|
277
|
-
this._labelsGroup.attr('transform', `translate(0,${-this._scrollDistance})`)
|
|
278
|
-
const scrollBarPosition = (this._scrollDistance / this._maxScroll * (yHeight - this._scrollbarHeight)) || 0
|
|
279
|
-
this._scrollBarHandle.attr('y', scrollBarPosition)
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
private _getMaxLineWidth (): number {
|
|
283
|
-
const { config, datamodel: { data } } = this
|
|
284
|
-
return max(data, (d, i) => getNumber(d, config.lineWidth, i)) ?? 0
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
private _getRecordType (d: Datum, i: number): string {
|
|
288
|
-
return getString(d, this.config.type) || `__${i}`
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
private _getRecordLabels (data: Datum[]): string[] {
|
|
292
|
-
return data.map((d, i) => getString(d, this.config.type) || `${i + 1}`)
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
// Override the default XYComponent getXDataExtent method to take into account line lengths
|
|
296
|
-
getXDataExtent (): number[] {
|
|
297
|
-
const { config, datamodel } = this
|
|
298
|
-
const min = getMin(datamodel.data, config.x)
|
|
299
|
-
const max = getMax(datamodel.data, (d, i) => getNumber(d, config.x, i) + (getNumber(d, config.length, i) ?? 0))
|
|
300
|
-
return [min, max]
|
|
301
|
-
}
|
|
302
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-irregular-whitespace */
|
|
2
|
-
import { Config } from 'core/config'
|
|
3
|
-
import { ComponentCore } from 'core/component'
|
|
4
|
-
|
|
5
|
-
// Types
|
|
6
|
-
import { Position } from 'types/position'
|
|
7
|
-
|
|
8
|
-
export interface TooltipConfigInterface {
|
|
9
|
-
/** An array of visualization components to interact with. Default: `[]` */
|
|
10
|
-
components?: ComponentCore<unknown>[];
|
|
11
|
-
/** Container to where the Tooltip component should be inserted. Default: `undefined` */
|
|
12
|
-
container?: HTMLElement;
|
|
13
|
-
/** Horizontal placement of the tooltip. Default: `Position.Auto` */
|
|
14
|
-
horizontalPlacement?: Position | string | undefined;
|
|
15
|
-
/** Horizontal shift of the tooltip in pixels. Default: `0` */
|
|
16
|
-
horizontalShift?: number;
|
|
17
|
-
/** Vertical placement of the tooltip. Default: `Position.Top` */
|
|
18
|
-
verticalPlacement?: Position | string | undefined;
|
|
19
|
-
/** Vertical shift of the tooltip in pixels. Default: `0` */
|
|
20
|
-
verticalShift?: number;
|
|
21
|
-
/** Defines the content of the tooltip and hovering over which elements should trigger it.
|
|
22
|
-
* An object containing properties in the following format:
|
|
23
|
-
*
|
|
24
|
-
* ```
|
|
25
|
-
* {
|
|
26
|
-
* [selectorString]: (d: unknown) => string | HTMLElement
|
|
27
|
-
* }
|
|
28
|
-
* ```
|
|
29
|
-
* e.g.:
|
|
30
|
-
* ```
|
|
31
|
-
* {
|
|
32
|
-
* [Area.selectors.area]: (d: AreaDatum[]) => `<div>${d.value.toString()}</div>
|
|
33
|
-
* }
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
triggers?: {
|
|
37
|
-
[selector: string]: (data: any, i: number, elements: (HTMLElement | SVGElement)[]) => string | HTMLElement | undefined | null;
|
|
38
|
-
};
|
|
39
|
-
/** Custom DOM attributes for the tooltip. Useful when you need to refer to a specific tooltip instance
|
|
40
|
-
* by using a CSS selector. Attributes configuration object has the following structure:
|
|
41
|
-
*
|
|
42
|
-
* ```
|
|
43
|
-
* {
|
|
44
|
-
* [attributeName]: attribute value
|
|
45
|
-
* }
|
|
46
|
-
* ```
|
|
47
|
-
* e.g.:
|
|
48
|
-
* ```
|
|
49
|
-
* {
|
|
50
|
-
* 'type': 'area-tooltip',
|
|
51
|
-
* 'value': 42
|
|
52
|
-
* }
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
attributes?: { [attr: string]: string | number | boolean };
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export class TooltipConfig extends Config implements TooltipConfigInterface {
|
|
59
|
-
components: ComponentCore<unknown>[] = []
|
|
60
|
-
container = undefined
|
|
61
|
-
horizontalPlacement = Position.Auto
|
|
62
|
-
horizontalShift = 0
|
|
63
|
-
verticalPlacement = Position.Top
|
|
64
|
-
verticalShift = 0
|
|
65
|
-
attributes: { [attr: string]: string | number | boolean } = {}
|
|
66
|
-
triggers: {
|
|
67
|
-
[selector: string]: (data: any, i: number, elements: (HTMLElement | SVGElement)[]) => string | HTMLElement | undefined | null;
|
|
68
|
-
} = {}
|
|
69
|
-
}
|