@unovis/ts 1.1.1-beta.5 → 1.1.1-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/declaration.d.ts +1 -0
- package/index.ts +1 -0
- package/licences.txt +43 -0
- package/maps.ts +1 -0
- package/package.json +1 -1
- package/rollup.config.js +71 -0
- package/rules/ts-getter-setter.js +35 -0
- package/src/components/area/config.ts +29 -0
- package/src/components/area/index.ts +133 -0
- package/{components/area/style.js → src/components/area/style.ts} +9 -10
- package/src/components/area/types.ts +2 -0
- package/src/components/axis/config.ts +76 -0
- package/src/components/axis/index.ts +363 -0
- package/{components/axis/style.js → src/components/axis/style.ts} +27 -22
- package/src/components/axis/types.ts +4 -0
- package/src/components/brush/config.ts +51 -0
- package/src/components/brush/index.ts +233 -0
- package/{components/brush/style.js → src/components/brush/style.ts} +15 -14
- package/src/components/brush/types.ts +8 -0
- package/src/components/bullet-legend/config.ts +38 -0
- package/src/components/bullet-legend/index.ts +104 -0
- package/{components/bullet-legend/style.js → src/components/bullet-legend/style.ts} +18 -16
- package/src/components/bullet-legend/types.ts +7 -0
- package/src/components/chord-diagram/config.ts +53 -0
- package/src/components/chord-diagram/index.ts +401 -0
- package/src/components/chord-diagram/modules/label.ts +155 -0
- package/src/components/chord-diagram/modules/link.ts +91 -0
- package/src/components/chord-diagram/modules/node.ts +80 -0
- package/{components/chord-diagram/style.js → src/components/chord-diagram/style.ts} +39 -30
- package/src/components/chord-diagram/types.ts +68 -0
- package/src/components/crosshair/config.ts +48 -0
- package/src/components/crosshair/index.ts +220 -0
- package/{components/crosshair/style.js → src/components/crosshair/style.ts} +12 -12
- package/src/components/crosshair/types.ts +15 -0
- package/src/components/donut/config.ts +65 -0
- package/src/components/donut/index.ts +148 -0
- package/src/components/donut/modules/arc.ts +86 -0
- package/{components/donut/style.js → src/components/donut/style.ts} +20 -18
- package/src/components/donut/types.ts +17 -0
- package/src/components/flow-legend/config.ts +31 -0
- package/src/components/flow-legend/index.ts +103 -0
- package/{components/flow-legend/style.js → src/components/flow-legend/style.ts} +25 -21
- package/src/components/flow-legend/types.ts +10 -0
- package/src/components/free-brush/config.ts +54 -0
- package/src/components/free-brush/index.ts +207 -0
- package/{components/free-brush/style.js → src/components/free-brush/style.ts} +12 -12
- package/src/components/free-brush/types.ts +8 -0
- package/src/components/graph/config.ts +280 -0
- package/src/components/graph/index.ts +809 -0
- package/src/components/graph/modules/layout-helpers.ts +96 -0
- package/src/components/graph/modules/layout.ts +502 -0
- package/src/components/graph/modules/link/helper.ts +105 -0
- package/src/components/graph/modules/link/index.ts +302 -0
- package/{components/graph/modules/link/style.js → src/components/graph/modules/link/style.ts} +45 -34
- package/src/components/graph/modules/node/helper.ts +162 -0
- package/src/components/graph/modules/node/index.ts +343 -0
- package/{components/graph/modules/node/style.js → src/components/graph/modules/node/style.ts} +72 -52
- package/src/components/graph/modules/panel/helper.ts +160 -0
- package/src/components/graph/modules/panel/index.ts +137 -0
- package/{components/graph/modules/panel/style.js → src/components/graph/modules/panel/style.ts} +42 -32
- package/src/components/graph/modules/shape.ts +108 -0
- package/src/components/graph/modules/zoom-levels.ts +6 -0
- package/src/components/graph/style.ts +72 -0
- package/src/components/graph/types.ts +152 -0
- package/src/components/grouped-bar/config.ts +40 -0
- package/src/components/grouped-bar/index.ts +325 -0
- package/{components/grouped-bar/style.js → src/components/grouped-bar/style.ts} +15 -14
- package/src/components/leaflet-flow-map/config.ts +60 -0
- package/src/components/leaflet-flow-map/index.ts +279 -0
- package/src/components/leaflet-flow-map/renderer-utils.ts +14 -0
- package/src/components/leaflet-flow-map/renderer.ts +146 -0
- package/{components/leaflet-flow-map/shaders.js → src/components/leaflet-flow-map/shaders.ts} +4 -7
- package/src/components/leaflet-flow-map/types.ts +18 -0
- package/src/components/leaflet-map/config.ts +234 -0
- package/src/components/leaflet-map/index.ts +808 -0
- package/src/components/leaflet-map/leaflet.css +625 -0
- package/src/components/leaflet-map/modules/clusterBackground.ts +34 -0
- package/src/components/leaflet-map/modules/donut.ts +37 -0
- package/src/components/leaflet-map/modules/map.ts +178 -0
- package/src/components/leaflet-map/modules/node.ts +208 -0
- package/src/components/leaflet-map/modules/selectionRing.ts +63 -0
- package/src/components/leaflet-map/modules/utils.ts +290 -0
- package/{components → src/components}/leaflet-map/renderer/leaflet-maplibre-gl.js +76 -78
- package/src/components/leaflet-map/renderer/map-style.ts +24 -0
- package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json +35 -0
- package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json +35 -0
- package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json +2185 -0
- package/src/components/leaflet-map/renderer/mapboxgl-layer.ts +43 -0
- package/src/components/leaflet-map/renderer/mapboxgl-utils.ts +40 -0
- package/{components → src/components}/leaflet-map/renderer/maplibre-gl.css.js +2 -4
- package/src/components/leaflet-map/style.ts +217 -0
- package/src/components/leaflet-map/types.ts +75 -0
- package/src/components/line/config.ts +34 -0
- package/src/components/line/index.ts +188 -0
- package/{components/line/style.js → src/components/line/style.ts} +18 -16
- package/src/components/line/types.ts +3 -0
- package/src/components/nested-donut/config.ts +75 -0
- package/src/components/nested-donut/index.ts +176 -0
- package/src/components/nested-donut/modules/arc.ts +78 -0
- package/src/components/nested-donut/modules/label.ts +63 -0
- package/src/components/nested-donut/style.ts +82 -0
- package/src/components/nested-donut/types.ts +29 -0
- package/src/components/sankey/config.ts +195 -0
- package/src/components/sankey/index.ts +387 -0
- package/src/components/sankey/modules/label.ts +228 -0
- package/src/components/sankey/modules/link.ts +141 -0
- package/src/components/sankey/modules/node.ts +221 -0
- package/{components/sankey/style.js → src/components/sankey/style.ts} +60 -44
- package/src/components/sankey/types.ts +95 -0
- package/src/components/scatter/config.ts +49 -0
- package/src/components/scatter/index.ts +220 -0
- package/src/components/scatter/modules/point.ts +123 -0
- package/src/components/scatter/modules/utils.ts +150 -0
- package/{components/scatter/style.js → src/components/scatter/style.ts} +15 -14
- package/src/components/scatter/types.ts +21 -0
- package/src/components/stacked-bar/config.ts +42 -0
- package/src/components/stacked-bar/index.ts +267 -0
- package/{components/stacked-bar/style.js → src/components/stacked-bar/style.ts} +15 -14
- package/src/components/stacked-bar/types.ts +5 -0
- package/src/components/timeline/config.ts +49 -0
- package/src/components/timeline/index.ts +302 -0
- package/{components/timeline/style.js → src/components/timeline/style.ts} +39 -30
- package/src/components/tooltip/config.ts +69 -0
- package/src/components/tooltip/index.ts +220 -0
- package/{components → src/components}/tooltip/style.js +11 -14
- package/src/components/topojson-map/config.ts +124 -0
- package/src/components/topojson-map/index.ts +436 -0
- package/{components/topojson-map/style.js → src/components/topojson-map/style.ts} +33 -26
- package/src/components/topojson-map/types.ts +123 -0
- package/src/components/topojson-map/utils.ts +29 -0
- package/src/components/vis-controls/config.ts +16 -0
- package/src/components/vis-controls/index.ts +68 -0
- package/{components/vis-controls/style.js → src/components/vis-controls/style.ts} +34 -27
- package/src/components/vis-controls/types.ts +14 -0
- package/src/components/xy-labels/config.ts +56 -0
- package/src/components/xy-labels/index.ts +109 -0
- package/src/components/xy-labels/modules/label.ts +140 -0
- package/{components/xy-labels/style.js → src/components/xy-labels/style.ts} +15 -14
- package/src/components/xy-labels/types.ts +26 -0
- package/src/components.ts +56 -0
- package/src/containers/single-container/config.ts +15 -0
- package/src/containers/single-container/index.ts +150 -0
- package/src/containers/xy-container/config.ts +112 -0
- package/src/containers/xy-container/index.ts +407 -0
- package/src/containers.ts +6 -0
- package/src/core/component/config.ts +61 -0
- package/src/core/component/index.ts +154 -0
- package/src/core/component/types.ts +9 -0
- package/src/core/config/index.ts +12 -0
- package/src/core/container/config.ts +56 -0
- package/src/core/container/index.ts +136 -0
- package/src/core/xy-component/config.ts +46 -0
- package/src/core/xy-component/index.ts +90 -0
- package/src/data-models/core.ts +15 -0
- package/src/data-models/graph.ts +138 -0
- package/src/data-models/map-graph.ts +72 -0
- package/src/data-models/map.ts +18 -0
- package/src/data-models/series.ts +16 -0
- package/src/index.ts +7 -0
- package/src/maps/china-provinces.json +1 -0
- package/src/maps/fr-regions.json +1 -0
- package/src/maps/germany-regions.json +1 -0
- package/src/maps/ind-regions.json +1 -0
- package/src/maps/uk-regions.json +1 -0
- package/src/maps/us-counties.json +1 -0
- package/src/maps/us-states.json +1 -0
- package/src/maps/world-110m-alpha.json +1 -0
- package/src/maps/world-simple.json +1 -0
- package/src/maps/world-simplest.json +1 -0
- package/src/maps.ts +34 -0
- package/src/styles/colors.ts +28 -0
- package/src/styles/index.ts +38 -0
- package/{styles/sizes.js → src/styles/sizes.ts} +6 -8
- package/src/types/accessor.ts +5 -0
- package/src/types/component.ts +15 -0
- package/src/types/curve.ts +62 -0
- package/src/types/data.ts +5 -0
- package/src/types/direction.ts +6 -0
- package/src/types/graph.ts +40 -0
- package/src/types/map.ts +5 -0
- package/src/types/misc.ts +10 -0
- package/src/types/position.ts +23 -0
- package/src/types/scale.ts +47 -0
- package/src/types/shape.ts +7 -0
- package/src/types/spacing.ts +6 -0
- package/src/types/svg.ts +32 -0
- package/src/types/symbol.ts +21 -0
- package/src/types/text.ts +71 -0
- package/src/types.ts +31 -0
- package/src/utils/color.ts +41 -0
- package/src/utils/d3.ts +15 -0
- package/src/utils/data.ts +328 -0
- package/src/utils/html.ts +13 -0
- package/src/utils/map.ts +29 -0
- package/src/utils/misc.ts +54 -0
- package/src/utils/path.ts +196 -0
- package/src/utils/scale.ts +1 -0
- package/src/utils/style.ts +37 -0
- package/src/utils/svg.ts +49 -0
- package/src/utils/text.ts +529 -0
- package/src/utils/type.ts +9 -0
- package/tsconfig.json +29 -0
- package/components/area/config.d.ts +0 -25
- package/components/area/config.js +0 -16
- package/components/area/config.js.map +0 -1
- package/components/area/index.d.ts +0 -19
- package/components/area/index.js +0 -102
- package/components/area/index.js.map +0 -1
- package/components/area/style.d.ts +0 -3
- package/components/area/style.js.map +0 -1
- package/components/area/types.d.ts +0 -6
- package/components/axis/config.d.ts +0 -71
- package/components/axis/config.js +0 -32
- package/components/axis/config.js.map +0 -1
- package/components/axis/index.d.ts +0 -44
- package/components/axis/index.js +0 -305
- package/components/axis/index.js.map +0 -1
- package/components/axis/style.d.ts +0 -9
- package/components/axis/style.js.map +0 -1
- package/components/axis/types.d.ts +0 -4
- package/components/axis/types.js +0 -8
- package/components/axis/types.js.map +0 -1
- package/components/brush/config.d.ts +0 -42
- package/components/brush/config.js +0 -24
- package/components/brush/config.js.map +0 -1
- package/components/brush/index.d.ts +0 -28
- package/components/brush/index.js +0 -199
- package/components/brush/index.js.map +0 -1
- package/components/brush/style.d.ts +0 -5
- package/components/brush/style.js.map +0 -1
- package/components/brush/types.d.ts +0 -7
- package/components/brush/types.js +0 -8
- package/components/brush/types.js.map +0 -1
- package/components/bullet-legend/config.d.ts +0 -34
- package/components/bullet-legend/config.js +0 -16
- package/components/bullet-legend/config.js.map +0 -1
- package/components/bullet-legend/index.d.ts +0 -19
- package/components/bullet-legend/index.js +0 -79
- package/components/bullet-legend/index.js.map +0 -1
- package/components/bullet-legend/style.d.ts +0 -6
- package/components/bullet-legend/style.js.map +0 -1
- package/components/bullet-legend/types.d.ts +0 -7
- package/components/bullet-legend/types.js +0 -2
- package/components/bullet-legend/types.js.map +0 -1
- package/components/chord-diagram/config.d.ts +0 -44
- package/components/chord-diagram/config.js +0 -25
- package/components/chord-diagram/config.js.map +0 -1
- package/components/chord-diagram/index.d.ts +0 -42
- package/components/chord-diagram/index.js +0 -305
- package/components/chord-diagram/index.js.map +0 -1
- package/components/chord-diagram/modules/label.d.ts +0 -8
- package/components/chord-diagram/modules/label.js +0 -115
- package/components/chord-diagram/modules/label.js.map +0 -1
- package/components/chord-diagram/modules/link.d.ts +0 -21
- package/components/chord-diagram/modules/link.js +0 -63
- package/components/chord-diagram/modules/link.js.map +0 -1
- package/components/chord-diagram/modules/node.d.ts +0 -17
- package/components/chord-diagram/modules/node.js +0 -52
- package/components/chord-diagram/modules/node.js.map +0 -1
- package/components/chord-diagram/style.d.ts +0 -13
- package/components/chord-diagram/style.js.map +0 -1
- package/components/chord-diagram/types.d.ts +0 -58
- package/components/chord-diagram/types.js +0 -8
- package/components/chord-diagram/types.js.map +0 -1
- package/components/crosshair/config.d.ts +0 -43
- package/components/crosshair/config.js +0 -19
- package/components/crosshair/config.js.map +0 -1
- package/components/crosshair/index.d.ts +0 -35
- package/components/crosshair/index.js +0 -183
- package/components/crosshair/index.js.map +0 -1
- package/components/crosshair/style.d.ts +0 -4
- package/components/crosshair/style.js.map +0 -1
- package/components/crosshair/types.d.ts +0 -13
- package/components/crosshair/types.js +0 -2
- package/components/crosshair/types.js.map +0 -1
- package/components/donut/config.d.ts +0 -59
- package/components/donut/config.js +0 -28
- package/components/donut/config.js.map +0 -1
- package/components/donut/index.d.ts +0 -21
- package/components/donut/index.js +0 -107
- package/components/donut/index.js.map +0 -1
- package/components/donut/modules/arc.d.ts +0 -10
- package/components/donut/modules/arc.js +0 -59
- package/components/donut/modules/arc.js.map +0 -1
- package/components/donut/style.d.ts +0 -7
- package/components/donut/style.js.map +0 -1
- package/components/donut/types.d.ts +0 -20
- package/components/flow-legend/config.d.ts +0 -29
- package/components/flow-legend/config.js +0 -18
- package/components/flow-legend/config.js.map +0 -1
- package/components/flow-legend/index.d.ts +0 -16
- package/components/flow-legend/index.js +0 -75
- package/components/flow-legend/index.js.map +0 -1
- package/components/flow-legend/style.d.ts +0 -8
- package/components/flow-legend/style.js.map +0 -1
- package/components/flow-legend/types.d.ts +0 -9
- package/components/flow-legend/types.js +0 -8
- package/components/flow-legend/types.js.map +0 -1
- package/components/free-brush/config.d.ts +0 -45
- package/components/free-brush/config.js +0 -24
- package/components/free-brush/config.js.map +0 -1
- package/components/free-brush/index.d.ts +0 -20
- package/components/free-brush/index.js +0 -192
- package/components/free-brush/index.js.map +0 -1
- package/components/free-brush/style.d.ts +0 -4
- package/components/free-brush/style.js.map +0 -1
- package/components/free-brush/types.d.ts +0 -7
- package/components/free-brush/types.js +0 -9
- package/components/free-brush/types.js.map +0 -1
- package/components/graph/config.d.ts +0 -238
- package/components/graph/config.js +0 -84
- package/components/graph/config.js.map +0 -1
- package/components/graph/index.d.ts +0 -126
- package/components/graph/index.js +0 -656
- package/components/graph/index.js.map +0 -1
- package/components/graph/modules/layout-helpers.d.ts +0 -21
- package/components/graph/modules/layout-helpers.js +0 -69
- package/components/graph/modules/layout-helpers.js.map +0 -1
- package/components/graph/modules/layout.d.ts +0 -10
- package/components/graph/modules/layout.js +0 -399
- package/components/graph/modules/layout.js.map +0 -1
- package/components/graph/modules/link/helper.d.ts +0 -25
- package/components/graph/modules/link/helper.js +0 -74
- package/components/graph/modules/link/helper.js.map +0 -1
- package/components/graph/modules/link/index.d.ts +0 -11
- package/components/graph/modules/link/index.js +0 -212
- package/components/graph/modules/link/index.js.map +0 -1
- package/components/graph/modules/link/style.d.ts +0 -15
- package/components/graph/modules/link/style.js.map +0 -1
- package/components/graph/modules/node/helper.d.ts +0 -21
- package/components/graph/modules/node/helper.js +0 -126
- package/components/graph/modules/node/helper.js.map +0 -1
- package/components/graph/modules/node/index.d.ts +0 -11
- package/components/graph/modules/node/index.js +0 -252
- package/components/graph/modules/node/index.js.map +0 -1
- package/components/graph/modules/node/style.d.ts +0 -24
- package/components/graph/modules/node/style.js.map +0 -1
- package/components/graph/modules/panel/helper.d.ts +0 -18
- package/components/graph/modules/panel/helper.js +0 -111
- package/components/graph/modules/panel/helper.js.map +0 -1
- package/components/graph/modules/panel/index.d.ts +0 -7
- package/components/graph/modules/panel/index.js +0 -98
- package/components/graph/modules/panel/index.js.map +0 -1
- package/components/graph/modules/panel/style.d.ts +0 -14
- package/components/graph/modules/panel/style.js.map +0 -1
- package/components/graph/modules/shape.d.ts +0 -6
- package/components/graph/modules/shape.js +0 -80
- package/components/graph/modules/shape.js.map +0 -1
- package/components/graph/modules/zoom-levels.d.ts +0 -6
- package/components/graph/modules/zoom-levels.js +0 -10
- package/components/graph/modules/zoom-levels.js.map +0 -1
- package/components/graph/style.d.ts +0 -6
- package/components/graph/style.js +0 -66
- package/components/graph/style.js.map +0 -1
- package/components/graph/types.d.ts +0 -125
- package/components/graph/types.js +0 -30
- package/components/graph/types.js.map +0 -1
- package/components/grouped-bar/config.d.ts +0 -36
- package/components/grouped-bar/config.js +0 -20
- package/components/grouped-bar/config.js.map +0 -1
- package/components/grouped-bar/index.d.ts +0 -32
- package/components/grouped-bar/index.js +0 -249
- package/components/grouped-bar/index.js.map +0 -1
- package/components/grouped-bar/style.d.ts +0 -5
- package/components/grouped-bar/style.js.map +0 -1
- package/components/leaflet-flow-map/config.d.ts +0 -46
- package/components/leaflet-flow-map/config.js +0 -25
- package/components/leaflet-flow-map/config.js.map +0 -1
- package/components/leaflet-flow-map/index.d.ts +0 -52
- package/components/leaflet-flow-map/index.js +0 -220
- package/components/leaflet-flow-map/index.js.map +0 -1
- package/components/leaflet-flow-map/renderer-utils.d.ts +0 -5
- package/components/leaflet-flow-map/renderer-utils.js +0 -15
- package/components/leaflet-flow-map/renderer-utils.js.map +0 -1
- package/components/leaflet-flow-map/renderer.d.ts +0 -26
- package/components/leaflet-flow-map/renderer.js +0 -117
- package/components/leaflet-flow-map/renderer.js.map +0 -1
- package/components/leaflet-flow-map/shaders.d.ts +0 -2
- package/components/leaflet-flow-map/shaders.js.map +0 -1
- package/components/leaflet-flow-map/types.d.ts +0 -23
- package/components/leaflet-map/config.d.ts +0 -193
- package/components/leaflet-map/config.js +0 -71
- package/components/leaflet-map/config.js.map +0 -1
- package/components/leaflet-map/index.d.ts +0 -130
- package/components/leaflet-map/index.js +0 -690
- package/components/leaflet-map/index.js.map +0 -1
- package/components/leaflet-map/leaflet.css.js +0 -5
- package/components/leaflet-map/leaflet.css.js.map +0 -1
- package/components/leaflet-map/modules/clusterBackground.d.ts +0 -5
- package/components/leaflet-map/modules/clusterBackground.js +0 -27
- package/components/leaflet-map/modules/clusterBackground.js.map +0 -1
- package/components/leaflet-map/modules/donut.d.ts +0 -3
- package/components/leaflet-map/modules/donut.js +0 -25
- package/components/leaflet-map/modules/donut.js.map +0 -1
- package/components/leaflet-map/modules/map.d.ts +0 -14
- package/components/leaflet-map/modules/map.js +0 -154
- package/components/leaflet-map/modules/map.js.map +0 -1
- package/components/leaflet-map/modules/node.d.ts +0 -9
- package/components/leaflet-map/modules/node.js +0 -162
- package/components/leaflet-map/modules/node.js.map +0 -1
- package/components/leaflet-map/modules/selectionRing.d.ts +0 -7
- package/components/leaflet-map/modules/selectionRing.js +0 -41
- package/components/leaflet-map/modules/selectionRing.js.map +0 -1
- package/components/leaflet-map/modules/utils.d.ts +0 -50
- package/components/leaflet-map/modules/utils.js +0 -210
- package/components/leaflet-map/modules/utils.js.map +0 -1
- package/components/leaflet-map/renderer/leaflet-maplibre-gl.js.map +0 -1
- package/components/leaflet-map/renderer/map-style.d.ts +0 -4
- package/components/leaflet-map/renderer/map-style.js +0 -15
- package/components/leaflet-map/renderer/map-style.js.map +0 -1
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json.js +0 -40
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json.js.map +0 -1
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json.js +0 -40
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json.js.map +0 -1
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json.js +0 -4981
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json.js.map +0 -1
- package/components/leaflet-map/renderer/mapboxgl-layer.d.ts +0 -8
- package/components/leaflet-map/renderer/mapboxgl-layer.js +0 -27
- package/components/leaflet-map/renderer/mapboxgl-layer.js.map +0 -1
- package/components/leaflet-map/renderer/mapboxgl-utils.d.ts +0 -4
- package/components/leaflet-map/renderer/mapboxgl-utils.js +0 -39
- package/components/leaflet-map/renderer/mapboxgl-utils.js.map +0 -1
- package/components/leaflet-map/renderer/maplibre-gl.css.js.map +0 -1
- package/components/leaflet-map/style.d.ts +0 -52
- package/components/leaflet-map/style.js +0 -183
- package/components/leaflet-map/style.js.map +0 -1
- package/components/leaflet-map/types.d.ts +0 -75
- package/components/leaflet-map/types.js +0 -15
- package/components/leaflet-map/types.js.map +0 -1
- package/components/line/config.d.ts +0 -30
- package/components/line/config.js +0 -17
- package/components/line/config.js.map +0 -1
- package/components/line/index.d.ts +0 -27
- package/components/line/index.js +0 -152
- package/components/line/index.js.map +0 -1
- package/components/line/style.d.ts +0 -6
- package/components/line/style.js.map +0 -1
- package/components/line/types.d.ts +0 -12
- package/components/nested-donut/config.d.ts +0 -59
- package/components/nested-donut/config.js +0 -19
- package/components/nested-donut/config.js.map +0 -1
- package/components/nested-donut/index.d.ts +0 -38
- package/components/nested-donut/index.js +0 -133
- package/components/nested-donut/index.js.map +0 -1
- package/components/nested-donut/modules/arc.d.ts +0 -17
- package/components/nested-donut/modules/arc.js +0 -50
- package/components/nested-donut/modules/arc.js.map +0 -1
- package/components/nested-donut/modules/label.d.ts +0 -7
- package/components/nested-donut/modules/label.js +0 -34
- package/components/nested-donut/modules/label.js.map +0 -1
- package/components/nested-donut/style.d.ts +0 -26
- package/components/nested-donut/style.js +0 -70
- package/components/nested-donut/style.js.map +0 -1
- package/components/nested-donut/types.d.ts +0 -24
- package/components/nested-donut/types.js +0 -11
- package/components/nested-donut/types.js.map +0 -1
- package/components/sankey/config.d.ts +0 -162
- package/components/sankey/config.js +0 -65
- package/components/sankey/config.js.map +0 -1
- package/components/sankey/index.d.ts +0 -59
- package/components/sankey/index.js +0 -306
- package/components/sankey/index.js.map +0 -1
- package/components/sankey/modules/label.d.ts +0 -23
- package/components/sankey/modules/label.js +0 -168
- package/components/sankey/modules/label.js.map +0 -1
- package/components/sankey/modules/link.d.ts +0 -14
- package/components/sankey/modules/link.js +0 -108
- package/components/sankey/modules/link.js.map +0 -1
- package/components/sankey/modules/node.d.ts +0 -10
- package/components/sankey/modules/node.js +0 -156
- package/components/sankey/modules/node.js.map +0 -1
- package/components/sankey/style.d.ts +0 -20
- package/components/sankey/style.js.map +0 -1
- package/components/sankey/types.d.ts +0 -84
- package/components/sankey/types.js +0 -34
- package/components/sankey/types.js.map +0 -1
- package/components/scatter/config.d.ts +0 -44
- package/components/scatter/config.js +0 -23
- package/components/scatter/config.js.map +0 -1
- package/components/scatter/index.d.ts +0 -28
- package/components/scatter/index.js +0 -167
- package/components/scatter/index.js.map +0 -1
- package/components/scatter/modules/point.d.ts +0 -7
- package/components/scatter/modules/point.js +0 -86
- package/components/scatter/modules/point.js.map +0 -1
- package/components/scatter/modules/utils.d.ts +0 -11
- package/components/scatter/modules/utils.js +0 -112
- package/components/scatter/modules/utils.js.map +0 -1
- package/components/scatter/style.d.ts +0 -5
- package/components/scatter/style.js.map +0 -1
- package/components/scatter/types.d.ts +0 -19
- package/components/stacked-bar/config.d.ts +0 -38
- package/components/stacked-bar/config.js +0 -20
- package/components/stacked-bar/config.js.map +0 -1
- package/components/stacked-bar/index.d.ts +0 -28
- package/components/stacked-bar/index.js +0 -208
- package/components/stacked-bar/index.js.map +0 -1
- package/components/stacked-bar/style.d.ts +0 -5
- package/components/stacked-bar/style.js.map +0 -1
- package/components/stacked-bar/types.d.ts +0 -5
- package/components/timeline/config.d.ts +0 -43
- package/components/timeline/config.js +0 -24
- package/components/timeline/config.js.map +0 -1
- package/components/timeline/index.d.ts +0 -41
- package/components/timeline/index.js +0 -244
- package/components/timeline/index.js.map +0 -1
- package/components/timeline/style.d.ts +0 -13
- package/components/timeline/style.js.map +0 -1
- package/components/tooltip/config.d.ts +0 -68
- package/components/tooltip/config.js +0 -20
- package/components/tooltip/config.js.map +0 -1
- package/components/tooltip/index.d.ts +0 -36
- package/components/tooltip/index.js +0 -184
- package/components/tooltip/index.js.map +0 -1
- package/components/tooltip/style.js.map +0 -1
- package/components/topojson-map/config.d.ts +0 -99
- package/components/topojson-map/config.js +0 -42
- package/components/topojson-map/config.js.map +0 -1
- package/components/topojson-map/index.d.ts +0 -52
- package/components/topojson-map/index.js +0 -355
- package/components/topojson-map/index.js.map +0 -1
- package/components/topojson-map/style.d.ts +0 -11
- package/components/topojson-map/style.js.map +0 -1
- package/components/topojson-map/types.d.ts +0 -78
- package/components/topojson-map/types.js +0 -80
- package/components/topojson-map/types.js.map +0 -1
- package/components/topojson-map/utils.d.ts +0 -3
- package/components/topojson-map/utils.js +0 -30
- package/components/topojson-map/utils.js.map +0 -1
- package/components/vis-controls/config.d.ts +0 -12
- package/components/vis-controls/config.js +0 -13
- package/components/vis-controls/config.js.map +0 -1
- package/components/vis-controls/index.d.ts +0 -14
- package/components/vis-controls/index.js +0 -52
- package/components/vis-controls/index.js.map +0 -1
- package/components/vis-controls/style.d.ts +0 -11
- package/components/vis-controls/style.js.map +0 -1
- package/components/vis-controls/types.d.ts +0 -13
- package/components/vis-controls/types.js +0 -8
- package/components/vis-controls/types.js.map +0 -1
- package/components/xy-labels/config.d.ts +0 -48
- package/components/xy-labels/config.js +0 -25
- package/components/xy-labels/config.js.map +0 -1
- package/components/xy-labels/index.d.ts +0 -15
- package/components/xy-labels/index.js +0 -87
- package/components/xy-labels/index.js.map +0 -1
- package/components/xy-labels/modules/label.d.ts +0 -9
- package/components/xy-labels/modules/label.js +0 -107
- package/components/xy-labels/modules/label.js.map +0 -1
- package/components/xy-labels/style.d.ts +0 -5
- package/components/xy-labels/style.js.map +0 -1
- package/components/xy-labels/types.d.ts +0 -23
- package/components/xy-labels/types.js +0 -9
- package/components/xy-labels/types.js.map +0 -1
- package/components.d.ts +0 -51
- package/components.js +0 -29
- package/components.js.map +0 -1
- package/containers/single-container/config.d.ts +0 -12
- package/containers/single-container/config.js +0 -12
- package/containers/single-container/config.js.map +0 -1
- package/containers/single-container/index.d.ts +0 -19
- package/containers/single-container/index.js +0 -128
- package/containers/single-container/index.js.map +0 -1
- package/containers/xy-container/config.d.ts +0 -99
- package/containers/xy-container/config.js +0 -30
- package/containers/xy-container/config.js.map +0 -1
- package/containers/xy-container/index.d.ts +0 -34
- package/containers/xy-container/index.js +0 -330
- package/containers/xy-container/index.js.map +0 -1
- package/containers.d.ts +0 -6
- package/containers.js +0 -4
- package/containers.js.map +0 -1
- package/core/component/config.d.ts +0 -58
- package/core/component/config.js +0 -14
- package/core/component/config.js.map +0 -1
- package/core/component/index.d.ts +0 -43
- package/core/component/index.js +0 -118
- package/core/component/index.js.map +0 -1
- package/core/component/types.d.ts +0 -2
- package/core/component/types.js +0 -2
- package/core/component/types.js.map +0 -1
- package/core/config/index.d.ts +0 -3
- package/core/config/index.js +0 -16
- package/core/config/index.js.map +0 -1
- package/core/container/config.d.ts +0 -48
- package/core/container/config.js +0 -29
- package/core/container/config.js.map +0 -1
- package/core/container/index.d.ts +0 -26
- package/core/container/index.js +0 -105
- package/core/container/index.js.map +0 -1
- package/core/xy-component/config.d.ts +0 -38
- package/core/xy-component/config.js +0 -20
- package/core/xy-component/config.js.map +0 -1
- package/core/xy-component/index.d.ts +0 -27
- package/core/xy-component/index.js +0 -74
- package/core/xy-component/index.js.map +0 -1
- package/data-models/core.d.ts +0 -6
- package/data-models/core.js +0 -14
- package/data-models/core.js.map +0 -1
- package/data-models/graph.d.ts +0 -24
- package/data-models/graph.js +0 -107
- package/data-models/graph.js.map +0 -1
- package/data-models/map-graph.d.ts +0 -21
- package/data-models/map-graph.js +0 -62
- package/data-models/map-graph.js.map +0 -1
- package/data-models/map.d.ts +0 -5
- package/data-models/map.js +0 -12
- package/data-models/map.js.map +0 -1
- package/data-models/series.d.ts +0 -6
- package/data-models/series.js +0 -19
- package/data-models/series.js.map +0 -1
- package/index.d.ts +0 -7
- package/index.js +0 -55
- package/index.js.map +0 -1
- package/maps/china-provinces.json.js +0 -140373
- package/maps/fr-regions.json.js +0 -14162
- package/maps/germany-regions.json.js +0 -35760
- package/maps/ind-regions.json.js +0 -290584
- package/maps/uk-regions.json.js +0 -96233
- package/maps/us-counties.json.js +0 -206318
- package/maps/us-states.json.js +0 -16345
- package/maps/world-110m-alpha.json.js +0 -251366
- package/maps/world-simple.json.js +0 -89428
- package/maps/world-simplest.json.js +0 -28175
- package/maps.d.ts +0 -60
- package/maps.js +0 -23
- package/styles/colors.d.ts +0 -7
- package/styles/colors.js +0 -24
- package/styles/colors.js.map +0 -1
- package/styles/index.d.ts +0 -7
- package/styles/index.js +0 -38
- package/styles/index.js.map +0 -1
- package/styles/sizes.d.ts +0 -2
- package/styles/sizes.js.map +0 -1
- package/types/accessor.d.ts +0 -5
- package/types/accessor.js +0 -2
- package/types/accessor.js.map +0 -1
- package/types/component.d.ts +0 -13
- package/types/component.js +0 -14
- package/types/component.js.map +0 -1
- package/types/curve.d.ts +0 -40
- package/types/curve.js +0 -46
- package/types/curve.js.map +0 -1
- package/types/data.d.ts +0 -7
- package/types/data.js +0 -2
- package/types/data.js.map +0 -1
- package/types/direction.d.ts +0 -6
- package/types/direction.js +0 -10
- package/types/direction.js.map +0 -1
- package/types/graph.d.ts +0 -35
- package/types/graph.js +0 -2
- package/types/graph.js.map +0 -1
- package/types/map.d.ts +0 -4
- package/types/map.js +0 -2
- package/types/map.js.map +0 -1
- package/types/misc.d.ts +0 -8
- package/types/position.d.ts +0 -20
- package/types/position.js +0 -27
- package/types/position.js.map +0 -1
- package/types/scale.d.ts +0 -23
- package/types/scale.js +0 -27
- package/types/scale.js.map +0 -1
- package/types/shape.d.ts +0 -7
- package/types/shape.js +0 -11
- package/types/shape.js.map +0 -1
- package/types/spacing.d.ts +0 -6
- package/types/spacing.js +0 -2
- package/types/spacing.js.map +0 -1
- package/types/svg.d.ts +0 -18
- package/types/svg.js +0 -22
- package/types/svg.js.map +0 -1
- package/types/symbol.d.ts +0 -18
- package/types/symbol.js +0 -24
- package/types/symbol.js.map +0 -1
- package/types/text.d.ts +0 -46
- package/types/text.js +0 -26
- package/types/text.js.map +0 -1
- package/types.d.ts +0 -27
- package/types.js +0 -30
- package/types.js.map +0 -1
- package/utils/color.d.ts +0 -10
- package/utils/color.js +0 -32
- package/utils/color.js.map +0 -1
- package/utils/d3.d.ts +0 -3
- package/utils/d3.js +0 -16
- package/utils/d3.js.map +0 -1
- package/utils/data.d.ts +0 -45
- package/utils/data.js +0 -274
- package/utils/data.js.map +0 -1
- package/utils/html.d.ts +0 -1
- package/utils/html.js +0 -16
- package/utils/html.js.map +0 -1
- package/utils/map.d.ts +0 -2
- package/utils/map.js +0 -20
- package/utils/map.js.map +0 -1
- package/utils/misc.d.ts +0 -9
- package/utils/misc.js +0 -47
- package/utils/misc.js.map +0 -1
- package/utils/path.d.ts +0 -23
- package/utils/path.js +0 -144
- package/utils/path.js.map +0 -1
- package/utils/scale.d.ts +0 -1
- package/utils/style.d.ts +0 -6
- package/utils/style.js +0 -24
- package/utils/style.js.map +0 -1
- package/utils/svg.d.ts +0 -3
- package/utils/text.d.ts +0 -139
- package/utils/text.js +0 -417
- package/utils/text.js.map +0 -1
- package/utils/type.d.ts +0 -5
package/components/area/index.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { select } from 'd3-selection';
|
|
2
|
-
import { area } from 'd3-shape';
|
|
3
|
-
import { interpolatePath } from 'd3-interpolate-path';
|
|
4
|
-
import { XYComponentCore } from '../../core/xy-component/index.js';
|
|
5
|
-
import { isNumber, isArray, getNumber, getStackedData, getString, filterDataByRange, getStackedExtent } from '../../utils/data.js';
|
|
6
|
-
import { smartTransition } from '../../utils/d3.js';
|
|
7
|
-
import { getColor } from '../../utils/color.js';
|
|
8
|
-
import { Curve } from '../../types/curve.js';
|
|
9
|
-
import { AreaConfig } from './config.js';
|
|
10
|
-
import * as style from './style.js';
|
|
11
|
-
import { area as area$1 } from './style.js';
|
|
12
|
-
|
|
13
|
-
class Area extends XYComponentCore {
|
|
14
|
-
constructor(config) {
|
|
15
|
-
super();
|
|
16
|
-
this.stacked = true;
|
|
17
|
-
this.config = new AreaConfig();
|
|
18
|
-
this.events = {
|
|
19
|
-
[Area.selectors.area]: {},
|
|
20
|
-
};
|
|
21
|
-
if (config)
|
|
22
|
-
this.config.init(config);
|
|
23
|
-
}
|
|
24
|
-
_render(customDuration) {
|
|
25
|
-
super._render(customDuration);
|
|
26
|
-
const { config, datamodel: { data } } = this;
|
|
27
|
-
const duration = isNumber(customDuration) ? customDuration : config.duration;
|
|
28
|
-
const curveGen = Curve[config.curveType];
|
|
29
|
-
this.areaGen = area()
|
|
30
|
-
.x(d => d.x)
|
|
31
|
-
.y0(d => d.y0)
|
|
32
|
-
.y1(d => {
|
|
33
|
-
const isSmallerThanPixel = Math.abs(d.y1 - d.y0) < 1;
|
|
34
|
-
return d.y1 - ((isSmallerThanPixel && config.minHeight1Px) ? 1 : 0);
|
|
35
|
-
})
|
|
36
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
37
|
-
// @ts-ignore
|
|
38
|
-
.curve(curveGen);
|
|
39
|
-
const yAccessors = (isArray(config.y) ? config.y : [config.y]);
|
|
40
|
-
const areaDataX = data.map((d, i) => this.xScale(getNumber(d, config.x, i)));
|
|
41
|
-
const stacked = getStackedData(data, config.baseline, yAccessors, this._prevNegative);
|
|
42
|
-
this._prevNegative = stacked.map(s => !!s.negative);
|
|
43
|
-
const stackedData = stacked.map(arr => arr.map((d, j) => ({
|
|
44
|
-
y0: this.yScale(d[0]),
|
|
45
|
-
y1: this.yScale(d[1]),
|
|
46
|
-
x: areaDataX[j],
|
|
47
|
-
})));
|
|
48
|
-
// We reverse the data in order to have the first areas to be displayed on top
|
|
49
|
-
// for better visibility when they're close to zero
|
|
50
|
-
const areaMaxIdx = stackedData.length - 1;
|
|
51
|
-
const stackedDataReversed = stackedData.reverse();
|
|
52
|
-
const areas = this.g
|
|
53
|
-
.selectAll(`.${area$1}`)
|
|
54
|
-
.data(stackedDataReversed);
|
|
55
|
-
const areasEnter = areas.enter().append('path')
|
|
56
|
-
.attr('class', area$1)
|
|
57
|
-
.attr('d', d => this.areaGen(d) || this._emptyPath())
|
|
58
|
-
.style('opacity', 0)
|
|
59
|
-
.style('fill', (d, i) => getColor(data, config.color, areaMaxIdx - i));
|
|
60
|
-
const areasMerged = smartTransition(areasEnter.merge(areas), duration)
|
|
61
|
-
.style('opacity', (d, i) => {
|
|
62
|
-
const isDefined = d.some(p => (p.y0 - p.y1) !== 0);
|
|
63
|
-
return isDefined ? getNumber(d, config.opacity, areaMaxIdx - i) : 0;
|
|
64
|
-
})
|
|
65
|
-
.style('fill', (d, i) => getColor(data, config.color, areaMaxIdx - i))
|
|
66
|
-
.style('cursor', (d, i) => getString(data, config.cursor, areaMaxIdx - i));
|
|
67
|
-
if (duration) {
|
|
68
|
-
const transition = areasMerged;
|
|
69
|
-
transition.attrTween('d', (d, i, el) => {
|
|
70
|
-
const previous = select(el[i]).attr('d');
|
|
71
|
-
const next = this.areaGen(d) || this._emptyPath();
|
|
72
|
-
return interpolatePath(previous, next);
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
areasMerged.attr('d', d => this.areaGen(d) || this._emptyPath());
|
|
77
|
-
}
|
|
78
|
-
smartTransition(areas.exit(), duration)
|
|
79
|
-
.style('opacity', 0)
|
|
80
|
-
.remove();
|
|
81
|
-
}
|
|
82
|
-
getYDataExtent(scaleByVisibleData) {
|
|
83
|
-
const { config, datamodel } = this;
|
|
84
|
-
const yAccessors = (isArray(config.y) ? config.y : [config.y]);
|
|
85
|
-
const data = scaleByVisibleData ? filterDataByRange(datamodel.data, this.xScale.domain(), config.x) : datamodel.data;
|
|
86
|
-
return getStackedExtent(data, config.baseline, ...yAccessors);
|
|
87
|
-
}
|
|
88
|
-
_emptyPath() {
|
|
89
|
-
const xRange = this.xScale.range();
|
|
90
|
-
const yDomain = this.yScale.domain();
|
|
91
|
-
const y0 = this.yScale((yDomain[0] + yDomain[1]) / 2);
|
|
92
|
-
const y1 = y0;
|
|
93
|
-
return this.areaGen([
|
|
94
|
-
{ y0, y1, x: xRange[0] },
|
|
95
|
-
{ y0, y1, x: xRange[1] },
|
|
96
|
-
]);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
Area.selectors = style;
|
|
100
|
-
|
|
101
|
-
export { Area };
|
|
102
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/area/index.ts"],"sourcesContent":["import { select } from 'd3-selection'\nimport { Transition } from 'd3-transition'\nimport { area, Area as AreaInterface } from 'd3-shape'\nimport { interpolatePath } from 'd3-interpolate-path'\n\n// Core\nimport { XYComponentCore } from 'core/xy-component'\n\n// Utils\nimport { getNumber, getString, isArray, isNumber, getStackedExtent, getStackedData, filterDataByRange } from 'utils/data'\nimport { smartTransition } from 'utils/d3'\nimport { getColor } from 'utils/color'\n\n// Types\nimport { Curve } from 'types/curve'\nimport { NumericAccessor } from 'types/accessor'\n\n// Local Types\nimport { AreaDatum } from './types'\n\n// Config\nimport { AreaConfig, AreaConfigInterface } from './config'\n\n// Styles\nimport * as s from './style'\n\nexport class Area<Datum> extends XYComponentCore<Datum, AreaConfig<Datum>, AreaConfigInterface<Datum>> {\n static selectors = s\n stacked = true\n config: AreaConfig<Datum> = new AreaConfig()\n areaGen: AreaInterface<AreaDatum>\n private _prevNegative: boolean[] | undefined // To help guessing the stack direction when an accessor was set to null or 0\n\n events = {\n [Area.selectors.area]: {},\n }\n\n constructor (config?: AreaConfigInterface<Datum>) {\n super()\n if (config) this.config.init(config)\n }\n\n _render (customDuration?: number): void {\n super._render(customDuration)\n const { config, datamodel: { data } } = this\n const duration = isNumber(customDuration) ? customDuration : config.duration\n\n const curveGen = Curve[config.curveType]\n this.areaGen = area<AreaDatum>()\n .x(d => d.x)\n .y0(d => d.y0)\n .y1(d => {\n const isSmallerThanPixel = Math.abs(d.y1 - d.y0) < 1\n return d.y1 - ((isSmallerThanPixel && config.minHeight1Px) ? 1 : 0)\n })\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n .curve(curveGen)\n\n const yAccessors = (isArray(config.y) ? config.y : [config.y]) as NumericAccessor<Datum>[]\n const areaDataX = data.map((d, i) => this.xScale(getNumber(d, config.x, i)))\n\n const stacked = getStackedData(data, config.baseline, yAccessors, this._prevNegative)\n this._prevNegative = stacked.map(s => !!s.negative)\n const stackedData: AreaDatum[][] = stacked.map(\n arr => arr.map(\n (d, j) => ({\n y0: this.yScale(d[0]),\n y1: this.yScale(d[1]),\n x: areaDataX[j],\n })\n )\n )\n\n // We reverse the data in order to have the first areas to be displayed on top\n // for better visibility when they're close to zero\n const areaMaxIdx = stackedData.length - 1\n const stackedDataReversed = stackedData.reverse()\n const areas = this.g\n .selectAll<SVGPathElement, AreaDatum>(`.${s.area}`)\n .data(stackedDataReversed)\n\n const areasEnter = areas.enter().append('path')\n .attr('class', s.area)\n .attr('d', d => this.areaGen(d) || this._emptyPath())\n .style('opacity', 0)\n .style('fill', (d, i) => getColor(data, config.color, areaMaxIdx - i))\n\n const areasMerged = smartTransition(areasEnter.merge(areas), duration)\n .style('opacity', (d, i) => {\n const isDefined = d.some(p => (p.y0 - p.y1) !== 0)\n return isDefined ? getNumber(d, config.opacity, areaMaxIdx - i) : 0\n })\n .style('fill', (d, i) => getColor(data, config.color, areaMaxIdx - i))\n .style('cursor', (d, i) => getString(data, config.cursor, areaMaxIdx - i))\n\n if (duration) {\n const transition = areasMerged as Transition<SVGPathElement, AreaDatum[], SVGGElement, AreaDatum[]>\n transition.attrTween('d', (d, i, el) => {\n const previous = select(el[i]).attr('d')\n const next = this.areaGen(d) || this._emptyPath()\n return interpolatePath(previous, next)\n })\n } else {\n areasMerged.attr('d', d => this.areaGen(d) || this._emptyPath())\n }\n\n smartTransition(areas.exit(), duration)\n .style('opacity', 0)\n .remove()\n }\n\n getYDataExtent (scaleByVisibleData: boolean): number[] {\n const { config, datamodel } = this\n const yAccessors = (isArray(config.y) ? config.y : [config.y]) as NumericAccessor<Datum>[]\n\n const data = scaleByVisibleData ? filterDataByRange(datamodel.data, this.xScale.domain() as [number, number], config.x) : datamodel.data\n return getStackedExtent(data, config.baseline, ...yAccessors)\n }\n\n _emptyPath (): string {\n const xRange = this.xScale.range()\n const yDomain = this.yScale.domain() as number[]\n\n const y0 = this.yScale((yDomain[0] + yDomain[1]) / 2)\n const y1 = y0\n\n return this.areaGen([\n { y0, y1, x: xRange[0] },\n { y0, y1, x: xRange[1] },\n ])\n }\n}\n"],"names":["s.area","s"],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","sources":["../../../src/components/area/style.ts"],"sourcesContent":["import { css, injectGlobal } from '@emotion/css'\n\n\nexport const root = css`\n label: area-component;\n`\n\nexport const globalStyles = injectGlobal`\n :root {\n --vis-area-cursor: default;\n --vis-area-fill-opacity: 1;\n --vis-area-stroke-color: none;\n --vis-area-stroke-width: 0px;\n --vis-area-stroke-dasharray: none;\n --vis-area-stroke-opacity: 1;\n --vis-area-hover-fill-opacity: none;\n --vis-area-hover-stroke-width: none;\n\n /* Dark Theme */\n --vis-dark-area-stroke-color: none;\n }\n\n body.theme-dark ${`.${root}`} {\n --vis-area-stroke-color: var(--vis-dark-area-stroke-color);\n }\n\n`\nexport const area = css`\n label: area;\n cursor: var(--vis-area-cursor);\n fill-opacity: var(--vis-area-fill-opacity);\n stroke-width: var(--vis-area-stroke-width);\n stroke-dasharray: var(--vis-area-stroke-dasharray);\n stroke: var(--vis-area-stroke-color);\n stroke-opacity: var(--vis-area-stroke-opacity);\n\n &:hover {\n fill-opacity: var(--vis-area-hover-fill-opacity);\n stroke-width: var(--vis-area-hover-stroke-width);\n }\n`\n"],"names":[],"mappings":";;AAGO,MAAM,IAAI,GAAG,GAAG,CAAA,CAAA;;EAEtB;AAEM,MAAM,YAAY,GAAG,YAAY,CAAA,CAAA;;;;;;;;;;;;;;;AAepB,kBAAA,EAAA,CAAA,CAAA,EAAI,IAAI,CAAE,CAAA,CAAA;;;;EAI7B;AACM,MAAM,IAAI,GAAG,GAAG,CAAA,CAAA;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { XYComponentConfigInterface, XYComponentConfig } from "../../core/xy-component/config";
|
|
2
|
-
import { AxisType } from "./types";
|
|
3
|
-
import { Position } from "../../types/position";
|
|
4
|
-
import { FitMode, TrimMode, TextAlign } from "../../types/text";
|
|
5
|
-
export interface AxisConfigInterface<Datum> extends Partial<XYComponentConfigInterface<Datum>> {
|
|
6
|
-
/** Axis position: `Position.Top`, `Position.Bottom`, `Position.Right` or `Position.Left`. Default: `undefined` */
|
|
7
|
-
position?: Position | string;
|
|
8
|
-
/** Axis type: `AxisType.X` or `AxisType.Y` */
|
|
9
|
-
type?: AxisType | string;
|
|
10
|
-
/** Extend the axis domain line to be full width or full height. Default: `true` */
|
|
11
|
-
fullSize?: boolean;
|
|
12
|
-
/** Axis label. Default: `undefined` */
|
|
13
|
-
label?: string;
|
|
14
|
-
/** Font size of the axis label as CSS string. Default: `null` */
|
|
15
|
-
labelFontSize?: string | null;
|
|
16
|
-
/** Distance between the axis and the label in pixels. Default: `8` */
|
|
17
|
-
labelMargin?: number;
|
|
18
|
-
/** Sets whether to draw the grid lines or not. Default: `true` */
|
|
19
|
-
gridLine?: boolean;
|
|
20
|
-
/** Sets whether to draw the tick lines or not. Default: `true` */
|
|
21
|
-
tickLine?: boolean;
|
|
22
|
-
/** Sets whether to draw the domain line or not. Default: `true` */
|
|
23
|
-
domainLine?: boolean;
|
|
24
|
-
/** Draw the min and max axis ticks only. Default: `false` */
|
|
25
|
-
minMaxTicksOnly?: boolean;
|
|
26
|
-
/** Tick label formatter function. Default: `undefined` */
|
|
27
|
-
tickFormat?: ((tick: number, i: number, ticks: number[]) => string) | ((tick: Date, i: number, ticks: Date[]) => string);
|
|
28
|
-
/** Explicitly set tick values. Default: `undefined` */
|
|
29
|
-
tickValues?: number[];
|
|
30
|
-
/** Set the approximate number of axis ticks (will be passed to D3's axis constructor). Default: `undefined` */
|
|
31
|
-
numTicks?: number;
|
|
32
|
-
/** Tick text fit mode: `FitMode.Wrap` or `FitMode.Trim`. Default: `FitMode.Wrap`. */
|
|
33
|
-
tickTextFitMode?: FitMode | string;
|
|
34
|
-
/** Maximum width in pixels for the tick text to be wrapped or trimmed. Default: `undefined` */
|
|
35
|
-
tickTextWidth?: number;
|
|
36
|
-
/** Tick text wrapping separator. String or array of strings. Default: `' '` */
|
|
37
|
-
tickTextSeparator?: string | string[];
|
|
38
|
-
/** Force word break for ticks when they don't fit. Default: `false` */
|
|
39
|
-
tickTextForceWordBreak?: boolean;
|
|
40
|
-
/** Tick text trim mode: `TrimMode.Start`, `TrimMode.Middle` or `TrimMode.End`. Default: `TrimMode.Middle` */
|
|
41
|
-
tickTextTrimType?: TrimMode | string;
|
|
42
|
-
/** Font size of the tick text as CSS string. Default: `null` */
|
|
43
|
-
tickTextFontSize?: string | null;
|
|
44
|
-
/** Text alignment for ticks: `TextAlign.Left`, `TextAlign.Center` or `TextAlign.Right`. Default: `undefined` */
|
|
45
|
-
tickTextAlign?: TextAlign | string;
|
|
46
|
-
/** The spacing in pixels between the tick and it's label. Default: `8` */
|
|
47
|
-
tickPadding?: number;
|
|
48
|
-
}
|
|
49
|
-
export declare class AxisConfig<Datum> extends XYComponentConfig<Datum> implements AxisConfigInterface<Datum> {
|
|
50
|
-
position: any;
|
|
51
|
-
type: any;
|
|
52
|
-
label: any;
|
|
53
|
-
labelFontSize: any;
|
|
54
|
-
gridLine: boolean;
|
|
55
|
-
tickLine: boolean;
|
|
56
|
-
domainLine: boolean;
|
|
57
|
-
numTicks: any;
|
|
58
|
-
minMaxTicksOnly: boolean;
|
|
59
|
-
tickTextWidth: any;
|
|
60
|
-
tickTextSeparator: string;
|
|
61
|
-
tickTextForceWordBreak: boolean;
|
|
62
|
-
tickTextTrimType: TrimMode;
|
|
63
|
-
tickTextFitMode: FitMode;
|
|
64
|
-
tickTextFontSize: any;
|
|
65
|
-
tickTextAlign: any;
|
|
66
|
-
labelMargin: number;
|
|
67
|
-
tickFormat: any;
|
|
68
|
-
tickValues: any;
|
|
69
|
-
fullSize: boolean;
|
|
70
|
-
tickPadding: number;
|
|
71
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { XYComponentConfig } from '../../core/xy-component/config.js';
|
|
2
|
-
import { TrimMode, FitMode } from '../../types/text.js';
|
|
3
|
-
|
|
4
|
-
class AxisConfig extends XYComponentConfig {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.position = undefined;
|
|
8
|
-
this.type = undefined;
|
|
9
|
-
this.label = undefined;
|
|
10
|
-
this.labelFontSize = null;
|
|
11
|
-
this.gridLine = true;
|
|
12
|
-
this.tickLine = true;
|
|
13
|
-
this.domainLine = true;
|
|
14
|
-
this.numTicks = undefined;
|
|
15
|
-
this.minMaxTicksOnly = false;
|
|
16
|
-
this.tickTextWidth = undefined;
|
|
17
|
-
this.tickTextSeparator = ' ';
|
|
18
|
-
this.tickTextForceWordBreak = false;
|
|
19
|
-
this.tickTextTrimType = TrimMode.Middle;
|
|
20
|
-
this.tickTextFitMode = FitMode.Wrap;
|
|
21
|
-
this.tickTextFontSize = null;
|
|
22
|
-
this.tickTextAlign = undefined;
|
|
23
|
-
this.labelMargin = 8;
|
|
24
|
-
this.tickFormat = undefined;
|
|
25
|
-
this.tickValues = undefined;
|
|
26
|
-
this.fullSize = true;
|
|
27
|
-
this.tickPadding = 8;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export { AxisConfig };
|
|
32
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sources":["../../../src/components/axis/config.ts"],"sourcesContent":["import { XYComponentConfigInterface, XYComponentConfig } from 'core/xy-component/config'\n\n// Types\nimport { AxisType } from 'components/axis/types'\nimport { Position } from 'types/position'\nimport { FitMode, TrimMode, TextAlign } from 'types/text'\n\n// We extend partial XY config interface because x and y properties are optional for Axis\nexport interface AxisConfigInterface<Datum> extends Partial<XYComponentConfigInterface<Datum>> {\n /** Axis position: `Position.Top`, `Position.Bottom`, `Position.Right` or `Position.Left`. Default: `undefined` */\n position?: Position | string;\n /** Axis type: `AxisType.X` or `AxisType.Y` */\n type?: AxisType | string;\n /** Extend the axis domain line to be full width or full height. Default: `true` */\n fullSize?: boolean;\n /** Axis label. Default: `undefined` */\n label?: string;\n /** Font size of the axis label as CSS string. Default: `null` */\n labelFontSize?: string | null;\n /** Distance between the axis and the label in pixels. Default: `8` */\n labelMargin?: number;\n /** Sets whether to draw the grid lines or not. Default: `true` */\n gridLine?: boolean;\n /** Sets whether to draw the tick lines or not. Default: `true` */\n tickLine?: boolean;\n /** Sets whether to draw the domain line or not. Default: `true` */\n domainLine?: boolean;\n /** Draw the min and max axis ticks only. Default: `false` */\n minMaxTicksOnly?: boolean;\n /** Tick label formatter function. Default: `undefined` */\n tickFormat?: ((tick: number, i: number, ticks: number[]) => string) | ((tick: Date, i: number, ticks: Date[]) => string);\n /** Explicitly set tick values. Default: `undefined` */\n tickValues?: number[];\n /** Set the approximate number of axis ticks (will be passed to D3's axis constructor). Default: `undefined` */\n numTicks?: number;\n /** Tick text fit mode: `FitMode.Wrap` or `FitMode.Trim`. Default: `FitMode.Wrap`. */\n tickTextFitMode?: FitMode | string;\n /** Maximum width in pixels for the tick text to be wrapped or trimmed. Default: `undefined` */\n tickTextWidth?: number;\n /** Tick text wrapping separator. String or array of strings. Default: `' '` */\n tickTextSeparator?: string | string[];\n /** Force word break for ticks when they don't fit. Default: `false` */\n tickTextForceWordBreak?: boolean;\n /** Tick text trim mode: `TrimMode.Start`, `TrimMode.Middle` or `TrimMode.End`. Default: `TrimMode.Middle` */\n tickTextTrimType?: TrimMode | string;\n /** Font size of the tick text as CSS string. Default: `null` */\n tickTextFontSize?: string | null;\n /** Text alignment for ticks: `TextAlign.Left`, `TextAlign.Center` or `TextAlign.Right`. Default: `undefined` */\n tickTextAlign?: TextAlign | string;\n /** The spacing in pixels between the tick and it's label. Default: `8` */\n tickPadding?: number;\n}\n\nexport class AxisConfig<Datum> extends XYComponentConfig<Datum> implements AxisConfigInterface<Datum> {\n position = undefined\n type = undefined\n label = undefined\n labelFontSize = null\n gridLine = true\n tickLine = true\n domainLine = true\n numTicks = undefined\n minMaxTicksOnly = false\n tickTextWidth = undefined\n tickTextSeparator = ' '\n tickTextForceWordBreak = false\n tickTextTrimType = TrimMode.Middle\n tickTextFitMode = FitMode.Wrap\n tickTextFontSize = null\n tickTextAlign = undefined\n labelMargin = 8\n tickFormat = undefined\n tickValues = undefined\n fullSize = true\n tickPadding = 8\n}\n"],"names":[],"mappings":";;;AAqDM,MAAO,UAAkB,SAAQ,iBAAwB,CAAA;AAA/D,IAAA,WAAA,GAAA;;QACE,IAAQ,CAAA,QAAA,GAAG,SAAS,CAAA;QACpB,IAAI,CAAA,IAAA,GAAG,SAAS,CAAA;QAChB,IAAK,CAAA,KAAA,GAAG,SAAS,CAAA;QACjB,IAAa,CAAA,aAAA,GAAG,IAAI,CAAA;QACpB,IAAQ,CAAA,QAAA,GAAG,IAAI,CAAA;QACf,IAAQ,CAAA,QAAA,GAAG,IAAI,CAAA;QACf,IAAU,CAAA,UAAA,GAAG,IAAI,CAAA;QACjB,IAAQ,CAAA,QAAA,GAAG,SAAS,CAAA;QACpB,IAAe,CAAA,eAAA,GAAG,KAAK,CAAA;QACvB,IAAa,CAAA,aAAA,GAAG,SAAS,CAAA;QACzB,IAAiB,CAAA,iBAAA,GAAG,GAAG,CAAA;QACvB,IAAsB,CAAA,sBAAA,GAAG,KAAK,CAAA;AAC9B,QAAA,IAAA,CAAA,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAA;AAClC,QAAA,IAAA,CAAA,eAAe,GAAG,OAAO,CAAC,IAAI,CAAA;QAC9B,IAAgB,CAAA,gBAAA,GAAG,IAAI,CAAA;QACvB,IAAa,CAAA,aAAA,GAAG,SAAS,CAAA;QACzB,IAAW,CAAA,WAAA,GAAG,CAAC,CAAA;QACf,IAAU,CAAA,UAAA,GAAG,SAAS,CAAA;QACtB,IAAU,CAAA,UAAA,GAAG,SAAS,CAAA;QACtB,IAAQ,CAAA,QAAA,GAAG,IAAI,CAAA;QACf,IAAW,CAAA,WAAA,GAAG,CAAC,CAAA;KAChB;AAAA;;;;"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Selection } from 'd3-selection';
|
|
2
|
-
import { Axis as D3Axis } from 'd3-axis';
|
|
3
|
-
import { XYComponentCore } from "../../core/xy-component";
|
|
4
|
-
import { Position } from "../../types/position";
|
|
5
|
-
import { Spacing } from "../../types/spacing";
|
|
6
|
-
import { TextAlign } from "../../types/text";
|
|
7
|
-
import { AxisConfig, AxisConfigInterface } from './config';
|
|
8
|
-
import * as s from './style';
|
|
9
|
-
export declare class Axis<Datum> extends XYComponentCore<Datum, AxisConfig<Datum>, AxisConfigInterface<Datum>> {
|
|
10
|
-
static selectors: typeof s;
|
|
11
|
-
config: AxisConfig<Datum>;
|
|
12
|
-
axisGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>;
|
|
13
|
-
gridGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>;
|
|
14
|
-
private _axisRawBBox;
|
|
15
|
-
private _axisSizeBBox;
|
|
16
|
-
private _requiredMargin;
|
|
17
|
-
private _defaultNumTicks;
|
|
18
|
-
private _minMaxTicksOnlyEnforceWidth;
|
|
19
|
-
events: {};
|
|
20
|
-
constructor(config?: AxisConfigInterface<Datum>);
|
|
21
|
-
/** Renders axis to an invisible grouped to calculate automatic chart margins */
|
|
22
|
-
preRender(): void;
|
|
23
|
-
getPosition(): Position;
|
|
24
|
-
_getAxisSize(selection: Selection<SVGGElement, unknown, SVGGElement, undefined>): SVGRect;
|
|
25
|
-
_getRequiredMargin(axisSize?: DOMRect): Spacing;
|
|
26
|
-
getRequiredMargin(): Spacing;
|
|
27
|
-
/** Calculates axis transform:translate offset based on passed container margins */
|
|
28
|
-
getOffset(containerMargin: Spacing): {
|
|
29
|
-
left: number;
|
|
30
|
-
top: number;
|
|
31
|
-
};
|
|
32
|
-
_render(duration?: number, selection?: Selection<SVGGElement, unknown, SVGGElement, unknown>): void;
|
|
33
|
-
_buildAxis(): D3Axis<any>;
|
|
34
|
-
_buildGrid(): D3Axis<any>;
|
|
35
|
-
_renderAxis(selection?: Selection<SVGGElement, unknown, SVGGElement, unknown>, duration?: number): void;
|
|
36
|
-
_getNumTicks(): number;
|
|
37
|
-
_getConfiguredTickValues(): number[] | null;
|
|
38
|
-
_getFullDomainPath(tickSize?: number): string;
|
|
39
|
-
_renderAxisLabel(selection?: Selection<SVGGElement, unknown, SVGGElement, unknown>): void;
|
|
40
|
-
_getLabelDY(): number;
|
|
41
|
-
_alignTickLabels(): void;
|
|
42
|
-
_getTickTextAnchor(textAlign: TextAlign): string;
|
|
43
|
-
_getYTickTextTranslate(textAlign: TextAlign, axisPosition?: Position): number;
|
|
44
|
-
}
|
package/components/axis/index.js
DELETED
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
import { select } from 'd3-selection';
|
|
2
|
-
import { interrupt } from 'd3-transition';
|
|
3
|
-
import { axisLeft, axisRight, axisBottom, axisTop } from 'd3-axis';
|
|
4
|
-
import { XYComponentCore } from '../../core/xy-component/index.js';
|
|
5
|
-
import { Position } from '../../types/position.js';
|
|
6
|
-
import { FitMode, VerticalAlign, TextAlign } from '../../types/text.js';
|
|
7
|
-
import { smartTransition } from '../../utils/d3.js';
|
|
8
|
-
import { trimSVGText, renderTextToSvgTextElement } from '../../utils/text.js';
|
|
9
|
-
import { AxisType } from './types.js';
|
|
10
|
-
import { AxisConfig } from './config.js';
|
|
11
|
-
import * as style from './style.js';
|
|
12
|
-
import { grid, tick, axis, hideTickLine, hideDomain, label } from './style.js';
|
|
13
|
-
|
|
14
|
-
class Axis extends XYComponentCore {
|
|
15
|
-
constructor(config) {
|
|
16
|
-
super();
|
|
17
|
-
this.config = new AxisConfig();
|
|
18
|
-
this._defaultNumTicks = 3;
|
|
19
|
-
this._minMaxTicksOnlyEnforceWidth = 250;
|
|
20
|
-
this.events = {};
|
|
21
|
-
if (config)
|
|
22
|
-
this.config.init(config);
|
|
23
|
-
this.axisGroup = this.g.append('g');
|
|
24
|
-
this.gridGroup = this.g.append('g')
|
|
25
|
-
.attr('class', grid);
|
|
26
|
-
}
|
|
27
|
-
/** Renders axis to an invisible grouped to calculate automatic chart margins */
|
|
28
|
-
preRender() {
|
|
29
|
-
const { config } = this;
|
|
30
|
-
const axisRenderHelperGroup = this.g.append('g').attr('opacity', 0);
|
|
31
|
-
this._renderAxis(axisRenderHelperGroup, 0);
|
|
32
|
-
// Store axis raw BBox (without the label) for further label positioning (see _renderAxisLabel)
|
|
33
|
-
this._axisRawBBox = axisRenderHelperGroup.node().getBBox();
|
|
34
|
-
// Align tick text
|
|
35
|
-
if (config.tickTextAlign)
|
|
36
|
-
this._alignTickLabels();
|
|
37
|
-
// Render label and store total axis size and required margins
|
|
38
|
-
this._renderAxisLabel(axisRenderHelperGroup);
|
|
39
|
-
this._axisSizeBBox = this._getAxisSize(axisRenderHelperGroup);
|
|
40
|
-
this._requiredMargin = this._getRequiredMargin(this._axisSizeBBox);
|
|
41
|
-
axisRenderHelperGroup.remove();
|
|
42
|
-
}
|
|
43
|
-
getPosition() {
|
|
44
|
-
const { config: { type, position } } = this;
|
|
45
|
-
return (position !== null && position !== void 0 ? position : ((type === AxisType.X) ? Position.Bottom : Position.Left));
|
|
46
|
-
}
|
|
47
|
-
_getAxisSize(selection) {
|
|
48
|
-
const bBox = selection.node().getBBox();
|
|
49
|
-
return bBox;
|
|
50
|
-
}
|
|
51
|
-
_getRequiredMargin(axisSize = this._axisSizeBBox) {
|
|
52
|
-
const { config: { type, position } } = this;
|
|
53
|
-
switch (type) {
|
|
54
|
-
case AxisType.X: {
|
|
55
|
-
const tolerancePx = 1;
|
|
56
|
-
const xEnd = this._axisSizeBBox.x + this._axisSizeBBox.width;
|
|
57
|
-
const left = this._axisSizeBBox.x < 0 ? Math.abs(this._axisSizeBBox.x) : 0;
|
|
58
|
-
const right = (xEnd - this._width) > tolerancePx ? xEnd - this._width : 0;
|
|
59
|
-
switch (position) {
|
|
60
|
-
case Position.Top: return { top: axisSize.height, left, right };
|
|
61
|
-
case Position.Bottom:
|
|
62
|
-
default: return { bottom: axisSize.height, left, right };
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
case AxisType.Y: {
|
|
66
|
-
const bleedY = axisSize.height > this._height ? (axisSize.height - this._height) / 2 : 0;
|
|
67
|
-
const top = bleedY;
|
|
68
|
-
const bottom = bleedY;
|
|
69
|
-
switch (position) {
|
|
70
|
-
case Position.Right: return { right: axisSize.width, top, bottom };
|
|
71
|
-
case Position.Left:
|
|
72
|
-
default: return { left: axisSize.width, top, bottom };
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
getRequiredMargin() {
|
|
78
|
-
return this._requiredMargin;
|
|
79
|
-
}
|
|
80
|
-
/** Calculates axis transform:translate offset based on passed container margins */
|
|
81
|
-
getOffset(containerMargin) {
|
|
82
|
-
const { config: { type, position } } = this;
|
|
83
|
-
switch (type) {
|
|
84
|
-
case AxisType.X:
|
|
85
|
-
switch (position) {
|
|
86
|
-
case Position.Top: return { top: containerMargin.top, left: containerMargin.left };
|
|
87
|
-
case Position.Bottom:
|
|
88
|
-
default: return { top: containerMargin.top + this._height, left: containerMargin.left };
|
|
89
|
-
}
|
|
90
|
-
case AxisType.Y:
|
|
91
|
-
switch (position) {
|
|
92
|
-
case Position.Right: return { top: containerMargin.top, left: containerMargin.left + this._width };
|
|
93
|
-
case Position.Left:
|
|
94
|
-
default: return { top: containerMargin.top, left: containerMargin.left };
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
_render(duration = this.config.duration, selection = this.axisGroup) {
|
|
99
|
-
const { config } = this;
|
|
100
|
-
this._renderAxis(selection, duration);
|
|
101
|
-
this._renderAxisLabel(selection);
|
|
102
|
-
if (config.gridLine) {
|
|
103
|
-
const gridGen = this._buildGrid().tickFormat(() => '');
|
|
104
|
-
gridGen.tickValues(this._getConfiguredTickValues());
|
|
105
|
-
// Interrupting all active transitions first to prevent them from being stuck.
|
|
106
|
-
// Somehow we see it happening in Angular apps.
|
|
107
|
-
this.gridGroup.selectAll('*').interrupt();
|
|
108
|
-
smartTransition(this.gridGroup, duration).call(gridGen).style('opacity', 1);
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
smartTransition(this.gridGroup, duration).style('opacity', 0);
|
|
112
|
-
}
|
|
113
|
-
if (config.tickTextAlign)
|
|
114
|
-
this._alignTickLabels();
|
|
115
|
-
}
|
|
116
|
-
_buildAxis() {
|
|
117
|
-
const { config: { type, position, tickPadding } } = this;
|
|
118
|
-
const ticks = this._getNumTicks();
|
|
119
|
-
switch (type) {
|
|
120
|
-
case AxisType.X:
|
|
121
|
-
switch (position) {
|
|
122
|
-
case Position.Top: return axisTop(this.xScale).ticks(ticks).tickPadding(tickPadding);
|
|
123
|
-
case Position.Bottom:
|
|
124
|
-
default: return axisBottom(this.xScale).ticks(ticks).tickPadding(tickPadding);
|
|
125
|
-
}
|
|
126
|
-
case AxisType.Y:
|
|
127
|
-
switch (position) {
|
|
128
|
-
case Position.Right: return axisRight(this.yScale).ticks(ticks).tickPadding(tickPadding);
|
|
129
|
-
case Position.Left:
|
|
130
|
-
default: return axisLeft(this.yScale).ticks(ticks).tickPadding(tickPadding);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
_buildGrid() {
|
|
135
|
-
const { config: { type, position } } = this;
|
|
136
|
-
const ticks = this._getNumTicks();
|
|
137
|
-
switch (type) {
|
|
138
|
-
case AxisType.X:
|
|
139
|
-
switch (position) {
|
|
140
|
-
case Position.Top: return axisTop(this.xScale).ticks(ticks * 2).tickSize(-this._height).tickSizeOuter(0);
|
|
141
|
-
case Position.Bottom:
|
|
142
|
-
default: return axisBottom(this.xScale).ticks(ticks * 2).tickSize(-this._height).tickSizeOuter(0);
|
|
143
|
-
}
|
|
144
|
-
case AxisType.Y:
|
|
145
|
-
switch (position) {
|
|
146
|
-
case Position.Right: return axisRight(this.yScale).ticks(ticks * 2).tickSize(-this._width).tickSizeOuter(0);
|
|
147
|
-
case Position.Left:
|
|
148
|
-
default: return axisLeft(this.yScale).ticks(ticks * 2).tickSize(-this._width).tickSizeOuter(0);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
_renderAxis(selection = this.axisGroup, duration = this.config.duration) {
|
|
153
|
-
const { config } = this;
|
|
154
|
-
const axisGen = this._buildAxis();
|
|
155
|
-
axisGen.tickValues(this._getConfiguredTickValues());
|
|
156
|
-
// Interrupting all active transitions first to prevent them from being stuck.
|
|
157
|
-
// Somehow we see it happening in Angular apps.
|
|
158
|
-
selection.selectAll('*').interrupt();
|
|
159
|
-
smartTransition(selection, duration).call(axisGen);
|
|
160
|
-
const ticks = selection.selectAll('g.tick');
|
|
161
|
-
const tickValues = ticks.data();
|
|
162
|
-
ticks
|
|
163
|
-
.classed(tick, true)
|
|
164
|
-
.style('font-size', config.tickTextFontSize);
|
|
165
|
-
// We interrupt transition on tick Text to make it 'wrappable'
|
|
166
|
-
const tickText = selection.selectAll('g.tick > text');
|
|
167
|
-
tickText.nodes().forEach(node => interrupt(node));
|
|
168
|
-
tickText.each((value, i, elements) => {
|
|
169
|
-
var _a, _b;
|
|
170
|
-
const text = (_b = (_a = config.tickFormat) === null || _a === void 0 ? void 0 : _a.call(config, value, i, tickValues)) !== null && _b !== void 0 ? _b : `${value}`;
|
|
171
|
-
const textElement = elements[i];
|
|
172
|
-
const textMaxWidth = config.tickTextWidth || (config.type === AxisType.X ? this._containerWidth / (ticks.size() + 1) : this._containerWidth / 5);
|
|
173
|
-
const styleDeclaration = getComputedStyle(textElement);
|
|
174
|
-
const fontSize = Number.parseFloat(styleDeclaration.fontSize);
|
|
175
|
-
const fontFamily = styleDeclaration.fontFamily;
|
|
176
|
-
if (config.tickTextFitMode === FitMode.Trim) {
|
|
177
|
-
const textElementSelection = select(textElement).text(text);
|
|
178
|
-
trimSVGText(textElementSelection, textMaxWidth, config.tickTextTrimType, true, fontSize, 0.58);
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
const textBlock = { text, fontFamily, fontSize };
|
|
182
|
-
const textOptions = {
|
|
183
|
-
verticalAlign: config.type === AxisType.X ? VerticalAlign.Top : VerticalAlign.Middle,
|
|
184
|
-
width: textMaxWidth,
|
|
185
|
-
};
|
|
186
|
-
renderTextToSvgTextElement(textElement, textBlock, textOptions);
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
selection
|
|
190
|
-
.classed(axis, true)
|
|
191
|
-
.classed(hideTickLine, !config.tickLine)
|
|
192
|
-
.classed(hideDomain, !config.domainLine);
|
|
193
|
-
if (config.fullSize) {
|
|
194
|
-
const path = this._getFullDomainPath(0);
|
|
195
|
-
smartTransition(selection.select('.domain'), duration).attr('d', path);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
_getNumTicks() {
|
|
199
|
-
const { config: { type, numTicks } } = this;
|
|
200
|
-
if (numTicks)
|
|
201
|
-
return numTicks;
|
|
202
|
-
if (type === AxisType.X) {
|
|
203
|
-
const xRange = this.xScale.range();
|
|
204
|
-
const width = xRange[1] - xRange[0];
|
|
205
|
-
return Math.floor(width / 175);
|
|
206
|
-
}
|
|
207
|
-
if (type === AxisType.Y) {
|
|
208
|
-
const yRange = this.yScale.range();
|
|
209
|
-
const height = Math.abs(yRange[0] - yRange[1]);
|
|
210
|
-
return Math.pow(height, 0.85) / 25;
|
|
211
|
-
}
|
|
212
|
-
return this._defaultNumTicks;
|
|
213
|
-
}
|
|
214
|
-
_getConfiguredTickValues() {
|
|
215
|
-
const { config: { tickValues, type, minMaxTicksOnly } } = this;
|
|
216
|
-
const scale = type === AxisType.X ? this.xScale : this.yScale;
|
|
217
|
-
const scaleDomain = scale === null || scale === void 0 ? void 0 : scale.domain();
|
|
218
|
-
if (tickValues) {
|
|
219
|
-
return tickValues.filter(v => (v >= scaleDomain[0]) && (v <= scaleDomain[1]));
|
|
220
|
-
}
|
|
221
|
-
if (minMaxTicksOnly || (type === AxisType.X && this._width < this._minMaxTicksOnlyEnforceWidth)) {
|
|
222
|
-
return scaleDomain;
|
|
223
|
-
}
|
|
224
|
-
return null;
|
|
225
|
-
}
|
|
226
|
-
_getFullDomainPath(tickSize = 0) {
|
|
227
|
-
const { config: { type } } = this;
|
|
228
|
-
switch (type) {
|
|
229
|
-
case AxisType.X: return `M0.5, ${tickSize} V0.5 H${this._width + 0.5} V${tickSize}`;
|
|
230
|
-
case AxisType.Y: return `M${-tickSize}, ${this._height + 0.5} H0.5 V0.5 H${-tickSize}`;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
_renderAxisLabel(selection = this.axisGroup) {
|
|
234
|
-
var _a;
|
|
235
|
-
const { type, label: label$1, labelMargin, labelFontSize } = this.config;
|
|
236
|
-
// Remove the old label first to calculate the axis size properly
|
|
237
|
-
selection.selectAll(`.${label}`).remove();
|
|
238
|
-
// Calculate label position and rotation
|
|
239
|
-
const axisPosition = this.getPosition();
|
|
240
|
-
// We always use this.axisRenderHelperGroup to calculate the size of the axis because
|
|
241
|
-
// this.axisGroup will give us incorrect values due to animation
|
|
242
|
-
const { width: axisWidth, height: axisHeight } = (_a = this._axisRawBBox) !== null && _a !== void 0 ? _a : selection.node().getBBox();
|
|
243
|
-
const offsetX = type === AxisType.X ? this._width / 2 : Math.pow((-1), (+(axisPosition === Position.Left))) * axisWidth;
|
|
244
|
-
const offsetY = type === AxisType.X ? Math.pow((-1), (+(axisPosition === Position.Top))) * axisHeight : this._height / 2;
|
|
245
|
-
const marginX = type === AxisType.X ? 0 : Math.pow((-1), (+(axisPosition === Position.Left))) * labelMargin;
|
|
246
|
-
const marginY = type === AxisType.X ? Math.pow((-1), (+(axisPosition === Position.Top))) * labelMargin : 0;
|
|
247
|
-
const rotation = type === AxisType.Y ? -90 : 0;
|
|
248
|
-
// Append new label
|
|
249
|
-
selection
|
|
250
|
-
.append('text')
|
|
251
|
-
.attr('class', label)
|
|
252
|
-
.text(label$1)
|
|
253
|
-
.style('font-size', labelFontSize)
|
|
254
|
-
.attr('dy', `${this._getLabelDY()}em`)
|
|
255
|
-
.attr('transform', `translate(${offsetX + marginX},${offsetY + marginY}) rotate(${rotation})`);
|
|
256
|
-
}
|
|
257
|
-
_getLabelDY() {
|
|
258
|
-
const { type, position } = this.config;
|
|
259
|
-
switch (type) {
|
|
260
|
-
case AxisType.X:
|
|
261
|
-
switch (position) {
|
|
262
|
-
case Position.Top: return 0;
|
|
263
|
-
case Position.Bottom:
|
|
264
|
-
default: return 0.75;
|
|
265
|
-
}
|
|
266
|
-
case AxisType.Y:
|
|
267
|
-
switch (position) {
|
|
268
|
-
case Position.Right: return 0.75;
|
|
269
|
-
case Position.Left:
|
|
270
|
-
default: return -0.25;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
_alignTickLabels() {
|
|
275
|
-
const { config: { type, tickTextAlign, position } } = this;
|
|
276
|
-
const tickText = this.g.selectAll('g.tick > text');
|
|
277
|
-
const textAnchor = this._getTickTextAnchor(tickTextAlign);
|
|
278
|
-
const translateX = type === AxisType.X ? 0 : this._getYTickTextTranslate(tickTextAlign, position);
|
|
279
|
-
tickText
|
|
280
|
-
.attr('text-anchor', textAnchor)
|
|
281
|
-
.attr('transform', `translate(${translateX},0)`);
|
|
282
|
-
}
|
|
283
|
-
_getTickTextAnchor(textAlign) {
|
|
284
|
-
switch (textAlign) {
|
|
285
|
-
case TextAlign.Left: return 'start';
|
|
286
|
-
case TextAlign.Right: return 'end';
|
|
287
|
-
case TextAlign.Center: return 'middle';
|
|
288
|
-
default: return null;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
_getYTickTextTranslate(textAlign, axisPosition = Position.Left) {
|
|
292
|
-
const defaultTickTextSpacingPx = 9; // Default in D3
|
|
293
|
-
const width = this._axisRawBBox.width - defaultTickTextSpacingPx;
|
|
294
|
-
switch (textAlign) {
|
|
295
|
-
case TextAlign.Left: return axisPosition === Position.Left ? width * -1 : 0;
|
|
296
|
-
case TextAlign.Right: return axisPosition === Position.Left ? 0 : width;
|
|
297
|
-
case TextAlign.Center: return axisPosition === Position.Left ? width * (-0.5) : width * 0.5;
|
|
298
|
-
default: return 0;
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
Axis.selectors = style;
|
|
303
|
-
|
|
304
|
-
export { Axis };
|
|
305
|
-
//# sourceMappingURL=index.js.map
|