semiotic 2.0.3 → 3.0.0-beta.1
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/CLAUDE.md +530 -0
- package/README.md +190 -37
- package/ai/cli.js +48 -0
- package/ai/dist/ai/componentRegistry.js +45 -0
- package/ai/dist/ai/mcp-server.js +99 -0
- package/ai/dist/ai/renderHOCToSVG.js +77 -0
- package/ai/dist/src/components/Annotation.js +358 -0
- package/ai/dist/src/components/AnnotationLayer/AnnotationLayer.js +369 -0
- package/ai/dist/src/components/Axis/Axis.js +373 -0
- package/ai/dist/src/components/Axis/axisTitle.js +14 -0
- package/ai/dist/src/components/Axis/index.js +7 -0
- package/ai/dist/src/components/Axis/summaryGraphic.js +37 -0
- package/ai/dist/src/components/Brush.js +84 -0
- package/ai/dist/src/components/DividedLine.js +65 -0
- package/ai/dist/src/components/FacetController.js +259 -0
- package/ai/dist/src/components/Frame.js +139 -0
- package/ai/dist/src/components/InteractionLayer.js +328 -0
- package/ai/dist/src/components/Legend.js +140 -0
- package/ai/dist/src/components/MiniMap.js +75 -0
- package/ai/dist/src/components/MinimapXYFrame.js +99 -0
- package/ai/dist/src/components/NetworkFrame.js +335 -0
- package/ai/dist/src/components/OrdinalFrame.js +437 -0
- package/ai/dist/src/components/ResponsiveFrame.js +68 -0
- package/ai/dist/src/components/ResponsiveMinimapXYFrame.js +11 -0
- package/ai/dist/src/components/ResponsiveNetworkFrame.js +11 -0
- package/ai/dist/src/components/ResponsiveOrdinalFrame.js +11 -0
- package/ai/dist/src/components/ResponsiveXYFrame.js +10 -0
- package/ai/dist/src/components/SparkFrame.js +113 -0
- package/ai/dist/src/components/SparkNetworkFrame.js +11 -0
- package/ai/dist/src/components/SparkOrdinalFrame.js +11 -0
- package/ai/dist/src/components/SparkXYFrame.js +11 -0
- package/ai/dist/src/components/Tooltip/Tooltip.js +304 -0
- package/ai/dist/src/components/TooltipPositioner/index.js +132 -0
- package/ai/dist/src/components/VisualizationLayer.js +395 -0
- package/ai/dist/src/components/XYFrame.js +524 -0
- package/ai/dist/src/components/annotationLayerBehavior/annotationHandling.js +73 -0
- package/ai/dist/src/components/annotationLayerBehavior/d3labeler.js +254 -0
- package/ai/dist/src/components/annotationRules/baseRules.js +150 -0
- package/ai/dist/src/components/annotationRules/networkframeRules.js +198 -0
- package/ai/dist/src/components/annotationRules/orframeRules.js +695 -0
- package/ai/dist/src/components/annotationRules/xyframeRules.js +299 -0
- package/ai/dist/src/components/batchWork.js +35 -0
- package/ai/dist/src/components/charts/index.js +96 -0
- package/ai/dist/src/components/charts/network/ChordDiagram.js +245 -0
- package/ai/dist/src/components/charts/network/CirclePack.js +177 -0
- package/ai/dist/src/components/charts/network/ForceDirectedGraph.js +248 -0
- package/ai/dist/src/components/charts/network/SankeyDiagram.js +305 -0
- package/ai/dist/src/components/charts/network/TreeDiagram.js +268 -0
- package/ai/dist/src/components/charts/network/Treemap.js +177 -0
- package/ai/dist/src/components/charts/ordinal/BarChart.js +191 -0
- package/ai/dist/src/components/charts/ordinal/BoxPlot.js +235 -0
- package/ai/dist/src/components/charts/ordinal/DonutChart.js +178 -0
- package/ai/dist/src/components/charts/ordinal/DotPlot.js +194 -0
- package/ai/dist/src/components/charts/ordinal/GroupedBarChart.js +194 -0
- package/ai/dist/src/components/charts/ordinal/PieChart.js +155 -0
- package/ai/dist/src/components/charts/ordinal/StackedBarChart.js +213 -0
- package/ai/dist/src/components/charts/ordinal/SwarmPlot.js +219 -0
- package/ai/dist/src/components/charts/realtime/RealtimeBarChart.js +91 -0
- package/ai/dist/src/components/charts/realtime/RealtimeLineChart.js +73 -0
- package/ai/dist/src/components/charts/realtime/RealtimeSwarmChart.js +85 -0
- package/ai/dist/src/components/charts/realtime/RealtimeWaterfallChart.js +86 -0
- package/ai/dist/src/components/charts/shared/ChartError.js +72 -0
- package/ai/dist/src/components/charts/shared/colorUtils.js +138 -0
- package/ai/dist/src/components/charts/shared/formatUtils.js +176 -0
- package/ai/dist/src/components/charts/shared/hooks.js +49 -0
- package/ai/dist/src/components/charts/shared/legendUtils.js +57 -0
- package/ai/dist/src/components/charts/shared/types.js +2 -0
- package/ai/dist/src/components/charts/shared/validateChartData.js +82 -0
- package/ai/dist/src/components/charts/shared/validateProps.js +640 -0
- package/ai/dist/src/components/charts/xy/AreaChart.js +220 -0
- package/ai/dist/src/components/charts/xy/BubbleChart.js +222 -0
- package/ai/dist/src/components/charts/xy/Heatmap.js +230 -0
- package/ai/dist/src/components/charts/xy/LineChart.js +302 -0
- package/ai/dist/src/components/charts/xy/Scatterplot.js +136 -0
- package/ai/dist/src/components/charts/xy/StackedAreaChart.js +220 -0
- package/ai/dist/src/components/constants/coordinateNames.js +11 -0
- package/ai/dist/src/components/constants/frame_props.js +251 -0
- package/ai/dist/src/components/constants/jsx.js +71 -0
- package/ai/dist/src/components/data/dataFunctions.js +473 -0
- package/ai/dist/src/components/data/multiAccessorUtils.js +14 -0
- package/ai/dist/src/components/data/networkPipelineCache.js +43 -0
- package/ai/dist/src/components/data/ordinalPipelineCache.js +53 -0
- package/ai/dist/src/components/data/unflowedFunctions.js +5 -0
- package/ai/dist/src/components/data/xyPipelineCache.js +49 -0
- package/ai/dist/src/components/generic_utilities/functions.js +5 -0
- package/ai/dist/src/components/index.js +145 -0
- package/ai/dist/src/components/interactionLayerBehavior/InteractionCanvas.js +128 -0
- package/ai/dist/src/components/processing/InteractionItems.js +223 -0
- package/ai/dist/src/components/processing/hierarchyUtils.js +104 -0
- package/ai/dist/src/components/processing/layouts/chordLayout.js +58 -0
- package/ai/dist/src/components/processing/layouts/forceLayout.js +142 -0
- package/ai/dist/src/components/processing/layouts/hierarchyLayout.js +31 -0
- package/ai/dist/src/components/processing/layouts/index.js +32 -0
- package/ai/dist/src/components/processing/layouts/sankeyLayout.js +96 -0
- package/ai/dist/src/components/processing/layouts/simpleLayouts.js +34 -0
- package/ai/dist/src/components/processing/layouts/types.js +2 -0
- package/ai/dist/src/components/processing/network.js +771 -0
- package/ai/dist/src/components/processing/networkDefaults.js +39 -0
- package/ai/dist/src/components/processing/networkLayoutHelpers.js +98 -0
- package/ai/dist/src/components/processing/ordinal.js +889 -0
- package/ai/dist/src/components/processing/ordinalConstants.js +23 -0
- package/ai/dist/src/components/processing/ordinalOverlays.js +88 -0
- package/ai/dist/src/components/processing/ordinalRenderPipeline.js +196 -0
- package/ai/dist/src/components/processing/xyDrawing.js +484 -0
- package/ai/dist/src/components/realtime/BinAccumulator.js +36 -0
- package/ai/dist/src/components/realtime/IncrementalExtent.js +55 -0
- package/ai/dist/src/components/realtime/RealtimeFrame.js +710 -0
- package/ai/dist/src/components/realtime/RingBuffer.js +104 -0
- package/ai/dist/src/components/realtime/renderers/barRenderer.js +133 -0
- package/ai/dist/src/components/realtime/renderers/candlestickRenderer.js +7 -0
- package/ai/dist/src/components/realtime/renderers/lineRenderer.js +164 -0
- package/ai/dist/src/components/realtime/renderers/swarmRenderer.js +91 -0
- package/ai/dist/src/components/realtime/renderers/types.js +2 -0
- package/ai/dist/src/components/realtime/renderers/waterfallRenderer.js +163 -0
- package/ai/dist/src/components/realtime/types.js +2 -0
- package/ai/dist/src/components/semiotic-ai.js +66 -0
- package/ai/dist/src/components/semiotic-network.js +30 -0
- package/ai/dist/src/components/semiotic-ordinal.js +28 -0
- package/ai/dist/src/components/semiotic-realtime.js +37 -0
- package/ai/dist/src/components/semiotic-server.js +8 -0
- package/ai/dist/src/components/semiotic-xy.js +41 -0
- package/ai/dist/src/components/semiotic.js +101 -0
- package/ai/dist/src/components/server/renderToStaticSVG.js +392 -0
- package/ai/dist/src/components/store/TooltipStore.js +13 -0
- package/ai/dist/src/components/store/createStore.js +77 -0
- package/ai/dist/src/components/svg/SvgHelper.js +308 -0
- package/ai/dist/src/components/svg/areaDrawing.js +312 -0
- package/ai/dist/src/components/svg/boxplotRenderer.js +441 -0
- package/ai/dist/src/components/svg/bucketizedRenderer.js +677 -0
- package/ai/dist/src/components/svg/ckbinsRenderer.js +92 -0
- package/ai/dist/src/components/svg/ckmeans.js +238 -0
- package/ai/dist/src/components/svg/contourLayout.js +73 -0
- package/ai/dist/src/components/svg/contourRenderer.js +53 -0
- package/ai/dist/src/components/svg/edgeGenerators.js +181 -0
- package/ai/dist/src/components/svg/frameFunctions.js +579 -0
- package/ai/dist/src/components/svg/graphAlgorithms.js +138 -0
- package/ai/dist/src/components/svg/hexbinLayout.js +163 -0
- package/ai/dist/src/components/svg/lineDrawing.js +427 -0
- package/ai/dist/src/components/svg/networkDrawing.js +207 -0
- package/ai/dist/src/components/svg/nodeGenerators.js +131 -0
- package/ai/dist/src/components/svg/pieceDrawing.js +110 -0
- package/ai/dist/src/components/svg/pieceLayouts.js +588 -0
- package/ai/dist/src/components/svg/sankeyLinks.js +143 -0
- package/ai/dist/src/components/svg/summaryAxis.js +48 -0
- package/ai/dist/src/components/svg/summaryLayouts.js +202 -0
- package/ai/dist/src/components/svg/swarmLayout.js +128 -0
- package/ai/dist/src/components/types/annotationTypes.js +2 -0
- package/ai/dist/src/components/types/canvasTypes.js +2 -0
- package/ai/dist/src/components/types/generalTypes.js +2 -0
- package/ai/dist/src/components/types/interactionTypes.js +2 -0
- package/ai/dist/src/components/types/legendTypes.js +2 -0
- package/ai/dist/src/components/types/networkTypes.js +2 -0
- package/ai/dist/src/components/types/ordinalTypes.js +2 -0
- package/ai/dist/src/components/types/xyTypes.js +2 -0
- package/ai/dist/src/components/useBoundingRect.js +24 -0
- package/ai/dist/src/components/useDerivedStateFromProps.js +25 -0
- package/ai/dist/src/components/useLegacyUnmountCallback.js +21 -0
- package/ai/dist/src/components/visualizationLayerBehavior/axis.js +249 -0
- package/ai/dist/src/components/visualizationLayerBehavior/general.js +435 -0
- package/ai/dist/src/setupTests.js +4 -0
- package/ai/examples.md +394 -0
- package/ai/schema.json +1178 -0
- package/ai/system-prompt.md +38 -0
- package/dist/AnnotationLayer/AnnotationLayer.d.ts +0 -1
- package/dist/Axis/axisTitle.d.ts +3 -3
- package/dist/Axis/summaryGraphic.d.ts +1 -1
- package/dist/FacetController.d.ts +1 -1
- package/dist/MinimapXYFrame.d.ts +2 -2
- package/dist/NetworkFrame.d.ts +5 -1
- package/dist/OrdinalFrame.d.ts +5 -1
- package/dist/ResponsiveFrame.d.ts +2 -2
- package/dist/ResponsiveMinimapXYFrame.d.ts +3 -6
- package/dist/ResponsiveNetworkFrame.d.ts +3 -6
- package/dist/ResponsiveOrdinalFrame.d.ts +3 -6
- package/dist/ResponsiveXYFrame.d.ts +3 -6
- package/dist/SparkFrame.d.ts +1 -1
- package/dist/SparkNetworkFrame.d.ts +3 -3
- package/dist/SparkOrdinalFrame.d.ts +3 -3
- package/dist/SparkXYFrame.d.ts +3 -3
- package/dist/Tooltip/Tooltip.d.ts +141 -0
- package/dist/TooltipPositioner/index.d.ts +1 -1
- package/dist/VisualizationLayer.d.ts +3 -3
- package/dist/XYFrame.d.ts +5 -1
- package/dist/annotationLayerBehavior/annotationHandling.d.ts +2 -2
- package/dist/annotationRules/networkframeRules.d.ts +2 -2
- package/dist/annotationRules/orframeRules.d.ts +2 -4
- package/dist/annotationRules/xyframeRules.d.ts +2 -2
- package/dist/batchWork.d.ts +1 -1
- package/dist/charts/index.d.ts +62 -0
- package/dist/charts/network/ChordDiagram.d.ts +181 -0
- package/dist/charts/network/CirclePack.d.ts +103 -0
- package/dist/charts/network/ForceDirectedGraph.d.ts +192 -0
- package/dist/charts/network/SankeyDiagram.d.ts +195 -0
- package/dist/charts/network/TreeDiagram.d.ts +200 -0
- package/dist/charts/network/Treemap.d.ts +98 -0
- package/dist/charts/ordinal/BarChart.d.ts +119 -0
- package/dist/charts/ordinal/BoxPlot.d.ts +125 -0
- package/dist/charts/ordinal/DonutChart.d.ts +95 -0
- package/dist/charts/ordinal/DotPlot.d.ts +128 -0
- package/dist/charts/ordinal/GroupedBarChart.d.ts +113 -0
- package/dist/charts/ordinal/PieChart.d.ts +83 -0
- package/dist/charts/ordinal/StackedBarChart.d.ts +119 -0
- package/dist/charts/ordinal/SwarmPlot.d.ts +137 -0
- package/dist/charts/realtime/RealtimeBarChart.d.ts +102 -0
- package/dist/charts/realtime/RealtimeLineChart.d.ts +78 -0
- package/dist/charts/realtime/RealtimeSwarmChart.d.ts +88 -0
- package/dist/charts/realtime/RealtimeWaterfallChart.d.ts +85 -0
- package/dist/charts/shared/ChartError.d.ts +19 -0
- package/dist/charts/shared/colorUtils.d.ts +62 -0
- package/dist/charts/shared/formatUtils.d.ts +82 -0
- package/dist/charts/shared/hooks.d.ts +20 -0
- package/dist/charts/shared/legendUtils.d.ts +32 -0
- package/dist/charts/shared/types.d.ts +58 -0
- package/dist/charts/shared/validateChartData.d.ts +41 -0
- package/dist/charts/shared/validateProps.d.ts +18 -0
- package/dist/charts/xy/AreaChart.d.ts +127 -0
- package/dist/charts/xy/BubbleChart.d.ts +157 -0
- package/dist/charts/xy/Heatmap.d.ts +153 -0
- package/dist/charts/xy/LineChart.d.ts +193 -0
- package/dist/charts/xy/Scatterplot.d.ts +50 -0
- package/dist/charts/xy/StackedAreaChart.d.ts +131 -0
- package/dist/constants/frame_props.d.ts +9 -0
- package/dist/constants/jsx.d.ts +2 -2
- package/dist/data/dataFunctions.d.ts +11 -12
- package/dist/data/networkPipelineCache.d.ts +27 -0
- package/dist/data/ordinalPipelineCache.d.ts +33 -0
- package/dist/data/xyPipelineCache.d.ts +35 -0
- package/dist/index.d.ts +70 -62
- package/dist/interactionLayerBehavior/InteractionCanvas.d.ts +1 -1
- package/dist/network.js +8520 -0
- package/dist/network.js.map +1 -0
- package/dist/network.min.js +1 -0
- package/dist/network.module.js +8484 -0
- package/dist/network.module.js.map +1 -0
- package/dist/network.module.min.js +1 -0
- package/dist/ordinal.js +9276 -0
- package/dist/ordinal.js.map +1 -0
- package/dist/ordinal.min.js +1 -0
- package/dist/ordinal.module.js +9242 -0
- package/dist/ordinal.module.js.map +1 -0
- package/dist/ordinal.module.min.js +1 -0
- package/dist/processing/InteractionItems.d.ts +5 -4
- package/dist/processing/hierarchyUtils.d.ts +16 -0
- package/dist/processing/layouts/chordLayout.d.ts +2 -0
- package/dist/processing/layouts/forceLayout.d.ts +3 -0
- package/dist/processing/layouts/hierarchyLayout.d.ts +10 -0
- package/dist/processing/layouts/index.d.ts +8 -0
- package/dist/processing/layouts/sankeyLayout.d.ts +8 -0
- package/dist/processing/layouts/simpleLayouts.d.ts +7 -0
- package/dist/processing/layouts/types.d.ts +17 -0
- package/dist/processing/network.d.ts +25 -28
- package/dist/processing/networkDefaults.d.ts +36 -0
- package/dist/processing/networkLayoutHelpers.d.ts +54 -0
- package/dist/processing/ordinal.d.ts +43 -43
- package/dist/processing/ordinalConstants.d.ts +33 -0
- package/dist/processing/ordinalOverlays.d.ts +33 -0
- package/dist/processing/ordinalRenderPipeline.d.ts +148 -0
- package/dist/processing/xyDrawing.d.ts +46 -41
- package/dist/realtime/BinAccumulator.d.ts +8 -0
- package/dist/realtime/IncrementalExtent.d.ts +13 -0
- package/dist/realtime/RealtimeFrame.d.ts +4 -0
- package/dist/realtime/RingBuffer.d.ts +19 -0
- package/dist/realtime/renderers/barRenderer.d.ts +2 -0
- package/dist/realtime/renderers/candlestickRenderer.d.ts +2 -0
- package/dist/realtime/renderers/lineRenderer.d.ts +2 -0
- package/dist/realtime/renderers/swarmRenderer.d.ts +2 -0
- package/dist/realtime/renderers/types.d.ts +9 -0
- package/dist/realtime/renderers/waterfallRenderer.d.ts +3 -0
- package/dist/realtime/types.d.ts +113 -0
- package/dist/realtime.js +1598 -0
- package/dist/realtime.js.map +1 -0
- package/dist/realtime.min.js +1 -0
- package/dist/realtime.module.js +1566 -0
- package/dist/realtime.module.js.map +1 -0
- package/dist/realtime.module.min.js +1 -0
- package/dist/semiotic-ai.d.ts +28 -0
- package/dist/semiotic-ai.js +18722 -0
- package/dist/semiotic-ai.js.map +1 -0
- package/dist/semiotic-ai.min.js +1 -0
- package/dist/semiotic-ai.module.js +18668 -0
- package/dist/semiotic-ai.module.js.map +1 -0
- package/dist/semiotic-ai.module.min.js +1 -0
- package/dist/semiotic-network.d.ts +19 -0
- package/dist/semiotic-ordinal.d.ts +18 -0
- package/dist/semiotic-realtime.d.ts +23 -0
- package/dist/semiotic-server.d.ts +1 -0
- package/dist/semiotic-xy.d.ts +24 -0
- package/dist/semiotic.d.ts +19 -3
- package/dist/semiotic.js +18707 -12983
- package/dist/semiotic.js.map +1 -0
- package/dist/semiotic.min.js +1 -0
- package/dist/semiotic.module.js +18651 -12953
- package/dist/semiotic.module.js.map +1 -0
- package/dist/semiotic.module.min.js +1 -0
- package/dist/server/renderToStaticSVG.d.ts +9 -0
- package/dist/server.js +8360 -0
- package/dist/server.js.map +1 -0
- package/dist/server.min.js +1 -0
- package/dist/server.module.js +8331 -0
- package/dist/server.module.js.map +1 -0
- package/dist/server.module.min.js +1 -0
- package/dist/svg/SvgHelper.d.ts +1 -5
- package/dist/svg/areaDrawing.d.ts +3 -13
- package/dist/svg/boxplotRenderer.d.ts +15 -0
- package/dist/svg/bucketizedRenderer.d.ts +16 -0
- package/dist/svg/ckbinsRenderer.d.ts +20 -0
- package/dist/svg/contourLayout.d.ts +6 -0
- package/dist/svg/contourRenderer.d.ts +12 -0
- package/dist/svg/edgeGenerators.d.ts +51 -0
- package/dist/svg/frameFunctions.d.ts +17 -28
- package/dist/svg/graphAlgorithms.d.ts +14 -0
- package/dist/svg/hexbinLayout.d.ts +7 -0
- package/dist/svg/lineDrawing.d.ts +8 -8
- package/dist/svg/networkDrawing.d.ts +5 -123
- package/dist/svg/nodeGenerators.d.ts +58 -0
- package/dist/svg/pieceDrawing.d.ts +1 -2
- package/dist/svg/pieceLayouts.d.ts +5 -23
- package/dist/svg/sankeyLinks.d.ts +3 -0
- package/dist/svg/summaryAxis.d.ts +6 -0
- package/dist/svg/summaryLayouts.d.ts +36 -57
- package/dist/svg/swarmLayout.d.ts +13 -0
- package/dist/types/annotationTypes.d.ts +13 -18
- package/dist/types/canvasTypes.d.ts +1 -1
- package/dist/types/generalTypes.d.ts +37 -35
- package/dist/types/interactionTypes.d.ts +7 -9
- package/dist/types/legendTypes.d.ts +2 -2
- package/dist/types/networkTypes.d.ts +40 -30
- package/dist/types/ordinalTypes.d.ts +27 -18
- package/dist/types/xyTypes.d.ts +13 -16
- package/dist/useLegacyUnmountCallback.d.ts +2 -1
- package/dist/visualizationLayerBehavior/axis.d.ts +3 -5
- package/dist/visualizationLayerBehavior/general.d.ts +8 -12
- package/dist/xy.js +7944 -0
- package/dist/xy.js.map +1 -0
- package/dist/xy.min.js +1 -0
- package/dist/xy.module.js +7903 -0
- package/dist/xy.module.js.map +1 -0
- package/dist/xy.module.min.js +1 -0
- package/package.json +116 -66
- package/dist/AnnotationLayer/helpers.d.ts +0 -6
- package/dist/AnnotationLayer/index.d.ts +0 -2
- package/dist/Mark/Mark.d.ts +0 -3
- package/dist/Mark/Mark.types.d.ts +0 -10
- package/dist/Mark/constants/markTransition.d.ts +0 -10
- package/dist/Mark/markBehavior/drawing.d.ts +0 -13
- package/dist/SpanOrDiv.d.ts +0 -10
- package/dist/components/Annotation.d.ts +0 -3
- package/dist/components/AnnotationLayer/AnnotationLayer.d.ts +0 -26
- package/dist/components/Axis/Axis.d.ts +0 -7
- package/dist/components/Axis/axisTitle.d.ts +0 -10
- package/dist/components/Axis/index.d.ts +0 -2
- package/dist/components/Axis/summaryGraphic.d.ts +0 -17
- package/dist/components/Brush.d.ts +0 -12
- package/dist/components/DividedLine.d.ts +0 -16
- package/dist/components/FacetController.d.ts +0 -12
- package/dist/components/Frame.d.ts +0 -2
- package/dist/components/InteractionLayer.d.ts +0 -3
- package/dist/components/Legend.d.ts +0 -3
- package/dist/components/Mark/Mark.d.ts +0 -3
- package/dist/components/Mark/Mark.types.d.ts +0 -10
- package/dist/components/Mark/markBehavior/drawing.d.ts +0 -13
- package/dist/components/MiniMap.d.ts +0 -14
- package/dist/components/MinimapXYFrame.d.ts +0 -10
- package/dist/components/NetworkFrame.d.ts +0 -4
- package/dist/components/OrdinalFrame.d.ts +0 -4
- package/dist/components/ResponsiveFrame.d.ts +0 -22
- package/dist/components/ResponsiveMinimapXYFrame.d.ts +0 -6
- package/dist/components/ResponsiveNetworkFrame.d.ts +0 -6
- package/dist/components/ResponsiveOrdinalFrame.d.ts +0 -6
- package/dist/components/ResponsiveXYFrame.d.ts +0 -6
- package/dist/components/SpanOrDiv.d.ts +0 -10
- package/dist/components/SparkFrame.d.ts +0 -14
- package/dist/components/SparkNetworkFrame.d.ts +0 -5
- package/dist/components/SparkOrdinalFrame.d.ts +0 -5
- package/dist/components/SparkXYFrame.d.ts +0 -5
- package/dist/components/TooltipPositioner/index.d.ts +0 -7
- package/dist/components/VisualizationLayer.d.ts +0 -33
- package/dist/components/XYFrame.d.ts +0 -4
- package/dist/components/annotationLayerBehavior/annotationHandling.d.ts +0 -19
- package/dist/components/annotationLayerBehavior/d3labeler.d.ts +0 -9
- package/dist/components/annotationRules/baseRules.d.ts +0 -25
- package/dist/components/annotationRules/networkframeRules.d.ts +0 -48
- package/dist/components/annotationRules/orframeRules.d.ts +0 -105
- package/dist/components/annotationRules/xyframeRules.d.ts +0 -117
- package/dist/components/batchWork.d.ts +0 -6
- package/dist/components/constants/coordinateNames.d.ts +0 -8
- package/dist/components/constants/frame_props.d.ts +0 -4
- package/dist/components/constants/jsx.d.ts +0 -19
- package/dist/components/data/dataFunctions.d.ts +0 -46
- package/dist/components/data/multiAccessorUtils.d.ts +0 -1
- package/dist/components/data/unflowedFunctions.d.ts +0 -1
- package/dist/components/generic_utilities/functions.d.ts +0 -1
- package/dist/components/index.d.ts +0 -125
- package/dist/components/interactionLayerBehavior/InteractionCanvas.d.ts +0 -20
- package/dist/components/processing/InteractionItems.d.ts +0 -12
- package/dist/components/processing/network.d.ts +0 -114
- package/dist/components/processing/ordinal.d.ts +0 -102
- package/dist/components/processing/xyDrawing.d.ts +0 -135
- package/dist/components/semiotic.d.ts +0 -35
- package/dist/components/store/TooltipStore.d.ts +0 -2
- package/dist/components/store/createStore.d.ts +0 -1
- package/dist/components/svg/SvgHelper.d.ts +0 -37
- package/dist/components/svg/areaDrawing.d.ts +0 -31
- package/dist/components/svg/ckmeans.d.ts +0 -69
- package/dist/components/svg/frameFunctions.d.ts +0 -119
- package/dist/components/svg/lineDrawing.d.ts +0 -99
- package/dist/components/svg/networkDrawing.d.ts +0 -134
- package/dist/components/svg/pieceDrawing.d.ts +0 -13
- package/dist/components/svg/pieceLayouts.d.ts +0 -71
- package/dist/components/svg/summaryLayouts.d.ts +0 -74
- package/dist/components/types/annotationTypes.d.ts +0 -140
- package/dist/components/types/canvasTypes.d.ts +0 -9
- package/dist/components/types/generalTypes.d.ts +0 -236
- package/dist/components/types/interactionTypes.d.ts +0 -74
- package/dist/components/types/legendTypes.d.ts +0 -20
- package/dist/components/types/networkTypes.d.ts +0 -165
- package/dist/components/types/ordinalTypes.d.ts +0 -103
- package/dist/components/types/xyTypes.d.ts +0 -118
- package/dist/components/useBoundingRect.d.ts +0 -2
- package/dist/components/useDerivedStateFromProps.d.ts +0 -1
- package/dist/components/useLegacyUnmountCallback.d.ts +0 -1
- package/dist/components/visualizationLayerBehavior/axis.d.ts +0 -38
- package/dist/components/visualizationLayerBehavior/general.d.ts +0 -84
- package/dist/setupTests.d.ts +0 -1
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.groupBarMark = exports.drawAreaConnector = exports.arcTweener = void 0;
|
|
4
|
+
exports.linearRibbon = linearRibbon;
|
|
5
|
+
const d3_shape_1 = require("d3-shape");
|
|
6
|
+
const d3_interpolate_1 = require("d3-interpolate");
|
|
7
|
+
const emptyObjectReturnFn = () => ({});
|
|
8
|
+
const twoPI = Math.PI * 2;
|
|
9
|
+
const dedupeRibbonPoints = (weight = 1) => (p, c) => {
|
|
10
|
+
const l = p[p.length - 1];
|
|
11
|
+
if (!l ||
|
|
12
|
+
Math.round(l.x / weight) !== Math.round(c.x / weight) ||
|
|
13
|
+
Math.round(l.y / weight) !== Math.round(c.y / weight)) {
|
|
14
|
+
p.push(c);
|
|
15
|
+
}
|
|
16
|
+
return p;
|
|
17
|
+
};
|
|
18
|
+
const arcTweener = (oldProps, newProps) => {
|
|
19
|
+
const innerRadiusInterpolator = (0, d3_interpolate_1.interpolateNumber)(oldProps.innerRadius, newProps.innerRadius);
|
|
20
|
+
const outerRadiusInterpolator = (0, d3_interpolate_1.interpolateNumber)(oldProps.outerRadius, newProps.outerRadius);
|
|
21
|
+
const startAngleInterpolator = (0, d3_interpolate_1.interpolateNumber)(oldProps.startAngle, newProps.startAngle);
|
|
22
|
+
const endAngleInterpolator = (0, d3_interpolate_1.interpolateNumber)(oldProps.endAngle, newProps.endAngle);
|
|
23
|
+
return (t) => {
|
|
24
|
+
const sliceGenerator = (0, d3_shape_1.arc)()
|
|
25
|
+
.innerRadius(innerRadiusInterpolator(t))
|
|
26
|
+
.outerRadius(outerRadiusInterpolator(t));
|
|
27
|
+
return sliceGenerator({
|
|
28
|
+
startAngle: startAngleInterpolator(t),
|
|
29
|
+
endAngle: endAngleInterpolator(t)
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
exports.arcTweener = arcTweener;
|
|
34
|
+
const drawAreaConnector = ({ x1, x2, y1, y2, sizeX1, sizeY1, sizeX2, sizeY2 }) => {
|
|
35
|
+
return `M${x1},${y1}L${x2},${y2}L${x2 + sizeX2},${y2 + sizeY2}L${x1 + sizeX1},${y1 + sizeY1}Z`;
|
|
36
|
+
};
|
|
37
|
+
exports.drawAreaConnector = drawAreaConnector;
|
|
38
|
+
const groupBarMark = ({ bins, binMax, relativeBuckets, columnWidth, projection, adjustedSize, summaryI, summary, summaryStyle, type }) => {
|
|
39
|
+
const mappedBins = [];
|
|
40
|
+
const mappedPoints = [];
|
|
41
|
+
const actualMax = (relativeBuckets && relativeBuckets[summary.name]) || binMax;
|
|
42
|
+
const summaryElementStylingFn = type.elementStyleFn || emptyObjectReturnFn;
|
|
43
|
+
const barPadding = type.padding || 0;
|
|
44
|
+
bins.forEach((d, i) => {
|
|
45
|
+
const opacity = d.value / actualMax;
|
|
46
|
+
const additionalStyle = summaryElementStylingFn(d.value, opacity, d.pieces);
|
|
47
|
+
const finalStyle = type.type === "heatmap"
|
|
48
|
+
? { opacity: opacity, fill: summaryStyle.fill, ...additionalStyle }
|
|
49
|
+
: { ...summaryStyle, ...additionalStyle };
|
|
50
|
+
const thickness = Math.max(1, d.y1 - barPadding * 2);
|
|
51
|
+
const finalColumnWidth = type.type === "heatmap" ? columnWidth : columnWidth * opacity;
|
|
52
|
+
let yProp = d.y + barPadding;
|
|
53
|
+
let xProp = type.type === "heatmap" || type.flip
|
|
54
|
+
? -columnWidth / 2
|
|
55
|
+
: columnWidth / 2 - finalColumnWidth;
|
|
56
|
+
let height = thickness;
|
|
57
|
+
let width = finalColumnWidth;
|
|
58
|
+
let xOffset = type.type === "heatmap" ? finalColumnWidth / 2 : finalColumnWidth;
|
|
59
|
+
let yOffset = d.y1 / 2;
|
|
60
|
+
if (projection === "horizontal") {
|
|
61
|
+
yProp =
|
|
62
|
+
type.type === "heatmap"
|
|
63
|
+
? -columnWidth / 2
|
|
64
|
+
: type.flip
|
|
65
|
+
? -columnWidth / 2
|
|
66
|
+
: columnWidth / 2 - finalColumnWidth;
|
|
67
|
+
xProp = d.y - d.y1 + barPadding;
|
|
68
|
+
height = finalColumnWidth;
|
|
69
|
+
width = thickness;
|
|
70
|
+
yOffset =
|
|
71
|
+
type.type === "heatmap" ? finalColumnWidth / 2 : finalColumnWidth;
|
|
72
|
+
xOffset = d.y1 / 2;
|
|
73
|
+
}
|
|
74
|
+
else if (projection === "radial") {
|
|
75
|
+
const arcGenerator = (0, d3_shape_1.arc)()
|
|
76
|
+
.innerRadius(d.y / 2)
|
|
77
|
+
.outerRadius((d.y + d.y1) / 2);
|
|
78
|
+
const angle = summary.pct - summary.pct_padding;
|
|
79
|
+
let startAngle = summary.pct_middle - summary.pct_padding;
|
|
80
|
+
let endAngle = type.type === "heatmap"
|
|
81
|
+
? startAngle + angle
|
|
82
|
+
: startAngle + angle * opacity;
|
|
83
|
+
startAngle *= twoPI;
|
|
84
|
+
endAngle *= twoPI;
|
|
85
|
+
const arcAdjustX = adjustedSize[0] / 2;
|
|
86
|
+
const arcAdjustY = adjustedSize[1] / 2;
|
|
87
|
+
const arcTranslate = `translate(${arcAdjustX},${arcAdjustY})`;
|
|
88
|
+
const arcCenter = arcGenerator.centroid({ startAngle, endAngle });
|
|
89
|
+
mappedPoints.push({
|
|
90
|
+
key: summary.name,
|
|
91
|
+
value: d.value,
|
|
92
|
+
pieces: d.pieces.map((p) => p.piece),
|
|
93
|
+
label: "Heatmap",
|
|
94
|
+
x: arcCenter[0] + arcAdjustX,
|
|
95
|
+
y: arcCenter[1] + arcAdjustY
|
|
96
|
+
});
|
|
97
|
+
mappedBins.push({
|
|
98
|
+
markType: "path",
|
|
99
|
+
transform: arcTranslate,
|
|
100
|
+
key: `groupIcon-${summaryI}-${i}`,
|
|
101
|
+
d: arcGenerator({ startAngle, endAngle }),
|
|
102
|
+
style: finalStyle
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
if (projection !== "radial") {
|
|
106
|
+
mappedPoints.push({
|
|
107
|
+
key: summary.name,
|
|
108
|
+
value: d.value,
|
|
109
|
+
pieces: d.pieces.map((p) => p.piece),
|
|
110
|
+
label: "Heatmap",
|
|
111
|
+
x: xProp + xOffset,
|
|
112
|
+
y: yProp + yOffset
|
|
113
|
+
});
|
|
114
|
+
mappedBins.push({
|
|
115
|
+
markType: "rect",
|
|
116
|
+
key: `groupIcon-${summaryI}-${i}`,
|
|
117
|
+
x: xProp,
|
|
118
|
+
y: yProp,
|
|
119
|
+
height: height,
|
|
120
|
+
width: width,
|
|
121
|
+
style: finalStyle
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
return { marks: mappedBins, points: mappedPoints };
|
|
126
|
+
};
|
|
127
|
+
exports.groupBarMark = groupBarMark;
|
|
128
|
+
// FROM d3-svg-ribbon
|
|
129
|
+
function linearRibbon() {
|
|
130
|
+
const _lineConstructor = (0, d3_shape_1.line)();
|
|
131
|
+
let _xAccessor = function (d) {
|
|
132
|
+
return d.x;
|
|
133
|
+
};
|
|
134
|
+
let _yAccessor = function (d) {
|
|
135
|
+
return d.y;
|
|
136
|
+
};
|
|
137
|
+
let _rAccessor = function (d) {
|
|
138
|
+
return d.r;
|
|
139
|
+
};
|
|
140
|
+
let _interpolator = d3_shape_1.curveLinearClosed;
|
|
141
|
+
function _ribbon(pathData) {
|
|
142
|
+
if (pathData.multiple) {
|
|
143
|
+
const original_r = _rAccessor;
|
|
144
|
+
const parallelTotal = pathData.multiple.reduce((p, c) => p + c.weight, 0);
|
|
145
|
+
_rAccessor = () => parallelTotal;
|
|
146
|
+
const totalPoints = buildRibbon(pathData.points);
|
|
147
|
+
let currentPoints = totalPoints
|
|
148
|
+
.filter((d) => d.direction === "forward")
|
|
149
|
+
.reduce(dedupeRibbonPoints(), []);
|
|
150
|
+
const allRibbons = [];
|
|
151
|
+
pathData.multiple.forEach((siblingPath, siblingI) => {
|
|
152
|
+
_rAccessor = () => siblingPath.weight;
|
|
153
|
+
const currentRibbon = buildRibbon(currentPoints);
|
|
154
|
+
allRibbons.push(currentRibbon);
|
|
155
|
+
const nextSibling = pathData.multiple[siblingI + 1];
|
|
156
|
+
if (nextSibling) {
|
|
157
|
+
const currentLeftSide = currentRibbon
|
|
158
|
+
.reverse()
|
|
159
|
+
.filter((d) => d.direction === "back")
|
|
160
|
+
.reduce(dedupeRibbonPoints(), []);
|
|
161
|
+
_rAccessor = () => nextSibling.weight;
|
|
162
|
+
const leftHandInflatedRibbon = buildRibbon(currentLeftSide);
|
|
163
|
+
currentPoints = leftHandInflatedRibbon
|
|
164
|
+
.reverse()
|
|
165
|
+
.filter((d) => d.direction === "back")
|
|
166
|
+
.reduce(dedupeRibbonPoints(), []);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
_rAccessor = original_r;
|
|
170
|
+
return allRibbons.map((d) => _lineConstructor.x(_xAccessor).y(_yAccessor).curve(_interpolator)(d));
|
|
171
|
+
}
|
|
172
|
+
const bothPoints = buildRibbon(pathData).reduce(dedupeRibbonPoints(), []);
|
|
173
|
+
return _lineConstructor.x(_xAccessor).y(_yAccessor).curve(_interpolator)(bothPoints);
|
|
174
|
+
}
|
|
175
|
+
_ribbon.x = function (_value) {
|
|
176
|
+
if (!arguments.length)
|
|
177
|
+
return _xAccessor;
|
|
178
|
+
_xAccessor = _value;
|
|
179
|
+
return _ribbon;
|
|
180
|
+
};
|
|
181
|
+
_ribbon.y = function (_value) {
|
|
182
|
+
if (!arguments.length)
|
|
183
|
+
return _yAccessor;
|
|
184
|
+
_yAccessor = _value;
|
|
185
|
+
return _ribbon;
|
|
186
|
+
};
|
|
187
|
+
_ribbon.r = function (_value) {
|
|
188
|
+
if (!arguments.length)
|
|
189
|
+
return _rAccessor;
|
|
190
|
+
_rAccessor = _value;
|
|
191
|
+
return _ribbon;
|
|
192
|
+
};
|
|
193
|
+
_ribbon.interpolate = function (_value) {
|
|
194
|
+
if (!arguments.length)
|
|
195
|
+
return _interpolator;
|
|
196
|
+
_interpolator = _value;
|
|
197
|
+
return _ribbon;
|
|
198
|
+
};
|
|
199
|
+
return _ribbon;
|
|
200
|
+
function offsetEdge(d) {
|
|
201
|
+
const diffX = _yAccessor(d.target) - _yAccessor(d.source);
|
|
202
|
+
const diffY = _xAccessor(d.target) - _xAccessor(d.source);
|
|
203
|
+
const angle0 = Math.atan2(diffY, diffX) + Math.PI / 2;
|
|
204
|
+
const angle1 = angle0 + Math.PI * 0.5;
|
|
205
|
+
const angle2 = angle0 + Math.PI * 0.5;
|
|
206
|
+
const x1 = _xAccessor(d.source) + _rAccessor(d.source) * Math.cos(angle1);
|
|
207
|
+
const y1 = _yAccessor(d.source) - _rAccessor(d.source) * Math.sin(angle1);
|
|
208
|
+
const x2 = _xAccessor(d.target) + _rAccessor(d.target) * Math.cos(angle2);
|
|
209
|
+
const y2 = _yAccessor(d.target) - _rAccessor(d.target) * Math.sin(angle2);
|
|
210
|
+
return { x1: x1, y1: y1, x2: x2, y2: y2 };
|
|
211
|
+
}
|
|
212
|
+
function buildRibbon(points) {
|
|
213
|
+
const bothCode = [];
|
|
214
|
+
let x = 0;
|
|
215
|
+
let transformedPoints = { x1: 0, y1: 0, x2: 0, y2: 0 };
|
|
216
|
+
while (x < points.length) {
|
|
217
|
+
if (x !== points.length - 1) {
|
|
218
|
+
transformedPoints = offsetEdge({
|
|
219
|
+
source: points[x],
|
|
220
|
+
target: points[x + 1]
|
|
221
|
+
});
|
|
222
|
+
const p1 = {
|
|
223
|
+
x: transformedPoints.x1,
|
|
224
|
+
y: transformedPoints.y1,
|
|
225
|
+
direction: "forward"
|
|
226
|
+
};
|
|
227
|
+
const p2 = {
|
|
228
|
+
x: transformedPoints.x2,
|
|
229
|
+
y: transformedPoints.y2,
|
|
230
|
+
direction: "forward"
|
|
231
|
+
};
|
|
232
|
+
bothCode.push(p1, p2);
|
|
233
|
+
if (bothCode.length > 3) {
|
|
234
|
+
const l = bothCode.length - 1;
|
|
235
|
+
const lineA = { a: bothCode[l - 3], b: bothCode[l - 2] };
|
|
236
|
+
const lineB = { a: bothCode[l - 1], b: bothCode[l] };
|
|
237
|
+
const intersect = findIntersect(lineA.a.x, lineA.a.y, lineA.b.x, lineA.b.y, lineB.a.x, lineB.a.y, lineB.b.x, lineB.b.y);
|
|
238
|
+
if (intersect.found === true) {
|
|
239
|
+
lineA.b.x = intersect.x;
|
|
240
|
+
lineA.b.y = intersect.y;
|
|
241
|
+
lineB.a.x = intersect.x;
|
|
242
|
+
lineB.a.y = intersect.y;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
x++;
|
|
247
|
+
}
|
|
248
|
+
x--;
|
|
249
|
+
//Back
|
|
250
|
+
while (x >= 0) {
|
|
251
|
+
if (x !== 0) {
|
|
252
|
+
transformedPoints = offsetEdge({
|
|
253
|
+
source: points[x],
|
|
254
|
+
target: points[x - 1]
|
|
255
|
+
});
|
|
256
|
+
const p1 = {
|
|
257
|
+
x: transformedPoints.x1,
|
|
258
|
+
y: transformedPoints.y1,
|
|
259
|
+
direction: "back"
|
|
260
|
+
};
|
|
261
|
+
const p2 = {
|
|
262
|
+
x: transformedPoints.x2,
|
|
263
|
+
y: transformedPoints.y2,
|
|
264
|
+
direction: "back"
|
|
265
|
+
};
|
|
266
|
+
bothCode.push(p1, p2);
|
|
267
|
+
if (bothCode.length > 3) {
|
|
268
|
+
const l = bothCode.length - 1;
|
|
269
|
+
const lineA = { a: bothCode[l - 3], b: bothCode[l - 2] };
|
|
270
|
+
const lineB = { a: bothCode[l - 1], b: bothCode[l] };
|
|
271
|
+
const intersect = findIntersect(lineA.a.x, lineA.a.y, lineA.b.x, lineA.b.y, lineB.a.x, lineB.a.y, lineB.b.x, lineB.b.y);
|
|
272
|
+
if (intersect.found === true) {
|
|
273
|
+
lineA.b.x = intersect.x;
|
|
274
|
+
lineA.b.y = intersect.y;
|
|
275
|
+
lineB.a.x = intersect.x;
|
|
276
|
+
lineB.a.y = intersect.y;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
x--;
|
|
281
|
+
}
|
|
282
|
+
return bothCode;
|
|
283
|
+
}
|
|
284
|
+
function findIntersect(l1x1, l1y1, l1x2, l1y2, l2x1, l2y1, l2x2, l2y2) {
|
|
285
|
+
let a, b;
|
|
286
|
+
const result = {
|
|
287
|
+
x: null,
|
|
288
|
+
y: null,
|
|
289
|
+
found: false
|
|
290
|
+
};
|
|
291
|
+
const d = (l2y2 - l2y1) * (l1x2 - l1x1) - (l2x2 - l2x1) * (l1y2 - l1y1);
|
|
292
|
+
if (d === 0) {
|
|
293
|
+
return result;
|
|
294
|
+
}
|
|
295
|
+
a = l1y1 - l2y1;
|
|
296
|
+
b = l1x1 - l2x1;
|
|
297
|
+
const n1 = (l2x2 - l2x1) * a - (l2y2 - l2y1) * b;
|
|
298
|
+
const n2 = (l1x2 - l1x1) * a - (l1y2 - l1y1) * b;
|
|
299
|
+
a = n1 / d;
|
|
300
|
+
b = n2 / d;
|
|
301
|
+
result.x = l1x1 + a * (l1x2 - l1x1);
|
|
302
|
+
result.y = l1y1 + a * (l1y2 - l1y1);
|
|
303
|
+
if (a > 0 && a < 1 && b > 0 && b < 1) {
|
|
304
|
+
result.found = true;
|
|
305
|
+
}
|
|
306
|
+
return result;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.hexbinning = exports.contouring = void 0;
|
|
40
|
+
exports.lineBounding = lineBounding;
|
|
41
|
+
exports.heatmapping = heatmapping;
|
|
42
|
+
exports.trendlining = trendlining;
|
|
43
|
+
exports.shapeBounds = shapeBounds;
|
|
44
|
+
const React = __importStar(require("react"));
|
|
45
|
+
const d3_scale_1 = require("d3-scale");
|
|
46
|
+
const regression_1 = __importDefault(require("regression"));
|
|
47
|
+
const d3_shape_1 = require("d3-shape");
|
|
48
|
+
// Re-export from new locations for backwards compatibility
|
|
49
|
+
var contourLayout_1 = require("./contourLayout");
|
|
50
|
+
Object.defineProperty(exports, "contouring", { enumerable: true, get: function () { return contourLayout_1.contouring; } });
|
|
51
|
+
var hexbinLayout_1 = require("./hexbinLayout");
|
|
52
|
+
Object.defineProperty(exports, "hexbinning", { enumerable: true, get: function () { return hexbinLayout_1.hexbinning; } });
|
|
53
|
+
const generateLineBounds = (xydata, basedata, topBoundingAccessor, bottomBoundingAccessor) => {
|
|
54
|
+
const tops = xydata.map((d, i) => [
|
|
55
|
+
d[0],
|
|
56
|
+
d[1] + topBoundingAccessor(basedata[i])
|
|
57
|
+
]);
|
|
58
|
+
const bottoms = xydata.map((d, i) => [
|
|
59
|
+
d[0],
|
|
60
|
+
d[1] - bottomBoundingAccessor(basedata[i])
|
|
61
|
+
]);
|
|
62
|
+
return [...tops, ...bottoms.reverse()];
|
|
63
|
+
};
|
|
64
|
+
function lineBounding({ summaryType, data, defined }) {
|
|
65
|
+
let projectedSummaries = [];
|
|
66
|
+
if (!summaryType.type) {
|
|
67
|
+
summaryType = { type: summaryType };
|
|
68
|
+
}
|
|
69
|
+
const { boundingAccessor, topBoundingAccessor = boundingAccessor, bottomBoundingAccessor = boundingAccessor } = summaryType;
|
|
70
|
+
data.forEach((lineData) => {
|
|
71
|
+
const definedData = lineData._baseData.map(defined);
|
|
72
|
+
let currentBaseData = [];
|
|
73
|
+
let currentXYFC = [];
|
|
74
|
+
const boundingPieces = [
|
|
75
|
+
{
|
|
76
|
+
xyf: currentXYFC,
|
|
77
|
+
base: currentBaseData
|
|
78
|
+
}
|
|
79
|
+
];
|
|
80
|
+
definedData.forEach((d, i) => {
|
|
81
|
+
if (d === true) {
|
|
82
|
+
currentBaseData.push(lineData._baseData[i]);
|
|
83
|
+
currentXYFC.push(lineData._xyfCoordinates[i]);
|
|
84
|
+
}
|
|
85
|
+
else if (definedData[i + 1]) {
|
|
86
|
+
currentBaseData = [];
|
|
87
|
+
currentXYFC = [];
|
|
88
|
+
boundingPieces.push({
|
|
89
|
+
xyf: currentXYFC,
|
|
90
|
+
base: currentBaseData
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
boundingPieces.forEach(({ xyf, base }) => {
|
|
95
|
+
const boundingProjectedSummary = {
|
|
96
|
+
data: lineData,
|
|
97
|
+
parentSummary: lineData,
|
|
98
|
+
_xyfCoordinates: generateLineBounds(xyf, base, topBoundingAccessor, bottomBoundingAccessor)
|
|
99
|
+
};
|
|
100
|
+
projectedSummaries = [...projectedSummaries, boundingProjectedSummary];
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
return projectedSummaries;
|
|
104
|
+
}
|
|
105
|
+
function heatmapping({ preprocess = true, processedData = false, summaryType: baseSummaryType, data: baseData, finalXExtent = [
|
|
106
|
+
Math.min(...baseData.coordinates.map((d) => d.x)),
|
|
107
|
+
Math.max(...baseData.coordinates.map((d) => d.x))
|
|
108
|
+
], finalYExtent = [
|
|
109
|
+
Math.min(...baseData.coordinates.map((d) => d.y)),
|
|
110
|
+
Math.max(...baseData.coordinates.map((d) => d.y))
|
|
111
|
+
], size, xScaleType = (0, d3_scale_1.scaleLinear)(), yScaleType = (0, d3_scale_1.scaleLinear)(), margin, styleFn, classFn, renderFn, chartSize }) {
|
|
112
|
+
if (processedData && baseData) {
|
|
113
|
+
return baseData.coordinates;
|
|
114
|
+
}
|
|
115
|
+
if (baseData.coordinates && !baseData._xyfCoordinates) {
|
|
116
|
+
baseData._xyfCoordinates = baseData.coordinates.map((d) => [d.x, d.y]);
|
|
117
|
+
}
|
|
118
|
+
const data = Array.isArray(baseData) ? baseData : [baseData];
|
|
119
|
+
let projectedSummaries = [];
|
|
120
|
+
let summaryType;
|
|
121
|
+
if (!baseSummaryType.type) {
|
|
122
|
+
summaryType = { type: summaryType };
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
summaryType = baseSummaryType;
|
|
126
|
+
}
|
|
127
|
+
const {
|
|
128
|
+
// binGraphic = "square",
|
|
129
|
+
binValue = (d) => d.length, xBins = summaryType.yBins || 0.05, yBins = xBins, xCellPx = !summaryType.xBins && summaryType.xCellPx, yCellPx = !summaryType.yBins && summaryType.yCellPx, customMark, binMax } = summaryType;
|
|
130
|
+
const xBinPercent = xBins < 1 ? xBins : 1 / xBins;
|
|
131
|
+
const yBinPercent = yBins < 1 ? yBins : 1 / yBins;
|
|
132
|
+
const heatmapBinXScale = xScaleType.domain(finalXExtent).range([0, size[0]]);
|
|
133
|
+
const heatmapBinYScale = yScaleType.domain(finalYExtent).range([size[1], 0]);
|
|
134
|
+
const actualResolution = [
|
|
135
|
+
Math.ceil(((xCellPx && xCellPx / size[0]) || xBinPercent) * size[0] * 10) /
|
|
136
|
+
10,
|
|
137
|
+
Math.ceil(((yCellPx && yCellPx / size[1]) || yBinPercent) * size[1] * 10) /
|
|
138
|
+
10
|
|
139
|
+
];
|
|
140
|
+
let maxValue = -Infinity;
|
|
141
|
+
data.forEach((heatmapData) => {
|
|
142
|
+
const grid = [];
|
|
143
|
+
const flatGrid = [];
|
|
144
|
+
let cell;
|
|
145
|
+
let gridColumn;
|
|
146
|
+
for (let i = 0; Math.ceil(i) < size[0]; i += actualResolution[0]) {
|
|
147
|
+
const x = heatmapBinXScale.invert(i);
|
|
148
|
+
const x1 = heatmapBinXScale.invert(i + actualResolution[0]);
|
|
149
|
+
gridColumn = [];
|
|
150
|
+
grid.push(gridColumn);
|
|
151
|
+
for (let j = 0; Math.ceil(j) < size[1]; j += actualResolution[1]) {
|
|
152
|
+
const y = heatmapBinYScale.invert(j);
|
|
153
|
+
const y1 = heatmapBinYScale.invert(j + actualResolution[1]);
|
|
154
|
+
cell = {
|
|
155
|
+
gx: i,
|
|
156
|
+
gy: j,
|
|
157
|
+
gw: actualResolution[0],
|
|
158
|
+
gh: actualResolution[1],
|
|
159
|
+
x: (x + x1) / 2,
|
|
160
|
+
y: (y + y1) / 2,
|
|
161
|
+
binItems: [],
|
|
162
|
+
value: 0,
|
|
163
|
+
_xyfCoordinates: [
|
|
164
|
+
[x, y],
|
|
165
|
+
[x1, y],
|
|
166
|
+
[x1, y1],
|
|
167
|
+
[x, y1]
|
|
168
|
+
],
|
|
169
|
+
parentSummary: heatmapData
|
|
170
|
+
};
|
|
171
|
+
gridColumn.push(cell);
|
|
172
|
+
flatGrid.push(cell);
|
|
173
|
+
}
|
|
174
|
+
gridColumn.push(cell);
|
|
175
|
+
}
|
|
176
|
+
grid.push(gridColumn);
|
|
177
|
+
heatmapData._xyfCoordinates.forEach((d, di) => {
|
|
178
|
+
const baseX = heatmapBinXScale(d[0]);
|
|
179
|
+
const baseY = heatmapBinYScale(d[1]);
|
|
180
|
+
const xCoordinate = Math.floor(baseX / actualResolution[0]);
|
|
181
|
+
const yCoordinate = Math.floor(baseY / actualResolution[1]);
|
|
182
|
+
if (grid[xCoordinate][yCoordinate]) {
|
|
183
|
+
grid[xCoordinate][yCoordinate].binItems.push(heatmapData.coordinates[di]);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
flatGrid.forEach((d) => {
|
|
187
|
+
d.value = binValue(d.binItems);
|
|
188
|
+
maxValue = Math.max(maxValue, d.value);
|
|
189
|
+
});
|
|
190
|
+
flatGrid.forEach((d) => {
|
|
191
|
+
d.percent = d.value / maxValue;
|
|
192
|
+
d.customMark = customMark && (React.createElement("g", { transform: `translate(${d.gx},${d.gy})` }, customMark({
|
|
193
|
+
d,
|
|
194
|
+
margin,
|
|
195
|
+
styleFn,
|
|
196
|
+
classFn,
|
|
197
|
+
renderFn,
|
|
198
|
+
chartSize,
|
|
199
|
+
adjustedSize: size
|
|
200
|
+
})));
|
|
201
|
+
});
|
|
202
|
+
projectedSummaries = [...projectedSummaries, ...flatGrid];
|
|
203
|
+
});
|
|
204
|
+
if (binMax) {
|
|
205
|
+
binMax(maxValue);
|
|
206
|
+
}
|
|
207
|
+
if (preprocess) {
|
|
208
|
+
const preprocessedSummary = {
|
|
209
|
+
type: "heatmap",
|
|
210
|
+
processedData: true,
|
|
211
|
+
_baseData: [],
|
|
212
|
+
_xyfCoordinates: [],
|
|
213
|
+
data: [],
|
|
214
|
+
bounds: [],
|
|
215
|
+
x: 0,
|
|
216
|
+
y: 0,
|
|
217
|
+
coordinates: projectedSummaries,
|
|
218
|
+
binMax: maxValue
|
|
219
|
+
};
|
|
220
|
+
return preprocessedSummary;
|
|
221
|
+
}
|
|
222
|
+
return projectedSummaries;
|
|
223
|
+
}
|
|
224
|
+
function trendlining({ preprocess = false, summaryType: baseSummaryType, data: baseData, finalXExtent = [
|
|
225
|
+
Math.min(...baseData.coordinates.map((d) => d.x)),
|
|
226
|
+
Math.max(...baseData.coordinates.map((d) => d.x))
|
|
227
|
+
], xScaleType = (0, d3_scale_1.scaleLinear)() }) {
|
|
228
|
+
if (preprocess) {
|
|
229
|
+
return baseData[0].coordinates;
|
|
230
|
+
}
|
|
231
|
+
let projectedSummaries = [];
|
|
232
|
+
let summaryType;
|
|
233
|
+
if (!baseSummaryType.type) {
|
|
234
|
+
summaryType = { type: summaryType };
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
summaryType = baseSummaryType;
|
|
238
|
+
}
|
|
239
|
+
const { regressionType: baseRegressionType = "linear", order = 2, precision = 4, controlPoints = 20, curve = d3_shape_1.curveCardinal } = summaryType;
|
|
240
|
+
let regressionType = baseRegressionType;
|
|
241
|
+
if (finalXExtent[0] < 0 &&
|
|
242
|
+
(baseRegressionType === "logarithmic" ||
|
|
243
|
+
baseRegressionType === "power" ||
|
|
244
|
+
baseRegressionType === "exponential")) {
|
|
245
|
+
console.error(`Cannot use this ${baseRegressionType} regressionType type with value range that goes below 0, defaulting to linear`);
|
|
246
|
+
regressionType = "linear";
|
|
247
|
+
}
|
|
248
|
+
if (baseData.coordinates && !baseData._xyfCoordinates) {
|
|
249
|
+
baseData._xyfCoordinates = baseData.coordinates.map((d) => [d.x, d.y]);
|
|
250
|
+
}
|
|
251
|
+
const data = Array.isArray(baseData) ? baseData : [baseData];
|
|
252
|
+
const xScale = xScaleType.domain([0, 1]).range(finalXExtent);
|
|
253
|
+
projectedSummaries = [];
|
|
254
|
+
data.forEach((bdata) => {
|
|
255
|
+
const regressionLine = regression_1.default[regressionType](bdata._xyfCoordinates.map((d) => {
|
|
256
|
+
let x = d[0];
|
|
257
|
+
let y = d[1];
|
|
258
|
+
if (typeof x !== "number") {
|
|
259
|
+
x = x.getTime();
|
|
260
|
+
}
|
|
261
|
+
if (typeof y !== "number") {
|
|
262
|
+
y = y.getTime();
|
|
263
|
+
}
|
|
264
|
+
return [x, y];
|
|
265
|
+
}), {
|
|
266
|
+
order,
|
|
267
|
+
precision
|
|
268
|
+
});
|
|
269
|
+
const controlStep = 1 / controlPoints;
|
|
270
|
+
let steps = [0, 1];
|
|
271
|
+
if (regressionType !== "linear") {
|
|
272
|
+
steps = [];
|
|
273
|
+
for (let step = 0; step < 1 + controlStep; step += controlStep) {
|
|
274
|
+
steps.push(step);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
const controlPointArray = [];
|
|
278
|
+
steps.forEach((controlPoint) => {
|
|
279
|
+
controlPointArray.push(regressionLine.predict(xScale(controlPoint)));
|
|
280
|
+
});
|
|
281
|
+
projectedSummaries.push({
|
|
282
|
+
centroid: false,
|
|
283
|
+
customMark: undefined,
|
|
284
|
+
data: bdata,
|
|
285
|
+
parentSummary: bdata,
|
|
286
|
+
value: regressionLine.string,
|
|
287
|
+
r2: regressionLine.r2,
|
|
288
|
+
curve,
|
|
289
|
+
_xyfCoordinates: controlPointArray
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
return projectedSummaries;
|
|
293
|
+
}
|
|
294
|
+
function shapeBounds(coordinates) {
|
|
295
|
+
let left = [Infinity, 0];
|
|
296
|
+
let right = [-Infinity, 0];
|
|
297
|
+
let top = [0, Infinity];
|
|
298
|
+
let bottom = [0, -Infinity];
|
|
299
|
+
coordinates.forEach((d) => {
|
|
300
|
+
left = d[0] < left[0] ? d : left;
|
|
301
|
+
right = d[0] > right[0] ? d : right;
|
|
302
|
+
bottom = d[1] > bottom[1] ? d : bottom;
|
|
303
|
+
top = d[1] < top[1] ? d : top;
|
|
304
|
+
});
|
|
305
|
+
return {
|
|
306
|
+
center: [(left[0] + right[0]) / 2, (top[1] + bottom[1]) / 2],
|
|
307
|
+
top,
|
|
308
|
+
left,
|
|
309
|
+
right,
|
|
310
|
+
bottom
|
|
311
|
+
};
|
|
312
|
+
}
|