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,579 @@
|
|
|
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.canvasEvent = exports.orFrameAxisGenerator = exports.calculateMargin = exports.drawMarginPath = exports.circlePath = void 0;
|
|
40
|
+
exports.objectifyType = objectifyType;
|
|
41
|
+
exports.generateOrdinalFrameEventListeners = generateOrdinalFrameEventListeners;
|
|
42
|
+
exports.keyAndObjectifyBarData = keyAndObjectifyBarData;
|
|
43
|
+
exports.adjustedPositionSize = adjustedPositionSize;
|
|
44
|
+
exports.generateFrameTitle = generateFrameTitle;
|
|
45
|
+
exports.orFrameConnectionRenderer = orFrameConnectionRenderer;
|
|
46
|
+
const React = __importStar(require("react"));
|
|
47
|
+
const SvgHelper_1 = require("../svg/SvgHelper");
|
|
48
|
+
const Axis_1 = __importDefault(require("../Axis"));
|
|
49
|
+
const axis_1 = require("../visualizationLayerBehavior/axis");
|
|
50
|
+
const d3_scale_1 = require("d3-scale");
|
|
51
|
+
const extent = (inputArray) => inputArray.reduce((p, c) => {
|
|
52
|
+
return [Math.min(c, p[0]), Math.max(c, p[1])];
|
|
53
|
+
}, [Infinity, -Infinity]);
|
|
54
|
+
const findActualTitle = (rawTitle) => {
|
|
55
|
+
let title = null;
|
|
56
|
+
let orient = "top";
|
|
57
|
+
if (typeof rawTitle === "string") {
|
|
58
|
+
title = rawTitle;
|
|
59
|
+
}
|
|
60
|
+
else if ("title" in rawTitle) {
|
|
61
|
+
title = rawTitle.title;
|
|
62
|
+
orient = rawTitle.orient || "top";
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
title = rawTitle;
|
|
66
|
+
}
|
|
67
|
+
return { orient, title };
|
|
68
|
+
};
|
|
69
|
+
function roundToTenth(number) {
|
|
70
|
+
return Math.round(number * 10) / 10;
|
|
71
|
+
}
|
|
72
|
+
const circlePath = (cx, cy, r) => `${[
|
|
73
|
+
"M",
|
|
74
|
+
roundToTenth(cx - r),
|
|
75
|
+
roundToTenth(cy),
|
|
76
|
+
"a",
|
|
77
|
+
r,
|
|
78
|
+
r,
|
|
79
|
+
0,
|
|
80
|
+
1,
|
|
81
|
+
0,
|
|
82
|
+
r * 2,
|
|
83
|
+
0,
|
|
84
|
+
"a",
|
|
85
|
+
r,
|
|
86
|
+
r,
|
|
87
|
+
0,
|
|
88
|
+
1,
|
|
89
|
+
0,
|
|
90
|
+
-(r * 2),
|
|
91
|
+
0
|
|
92
|
+
].join(" ")}Z`;
|
|
93
|
+
exports.circlePath = circlePath;
|
|
94
|
+
const drawMarginPath = ({ margin, size, inset = 0 }) => {
|
|
95
|
+
const iSize = [size[0] - inset, size[1] - inset];
|
|
96
|
+
return `M0,0 h${size[0]} v${size[1]} h-${size[0]}Z M${margin.left - inset},${margin.top - inset} v${size[1] + inset * 2 - margin.top - margin.bottom} h${iSize[0] + inset * 3 - margin.left - margin.right} v-${iSize[1] + inset * 3 - margin.top - margin.bottom}Z`;
|
|
97
|
+
};
|
|
98
|
+
exports.drawMarginPath = drawMarginPath;
|
|
99
|
+
const calculateMargin = ({ margin, axes, title: rawTitle, oLabel, projection, size }) => {
|
|
100
|
+
if (margin !== undefined) {
|
|
101
|
+
if (typeof margin === "function") {
|
|
102
|
+
margin = margin({ size });
|
|
103
|
+
}
|
|
104
|
+
if (typeof margin !== "object") {
|
|
105
|
+
return { top: margin, bottom: margin, left: margin, right: margin };
|
|
106
|
+
}
|
|
107
|
+
else if (typeof margin === "object") {
|
|
108
|
+
return Object.assign({ top: 0, bottom: 0, left: 0, right: 0 }, margin);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const finalMargin = { top: 0, bottom: 0, left: 0, right: 0 };
|
|
112
|
+
let orient = "left";
|
|
113
|
+
if (axes && projection !== "radial") {
|
|
114
|
+
axes.forEach((axisObj) => {
|
|
115
|
+
const axisObjAdditionMargin = axisObj.label ? 60 : 50;
|
|
116
|
+
orient = axisObj.orient;
|
|
117
|
+
finalMargin[orient] = axisObjAdditionMargin;
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
const { title, orient: titleOrient } = findActualTitle(rawTitle);
|
|
121
|
+
if (title && !(typeof title === "string" && title.length === 0)) {
|
|
122
|
+
finalMargin[titleOrient] += 40;
|
|
123
|
+
}
|
|
124
|
+
if (oLabel && projection !== "radial") {
|
|
125
|
+
if (orient === "bottom" || orient === "top") {
|
|
126
|
+
finalMargin.left += 50;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
finalMargin.bottom += 50;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return finalMargin;
|
|
133
|
+
};
|
|
134
|
+
exports.calculateMargin = calculateMargin;
|
|
135
|
+
function objectifyType(type) {
|
|
136
|
+
if (type instanceof Function || typeof type === "string") {
|
|
137
|
+
return { type: type };
|
|
138
|
+
}
|
|
139
|
+
else if (type === undefined) {
|
|
140
|
+
return {};
|
|
141
|
+
}
|
|
142
|
+
return type;
|
|
143
|
+
}
|
|
144
|
+
function generateOrdinalFrameEventListeners(customHoverBehavior, customClickBehavior) {
|
|
145
|
+
let eventListenersGenerator = () => ({});
|
|
146
|
+
if (customHoverBehavior || customClickBehavior) {
|
|
147
|
+
eventListenersGenerator = (d, i) => ({
|
|
148
|
+
onMouseEnter: customHoverBehavior
|
|
149
|
+
? (e) => customHoverBehavior(d, i, e)
|
|
150
|
+
: undefined,
|
|
151
|
+
onMouseLeave: customHoverBehavior
|
|
152
|
+
? (e) => customHoverBehavior(undefined, undefined, e)
|
|
153
|
+
: undefined,
|
|
154
|
+
onClick: customClickBehavior
|
|
155
|
+
? (e) => customClickBehavior(d, i, e)
|
|
156
|
+
: undefined
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
return eventListenersGenerator;
|
|
160
|
+
}
|
|
161
|
+
function keyAndObjectifyBarData({ data, renderKey = (d, i) => i, oAccessor, rAccessor: baseRAccessor, originalRAccessor, originalOAccessor, multiAxis = false }) {
|
|
162
|
+
let rAccessor;
|
|
163
|
+
let multiExtents;
|
|
164
|
+
if (multiAxis && baseRAccessor.length > 1) {
|
|
165
|
+
let minNegative = Infinity;
|
|
166
|
+
multiExtents = baseRAccessor.map((accessor) => {
|
|
167
|
+
const basicExtent = extent(data.map(accessor));
|
|
168
|
+
minNegative = Math.min(basicExtent[0] / basicExtent[1], minNegative);
|
|
169
|
+
return basicExtent;
|
|
170
|
+
});
|
|
171
|
+
const rScales = multiExtents.map((ext) => {
|
|
172
|
+
let range = [0, 1];
|
|
173
|
+
let adjustedExtent = ext;
|
|
174
|
+
if (ext[0] < 0 && ext[1] > 0) {
|
|
175
|
+
range[0] = minNegative;
|
|
176
|
+
adjustedExtent[0] = adjustedExtent[1] * minNegative;
|
|
177
|
+
}
|
|
178
|
+
else if (ext[0] < 0 && ext[1] < 0) {
|
|
179
|
+
adjustedExtent[1] = 0;
|
|
180
|
+
range = [-1, 0];
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
adjustedExtent[0] = 0;
|
|
184
|
+
}
|
|
185
|
+
return (0, d3_scale_1.scaleLinear)().domain(ext).range(range);
|
|
186
|
+
});
|
|
187
|
+
rAccessor = rScales.map((scale, i) => (d) => {
|
|
188
|
+
return scale(baseRAccessor[i](d));
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
rAccessor = baseRAccessor;
|
|
193
|
+
}
|
|
194
|
+
const decoratedData = [];
|
|
195
|
+
oAccessor.forEach((actualOAccessor, oIndex) => {
|
|
196
|
+
rAccessor.forEach((actualRAccessor, rIndex) => {
|
|
197
|
+
;
|
|
198
|
+
(data || []).forEach((d) => {
|
|
199
|
+
const baseAppliedKey = renderKey(d, decoratedData.length);
|
|
200
|
+
const appliedKey = (baseAppliedKey !== undefined &&
|
|
201
|
+
baseAppliedKey.toString &&
|
|
202
|
+
baseAppliedKey.toString()) ||
|
|
203
|
+
baseAppliedKey;
|
|
204
|
+
const originalR = originalRAccessor[rIndex];
|
|
205
|
+
const originalO = originalOAccessor[oIndex];
|
|
206
|
+
const rName = typeof originalR === "string" ? originalR : `function-${rIndex}`;
|
|
207
|
+
const oName = typeof originalO === "string" ? originalO : `function-${oIndex}`;
|
|
208
|
+
if (typeof d !== "object") {
|
|
209
|
+
const expandedData = { value: d, renderKey: appliedKey };
|
|
210
|
+
const value = actualRAccessor(expandedData);
|
|
211
|
+
decoratedData.push({
|
|
212
|
+
data: expandedData,
|
|
213
|
+
value,
|
|
214
|
+
rIndex,
|
|
215
|
+
rName,
|
|
216
|
+
oIndex,
|
|
217
|
+
oName,
|
|
218
|
+
column: appliedKey,
|
|
219
|
+
renderKey: appliedKey
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
const value = actualRAccessor(d);
|
|
224
|
+
const column = actualOAccessor(d);
|
|
225
|
+
decoratedData.push({
|
|
226
|
+
renderKey: appliedKey,
|
|
227
|
+
data: d,
|
|
228
|
+
rIndex,
|
|
229
|
+
rName,
|
|
230
|
+
oIndex,
|
|
231
|
+
oName,
|
|
232
|
+
value,
|
|
233
|
+
column: column && column.toString ? column.toString() : column
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
return { allData: decoratedData, multiExtents };
|
|
240
|
+
}
|
|
241
|
+
function adjustedPositionSize({ size = [500, 500], position = [0, 0], margin, projection }) {
|
|
242
|
+
const heightAdjust = margin.top + margin.bottom;
|
|
243
|
+
const widthAdjust = margin.left + margin.right;
|
|
244
|
+
const adjustedPosition = [position[0], position[1]];
|
|
245
|
+
let adjustedSize = [size[0] - widthAdjust, size[1] - heightAdjust];
|
|
246
|
+
if (projection === "radial") {
|
|
247
|
+
const minSize = Math.min(adjustedSize[0], adjustedSize[1]);
|
|
248
|
+
adjustedSize = [minSize, minSize];
|
|
249
|
+
}
|
|
250
|
+
return { adjustedPosition, adjustedSize };
|
|
251
|
+
}
|
|
252
|
+
function generateFrameTitle({ title: rawTitle = { title: "", orient: "top" }, size }) {
|
|
253
|
+
let finalTitle = null;
|
|
254
|
+
const { title, orient } = findActualTitle(rawTitle);
|
|
255
|
+
let x = 0, y = 0, transform;
|
|
256
|
+
switch (orient) {
|
|
257
|
+
case "top":
|
|
258
|
+
x = size[0] / 2;
|
|
259
|
+
y = 25;
|
|
260
|
+
break;
|
|
261
|
+
case "bottom":
|
|
262
|
+
x = size[0] / 2;
|
|
263
|
+
y = size[1] - 25;
|
|
264
|
+
break;
|
|
265
|
+
case "left":
|
|
266
|
+
x = 25;
|
|
267
|
+
y = size[1] / 2;
|
|
268
|
+
transform = "rotate(-90)";
|
|
269
|
+
break;
|
|
270
|
+
case "right":
|
|
271
|
+
x = size[0] - 25;
|
|
272
|
+
y = size[1] / 2;
|
|
273
|
+
transform = "rotate(90)";
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
const gTransform = `translate(${x},${y})`;
|
|
277
|
+
if (typeof title === "string" && title.length > 0) {
|
|
278
|
+
finalTitle = (React.createElement("g", { transform: gTransform },
|
|
279
|
+
React.createElement("text", { className: "frame-title", transform: transform, style: { textAnchor: "middle", pointerEvents: "none" } }, title)));
|
|
280
|
+
}
|
|
281
|
+
else if (title) {
|
|
282
|
+
//assume if defined then its an svg mark of some sort
|
|
283
|
+
finalTitle = React.createElement("g", { transform: gTransform }, title);
|
|
284
|
+
}
|
|
285
|
+
return finalTitle;
|
|
286
|
+
}
|
|
287
|
+
function orFrameConnectionRenderer({ type, data, renderMode, eventListenersGenerator, styleFn, classFn, projection, canvasRender, canvasDrawing, pieceType }) {
|
|
288
|
+
if (!type.type) {
|
|
289
|
+
return null;
|
|
290
|
+
}
|
|
291
|
+
const renderedConnectorMarks = [];
|
|
292
|
+
const radarMap = new Map();
|
|
293
|
+
const { keyedData, oExtent } = data;
|
|
294
|
+
if (typeof type.type === "function") {
|
|
295
|
+
const connectionRule = type.type;
|
|
296
|
+
const keys = oExtent;
|
|
297
|
+
oExtent.forEach((key, pieceArrayI) => {
|
|
298
|
+
const pieceArray = keyedData[key];
|
|
299
|
+
const nextColumn = keyedData[keys[pieceArrayI + 1]];
|
|
300
|
+
if (nextColumn) {
|
|
301
|
+
const matchArray = nextColumn.map((d, i) => connectionRule({ ...d.piece, ...d.piece.data }, i));
|
|
302
|
+
pieceArray.forEach((piece, pieceI) => {
|
|
303
|
+
const thisConnectionPiece = connectionRule({ ...piece.piece, ...piece.piece.data }, pieceI);
|
|
304
|
+
const targetMatch = connectionRule({ ...piece.piece, ...piece.piece.data }, pieceI);
|
|
305
|
+
const matchingPieceIndex = targetMatch !== undefined &&
|
|
306
|
+
targetMatch !== false &&
|
|
307
|
+
matchArray.indexOf(targetMatch);
|
|
308
|
+
if (thisConnectionPiece !== undefined &&
|
|
309
|
+
thisConnectionPiece !== null &&
|
|
310
|
+
matchingPieceIndex !== false &&
|
|
311
|
+
matchingPieceIndex !== -1) {
|
|
312
|
+
const matchingPiece = nextColumn[matchingPieceIndex];
|
|
313
|
+
let markD;
|
|
314
|
+
if (projection === "radial" && pieceType.type === "point") {
|
|
315
|
+
if (!radarMap.get(piece)) {
|
|
316
|
+
radarMap.set(piece, [piece]);
|
|
317
|
+
}
|
|
318
|
+
const thisRadar = radarMap.get(piece);
|
|
319
|
+
if (thisRadar) {
|
|
320
|
+
thisRadar.push(matchingPiece);
|
|
321
|
+
radarMap.set(matchingPiece, thisRadar);
|
|
322
|
+
radarMap.delete(piece);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
const { xy } = piece;
|
|
327
|
+
const { xy: mxy } = matchingPiece;
|
|
328
|
+
const { x, y, height = 1, width = 1 } = xy;
|
|
329
|
+
const { x: mx, y: my, height: mheight = 1, width: mwidth = 1 } = mxy;
|
|
330
|
+
if (projection === "vertical") {
|
|
331
|
+
markD = (0, SvgHelper_1.drawAreaConnector)({
|
|
332
|
+
x1: x + width,
|
|
333
|
+
x2: mx,
|
|
334
|
+
y1: y,
|
|
335
|
+
y2: my,
|
|
336
|
+
sizeX1: 0,
|
|
337
|
+
sizeX2: 0,
|
|
338
|
+
sizeY1: height,
|
|
339
|
+
sizeY2: mheight
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
else if (projection === "horizontal") {
|
|
343
|
+
const { value } = piece.piece;
|
|
344
|
+
const { value: mvalue } = matchingPiece.piece;
|
|
345
|
+
const x1 = value >= 0 ? x - width : piece.piece.bottom - width;
|
|
346
|
+
const x2 = mvalue >= 0
|
|
347
|
+
? mx - mwidth
|
|
348
|
+
: matchingPiece.piece.bottom - mwidth;
|
|
349
|
+
markD = (0, SvgHelper_1.drawAreaConnector)({
|
|
350
|
+
x1,
|
|
351
|
+
x2,
|
|
352
|
+
y1: y + height,
|
|
353
|
+
y2: my,
|
|
354
|
+
sizeX1: width,
|
|
355
|
+
sizeX2: mwidth,
|
|
356
|
+
sizeY1: 0,
|
|
357
|
+
sizeY2: 0
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
else if (projection === "radial") {
|
|
361
|
+
markD = (0, SvgHelper_1.drawAreaConnector)({
|
|
362
|
+
x1: x,
|
|
363
|
+
x2: mx,
|
|
364
|
+
y1: y + height,
|
|
365
|
+
y2: my,
|
|
366
|
+
sizeX1: width,
|
|
367
|
+
sizeX2: mwidth,
|
|
368
|
+
sizeY1: 0,
|
|
369
|
+
sizeY2: 0
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
const renderValue = renderMode && renderMode(piece.piece, pieceI);
|
|
373
|
+
const source = { ...piece.piece.data, ...piece.piece.data };
|
|
374
|
+
const target = {
|
|
375
|
+
...matchingPiece.piece,
|
|
376
|
+
...matchingPiece.piece.data
|
|
377
|
+
};
|
|
378
|
+
const calculatedStyle = styleFn({
|
|
379
|
+
source,
|
|
380
|
+
target
|
|
381
|
+
});
|
|
382
|
+
const eventListeners = eventListenersGenerator({ source, target }, pieceI);
|
|
383
|
+
if (canvasRender && canvasRender(piece.piece) === true) {
|
|
384
|
+
const canvasConnector = {
|
|
385
|
+
baseClass: "xyframe-line",
|
|
386
|
+
tx: 0,
|
|
387
|
+
ty: 0,
|
|
388
|
+
d: {
|
|
389
|
+
source,
|
|
390
|
+
target
|
|
391
|
+
},
|
|
392
|
+
markProps: { d: markD, markType: "path" },
|
|
393
|
+
styleFn: styleFn,
|
|
394
|
+
renderFn: renderMode,
|
|
395
|
+
classFn
|
|
396
|
+
};
|
|
397
|
+
canvasDrawing.push(canvasConnector);
|
|
398
|
+
}
|
|
399
|
+
else {
|
|
400
|
+
renderedConnectorMarks.push(React.createElement("path", { ...eventListeners, d: markD, className: classFn ? classFn(piece.piece.data, pieceI) : "", key: `connector${piece.piece.renderKey}`, ...calculatedStyle, style: calculatedStyle }));
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
if (radarMap.size > 0) {
|
|
408
|
+
for (const ring of radarMap.values()) {
|
|
409
|
+
const ringPiece = { ...ring[0].piece, ...ring[0].piece.data };
|
|
410
|
+
const markD = `M${ring.map((d) => `${d.xy.x},${d.xy.y}`).join("L")}Z`;
|
|
411
|
+
if (canvasRender && canvasRender(ringPiece)) {
|
|
412
|
+
const canvasRadar = {
|
|
413
|
+
baseClass: "ordinal-radar",
|
|
414
|
+
tx: 0,
|
|
415
|
+
ty: 0,
|
|
416
|
+
d: {
|
|
417
|
+
source: ringPiece
|
|
418
|
+
},
|
|
419
|
+
markProps: { d: markD, markType: "path" },
|
|
420
|
+
styleFn: styleFn,
|
|
421
|
+
renderFn: renderMode,
|
|
422
|
+
classFn
|
|
423
|
+
};
|
|
424
|
+
canvasDrawing.push(canvasRadar);
|
|
425
|
+
}
|
|
426
|
+
else {
|
|
427
|
+
const style = styleFn({
|
|
428
|
+
source: ringPiece
|
|
429
|
+
});
|
|
430
|
+
renderedConnectorMarks.push(React.createElement("path", { d: markD, className: classFn ? classFn(ringPiece) : "", key: `ordinal-ring-${ringPiece.renderKey}`, ...style, style: style }));
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
else if (type.type) {
|
|
436
|
+
console.error(`Invalid connectorType - Must be a function that takes a data point and determines if it is connected to a data point in the next column`);
|
|
437
|
+
}
|
|
438
|
+
return renderedConnectorMarks;
|
|
439
|
+
}
|
|
440
|
+
const orFrameAxisGenerator = ({ projection, axis, adjustedSize, size, rScale, rScaleType, pieceType, rExtent, data, maxColumnValues = 1, xyData, margin, thresholds }) => {
|
|
441
|
+
if (!axis)
|
|
442
|
+
return { axis: undefined, axesTickLines: undefined };
|
|
443
|
+
let generatedAxis, axesTickLines;
|
|
444
|
+
if (projection !== "radial" && axis) {
|
|
445
|
+
axesTickLines = [];
|
|
446
|
+
const axisPosition = [0, 0];
|
|
447
|
+
generatedAxis = axis.map((d, i) => {
|
|
448
|
+
let axisClassname = d.className || "";
|
|
449
|
+
let tickValues;
|
|
450
|
+
const axisDomain = d.extentOverride ? d.extentOverride : rScale.domain();
|
|
451
|
+
const leftRight = ["left", "right"];
|
|
452
|
+
const axisScale = (leftRight.indexOf(d.orient) === -1 && projection !== "vertical") ||
|
|
453
|
+
(leftRight.indexOf(d.orient) !== -1 && projection !== "horizontal")
|
|
454
|
+
? rScaleType.domain(axisDomain)
|
|
455
|
+
: rScaleType.domain([0, maxColumnValues]);
|
|
456
|
+
const orient = d.orient;
|
|
457
|
+
const axisRange = (leftRight.indexOf(d.orient) === -1 && projection !== "vertical") ||
|
|
458
|
+
(leftRight.indexOf(d.orient) !== -1 && projection !== "horizontal")
|
|
459
|
+
? rScale.range()
|
|
460
|
+
: [0, projection === "vertical" ? adjustedSize[0] : adjustedSize[1]];
|
|
461
|
+
if (orient === "right") {
|
|
462
|
+
axisScale.range(axisRange.reverse());
|
|
463
|
+
axisClassname += " right y";
|
|
464
|
+
}
|
|
465
|
+
else if (orient === "left") {
|
|
466
|
+
axisClassname += " left y";
|
|
467
|
+
axisScale.range(axisRange.reverse());
|
|
468
|
+
}
|
|
469
|
+
else if (orient === "top") {
|
|
470
|
+
axisClassname += " top x";
|
|
471
|
+
axisScale.range(axisRange);
|
|
472
|
+
}
|
|
473
|
+
else if (orient === "bottom") {
|
|
474
|
+
axisClassname += " bottom x";
|
|
475
|
+
axisScale.range(axisRange);
|
|
476
|
+
}
|
|
477
|
+
if (d.tickValues && Array.isArray(d.tickValues)) {
|
|
478
|
+
tickValues = d.tickValues;
|
|
479
|
+
}
|
|
480
|
+
else if (d.tickValues instanceof Function) {
|
|
481
|
+
//otherwise assume a function
|
|
482
|
+
tickValues = d.tickValues(data, size, rScale);
|
|
483
|
+
}
|
|
484
|
+
else if (!d.tickValues && thresholds) {
|
|
485
|
+
tickValues = thresholds.map((d) => rScale.invert(d));
|
|
486
|
+
}
|
|
487
|
+
const axisParts = (0, axis_1.axisPieces)({
|
|
488
|
+
padding: d.padding,
|
|
489
|
+
tickValues,
|
|
490
|
+
scale: axisScale,
|
|
491
|
+
ticks: d.ticks,
|
|
492
|
+
orient,
|
|
493
|
+
size: adjustedSize,
|
|
494
|
+
footer: d.footer,
|
|
495
|
+
tickSize: d.tickSize,
|
|
496
|
+
jaggedBase: d.jaggedBase
|
|
497
|
+
});
|
|
498
|
+
const axisTickLines = (0, axis_1.axisLines)({
|
|
499
|
+
className: d.className,
|
|
500
|
+
axisParts,
|
|
501
|
+
orient,
|
|
502
|
+
tickLineGenerator: d.tickLineGenerator,
|
|
503
|
+
jaggedBase: d.jaggedBase,
|
|
504
|
+
scale: axisScale
|
|
505
|
+
});
|
|
506
|
+
axesTickLines.push(axisTickLines);
|
|
507
|
+
if (d.baseline === "under") {
|
|
508
|
+
axesTickLines.push((0, axis_1.baselineGenerator)(d.orient, adjustedSize, d.className));
|
|
509
|
+
}
|
|
510
|
+
const marginalSummaryType = typeof d.marginalSummaryType === "string"
|
|
511
|
+
? { type: d.marginalSummaryType }
|
|
512
|
+
: d.marginalSummaryType;
|
|
513
|
+
return (React.createElement(Axis_1.default, { ...d, key: d.key || `orframe-axis-${i}`, axisParts: axisParts, orient: orient, size: adjustedSize, position: axisPosition, tickValues: tickValues, scale: axisScale, className: axisClassname, marginalSummaryType: marginalSummaryType, margin: margin, xyPoints: xyData.map((d) => ({
|
|
514
|
+
x: projection === "vertical" ? 0 : d.value,
|
|
515
|
+
y: projection === "vertical" ? d.value : 0,
|
|
516
|
+
data: d.data
|
|
517
|
+
})) }));
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
else if (projection === "radial" && axis) {
|
|
521
|
+
const { innerRadius = 0 } = pieceType;
|
|
522
|
+
const ticks = [];
|
|
523
|
+
axis.forEach((axisObj) => {
|
|
524
|
+
const { tickValues: baseTickValues = rScale.ticks(Math.max(2, (adjustedSize[0] / 2 - innerRadius) / 50)), label, tickFormat = (d) => d } = axisObj;
|
|
525
|
+
const tickScale = rScaleType
|
|
526
|
+
.domain(rExtent)
|
|
527
|
+
.range([innerRadius, adjustedSize[0] / 2]);
|
|
528
|
+
const tickValues = baseTickValues instanceof Function
|
|
529
|
+
? baseTickValues({
|
|
530
|
+
orient: axisObj.orient
|
|
531
|
+
})
|
|
532
|
+
: baseTickValues;
|
|
533
|
+
tickValues.forEach((t, i) => {
|
|
534
|
+
const tickSize = tickScale(t);
|
|
535
|
+
if (!(innerRadius === 0 && t === 0)) {
|
|
536
|
+
let axisLabel;
|
|
537
|
+
let ref = "";
|
|
538
|
+
if (label && i === tickValues.length - 1) {
|
|
539
|
+
const labelSettings = typeof label === "string"
|
|
540
|
+
? { name: label, locationDistance: 15 }
|
|
541
|
+
: label;
|
|
542
|
+
const { locationDistance = 15 } = labelSettings;
|
|
543
|
+
ref = `${Math.random().toString()} `;
|
|
544
|
+
axisLabel = (React.createElement("g", { className: "axis-label radial", transform: `translate(0,${locationDistance})` },
|
|
545
|
+
React.createElement("text", { textAnchor: "middle" },
|
|
546
|
+
React.createElement("textPath", { startOffset: tickSize * Math.PI * 0.5, xlinkHref: `#${ref}` }, label.name))));
|
|
547
|
+
}
|
|
548
|
+
ticks.push(React.createElement("g", { key: `orframe-radial-axis-element-${t}`, className: "axis axis-label axis-tick radial", transform: `translate(0,0)` },
|
|
549
|
+
React.createElement("path", { id: ref, d: (0, exports.circlePath)(0, 0, tickSize), r: tickSize, stroke: "gray", fill: "none" }),
|
|
550
|
+
React.createElement("text", { y: -tickSize + 5, textAnchor: "middle" }, tickFormat(t)),
|
|
551
|
+
axisLabel));
|
|
552
|
+
}
|
|
553
|
+
return undefined;
|
|
554
|
+
});
|
|
555
|
+
});
|
|
556
|
+
generatedAxis = [
|
|
557
|
+
React.createElement("g", { key: axis[0].key || `orframe-radial-axis-container`, className: "axis-labels", transform: `translate(${adjustedSize[0] / 2},${adjustedSize[1] / 2})` }, ticks)
|
|
558
|
+
];
|
|
559
|
+
}
|
|
560
|
+
return { axis: generatedAxis, axesTickLines };
|
|
561
|
+
};
|
|
562
|
+
exports.orFrameAxisGenerator = orFrameAxisGenerator;
|
|
563
|
+
const canvasEvent = (canvasContext, overlayRegions, canvasMap, e) => {
|
|
564
|
+
const interactionContext = canvasContext.getContext("2d", { willReadFrequently: true });
|
|
565
|
+
const hoverPoint = interactionContext.getImageData(e.offsetX, e.offsetY, 1, 1);
|
|
566
|
+
const mostCommonRGB = `rgba(${hoverPoint.data[0]},${hoverPoint.data[1]},${hoverPoint.data[2]},255)`;
|
|
567
|
+
let overlay = overlayRegions[canvasMap.get(mostCommonRGB)];
|
|
568
|
+
if (!overlay) {
|
|
569
|
+
const hoverArea = interactionContext.getImageData(e.offsetX - 2, e.offsetY - 2, 5, 5);
|
|
570
|
+
let x = 0;
|
|
571
|
+
while (!overlay && x < 100) {
|
|
572
|
+
overlay =
|
|
573
|
+
overlayRegions[canvasMap.get(`rgba(${hoverArea.data[x]},${hoverArea.data[x + 1]},${hoverArea.data[x + 2]},255)`)];
|
|
574
|
+
x += 4;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
return overlay;
|
|
578
|
+
};
|
|
579
|
+
exports.canvasEvent = canvasEvent;
|