@unovis/ts 1.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +193 -0
- package/components/area/config.d.ts +25 -0
- package/components/area/config.js +16 -0
- package/components/area/config.js.map +1 -0
- package/components/area/index.d.ts +19 -0
- package/components/area/index.js +103 -0
- package/components/area/index.js.map +1 -0
- package/components/area/style.d.ts +3 -0
- package/components/area/style.js +32 -0
- package/components/area/style.js.map +1 -0
- package/components/area/types.d.ts +6 -0
- package/components/axis/config.d.ts +74 -0
- package/components/axis/config.js +33 -0
- package/components/axis/config.js.map +1 -0
- package/components/axis/index.d.ts +51 -0
- package/components/axis/index.js +291 -0
- package/components/axis/index.js.map +1 -0
- package/components/axis/modules/tick.d.ts +5 -0
- package/components/axis/modules/tick.js +48 -0
- package/components/axis/modules/tick.js.map +1 -0
- package/components/axis/style.d.ts +9 -0
- package/components/axis/style.js +95 -0
- package/components/axis/style.js.map +1 -0
- package/components/axis/types.d.ts +4 -0
- package/components/axis/types.js +8 -0
- package/components/axis/types.js.map +1 -0
- package/components/brush/config.d.ts +42 -0
- package/components/brush/config.js +24 -0
- package/components/brush/config.js.map +1 -0
- package/components/brush/index.d.ts +28 -0
- package/components/brush/index.js +199 -0
- package/components/brush/index.js.map +1 -0
- package/components/brush/style.d.ts +5 -0
- package/components/brush/style.js +63 -0
- package/components/brush/style.js.map +1 -0
- package/components/brush/types.d.ts +7 -0
- package/components/brush/types.js +8 -0
- package/components/brush/types.js.map +1 -0
- package/components/bullet-legend/config.d.ts +24 -0
- package/components/bullet-legend/config.js +16 -0
- package/components/bullet-legend/config.js.map +1 -0
- package/components/bullet-legend/index.d.ts +19 -0
- package/components/bullet-legend/index.js +79 -0
- package/components/bullet-legend/index.js.map +1 -0
- package/components/bullet-legend/style.d.ts +6 -0
- package/components/bullet-legend/style.js +66 -0
- package/components/bullet-legend/style.js.map +1 -0
- package/components/bullet-legend/types.d.ts +7 -0
- package/components/chord-diagram/config.d.ts +42 -0
- package/components/chord-diagram/config.js +25 -0
- package/components/chord-diagram/config.js.map +1 -0
- package/components/chord-diagram/index.d.ts +52 -0
- package/components/chord-diagram/index.js +280 -0
- package/components/chord-diagram/index.js.map +1 -0
- package/components/chord-diagram/modules/label.d.ts +8 -0
- package/components/chord-diagram/modules/label.js +128 -0
- package/components/chord-diagram/modules/label.js.map +1 -0
- package/components/chord-diagram/modules/link.d.ts +20 -0
- package/components/chord-diagram/modules/link.js +35 -0
- package/components/chord-diagram/modules/link.js.map +1 -0
- package/components/chord-diagram/modules/node.d.ts +17 -0
- package/components/chord-diagram/modules/node.js +52 -0
- package/components/chord-diagram/modules/node.js.map +1 -0
- package/components/chord-diagram/style.d.ts +13 -0
- package/components/chord-diagram/style.js +88 -0
- package/components/chord-diagram/style.js.map +1 -0
- package/components/chord-diagram/types.d.ts +40 -0
- package/components/chord-diagram/types.js +8 -0
- package/components/chord-diagram/types.js.map +1 -0
- package/components/crosshair/config.d.ts +43 -0
- package/components/crosshair/config.js +19 -0
- package/components/crosshair/config.js.map +1 -0
- package/components/crosshair/index.d.ts +35 -0
- package/components/crosshair/index.js +180 -0
- package/components/crosshair/index.js.map +1 -0
- package/components/crosshair/style.d.ts +4 -0
- package/components/crosshair/style.js +25 -0
- package/components/crosshair/style.js.map +1 -0
- package/components/crosshair/types.d.ts +13 -0
- package/components/donut/config.d.ts +45 -0
- package/components/donut/config.js +25 -0
- package/components/donut/config.js.map +1 -0
- package/components/donut/index.d.ts +20 -0
- package/components/donut/index.js +84 -0
- package/components/donut/index.js.map +1 -0
- package/components/donut/modules/arc.d.ts +10 -0
- package/components/donut/modules/arc.js +53 -0
- package/components/donut/modules/arc.js.map +1 -0
- package/components/donut/style.d.ts +6 -0
- package/components/donut/style.js +53 -0
- package/components/donut/style.js.map +1 -0
- package/components/donut/types.d.ts +12 -0
- package/components/flow-legend/config.d.ts +26 -0
- package/components/flow-legend/config.js +17 -0
- package/components/flow-legend/config.js.map +1 -0
- package/components/flow-legend/index.d.ts +16 -0
- package/components/flow-legend/index.js +73 -0
- package/components/flow-legend/index.js.map +1 -0
- package/components/flow-legend/style.d.ts +8 -0
- package/components/flow-legend/style.js +80 -0
- package/components/flow-legend/style.js.map +1 -0
- package/components/flow-legend/types.d.ts +9 -0
- package/components/flow-legend/types.js +8 -0
- package/components/flow-legend/types.js.map +1 -0
- package/components/free-brush/config.d.ts +45 -0
- package/components/free-brush/config.js +24 -0
- package/components/free-brush/config.js.map +1 -0
- package/components/free-brush/index.d.ts +20 -0
- package/components/free-brush/index.js +191 -0
- package/components/free-brush/index.js.map +1 -0
- package/components/free-brush/style.d.ts +4 -0
- package/components/free-brush/style.js +50 -0
- package/components/free-brush/style.js.map +1 -0
- package/components/free-brush/types.d.ts +7 -0
- package/components/free-brush/types.js +9 -0
- package/components/free-brush/types.js.map +1 -0
- package/components/graph/config.d.ts +207 -0
- package/components/graph/config.js +75 -0
- package/components/graph/config.js.map +1 -0
- package/components/graph/index.d.ts +125 -0
- package/components/graph/index.js +653 -0
- package/components/graph/index.js.map +1 -0
- package/components/graph/modules/layout-helpers.d.ts +2 -0
- package/components/graph/modules/layout-helpers.js +11 -0
- package/components/graph/modules/layout-helpers.js.map +1 -0
- package/components/graph/modules/layout.d.ts +9 -0
- package/components/graph/modules/layout.js +343 -0
- package/components/graph/modules/layout.js.map +1 -0
- package/components/graph/modules/link/helper.d.ts +25 -0
- package/components/graph/modules/link/helper.js +78 -0
- package/components/graph/modules/link/helper.js.map +1 -0
- package/components/graph/modules/link/index.d.ts +12 -0
- package/components/graph/modules/link/index.js +201 -0
- package/components/graph/modules/link/index.js.map +1 -0
- package/components/graph/modules/link/style.d.ts +15 -0
- package/components/graph/modules/link/style.js +112 -0
- package/components/graph/modules/link/style.js.map +1 -0
- package/components/graph/modules/node/helper.d.ts +21 -0
- package/components/graph/modules/node/helper.js +127 -0
- package/components/graph/modules/node/helper.js.map +1 -0
- package/components/graph/modules/node/index.d.ts +12 -0
- package/components/graph/modules/node/index.js +248 -0
- package/components/graph/modules/node/index.js.map +1 -0
- package/components/graph/modules/node/style.d.ts +24 -0
- package/components/graph/modules/node/style.js +273 -0
- package/components/graph/modules/node/style.js.map +1 -0
- package/components/graph/modules/panel/helper.d.ts +16 -0
- package/components/graph/modules/panel/helper.js +110 -0
- package/components/graph/modules/panel/helper.js.map +1 -0
- package/components/graph/modules/panel/index.d.ts +7 -0
- package/components/graph/modules/panel/index.js +103 -0
- package/components/graph/modules/panel/index.js.map +1 -0
- package/components/graph/modules/panel/style.d.ts +14 -0
- package/components/graph/modules/panel/style.js +123 -0
- package/components/graph/modules/panel/style.js.map +1 -0
- package/components/graph/modules/shape.d.ts +7 -0
- package/components/graph/modules/shape.js +80 -0
- package/components/graph/modules/shape.js.map +1 -0
- package/components/graph/modules/zoom-levels.d.ts +6 -0
- package/components/graph/modules/zoom-levels.js +10 -0
- package/components/graph/modules/zoom-levels.js.map +1 -0
- package/components/graph/style.d.ts +6 -0
- package/components/graph/style.js +66 -0
- package/components/graph/style.js.map +1 -0
- package/components/graph/types.d.ts +120 -0
- package/components/graph/types.js +29 -0
- package/components/graph/types.js.map +1 -0
- package/components/grouped-bar/config.d.ts +36 -0
- package/components/grouped-bar/config.js +20 -0
- package/components/grouped-bar/config.js.map +1 -0
- package/components/grouped-bar/index.d.ts +30 -0
- package/components/grouped-bar/index.js +231 -0
- package/components/grouped-bar/index.js.map +1 -0
- package/components/grouped-bar/style.d.ts +5 -0
- package/components/grouped-bar/style.js +36 -0
- package/components/grouped-bar/style.js.map +1 -0
- package/components/leaflet-flow-map/config.d.ts +46 -0
- package/components/leaflet-flow-map/config.js +25 -0
- package/components/leaflet-flow-map/config.js.map +1 -0
- package/components/leaflet-flow-map/index.d.ts +51 -0
- package/components/leaflet-flow-map/index.js +219 -0
- package/components/leaflet-flow-map/index.js.map +1 -0
- package/components/leaflet-flow-map/renderer-utils.d.ts +5 -0
- package/components/leaflet-flow-map/renderer-utils.js +15 -0
- package/components/leaflet-flow-map/renderer-utils.js.map +1 -0
- package/components/leaflet-flow-map/renderer.d.ts +26 -0
- package/components/leaflet-flow-map/renderer.js +117 -0
- package/components/leaflet-flow-map/renderer.js.map +1 -0
- package/components/leaflet-flow-map/shaders.d.ts +2 -0
- package/components/leaflet-flow-map/shaders.js +27 -0
- package/components/leaflet-flow-map/shaders.js.map +1 -0
- package/components/leaflet-flow-map/types.d.ts +23 -0
- package/components/leaflet-map/config.d.ts +175 -0
- package/components/leaflet-map/config.js +67 -0
- package/components/leaflet-map/config.js.map +1 -0
- package/components/leaflet-map/index.d.ts +95 -0
- package/components/leaflet-map/index.js +648 -0
- package/components/leaflet-map/index.js.map +1 -0
- package/components/leaflet-map/leaflet.css.js +4 -0
- package/components/leaflet-map/leaflet.css.js.map +1 -0
- package/components/leaflet-map/modules/clusterBackground.d.ts +4 -0
- package/components/leaflet-map/modules/clusterBackground.js +27 -0
- package/components/leaflet-map/modules/clusterBackground.js.map +1 -0
- package/components/leaflet-map/modules/donut.d.ts +3 -0
- package/components/leaflet-map/modules/donut.js +25 -0
- package/components/leaflet-map/modules/donut.js.map +1 -0
- package/components/leaflet-map/modules/map.d.ts +13 -0
- package/components/leaflet-map/modules/map.js +143 -0
- package/components/leaflet-map/modules/map.js.map +1 -0
- package/components/leaflet-map/modules/node.d.ts +8 -0
- package/components/leaflet-map/modules/node.js +148 -0
- package/components/leaflet-map/modules/node.js.map +1 -0
- package/components/leaflet-map/modules/selectionRing.d.ts +6 -0
- package/components/leaflet-map/modules/selectionRing.js +41 -0
- package/components/leaflet-map/modules/selectionRing.js.map +1 -0
- package/components/leaflet-map/modules/utils.d.ts +49 -0
- package/components/leaflet-map/modules/utils.js +206 -0
- package/components/leaflet-map/modules/utils.js.map +1 -0
- package/components/leaflet-map/renderer/leaflet-maplibre-gl.js +273 -0
- package/components/leaflet-map/renderer/leaflet-maplibre-gl.js.map +1 -0
- package/components/leaflet-map/renderer/map-style.d.ts +4 -0
- package/components/leaflet-map/renderer/map-style.js +15 -0
- package/components/leaflet-map/renderer/map-style.js.map +1 -0
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json.js +40 -0
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json.js.map +1 -0
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json.js +40 -0
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json.js.map +1 -0
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json.js +4987 -0
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json.js.map +1 -0
- package/components/leaflet-map/renderer/mapboxgl-layer.d.ts +7 -0
- package/components/leaflet-map/renderer/mapboxgl-layer.js +27 -0
- package/components/leaflet-map/renderer/mapboxgl-layer.js.map +1 -0
- package/components/leaflet-map/renderer/mapboxgl-utils.d.ts +5 -0
- package/components/leaflet-map/renderer/mapboxgl-utils.js +39 -0
- package/components/leaflet-map/renderer/mapboxgl-utils.js.map +1 -0
- package/components/leaflet-map/renderer/maplibre-gl.css.js +4 -0
- package/components/leaflet-map/renderer/maplibre-gl.css.js.map +1 -0
- package/components/leaflet-map/style.d.ts +19 -0
- package/components/leaflet-map/style.js +192 -0
- package/components/leaflet-map/style.js.map +1 -0
- package/components/leaflet-map/types.d.ts +70 -0
- package/components/leaflet-map/types.js +10 -0
- package/components/leaflet-map/types.js.map +1 -0
- package/components/line/config.d.ts +30 -0
- package/components/line/config.js +17 -0
- package/components/line/config.js.map +1 -0
- package/components/line/index.d.ts +27 -0
- package/components/line/index.js +139 -0
- package/components/line/index.js.map +1 -0
- package/components/line/style.d.ts +6 -0
- package/components/line/style.js +35 -0
- package/components/line/style.js.map +1 -0
- package/components/line/types.d.ts +12 -0
- package/components/radial-dendrogram/config.d.ts +34 -0
- package/components/radial-dendrogram/config.js +20 -0
- package/components/radial-dendrogram/config.js.map +1 -0
- package/components/radial-dendrogram/index.d.ts +22 -0
- package/components/radial-dendrogram/index.js +98 -0
- package/components/radial-dendrogram/index.js.map +1 -0
- package/components/radial-dendrogram/modules/label.d.ts +8 -0
- package/components/radial-dendrogram/modules/label.js +70 -0
- package/components/radial-dendrogram/modules/label.js.map +1 -0
- package/components/radial-dendrogram/modules/link.d.ts +19 -0
- package/components/radial-dendrogram/modules/link.js +59 -0
- package/components/radial-dendrogram/modules/link.js.map +1 -0
- package/components/radial-dendrogram/modules/node.d.ts +16 -0
- package/components/radial-dendrogram/modules/node.js +51 -0
- package/components/radial-dendrogram/modules/node.js.map +1 -0
- package/components/radial-dendrogram/style.d.ts +6 -0
- package/components/radial-dendrogram/style.js +54 -0
- package/components/radial-dendrogram/style.js.map +1 -0
- package/components/radial-dendrogram/types.d.ts +34 -0
- package/components/sankey/config.d.ts +162 -0
- package/components/sankey/config.js +65 -0
- package/components/sankey/config.js.map +1 -0
- package/components/sankey/index.d.ts +59 -0
- package/components/sankey/index.js +299 -0
- package/components/sankey/index.js.map +1 -0
- package/components/sankey/modules/label.d.ts +23 -0
- package/components/sankey/modules/label.js +164 -0
- package/components/sankey/modules/label.js.map +1 -0
- package/components/sankey/modules/link.d.ts +13 -0
- package/components/sankey/modules/link.js +108 -0
- package/components/sankey/modules/link.js.map +1 -0
- package/components/sankey/modules/node.d.ts +10 -0
- package/components/sankey/modules/node.js +156 -0
- package/components/sankey/modules/node.js.map +1 -0
- package/components/sankey/style.d.ts +20 -0
- package/components/sankey/style.js +164 -0
- package/components/sankey/style.js.map +1 -0
- package/components/sankey/types.d.ts +84 -0
- package/components/sankey/types.js +34 -0
- package/components/sankey/types.js.map +1 -0
- package/components/scatter/config.d.ts +44 -0
- package/components/scatter/config.js +23 -0
- package/components/scatter/config.js.map +1 -0
- package/components/scatter/index.d.ts +19 -0
- package/components/scatter/index.js +123 -0
- package/components/scatter/index.js.map +1 -0
- package/components/scatter/modules/point.d.ts +7 -0
- package/components/scatter/modules/point.js +98 -0
- package/components/scatter/modules/point.js.map +1 -0
- package/components/scatter/style.d.ts +5 -0
- package/components/scatter/style.js +53 -0
- package/components/scatter/style.js.map +1 -0
- package/components/scatter/types.d.ts +13 -0
- package/components/stacked-bar/config.d.ts +38 -0
- package/components/stacked-bar/config.js +20 -0
- package/components/stacked-bar/config.js.map +1 -0
- package/components/stacked-bar/index.d.ts +27 -0
- package/components/stacked-bar/index.js +193 -0
- package/components/stacked-bar/index.js.map +1 -0
- package/components/stacked-bar/style.d.ts +5 -0
- package/components/stacked-bar/style.js +36 -0
- package/components/stacked-bar/style.js.map +1 -0
- package/components/stacked-bar/types.d.ts +5 -0
- package/components/timeline/config.d.ts +43 -0
- package/components/timeline/config.js +23 -0
- package/components/timeline/config.js.map +1 -0
- package/components/timeline/index.d.ts +43 -0
- package/components/timeline/index.js +235 -0
- package/components/timeline/index.js.map +1 -0
- package/components/timeline/style.d.ts +12 -0
- package/components/timeline/style.js +86 -0
- package/components/timeline/style.js.map +1 -0
- package/components/tooltip/config.d.ts +46 -0
- package/components/tooltip/config.js +19 -0
- package/components/tooltip/config.js.map +1 -0
- package/components/tooltip/index.d.ts +34 -0
- package/components/tooltip/index.js +147 -0
- package/components/tooltip/index.js.map +1 -0
- package/components/tooltip/style.js +72 -0
- package/components/tooltip/style.js.map +1 -0
- package/components/topojson-map/config.d.ts +99 -0
- package/components/topojson-map/config.js +42 -0
- package/components/topojson-map/config.js.map +1 -0
- package/components/topojson-map/index.d.ts +52 -0
- package/components/topojson-map/index.js +355 -0
- package/components/topojson-map/index.js.map +1 -0
- package/components/topojson-map/style.d.ts +11 -0
- package/components/topojson-map/style.js +97 -0
- package/components/topojson-map/style.js.map +1 -0
- package/components/topojson-map/types.d.ts +48 -0
- package/components/topojson-map/types.js +45 -0
- package/components/topojson-map/types.js.map +1 -0
- package/components/topojson-map/utils.d.ts +3 -0
- package/components/topojson-map/utils.js +30 -0
- package/components/topojson-map/utils.js.map +1 -0
- package/components/vis-controls/config.d.ts +12 -0
- package/components/vis-controls/config.js +13 -0
- package/components/vis-controls/config.js.map +1 -0
- package/components/vis-controls/index.d.ts +14 -0
- package/components/vis-controls/index.js +52 -0
- package/components/vis-controls/index.js.map +1 -0
- package/components/vis-controls/style.d.ts +11 -0
- package/components/vis-controls/style.js +75 -0
- package/components/vis-controls/style.js.map +1 -0
- package/components/vis-controls/types.d.ts +13 -0
- package/components/vis-controls/types.js +8 -0
- package/components/vis-controls/types.js.map +1 -0
- package/components/xy-labels/config.d.ts +48 -0
- package/components/xy-labels/config.js +25 -0
- package/components/xy-labels/config.js.map +1 -0
- package/components/xy-labels/index.d.ts +15 -0
- package/components/xy-labels/index.js +86 -0
- package/components/xy-labels/index.js.map +1 -0
- package/components/xy-labels/modules/label.d.ts +9 -0
- package/components/xy-labels/modules/label.js +105 -0
- package/components/xy-labels/modules/label.js.map +1 -0
- package/components/xy-labels/style.d.ts +5 -0
- package/components/xy-labels/style.js +53 -0
- package/components/xy-labels/style.js.map +1 -0
- package/components/xy-labels/types.d.ts +23 -0
- package/components/xy-labels/types.js +9 -0
- package/components/xy-labels/types.js.map +1 -0
- package/components.d.ts +52 -0
- package/containers/single-container/config.d.ts +12 -0
- package/containers/single-container/config.js +12 -0
- package/containers/single-container/config.js.map +1 -0
- package/containers/single-container/index.d.ts +17 -0
- package/containers/single-container/index.js +115 -0
- package/containers/single-container/index.js.map +1 -0
- package/containers/xy-container/config.d.ts +99 -0
- package/containers/xy-container/config.js +30 -0
- package/containers/xy-container/config.js.map +1 -0
- package/containers/xy-container/index.d.ts +33 -0
- package/containers/xy-container/index.js +322 -0
- package/containers/xy-container/index.js.map +1 -0
- package/containers.d.ts +6 -0
- package/core/component/config.d.ts +58 -0
- package/core/component/config.js +14 -0
- package/core/component/config.js.map +1 -0
- package/core/component/index.d.ts +38 -0
- package/core/component/index.js +112 -0
- package/core/component/index.js.map +1 -0
- package/core/component/types.d.ts +2 -0
- package/core/config/index.d.ts +3 -0
- package/core/config/index.js +16 -0
- package/core/config/index.js.map +1 -0
- package/core/container/config.d.ts +38 -0
- package/core/container/config.js +29 -0
- package/core/container/config.js.map +1 -0
- package/core/container/index.d.ts +25 -0
- package/core/container/index.js +92 -0
- package/core/container/index.js.map +1 -0
- package/core/xy-component/config.d.ts +38 -0
- package/core/xy-component/config.js +20 -0
- package/core/xy-component/config.js.map +1 -0
- package/core/xy-component/index.d.ts +25 -0
- package/core/xy-component/index.js +65 -0
- package/core/xy-component/index.js.map +1 -0
- package/data-models/core.d.ts +6 -0
- package/data-models/core.js +14 -0
- package/data-models/core.js.map +1 -0
- package/data-models/graph.d.ts +24 -0
- package/data-models/graph.js +101 -0
- package/data-models/graph.js.map +1 -0
- package/data-models/map-graph.d.ts +23 -0
- package/data-models/map-graph.js +59 -0
- package/data-models/map-graph.js.map +1 -0
- package/data-models/map.d.ts +5 -0
- package/data-models/map.js +12 -0
- package/data-models/map.js.map +1 -0
- package/data-models/series.d.ts +6 -0
- package/data-models/series.js +19 -0
- package/data-models/series.js.map +1 -0
- package/index.d.ts +4 -0
- package/index.js +49 -0
- package/index.js.map +1 -0
- package/maps/china-provinces.json.js +140373 -0
- package/maps/fr-regions.json.js +14162 -0
- package/maps/germany-regions.json.js +35760 -0
- package/maps/ind-regions.json.js +290584 -0
- package/maps/uk-regions.json.js +96233 -0
- package/maps/us-counties.json.js +206318 -0
- package/maps/us-states.json.js +16345 -0
- package/maps/world-110m-alpha.json.js +251366 -0
- package/maps/world-simple.json.js +89428 -0
- package/maps/world-simplest.json.js +28175 -0
- package/maps.d.ts +60 -0
- package/maps.js +23 -0
- package/package.json +58 -0
- package/styles/colors.d.ts +4 -0
- package/styles/colors.js +11 -0
- package/styles/colors.js.map +1 -0
- package/styles/css-variables.d.ts +2 -0
- package/styles/css-variables.js +16 -0
- package/styles/css-variables.js.map +1 -0
- package/types/accessor.d.ts +5 -0
- package/types/component.d.ts +13 -0
- package/types/component.js +14 -0
- package/types/component.js.map +1 -0
- package/types/curve.d.ts +40 -0
- package/types/curve.js +46 -0
- package/types/curve.js.map +1 -0
- package/types/data.d.ts +7 -0
- package/types/direction.d.ts +6 -0
- package/types/direction.js +10 -0
- package/types/direction.js.map +1 -0
- package/types/graph.d.ts +35 -0
- package/types/map.d.ts +4 -0
- package/types/misc.d.ts +8 -0
- package/types/position.d.ts +20 -0
- package/types/position.js +27 -0
- package/types/position.js.map +1 -0
- package/types/scale.d.ts +23 -0
- package/types/scale.js +27 -0
- package/types/scale.js.map +1 -0
- package/types/shape.d.ts +7 -0
- package/types/shape.js +11 -0
- package/types/shape.js.map +1 -0
- package/types/spacing.d.ts +6 -0
- package/types/symbol.d.ts +18 -0
- package/types/symbol.js +24 -0
- package/types/symbol.js.map +1 -0
- package/types/text.d.ts +38 -0
- package/types/text.js +31 -0
- package/types/text.js.map +1 -0
- package/types.d.ts +28 -0
- package/utils/color.d.ts +9 -0
- package/utils/color.js +26 -0
- package/utils/color.js.map +1 -0
- package/utils/d3.d.ts +3 -0
- package/utils/d3.js +16 -0
- package/utils/d3.js.map +1 -0
- package/utils/data.d.ts +123 -0
- package/utils/data.js +193 -0
- package/utils/data.js.map +1 -0
- package/utils/html.d.ts +1 -0
- package/utils/html.js +15 -0
- package/utils/html.js.map +1 -0
- package/utils/map.d.ts +2 -0
- package/utils/map.js +20 -0
- package/utils/map.js.map +1 -0
- package/utils/misc.d.ts +16 -0
- package/utils/misc.js +42 -0
- package/utils/misc.js.map +1 -0
- package/utils/path.d.ts +21 -0
- package/utils/path.js +144 -0
- package/utils/path.js.map +1 -0
- package/utils/scale.d.ts +1 -0
- package/utils/text.d.ts +17 -0
- package/utils/text.js +196 -0
- package/utils/text.js.map +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
https://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
© 2022 F5, Inc. https://www.f5.com/
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
|
191
|
+
|
|
192
|
+
This project uses multiple third-party components under different open-source
|
|
193
|
+
licences. See license.txt for more details.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { XYComponentConfigInterface, XYComponentConfig } from "../../core/xy-component/config";
|
|
2
|
+
import { CurveType } from "../../types/curve";
|
|
3
|
+
import { NumericAccessor, StringAccessor } from "../../types/accessor";
|
|
4
|
+
export interface AreaConfigInterface<Datum> extends XYComponentConfigInterface<Datum> {
|
|
5
|
+
/** Curve type from the CurveType enum. Default: `CurveType.MonotoneX` */
|
|
6
|
+
curveType?: CurveType;
|
|
7
|
+
/** Baseline value or accessor function. Default: `undefined` */
|
|
8
|
+
baseline?: NumericAccessor<Datum>;
|
|
9
|
+
/** Opacity value or accessor function. Default: `1` */
|
|
10
|
+
opacity?: NumericAccessor<Datum>;
|
|
11
|
+
/** Optional area cursor. String or accessor function. Default: `null` */
|
|
12
|
+
cursor?: StringAccessor<Datum[]>;
|
|
13
|
+
/** If an area is smaller than 1px, extend it to have 1px height.
|
|
14
|
+
* This setting is useful when some of the area values are zeros or very small so visually they become
|
|
15
|
+
* practically invisible, but you want to show that the data behind them exists and they're not just empty segments.
|
|
16
|
+
* Default: `false` */
|
|
17
|
+
minHeight1Px?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare class AreaConfig<Datum> extends XYComponentConfig<Datum> implements AreaConfigInterface<Datum> {
|
|
20
|
+
curveType: CurveType;
|
|
21
|
+
baseline: () => number;
|
|
22
|
+
opacity: number;
|
|
23
|
+
cursor: any;
|
|
24
|
+
minHeight1Px: boolean;
|
|
25
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { XYComponentConfig } from '../../core/xy-component/config.js';
|
|
2
|
+
import { CurveType } from '../../types/curve.js';
|
|
3
|
+
|
|
4
|
+
class AreaConfig extends XYComponentConfig {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.curveType = CurveType.MonotoneX;
|
|
8
|
+
this.baseline = () => 0;
|
|
9
|
+
this.opacity = 1;
|
|
10
|
+
this.cursor = null;
|
|
11
|
+
this.minHeight1Px = false;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { AreaConfig };
|
|
16
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../../src/components/area/config.ts"],"sourcesContent":["import { XYComponentConfigInterface, XYComponentConfig } from 'core/xy-component/config'\n\n// Types\nimport { CurveType } from 'types/curve'\nimport { NumericAccessor, StringAccessor } from 'types/accessor'\n\nexport interface AreaConfigInterface<Datum> extends XYComponentConfigInterface<Datum> {\n /** Curve type from the CurveType enum. Default: `CurveType.MonotoneX` */\n curveType?: CurveType;\n /** Baseline value or accessor function. Default: `undefined` */\n baseline?: NumericAccessor<Datum>;\n /** Opacity value or accessor function. Default: `1` */\n opacity?: NumericAccessor<Datum>;\n /** Optional area cursor. String or accessor function. Default: `null` */\n cursor?: StringAccessor<Datum[]>;\n /** If an area is smaller than 1px, extend it to have 1px height.\n * This setting is useful when some of the area values are zeros or very small so visually they become\n * practically invisible, but you want to show that the data behind them exists and they're not just empty segments.\n * Default: `false` */\n minHeight1Px?: boolean;\n}\n\nexport class AreaConfig<Datum> extends XYComponentConfig<Datum> implements AreaConfigInterface<Datum> {\n curveType = CurveType.MonotoneX\n baseline = (): number => 0\n opacity = 1\n cursor = null\n minHeight1Px = false\n}\n"],"names":[],"mappings":";;;AAsBM,MAAO,UAAkB,SAAQ,iBAAwB,CAAA;AAA/D,IAAA,WAAA,GAAA;;AACE,QAAA,IAAA,CAAA,SAAS,GAAG,SAAS,CAAC,SAAS,CAAA;AAC/B,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAc,CAAC,CAAA;QAC1B,IAAO,CAAA,OAAA,GAAG,CAAC,CAAA;QACX,IAAM,CAAA,MAAA,GAAG,IAAI,CAAA;QACb,IAAY,CAAA,YAAA,GAAG,KAAK,CAAA;KACrB;AAAA;;;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Area as AreaInterface } from 'd3-shape';
|
|
2
|
+
import { XYComponentCore } from "../../core/xy-component";
|
|
3
|
+
import { AreaDatum } from './types';
|
|
4
|
+
import { AreaConfig, AreaConfigInterface } from './config';
|
|
5
|
+
import * as s from './style';
|
|
6
|
+
export declare class Area<Datum> extends XYComponentCore<Datum> {
|
|
7
|
+
static selectors: typeof s;
|
|
8
|
+
stacked: boolean;
|
|
9
|
+
config: AreaConfig<Datum>;
|
|
10
|
+
areaGen: AreaInterface<AreaDatum>;
|
|
11
|
+
private _prevNegative;
|
|
12
|
+
events: {
|
|
13
|
+
[x: string]: {};
|
|
14
|
+
};
|
|
15
|
+
constructor(config?: AreaConfigInterface<Datum>);
|
|
16
|
+
_render(customDuration?: number): void;
|
|
17
|
+
getYDataExtent(scaleByVisibleData: boolean): number[];
|
|
18
|
+
_emptyPath(): string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
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('stroke', (d, i) => getColor(data, config.color, areaMaxIdx - i))
|
|
67
|
+
.style('cursor', (d, i) => getString(data, config.cursor, areaMaxIdx - i));
|
|
68
|
+
if (duration) {
|
|
69
|
+
const transition = areasMerged;
|
|
70
|
+
transition.attrTween('d', (d, i, el) => {
|
|
71
|
+
const previous = select(el[i]).attr('d');
|
|
72
|
+
const next = this.areaGen(d) || this._emptyPath();
|
|
73
|
+
return interpolatePath(previous, next);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
areasMerged.attr('d', d => this.areaGen(d) || this._emptyPath());
|
|
78
|
+
}
|
|
79
|
+
smartTransition(areas.exit(), duration)
|
|
80
|
+
.style('opacity', 0)
|
|
81
|
+
.remove();
|
|
82
|
+
}
|
|
83
|
+
getYDataExtent(scaleByVisibleData) {
|
|
84
|
+
const { config, datamodel } = this;
|
|
85
|
+
const yAccessors = (isArray(config.y) ? config.y : [config.y]);
|
|
86
|
+
const data = scaleByVisibleData ? filterDataByRange(datamodel.data, this.xScale.domain(), config.x) : datamodel.data;
|
|
87
|
+
return getStackedExtent(data, config.baseline, ...yAccessors);
|
|
88
|
+
}
|
|
89
|
+
_emptyPath() {
|
|
90
|
+
const xRange = this.xScale.range();
|
|
91
|
+
const yDomain = this.yScale.domain();
|
|
92
|
+
const y0 = this.yScale((yDomain[0] + yDomain[1]) / 2);
|
|
93
|
+
const y1 = y0;
|
|
94
|
+
return this.areaGen([
|
|
95
|
+
{ y0, y1, x: xRange[0] },
|
|
96
|
+
{ y0, y1, x: xRange[1] },
|
|
97
|
+
]);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
Area.selectors = style;
|
|
101
|
+
|
|
102
|
+
export { Area };
|
|
103
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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> {\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('stroke', (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,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AC,GAAG,SAAS,CAAC,IAAI,CAAA;QACxI,OAAO,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,EAAE,GAAG,UAAU,CAAC,CAAA;KAC9D;IAED,UAAU,GAAA;QACR,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;QAClC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAc,CAAA;QAEhD,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;QACrD,MAAM,EAAE,GAAG,EAAE,CAAA;QAEb,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE;YACxB,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE;AACzB,SAAA,CAAC,CAAA;KACH;;AAzGM,IAAS,CAAA,SAAA,GAAGC,KAAC;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { injectGlobal, css } from '@emotion/css';
|
|
2
|
+
|
|
3
|
+
const globalStyles = injectGlobal `
|
|
4
|
+
:root {
|
|
5
|
+
--vis-area-cursor: default;
|
|
6
|
+
--vis-area-fill-opacity: 1;
|
|
7
|
+
--vis-area-stroke-width: 0px;
|
|
8
|
+
--vis-area-stroke-dasharray: none;
|
|
9
|
+
--vis-area-stroke-opacity: 1;
|
|
10
|
+
--vis-area-hover-fill-opacity: var(--vis-area-fill-opacity);
|
|
11
|
+
--vis-area-hover-stroke-width: var(--vis-area-stroke-width);
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
const root = css `
|
|
15
|
+
label: area-component;
|
|
16
|
+
`;
|
|
17
|
+
const area = css `
|
|
18
|
+
label: area;
|
|
19
|
+
cursor: var(--vis-area-cursor);
|
|
20
|
+
fill-opacity: var(--vis-area-fill-opacity);
|
|
21
|
+
stroke-width: var(--vis-area-stroke-width);
|
|
22
|
+
stroke-dasharray: var(--vis-area-stroke-dasharray);
|
|
23
|
+
stroke-opacity: var(--vis-area-stroke-opacity);
|
|
24
|
+
|
|
25
|
+
&:hover {
|
|
26
|
+
fill-opacity: var(--vis-area-hover-fill-opacity);
|
|
27
|
+
stroke-width: var(--vis-area-hover-stroke-width);
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
|
|
31
|
+
export { area, globalStyles, root };
|
|
32
|
+
//# sourceMappingURL=style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.js","sources":["../../../src/components/area/style.ts"],"sourcesContent":["import { css, injectGlobal } from '@emotion/css'\n\nexport const globalStyles = injectGlobal`\n :root {\n --vis-area-cursor: default;\n --vis-area-fill-opacity: 1;\n --vis-area-stroke-width: 0px;\n --vis-area-stroke-dasharray: none;\n --vis-area-stroke-opacity: 1;\n --vis-area-hover-fill-opacity: var(--vis-area-fill-opacity);\n --vis-area-hover-stroke-width: var(--vis-area-stroke-width);\n }\n`\n\nexport const root = css`\n label: area-component;\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-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":";;AAEO,MAAM,YAAY,GAAG,YAAY,CAAA,CAAA;;;;;;;;;;EAUvC;AAEM,MAAM,IAAI,GAAG,GAAG,CAAA,CAAA;;EAEtB;AAEM,MAAM,IAAI,GAAG,GAAG,CAAA,CAAA;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,74 @@
|
|
|
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 | Date, i: number, ticks: (number | 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 number of characters for tick text wrapping. Default: `undefined` */
|
|
35
|
+
tickTextLength?: number;
|
|
36
|
+
/** Maximum width in pixels for the tick text to be wrapped or trimmed. Default: `undefined` */
|
|
37
|
+
tickTextWidth?: number;
|
|
38
|
+
/** Tick text wrapping separator. String or array of strings. Default: `' '` */
|
|
39
|
+
tickTextSeparator?: string | string[];
|
|
40
|
+
/** Force word break for ticks when they don't fit. Default: `false` */
|
|
41
|
+
tickTextForceWordBreak?: boolean;
|
|
42
|
+
/** Tick text trim mode: `TrimMode.Start`, `TrimMode.Middle` or `TrimMode.End`. Default: `TrimMode.Middle` */
|
|
43
|
+
tickTextTrimType?: TrimMode | string;
|
|
44
|
+
/** Font size of the tick text as CSS string. Default: `null` */
|
|
45
|
+
tickTextFontSize?: string | null;
|
|
46
|
+
/** Text alignment for ticks: `TextAlign.Left`, `TextAlign.Center` or `TextAlign.Right`. Default: `undefined` */
|
|
47
|
+
tickTextAlign?: TextAlign;
|
|
48
|
+
/** The spacing in pixels between the tick and it's label. Default: `8` */
|
|
49
|
+
tickPadding?: number;
|
|
50
|
+
}
|
|
51
|
+
export declare class AxisConfig<Datum> extends XYComponentConfig<Datum> implements AxisConfigInterface<Datum> {
|
|
52
|
+
position: any;
|
|
53
|
+
type: any;
|
|
54
|
+
label: any;
|
|
55
|
+
labelFontSize: any;
|
|
56
|
+
gridLine: boolean;
|
|
57
|
+
tickLine: boolean;
|
|
58
|
+
domainLine: boolean;
|
|
59
|
+
numTicks: any;
|
|
60
|
+
minMaxTicksOnly: boolean;
|
|
61
|
+
tickTextLength: any;
|
|
62
|
+
tickTextWidth: any;
|
|
63
|
+
tickTextSeparator: string;
|
|
64
|
+
tickTextForceWordBreak: boolean;
|
|
65
|
+
tickTextTrimType: TrimMode;
|
|
66
|
+
tickTextFitMode: FitMode;
|
|
67
|
+
tickTextFontSize: any;
|
|
68
|
+
tickTextAlign: any;
|
|
69
|
+
labelMargin: number;
|
|
70
|
+
tickFormat: any;
|
|
71
|
+
tickValues: any;
|
|
72
|
+
fullSize: boolean;
|
|
73
|
+
tickPadding: number;
|
|
74
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
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.tickTextLength = undefined;
|
|
17
|
+
this.tickTextWidth = undefined;
|
|
18
|
+
this.tickTextSeparator = ' ';
|
|
19
|
+
this.tickTextForceWordBreak = false;
|
|
20
|
+
this.tickTextTrimType = TrimMode.Middle;
|
|
21
|
+
this.tickTextFitMode = FitMode.Wrap;
|
|
22
|
+
this.tickTextFontSize = null;
|
|
23
|
+
this.tickTextAlign = undefined;
|
|
24
|
+
this.labelMargin = 8;
|
|
25
|
+
this.tickFormat = undefined;
|
|
26
|
+
this.tickValues = undefined;
|
|
27
|
+
this.fullSize = true;
|
|
28
|
+
this.tickPadding = 8;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { AxisConfig };
|
|
33
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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 | Date, i: number, ticks: (number | 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 number of characters for tick text wrapping. Default: `undefined` */\n tickTextLength?: number;\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;\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 tickTextLength = undefined\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":";;;AAuDM,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,CAAC;QACrB,IAAe,CAAA,eAAA,GAAG,KAAK,CAAA;QACvB,IAAc,CAAA,cAAA,GAAG,SAAS,CAAA;QAC1B,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;;;;"}
|
|
@@ -0,0 +1,51 @@
|
|
|
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> {
|
|
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
|
+
[x: string]: {
|
|
21
|
+
mouseover: (d: any, event: MouseEvent) => void;
|
|
22
|
+
mouseout: (d: any, event: MouseEvent) => void;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
constructor(config?: AxisConfigInterface<Datum>);
|
|
26
|
+
/** Renders axis to an invisible grouped to calculate automatic chart margins */
|
|
27
|
+
preRender(): void;
|
|
28
|
+
getPosition(): Position;
|
|
29
|
+
_getAxisSize(selection: Selection<SVGGElement, unknown, SVGGElement, undefined>): SVGRect;
|
|
30
|
+
_getRequiredMargin(axisSize?: DOMRect): Spacing;
|
|
31
|
+
getRequiredMargin(): Spacing;
|
|
32
|
+
/** Calculates axis transform:translate offset based on passed container margins */
|
|
33
|
+
getOffset(containerMargin: Spacing): {
|
|
34
|
+
left: number;
|
|
35
|
+
top: number;
|
|
36
|
+
};
|
|
37
|
+
_render(duration?: number, selection?: Selection<SVGGElement, unknown, SVGGElement, unknown>): void;
|
|
38
|
+
_buildAxis(): D3Axis<any>;
|
|
39
|
+
_buildGrid(): D3Axis<any>;
|
|
40
|
+
_renderAxis(selection?: Selection<SVGGElement, unknown, SVGGElement, unknown>, duration?: number): void;
|
|
41
|
+
_getNumTicks(): number;
|
|
42
|
+
_getConfiguredTickValues(): number[] | null;
|
|
43
|
+
_getFullDomainPath(tickSize?: number): string;
|
|
44
|
+
_renderAxisLabel(selection?: Selection<SVGGElement, unknown, SVGGElement, unknown>): void;
|
|
45
|
+
_getLabelDY(): number;
|
|
46
|
+
_alignTickLabels(): void;
|
|
47
|
+
_getTickTextAnchor(textAlign: TextAlign): string;
|
|
48
|
+
_getYTickTextTranslate(textAlign: TextAlign, axisPosition?: Position): number;
|
|
49
|
+
_onTickMouseOver(d: any, event: MouseEvent): void;
|
|
50
|
+
_onTickMouseOut(d: any, event: MouseEvent): void;
|
|
51
|
+
}
|