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,588 @@
|
|
|
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.swarmLayout = void 0;
|
|
40
|
+
exports.clusterBarLayout = clusterBarLayout;
|
|
41
|
+
exports.barLayout = barLayout;
|
|
42
|
+
exports.timelineLayout = timelineLayout;
|
|
43
|
+
exports.pointLayout = pointLayout;
|
|
44
|
+
const React = __importStar(require("react"));
|
|
45
|
+
const d3_shape_1 = require("d3-shape");
|
|
46
|
+
const svg_path_bounding_box_1 = __importDefault(require("svg-path-bounding-box"));
|
|
47
|
+
const d3_scale_1 = require("d3-scale");
|
|
48
|
+
const pieceDrawing_1 = require("./pieceDrawing");
|
|
49
|
+
const twoPI = Math.PI * 2;
|
|
50
|
+
const radialBarFeatureGenerator = ({ type, ordset, adjustedSize, piece, i }) => {
|
|
51
|
+
let { innerRadius } = type;
|
|
52
|
+
const { offsetAngle = 0, angleRange = [0, 360] } = type;
|
|
53
|
+
const offsetPct = offsetAngle / 360;
|
|
54
|
+
const rangePct = angleRange.map((d) => d / 360);
|
|
55
|
+
const rangeMod = rangePct[1] - rangePct[0];
|
|
56
|
+
const adjustedPct = rangeMod < 1 ? (0, d3_scale_1.scaleLinear)().domain([0, 1]).range(rangePct) : (d) => d;
|
|
57
|
+
let innerSize = type.type === "clusterbar"
|
|
58
|
+
? 0
|
|
59
|
+
: type.type === "timeline"
|
|
60
|
+
? piece.scaledValue / 2
|
|
61
|
+
: piece.bottom / 2;
|
|
62
|
+
let outerSize = type.type === "clusterbar"
|
|
63
|
+
? piece.scaledValue / 2
|
|
64
|
+
: type.type === "timeline"
|
|
65
|
+
? piece.scaledEndValue / 2
|
|
66
|
+
: piece.scaledValue / 2 + piece.bottom / 2;
|
|
67
|
+
if (innerRadius) {
|
|
68
|
+
innerRadius = parseInt(innerRadius, 10);
|
|
69
|
+
const canvasRadius = adjustedSize[0] / 2;
|
|
70
|
+
const donutMod = (canvasRadius - innerRadius) / canvasRadius;
|
|
71
|
+
innerSize = innerSize * donutMod + innerRadius;
|
|
72
|
+
outerSize = outerSize * donutMod + innerRadius;
|
|
73
|
+
}
|
|
74
|
+
const arcGenerator = (0, d3_shape_1.arc)().innerRadius(innerSize).outerRadius(outerSize);
|
|
75
|
+
const angle = (type.type === "clusterbar"
|
|
76
|
+
? (ordset.pct - ordset.pct_padding) / ordset.pieceData.length
|
|
77
|
+
: ordset.pct) * rangeMod;
|
|
78
|
+
const startAngle = adjustedPct(type.type === "clusterbar"
|
|
79
|
+
? ordset.pct_start +
|
|
80
|
+
(i / ordset.pieceData.length) * (ordset.pct - ordset.pct_padding)
|
|
81
|
+
: ordset.pct === 1
|
|
82
|
+
? 0
|
|
83
|
+
: ordset.pct_start + offsetPct);
|
|
84
|
+
const endAngle = ordset.pct === 1
|
|
85
|
+
? rangePct[1]
|
|
86
|
+
: Math.max(startAngle, startAngle + angle - ordset.pct_padding / 2);
|
|
87
|
+
const startAngleFinal = startAngle * twoPI;
|
|
88
|
+
const endAngleFinal = endAngle * twoPI;
|
|
89
|
+
const markD = arcGenerator({
|
|
90
|
+
startAngle: startAngleFinal,
|
|
91
|
+
endAngle: endAngleFinal
|
|
92
|
+
});
|
|
93
|
+
const centroid = arcGenerator.centroid({
|
|
94
|
+
startAngle: startAngleFinal,
|
|
95
|
+
endAngle: endAngleFinal
|
|
96
|
+
});
|
|
97
|
+
const xOffset = adjustedSize[0] / 2;
|
|
98
|
+
const yOffset = adjustedSize[1] / 2;
|
|
99
|
+
const xPosition = centroid[0] + xOffset;
|
|
100
|
+
const yPosition = centroid[1] + yOffset;
|
|
101
|
+
const outerPoint = (0, pieceDrawing_1.pointOnArcAtAngle)([0, 0], (startAngle + endAngle) / 2, piece.scaledValue / 2);
|
|
102
|
+
const xy = {
|
|
103
|
+
arcGenerator: arcGenerator,
|
|
104
|
+
startAngle: startAngleFinal,
|
|
105
|
+
endAngle: endAngleFinal,
|
|
106
|
+
dx: outerPoint[0],
|
|
107
|
+
dy: outerPoint[1]
|
|
108
|
+
};
|
|
109
|
+
const translate = `translate(${xOffset},${yOffset})`;
|
|
110
|
+
return {
|
|
111
|
+
xPosition,
|
|
112
|
+
yPosition,
|
|
113
|
+
xy,
|
|
114
|
+
translate,
|
|
115
|
+
tx: xOffset,
|
|
116
|
+
ty: yOffset,
|
|
117
|
+
markProps: {
|
|
118
|
+
markType: "path",
|
|
119
|
+
d: markD,
|
|
120
|
+
transform: translate
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
const iconBarCustomMark = ({ type, projection, finalHeight, finalWidth, styleFn, renderValue, classFn }) => (piece, i, xy) => {
|
|
125
|
+
const iconD = typeof type.icon === "string" ? type.icon : type.icon(piece.data, i);
|
|
126
|
+
const { iconPadding = 1, resize = "auto" } = type;
|
|
127
|
+
const iconBounds = (0, svg_path_bounding_box_1.default)(iconD);
|
|
128
|
+
const iconTranslate = [
|
|
129
|
+
0 - iconBounds.x1 + iconPadding,
|
|
130
|
+
0 - iconBounds.y1 + iconPadding
|
|
131
|
+
];
|
|
132
|
+
iconBounds.height += iconPadding * 2;
|
|
133
|
+
iconBounds.width += iconPadding * 2;
|
|
134
|
+
const icons = [];
|
|
135
|
+
let stackedIconSize = iconBounds.height;
|
|
136
|
+
let stackedIconNumber = 1;
|
|
137
|
+
let iconScale = 1;
|
|
138
|
+
const spaceToUse = projection === "horizontal" ? finalHeight : finalWidth;
|
|
139
|
+
const sizeToFit = projection === "horizontal" ? iconBounds.height : iconBounds.width;
|
|
140
|
+
const sizeToPad = projection === "horizontal" ? iconBounds.width : iconBounds.height;
|
|
141
|
+
const spaceToFill = projection === "horizontal" ? xy.width : xy.height;
|
|
142
|
+
const spaceToStackFill = projection === "horizontal" ? xy.height : xy.width;
|
|
143
|
+
if (resize === "auto") {
|
|
144
|
+
stackedIconSize = spaceToUse / sizeToFit;
|
|
145
|
+
if (stackedIconSize < 1) {
|
|
146
|
+
iconScale = stackedIconSize;
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
stackedIconNumber = Math.floor(stackedIconSize);
|
|
150
|
+
iconScale =
|
|
151
|
+
1 + (stackedIconSize - stackedIconNumber) / stackedIconNumber;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
else if (resize === "fixed") {
|
|
155
|
+
iconScale = spaceToUse / sizeToFit;
|
|
156
|
+
}
|
|
157
|
+
// const finalIconWidth = iconBounds.width * iconScale;
|
|
158
|
+
const finalIconHeight = iconBounds.height * iconScale;
|
|
159
|
+
const spaceToStep = sizeToPad * iconScale;
|
|
160
|
+
const spaceToStackStep = sizeToFit * iconScale;
|
|
161
|
+
iconTranslate[0] = iconTranslate[0] * iconScale;
|
|
162
|
+
iconTranslate[1] = iconTranslate[1] * iconScale;
|
|
163
|
+
const randoClipID = `iso-clip-${i}-${Math.random()}`;
|
|
164
|
+
const clipPath = `url(#${randoClipID})`;
|
|
165
|
+
if (xy.width > 0) {
|
|
166
|
+
icons.push(React.createElement("clipPath", { key: randoClipID, id: randoClipID },
|
|
167
|
+
React.createElement("rect", { x: 0, y: 0, width: xy.width, height: xy.height })));
|
|
168
|
+
const iconPieces = [];
|
|
169
|
+
const stepStart = projection === "horizontal" ? 0 : xy.height - finalIconHeight;
|
|
170
|
+
const stepper = projection === "horizontal" ? spaceToStep : -spaceToStep;
|
|
171
|
+
const stepTest = projection === "horizontal"
|
|
172
|
+
? (step, spaceToFillValue) => step < spaceToFillValue
|
|
173
|
+
: (step, spaceToFillValue, stepperValue) => step > 0 + stepperValue;
|
|
174
|
+
for (let step = stepStart; stepTest(step, spaceToFill, stepper); step += stepper) {
|
|
175
|
+
for (let stack = 0; stack < spaceToStackFill; stack += spaceToStackStep) {
|
|
176
|
+
const stepX = projection === "horizontal" ? step : stack;
|
|
177
|
+
const stepY = projection === "horizontal" ? stack : step;
|
|
178
|
+
const paddedX = stepX + iconTranslate[0];
|
|
179
|
+
const paddedY = stepY + iconTranslate[1];
|
|
180
|
+
iconPieces.push(React.createElement("path", { key: `icon-${step}-${stack}`, transform: `translate(${paddedX},${paddedY}) scale(${iconScale})`, vectorEffect: "non-scaling-stroke", d: iconD, style: styleFn({ ...piece, ...piece.data }, i), className: classFn({ ...piece, ...piece.data }, i) }));
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
icons.push(React.createElement("g", { key: `clipped-region-${i}`, clipPath: clipPath }, iconPieces));
|
|
184
|
+
}
|
|
185
|
+
return icons;
|
|
186
|
+
};
|
|
187
|
+
function clusterBarLayout({ type, data, renderMode, eventListenersGenerator, styleFn, projection, classFn, adjustedSize, chartSize, margin, rScale }) {
|
|
188
|
+
let allCalculatedPieces = [];
|
|
189
|
+
const keys = Object.keys(data);
|
|
190
|
+
keys.forEach((key, ordsetI) => {
|
|
191
|
+
const ordset = data[key];
|
|
192
|
+
const barColumnWidth = Math.max(ordset.width, 1);
|
|
193
|
+
const clusterWidth = barColumnWidth / ordset.pieceData.length;
|
|
194
|
+
let currentX = 0;
|
|
195
|
+
let currentY = 0;
|
|
196
|
+
const calculatedPieces = ordset.pieceData.map((piece, i) => {
|
|
197
|
+
const renderValue = renderMode && renderMode(piece.data, i);
|
|
198
|
+
let xPosition = piece.x;
|
|
199
|
+
let yPosition = piece.base;
|
|
200
|
+
let finalWidth = clusterWidth;
|
|
201
|
+
let finalHeight = piece.scaledValue;
|
|
202
|
+
let xy = { x: 0, y: 0 };
|
|
203
|
+
if (!piece.negative) {
|
|
204
|
+
yPosition -= piece.scaledValue;
|
|
205
|
+
}
|
|
206
|
+
if (projection === "horizontal") {
|
|
207
|
+
//TODO: NEGATIVE FOR HORIZONTAL
|
|
208
|
+
yPosition = piece.x;
|
|
209
|
+
xPosition = piece.base;
|
|
210
|
+
finalHeight = clusterWidth;
|
|
211
|
+
finalWidth = piece.scaledValue;
|
|
212
|
+
xy.x = piece.scaledValue;
|
|
213
|
+
if (piece.negative) {
|
|
214
|
+
xPosition -= piece.scaledValue;
|
|
215
|
+
xy.x = xPosition;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
let translate, markProps = {}, pieceTx = 0, pieceTy = 0;
|
|
219
|
+
if (projection === "radial") {
|
|
220
|
+
let tx, ty;
|
|
221
|
+
({ xPosition, yPosition, markProps, xy, tx, ty } = radialBarFeatureGenerator({
|
|
222
|
+
type,
|
|
223
|
+
ordset,
|
|
224
|
+
adjustedSize,
|
|
225
|
+
piece,
|
|
226
|
+
i
|
|
227
|
+
}));
|
|
228
|
+
pieceTx = tx;
|
|
229
|
+
pieceTy = ty;
|
|
230
|
+
xy.x = xPosition;
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
xPosition += currentX;
|
|
234
|
+
yPosition += currentY;
|
|
235
|
+
markProps = {
|
|
236
|
+
markType: "rect",
|
|
237
|
+
x: xPosition,
|
|
238
|
+
y: yPosition,
|
|
239
|
+
width: Math.max(0, finalWidth),
|
|
240
|
+
height: Math.max(0, finalHeight),
|
|
241
|
+
rx: 0,
|
|
242
|
+
ry: 0
|
|
243
|
+
};
|
|
244
|
+
if (projection === "vertical") {
|
|
245
|
+
xy.x = xPosition;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
const eventListeners = eventListenersGenerator(piece, i);
|
|
249
|
+
xy.y = yPosition;
|
|
250
|
+
xy.middle = clusterWidth / 2;
|
|
251
|
+
xy.height = finalHeight;
|
|
252
|
+
xy.width = finalWidth;
|
|
253
|
+
if (type.icon && projection !== "radial") {
|
|
254
|
+
type.customMark = iconBarCustomMark({
|
|
255
|
+
type,
|
|
256
|
+
projection,
|
|
257
|
+
finalHeight,
|
|
258
|
+
finalWidth,
|
|
259
|
+
styleFn,
|
|
260
|
+
renderValue,
|
|
261
|
+
classFn
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
else if (type.icon && projection === "radial") {
|
|
265
|
+
console.error("Icons are currently unsupported on radial charts");
|
|
266
|
+
}
|
|
267
|
+
const renderElementObject = type.customMark ? (React.createElement("g", { key: `piece-${piece.renderKey}`, transform: translate ? translate : `translate(${xPosition},${yPosition})` }, type.customMark({ ...piece.data, ...piece, x: xPosition, y: yPosition }, i, {
|
|
268
|
+
...xy,
|
|
269
|
+
renderMode,
|
|
270
|
+
styleFn,
|
|
271
|
+
classFn,
|
|
272
|
+
adjustedSize,
|
|
273
|
+
chartSize,
|
|
274
|
+
margin,
|
|
275
|
+
rScale
|
|
276
|
+
}))) : ({
|
|
277
|
+
className: classFn({ ...piece, ...piece.data }, i),
|
|
278
|
+
key: `piece-${piece.renderKey}`,
|
|
279
|
+
transform: translate,
|
|
280
|
+
style: styleFn({ ...piece, ...piece.data }, ordsetI),
|
|
281
|
+
...markProps,
|
|
282
|
+
...eventListeners
|
|
283
|
+
});
|
|
284
|
+
const calculatedPiece = {
|
|
285
|
+
o: key,
|
|
286
|
+
xy,
|
|
287
|
+
piece,
|
|
288
|
+
tx: pieceTx,
|
|
289
|
+
ty: pieceTy,
|
|
290
|
+
renderValue,
|
|
291
|
+
renderElement: renderElementObject
|
|
292
|
+
};
|
|
293
|
+
if (projection === "horizontal") {
|
|
294
|
+
currentY += finalHeight;
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
currentX += finalWidth;
|
|
298
|
+
}
|
|
299
|
+
// currentOffset += pieceSize
|
|
300
|
+
return calculatedPiece;
|
|
301
|
+
});
|
|
302
|
+
allCalculatedPieces = [...allCalculatedPieces, ...calculatedPieces];
|
|
303
|
+
});
|
|
304
|
+
return allCalculatedPieces;
|
|
305
|
+
}
|
|
306
|
+
function barLayout({ type, data, renderMode, eventListenersGenerator, styleFn, projection, classFn, adjustedSize, chartSize, margin, rScale }) {
|
|
307
|
+
const keys = Object.keys(data);
|
|
308
|
+
let allCalculatedPieces = [];
|
|
309
|
+
keys.forEach((key, ordsetI) => {
|
|
310
|
+
const ordset = data[key];
|
|
311
|
+
const barColumnWidth = Math.max(ordset.width, 1);
|
|
312
|
+
ordset.pieceData.forEach((piece, i) => {
|
|
313
|
+
const pieceSize = piece.scaledValue;
|
|
314
|
+
const renderValue = renderMode && renderMode(piece.data, i);
|
|
315
|
+
let xPosition = piece.x;
|
|
316
|
+
let yPosition = piece.bottom;
|
|
317
|
+
let finalWidth = barColumnWidth;
|
|
318
|
+
let finalHeight = pieceSize;
|
|
319
|
+
let xy = {};
|
|
320
|
+
if (!piece.negative) {
|
|
321
|
+
yPosition -= piece.scaledValue;
|
|
322
|
+
}
|
|
323
|
+
if (projection === "vertical") {
|
|
324
|
+
xy = {
|
|
325
|
+
x: xPosition,
|
|
326
|
+
y: yPosition,
|
|
327
|
+
middle: barColumnWidth / 2,
|
|
328
|
+
height: finalHeight,
|
|
329
|
+
width: finalWidth
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
else if (projection === "horizontal") {
|
|
333
|
+
yPosition = piece.x;
|
|
334
|
+
xPosition = piece.bottom;
|
|
335
|
+
finalHeight = barColumnWidth;
|
|
336
|
+
finalWidth = pieceSize;
|
|
337
|
+
xy = {
|
|
338
|
+
x: xPosition + piece.scaledValue,
|
|
339
|
+
y: yPosition,
|
|
340
|
+
middle: barColumnWidth / 2,
|
|
341
|
+
height: finalHeight,
|
|
342
|
+
width: finalWidth
|
|
343
|
+
};
|
|
344
|
+
if (piece.negative) {
|
|
345
|
+
xPosition = piece.bottom - piece.scaledValue;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
let markProps, pieceTx = 0, pieceTy = 0;
|
|
349
|
+
if (projection === "radial") {
|
|
350
|
+
let tx, ty;
|
|
351
|
+
({ markProps, xPosition, yPosition, tx, ty } = radialBarFeatureGenerator({
|
|
352
|
+
type,
|
|
353
|
+
ordset,
|
|
354
|
+
adjustedSize,
|
|
355
|
+
piece,
|
|
356
|
+
i
|
|
357
|
+
}));
|
|
358
|
+
pieceTx = tx;
|
|
359
|
+
pieceTy = ty;
|
|
360
|
+
finalHeight = undefined;
|
|
361
|
+
finalWidth = undefined;
|
|
362
|
+
xy = {
|
|
363
|
+
x: xPosition,
|
|
364
|
+
y: yPosition,
|
|
365
|
+
middle: barColumnWidth / 2,
|
|
366
|
+
height: finalHeight,
|
|
367
|
+
width: finalWidth
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
else {
|
|
371
|
+
markProps = {
|
|
372
|
+
markType: "rect",
|
|
373
|
+
x: xPosition,
|
|
374
|
+
y: yPosition,
|
|
375
|
+
width: Math.max(0, finalWidth),
|
|
376
|
+
height: Math.max(0, finalHeight),
|
|
377
|
+
rx: 0,
|
|
378
|
+
ry: 0
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
const eventListeners = eventListenersGenerator(piece, i);
|
|
382
|
+
if (type.icon && projection !== "radial") {
|
|
383
|
+
type.customMark = iconBarCustomMark({
|
|
384
|
+
type,
|
|
385
|
+
projection,
|
|
386
|
+
finalHeight,
|
|
387
|
+
finalWidth,
|
|
388
|
+
styleFn,
|
|
389
|
+
renderValue,
|
|
390
|
+
classFn
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
else if (type.icon && projection !== "horizontal") {
|
|
394
|
+
console.error("Icons are currently unsupported in radial charts");
|
|
395
|
+
}
|
|
396
|
+
const renderElementObject = type.customMark ? (React.createElement("g", { key: `piece-${piece.renderKey}`, transform: `translate(${xPosition},${yPosition})`, role: "img", tabIndex: -1 }, type.customMark({ ...piece.data, ...piece, x: xPosition, y: yPosition }, i, {
|
|
397
|
+
...xy,
|
|
398
|
+
renderMode,
|
|
399
|
+
styleFn,
|
|
400
|
+
classFn,
|
|
401
|
+
adjustedSize,
|
|
402
|
+
chartSize,
|
|
403
|
+
margin,
|
|
404
|
+
rScale
|
|
405
|
+
}))) : ({
|
|
406
|
+
className: classFn({ ...piece, ...piece.data }, i),
|
|
407
|
+
key: `piece-${piece.renderKey}`,
|
|
408
|
+
style: styleFn({ ...piece, ...piece.data }, ordsetI),
|
|
409
|
+
...eventListeners,
|
|
410
|
+
...markProps
|
|
411
|
+
});
|
|
412
|
+
allCalculatedPieces.push({
|
|
413
|
+
o: key,
|
|
414
|
+
xy,
|
|
415
|
+
piece,
|
|
416
|
+
tx: pieceTx,
|
|
417
|
+
ty: pieceTy,
|
|
418
|
+
renderValue,
|
|
419
|
+
renderElement: renderElementObject
|
|
420
|
+
});
|
|
421
|
+
});
|
|
422
|
+
});
|
|
423
|
+
return allCalculatedPieces;
|
|
424
|
+
}
|
|
425
|
+
function timelineLayout({ type, data, renderMode, eventListenersGenerator, styleFn, projection, classFn, adjustedSize, chartSize, margin, rScale }) {
|
|
426
|
+
let allCalculatedPieces = [];
|
|
427
|
+
const keys = Object.keys(data);
|
|
428
|
+
keys.forEach((key, ordsetI) => {
|
|
429
|
+
const ordset = data[key];
|
|
430
|
+
const calculatedPieces = [];
|
|
431
|
+
ordset.pieceData.forEach((piece, i) => {
|
|
432
|
+
let scaledValue, scaledBottom;
|
|
433
|
+
let pieceTx = 0, pieceTy = 0;
|
|
434
|
+
const renderValue = renderMode && renderMode(piece.data, i);
|
|
435
|
+
let xPosition = ordset.x;
|
|
436
|
+
let height = piece.scaledEndValue - piece.scaledValue;
|
|
437
|
+
let yPosition = piece.scaledVerticalValue - height;
|
|
438
|
+
let width = ordset.width;
|
|
439
|
+
let markProps = {
|
|
440
|
+
markType: "rect",
|
|
441
|
+
height: height < 0 ? -height : height,
|
|
442
|
+
width,
|
|
443
|
+
x: xPosition,
|
|
444
|
+
y: height < 0 ? yPosition + height : yPosition
|
|
445
|
+
};
|
|
446
|
+
if (projection === "horizontal") {
|
|
447
|
+
yPosition = ordset.x;
|
|
448
|
+
xPosition = piece.scaledValue;
|
|
449
|
+
scaledValue = piece.scaledEndValue - piece.scaledValue;
|
|
450
|
+
scaledBottom = piece.scaledBottom;
|
|
451
|
+
width = piece.scaledEndValue - piece.scaledValue;
|
|
452
|
+
height = ordset.width;
|
|
453
|
+
markProps = {
|
|
454
|
+
markType: "rect",
|
|
455
|
+
height,
|
|
456
|
+
width: width < 0 ? -width : width,
|
|
457
|
+
x: width < 0 ? xPosition + width : xPosition,
|
|
458
|
+
y: yPosition
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
else if (projection === "radial") {
|
|
462
|
+
let tx, ty;
|
|
463
|
+
({ markProps, tx, ty } = radialBarFeatureGenerator({
|
|
464
|
+
piece,
|
|
465
|
+
type,
|
|
466
|
+
ordset,
|
|
467
|
+
adjustedSize,
|
|
468
|
+
i
|
|
469
|
+
}));
|
|
470
|
+
pieceTx = tx;
|
|
471
|
+
pieceTy = ty;
|
|
472
|
+
}
|
|
473
|
+
//Only return the actual piece if you're rendering points, otherwise you just needed to iterate and calculate the points for the contour summary type
|
|
474
|
+
const eventListeners = eventListenersGenerator(piece, i);
|
|
475
|
+
const xy = {
|
|
476
|
+
x: xPosition,
|
|
477
|
+
y: yPosition,
|
|
478
|
+
scaledValue,
|
|
479
|
+
scaledBottom,
|
|
480
|
+
height
|
|
481
|
+
};
|
|
482
|
+
const renderElementObject = type.customMark ? (React.createElement("g", { key: `piece-${piece.renderKey}`, transform: `translate(${xPosition},${yPosition + height})` }, type.customMark({ ...piece.data, ...piece, x: xPosition, y: yPosition }, i, {
|
|
483
|
+
...xy,
|
|
484
|
+
renderMode,
|
|
485
|
+
styleFn,
|
|
486
|
+
classFn,
|
|
487
|
+
adjustedSize,
|
|
488
|
+
chartSize,
|
|
489
|
+
margin,
|
|
490
|
+
rScale
|
|
491
|
+
}))) : ({
|
|
492
|
+
className: classFn({ ...piece, ...piece.data }, i),
|
|
493
|
+
key: `piece-${piece.renderKey}`,
|
|
494
|
+
style: styleFn({ ...piece, ...piece.data }, ordsetI),
|
|
495
|
+
...markProps,
|
|
496
|
+
...eventListeners
|
|
497
|
+
});
|
|
498
|
+
const calculatedPiece = {
|
|
499
|
+
o: key,
|
|
500
|
+
xy,
|
|
501
|
+
piece,
|
|
502
|
+
tx: pieceTx,
|
|
503
|
+
ty: pieceTy,
|
|
504
|
+
renderValue,
|
|
505
|
+
renderElement: renderElementObject
|
|
506
|
+
};
|
|
507
|
+
calculatedPieces.push(calculatedPiece);
|
|
508
|
+
});
|
|
509
|
+
allCalculatedPieces = [...allCalculatedPieces, ...calculatedPieces];
|
|
510
|
+
});
|
|
511
|
+
return allCalculatedPieces;
|
|
512
|
+
}
|
|
513
|
+
function pointLayout({ type, data, renderMode, eventListenersGenerator, styleFn, projection, classFn, adjustedSize, chartSize, margin, rScale }) {
|
|
514
|
+
const circleRadius = type.r || 3;
|
|
515
|
+
let allCalculatedPieces = [];
|
|
516
|
+
const keys = Object.keys(data);
|
|
517
|
+
keys.forEach((key, ordsetI) => {
|
|
518
|
+
const ordset = data[key];
|
|
519
|
+
const calculatedPieces = [];
|
|
520
|
+
ordset.pieceData.forEach((piece, i) => {
|
|
521
|
+
const renderValue = renderMode && renderMode(piece.data, i);
|
|
522
|
+
let xPosition = ordset.middle;
|
|
523
|
+
let yPosition = piece.scaledVerticalValue;
|
|
524
|
+
if (projection === "horizontal") {
|
|
525
|
+
yPosition = ordset.middle;
|
|
526
|
+
xPosition = piece.scaledValue;
|
|
527
|
+
}
|
|
528
|
+
else if (projection === "radial") {
|
|
529
|
+
const angle = ordset.pct_middle;
|
|
530
|
+
const rPosition = piece.scaledValue / 2;
|
|
531
|
+
const baseCentroid = (0, pieceDrawing_1.pointOnArcAtAngle)([adjustedSize[0] / 2, adjustedSize[1] / 2], angle, rPosition);
|
|
532
|
+
xPosition = baseCentroid[0];
|
|
533
|
+
yPosition = baseCentroid[1];
|
|
534
|
+
}
|
|
535
|
+
//Only return the actual piece if you're rendering points, otherwise you just needed to iterate and calculate the points for the contour summary type
|
|
536
|
+
const actualCircleRadius = typeof circleRadius === "function"
|
|
537
|
+
? circleRadius(piece, i)
|
|
538
|
+
: circleRadius;
|
|
539
|
+
const eventListeners = eventListenersGenerator(piece, i);
|
|
540
|
+
const renderElementObject = type.customMark ? (React.createElement("g", { key: `piece-${piece.renderKey}`, transform: `translate(${xPosition},${yPosition})` }, type.customMark({
|
|
541
|
+
...piece.data,
|
|
542
|
+
...piece,
|
|
543
|
+
x: xPosition,
|
|
544
|
+
y: yPosition,
|
|
545
|
+
width: ordset.width
|
|
546
|
+
}, i, {
|
|
547
|
+
r: circleRadius,
|
|
548
|
+
x: xPosition,
|
|
549
|
+
y: yPosition,
|
|
550
|
+
renderMode,
|
|
551
|
+
styleFn,
|
|
552
|
+
classFn,
|
|
553
|
+
adjustedSize,
|
|
554
|
+
chartSize,
|
|
555
|
+
margin,
|
|
556
|
+
rScale
|
|
557
|
+
}))) : ({
|
|
558
|
+
className: classFn({ ...piece, ...piece.data }, i),
|
|
559
|
+
markType: "rect",
|
|
560
|
+
key: `piece-${piece.renderKey}`,
|
|
561
|
+
height: actualCircleRadius * 2,
|
|
562
|
+
width: actualCircleRadius * 2,
|
|
563
|
+
x: xPosition - actualCircleRadius,
|
|
564
|
+
y: yPosition - actualCircleRadius,
|
|
565
|
+
rx: actualCircleRadius,
|
|
566
|
+
ry: actualCircleRadius,
|
|
567
|
+
style: styleFn({ ...piece, ...piece.data }, ordsetI),
|
|
568
|
+
...eventListeners
|
|
569
|
+
});
|
|
570
|
+
const calculatedPiece = {
|
|
571
|
+
o: key,
|
|
572
|
+
xy: {
|
|
573
|
+
x: xPosition,
|
|
574
|
+
y: yPosition
|
|
575
|
+
},
|
|
576
|
+
piece,
|
|
577
|
+
renderValue,
|
|
578
|
+
renderElement: renderElementObject
|
|
579
|
+
};
|
|
580
|
+
calculatedPieces.push(calculatedPiece);
|
|
581
|
+
});
|
|
582
|
+
allCalculatedPieces = [...allCalculatedPieces, ...calculatedPieces];
|
|
583
|
+
});
|
|
584
|
+
return allCalculatedPieces;
|
|
585
|
+
}
|
|
586
|
+
// Re-export from new location for backwards compatibility
|
|
587
|
+
var swarmLayout_1 = require("./swarmLayout");
|
|
588
|
+
Object.defineProperty(exports, "swarmLayout", { enumerable: true, get: function () { return swarmLayout_1.swarmLayout; } });
|