semiotic 2.0.2 → 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/Annotation.d.ts +3 -0
- package/dist/AnnotationLayer/AnnotationLayer.d.ts +25 -0
- package/dist/Axis/Axis.d.ts +7 -0
- package/dist/Axis/axisTitle.d.ts +10 -0
- package/dist/Axis/index.d.ts +2 -0
- package/dist/Axis/summaryGraphic.d.ts +17 -0
- package/dist/Brush.d.ts +12 -0
- package/dist/DividedLine.d.ts +16 -0
- package/dist/FacetController.d.ts +12 -0
- package/dist/Frame.d.ts +2 -0
- package/dist/InteractionLayer.d.ts +3 -0
- package/dist/Legend.d.ts +3 -0
- package/dist/MiniMap.d.ts +14 -0
- package/dist/MinimapXYFrame.d.ts +10 -0
- package/dist/NetworkFrame.d.ts +8 -0
- package/dist/OrdinalFrame.d.ts +8 -0
- package/dist/ResponsiveFrame.d.ts +22 -0
- package/dist/ResponsiveMinimapXYFrame.d.ts +3 -0
- package/dist/ResponsiveNetworkFrame.d.ts +3 -0
- package/dist/ResponsiveOrdinalFrame.d.ts +3 -0
- package/dist/ResponsiveXYFrame.d.ts +3 -0
- package/dist/SparkFrame.d.ts +14 -0
- package/dist/SparkNetworkFrame.d.ts +5 -0
- package/dist/SparkOrdinalFrame.d.ts +5 -0
- package/dist/SparkXYFrame.d.ts +5 -0
- package/dist/Tooltip/Tooltip.d.ts +141 -0
- package/dist/TooltipPositioner/index.d.ts +7 -0
- package/dist/VisualizationLayer.d.ts +33 -0
- package/dist/XYFrame.d.ts +8 -0
- package/dist/annotationLayerBehavior/annotationHandling.d.ts +19 -0
- package/dist/annotationLayerBehavior/d3labeler.d.ts +9 -0
- package/dist/annotationRules/baseRules.d.ts +25 -0
- package/dist/annotationRules/networkframeRules.d.ts +48 -0
- package/dist/annotationRules/orframeRules.d.ts +103 -0
- package/dist/annotationRules/xyframeRules.d.ts +117 -0
- package/dist/batchWork.d.ts +6 -0
- 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/coordinateNames.d.ts +8 -0
- package/dist/constants/frame_props.d.ts +13 -0
- package/dist/constants/jsx.d.ts +19 -0
- package/dist/data/dataFunctions.d.ts +45 -0
- package/dist/data/multiAccessorUtils.d.ts +1 -0
- package/dist/data/networkPipelineCache.d.ts +27 -0
- package/dist/data/ordinalPipelineCache.d.ts +33 -0
- package/dist/data/unflowedFunctions.d.ts +1 -0
- package/dist/data/xyPipelineCache.d.ts +35 -0
- package/dist/generic_utilities/functions.d.ts +1 -0
- package/dist/index.d.ts +133 -0
- package/dist/interactionLayerBehavior/InteractionCanvas.d.ts +20 -0
- 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 +13 -0
- 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 +111 -0
- package/dist/processing/networkDefaults.d.ts +36 -0
- package/dist/processing/networkLayoutHelpers.d.ts +54 -0
- package/dist/processing/ordinal.d.ts +102 -0
- 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 +140 -0
- 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 +51 -0
- package/dist/semiotic.js +18723 -12996
- package/dist/semiotic.js.map +1 -0
- package/dist/semiotic.min.js +1 -0
- package/dist/semiotic.module.js +18666 -12965
- 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/store/TooltipStore.d.ts +2 -0
- package/dist/store/createStore.d.ts +1 -0
- package/dist/svg/SvgHelper.d.ts +33 -0
- package/dist/svg/areaDrawing.d.ts +21 -0
- 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/ckmeans.d.ts +69 -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 +108 -0
- package/dist/svg/graphAlgorithms.d.ts +14 -0
- package/dist/svg/hexbinLayout.d.ts +7 -0
- package/dist/svg/lineDrawing.d.ts +99 -0
- package/dist/svg/networkDrawing.d.ts +16 -0
- package/dist/svg/nodeGenerators.d.ts +58 -0
- package/dist/svg/pieceDrawing.d.ts +12 -0
- package/dist/svg/pieceLayouts.d.ts +53 -0
- package/dist/svg/sankeyLinks.d.ts +3 -0
- package/dist/svg/summaryAxis.d.ts +6 -0
- package/dist/svg/summaryLayouts.d.ts +53 -0
- package/dist/svg/swarmLayout.d.ts +13 -0
- package/dist/types/annotationTypes.d.ts +135 -0
- package/dist/types/canvasTypes.d.ts +9 -0
- package/dist/types/generalTypes.d.ts +238 -0
- package/dist/types/interactionTypes.d.ts +72 -0
- package/dist/types/legendTypes.d.ts +20 -0
- package/dist/types/networkTypes.d.ts +175 -0
- package/dist/types/ordinalTypes.d.ts +112 -0
- package/dist/types/xyTypes.d.ts +115 -0
- package/dist/useBoundingRect.d.ts +2 -0
- package/dist/useDerivedStateFromProps.d.ts +1 -0
- package/dist/useLegacyUnmountCallback.d.ts +2 -0
- package/dist/visualizationLayerBehavior/axis.d.ts +36 -0
- package/dist/visualizationLayerBehavior/general.d.ts +80 -0
- 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 -65
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.XYFrameInner = XYFrameInner;
|
|
41
|
+
const React = __importStar(require("react"));
|
|
42
|
+
const react_1 = require("react");
|
|
43
|
+
const d3_scale_1 = require("d3-scale");
|
|
44
|
+
// components
|
|
45
|
+
const Frame_1 = __importDefault(require("./Frame"));
|
|
46
|
+
const TooltipPositioner_1 = __importDefault(require("./TooltipPositioner"));
|
|
47
|
+
const xyframeRules_1 = require("./annotationRules/xyframeRules");
|
|
48
|
+
const baseRules_1 = require("./annotationRules/baseRules");
|
|
49
|
+
const lineDrawing_1 = require("./svg/lineDrawing");
|
|
50
|
+
const frameFunctions_1 = require("./svg/frameFunctions");
|
|
51
|
+
const coordinateNames_1 = require("./constants/coordinateNames");
|
|
52
|
+
const unflowedFunctions_1 = require("./data/unflowedFunctions");
|
|
53
|
+
const multiAccessorUtils_1 = require("./data/multiAccessorUtils");
|
|
54
|
+
const xyDrawing_1 = require("./processing/xyDrawing");
|
|
55
|
+
const xyPipelineCache_1 = require("./data/xyPipelineCache");
|
|
56
|
+
const frame_props_1 = require("./constants/frame_props");
|
|
57
|
+
const useDerivedStateFromProps_1 = require("./useDerivedStateFromProps");
|
|
58
|
+
const useLegacyUnmountCallback_1 = require("./useLegacyUnmountCallback");
|
|
59
|
+
let xyframeKey = "";
|
|
60
|
+
const chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
61
|
+
for (let i = 32; i > 0; --i)
|
|
62
|
+
xyframeKey += chars[Math.floor(Math.random() * chars.length)];
|
|
63
|
+
const projectedCoordinateNames = {
|
|
64
|
+
y: coordinateNames_1.projectedY,
|
|
65
|
+
x: coordinateNames_1.projectedX,
|
|
66
|
+
yMiddle: coordinateNames_1.projectedYMiddle,
|
|
67
|
+
yTop: coordinateNames_1.projectedYTop,
|
|
68
|
+
yBottom: coordinateNames_1.projectedYBottom,
|
|
69
|
+
xMiddle: coordinateNames_1.projectedXMiddle,
|
|
70
|
+
xTop: coordinateNames_1.projectedXTop,
|
|
71
|
+
xBottom: coordinateNames_1.projectedXBottom
|
|
72
|
+
};
|
|
73
|
+
const defaultProps = {
|
|
74
|
+
annotations: [],
|
|
75
|
+
foregroundGraphics: undefined,
|
|
76
|
+
size: [500, 500],
|
|
77
|
+
className: "",
|
|
78
|
+
lineType: "line",
|
|
79
|
+
name: "xyframe",
|
|
80
|
+
dataVersion: undefined
|
|
81
|
+
};
|
|
82
|
+
function XYFrameInner(allProps) {
|
|
83
|
+
const props = { ...defaultProps, ...allProps };
|
|
84
|
+
const pipelineCacheRef = (0, react_1.useRef)((0, xyPipelineCache_1.createXYPipelineCache)());
|
|
85
|
+
const baseState = {
|
|
86
|
+
size: [500, 500],
|
|
87
|
+
dataVersion: undefined,
|
|
88
|
+
lineData: undefined,
|
|
89
|
+
pointData: undefined,
|
|
90
|
+
summaryData: undefined,
|
|
91
|
+
projectedLines: undefined,
|
|
92
|
+
projectedPoints: undefined,
|
|
93
|
+
projectedSummaries: undefined,
|
|
94
|
+
fullDataset: [],
|
|
95
|
+
adjustedPosition: [0, 0],
|
|
96
|
+
adjustedSize: [500, 500],
|
|
97
|
+
backgroundGraphics: null,
|
|
98
|
+
foregroundGraphics: null,
|
|
99
|
+
axesData: undefined,
|
|
100
|
+
axes: undefined,
|
|
101
|
+
axesTickLines: undefined,
|
|
102
|
+
renderNumber: 0,
|
|
103
|
+
margin: { top: 0, bottom: 0, left: 0, right: 0 },
|
|
104
|
+
calculatedXExtent: [0, 0],
|
|
105
|
+
calculatedYExtent: [0, 0],
|
|
106
|
+
xAccessor: [(d) => d.x],
|
|
107
|
+
yAccessor: [(d) => d.y],
|
|
108
|
+
xExtent: [0, 0],
|
|
109
|
+
yExtent: [0, 0],
|
|
110
|
+
areaAnnotations: [],
|
|
111
|
+
xScale: (0, d3_scale_1.scaleLinear)(),
|
|
112
|
+
yScale: (0, d3_scale_1.scaleLinear)(),
|
|
113
|
+
title: null,
|
|
114
|
+
legendSettings: undefined,
|
|
115
|
+
xyFrameRender: {},
|
|
116
|
+
canvasDrawing: [],
|
|
117
|
+
annotatedSettings: {
|
|
118
|
+
xAccessor: undefined,
|
|
119
|
+
yAccessor: undefined,
|
|
120
|
+
summaryDataAccessor: undefined,
|
|
121
|
+
lineDataAccessor: undefined,
|
|
122
|
+
renderKeyFn: undefined,
|
|
123
|
+
lineType: undefined,
|
|
124
|
+
summaryType: undefined,
|
|
125
|
+
lineIDAccessor: undefined,
|
|
126
|
+
summaries: undefined,
|
|
127
|
+
lines: undefined,
|
|
128
|
+
title: undefined,
|
|
129
|
+
xExtent: undefined,
|
|
130
|
+
yExtent: undefined
|
|
131
|
+
},
|
|
132
|
+
overlay: undefined,
|
|
133
|
+
props
|
|
134
|
+
};
|
|
135
|
+
const initialState = (0, react_1.useMemo)(() => ({
|
|
136
|
+
...baseState,
|
|
137
|
+
...(0, xyDrawing_1.calculateXYFrame)(props, baseState, true, pipelineCacheRef.current)
|
|
138
|
+
}), []);
|
|
139
|
+
const state = (0, useDerivedStateFromProps_1.useDerivedStateFromProps)((nextProps, prevState) => deriveXYFrameState(nextProps, prevState, pipelineCacheRef.current), props, initialState);
|
|
140
|
+
const { size, className, annotationSettings, annotations, additionalDefs, hoverAnnotation, interaction, customClickBehavior, customHoverBehavior, customDoubleClickBehavior, canvasPostProcess, canvasSummaries, canvasPoints, canvasLines, afterElements, beforeElements, renderOrder, matte, frameKey, showLinePoints, sketchyRenderingEngine, disableContext, frameRenderOrder, disableCanvasInteraction, interactionSettings, disableProgressiveRendering, transition } = props;
|
|
141
|
+
const { backgroundGraphics, foregroundGraphics, adjustedPosition, adjustedSize, margin, axes, axesTickLines, xScale, yScale, fullDataset, dataVersion, areaAnnotations, legendSettings, xyFrameRender, annotatedSettings, overlay } = state;
|
|
142
|
+
(0, useLegacyUnmountCallback_1.useLegacyUnmountCallback)(props, state);
|
|
143
|
+
const propsRef = (0, react_1.useRef)(props);
|
|
144
|
+
propsRef.current = props;
|
|
145
|
+
const stateRef = (0, react_1.useRef)(state);
|
|
146
|
+
stateRef.current = state;
|
|
147
|
+
const defaultSVGRuleCb = (0, react_1.useCallback)((args) => defaultXYSVGRule(propsRef.current, stateRef.current, args), []);
|
|
148
|
+
const defaultHTMLRuleCb = (0, react_1.useCallback)((args) => defaultXYHTMLRule(propsRef.current, stateRef.current, args), []);
|
|
149
|
+
// Memoize merged annotations to prevent unnecessary array creation
|
|
150
|
+
const mergedAnnotations = (0, react_1.useMemo)(() => areaAnnotations.length > 0
|
|
151
|
+
? [...annotations, ...areaAnnotations]
|
|
152
|
+
: annotations, [annotations, areaAnnotations]);
|
|
153
|
+
// Memoize showLinePoints conversion
|
|
154
|
+
const showLinePointsValue = (0, react_1.useMemo)(() => (typeof showLinePoints === "string" ? showLinePoints : undefined), [showLinePoints]);
|
|
155
|
+
// Memoize canvas rendering flag
|
|
156
|
+
const canvasRendering = (0, react_1.useMemo)(() => !!(canvasSummaries || canvasPoints || canvasLines), [canvasSummaries, canvasPoints, canvasLines]);
|
|
157
|
+
return (React.createElement(Frame_1.default, { name: "xyframe", renderPipeline: xyFrameRender, adjustedPosition: adjustedPosition, size: size, projectedCoordinateNames: projectedCoordinateNames, xScale: xScale, yScale: yScale, axes: axes, axesTickLines: axesTickLines, title: annotatedSettings.title, dataVersion: dataVersion, matte: matte, className: className, adjustedSize: adjustedSize, frameKey: frameKey || xyframeKey, additionalDefs: additionalDefs, hoverAnnotation: hoverAnnotation, defaultSVGRule: defaultSVGRuleCb, defaultHTMLRule: defaultHTMLRuleCb, annotations: mergedAnnotations, annotationSettings: annotationSettings, legendSettings: legendSettings, projectedYMiddle: coordinateNames_1.projectedYMiddle, interaction: interaction, customClickBehavior: customClickBehavior, customHoverBehavior: customHoverBehavior, customDoubleClickBehavior: customDoubleClickBehavior, points: fullDataset, showLinePoints: showLinePointsValue, margin: margin, backgroundGraphics: backgroundGraphics, foregroundGraphics: foregroundGraphics, beforeElements: beforeElements, afterElements: afterElements, disableContext: disableContext, canvasPostProcess: canvasPostProcess, canvasRendering: canvasRendering, renderOrder: renderOrder, overlay: overlay, sketchyRenderingEngine: sketchyRenderingEngine, frameRenderOrder: frameRenderOrder, disableCanvasInteraction: disableCanvasInteraction, interactionSettings: interactionSettings, disableProgressiveRendering: disableProgressiveRendering, transition: transition }));
|
|
158
|
+
}
|
|
159
|
+
function deriveXYFrameState(nextProps, prevState, cache) {
|
|
160
|
+
const { props } = prevState;
|
|
161
|
+
const { xExtent: oldXExtent = [], yExtent: oldYExtent = [], size: oldSize, dataVersion: oldDataVersion, lineData, summaryData, pointData } = prevState;
|
|
162
|
+
const { xExtent: baseNewXExtent, yExtent: baseNewYExtent, size: newSize, dataVersion: newDataVersion, lines: newLines, summaries: newSummaries, points: newPoints } = nextProps;
|
|
163
|
+
const newXExtent = (0, unflowedFunctions_1.extentValue)(baseNewXExtent);
|
|
164
|
+
const newYExtent = (0, unflowedFunctions_1.extentValue)(baseNewYExtent);
|
|
165
|
+
const extentChange = (oldXExtent[0] !== newXExtent[0] && newXExtent[0] !== undefined) ||
|
|
166
|
+
(oldYExtent[0] !== newYExtent[0] && newYExtent[0] !== undefined) ||
|
|
167
|
+
(oldXExtent[1] !== newXExtent[1] && newXExtent[1] !== undefined) ||
|
|
168
|
+
(oldYExtent[1] !== newYExtent[1] && newYExtent[1] !== undefined);
|
|
169
|
+
const lineChange = lineData !== newLines;
|
|
170
|
+
const summaryChange = summaryData !== newSummaries;
|
|
171
|
+
const pointChange = pointData !== newPoints;
|
|
172
|
+
// Check which category of props changed
|
|
173
|
+
const dataPropsChanged = !oldDataVersion && frame_props_1.xyFrameDataAffectingProps.some((prop) => props[prop] !== nextProps[prop]);
|
|
174
|
+
const scalePropsChanged = !oldDataVersion && frame_props_1.xyFrameScaleAffectingProps.some((prop) => props[prop] !== nextProps[prop]);
|
|
175
|
+
const sizeChanged = oldSize[0] !== newSize[0] || oldSize[1] !== newSize[1];
|
|
176
|
+
// Force full recalc if dataVersion changed or no fullDataset exists
|
|
177
|
+
if ((oldDataVersion && oldDataVersion !== newDataVersion) ||
|
|
178
|
+
!prevState.fullDataset) {
|
|
179
|
+
return (0, xyDrawing_1.calculateXYFrame)(nextProps, prevState, true, cache);
|
|
180
|
+
}
|
|
181
|
+
// Full data recalculation needed if:
|
|
182
|
+
// - Data arrays changed (lines, points, summaries)
|
|
183
|
+
// - Extent overrides changed
|
|
184
|
+
// - Data-affecting props changed (accessors, types, etc.)
|
|
185
|
+
if (lineChange ||
|
|
186
|
+
summaryChange ||
|
|
187
|
+
pointChange ||
|
|
188
|
+
extentChange ||
|
|
189
|
+
dataPropsChanged) {
|
|
190
|
+
return (0, xyDrawing_1.calculateXYFrame)(nextProps, prevState, true, cache);
|
|
191
|
+
}
|
|
192
|
+
// Scale-only recalculation needed if:
|
|
193
|
+
// - Size changed
|
|
194
|
+
// - Scale-affecting props changed (but not data props)
|
|
195
|
+
if (sizeChanged || scalePropsChanged) {
|
|
196
|
+
// TODO: Once calculateXYFrame supports updateScales flag, use:
|
|
197
|
+
// return calculateXYFrame(nextProps, prevState, { updateData: false, updateScales: true })
|
|
198
|
+
// For now, still do full recalc to avoid breaking changes
|
|
199
|
+
return (0, xyDrawing_1.calculateXYFrame)(nextProps, prevState, false, cache);
|
|
200
|
+
}
|
|
201
|
+
// Only styling changed - no recalc needed, React will re-render with existing state
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
const annotationTypeStrings = new Set([
|
|
205
|
+
"label", "callout", "callout-circle", "callout-rect",
|
|
206
|
+
"callout-custom", "xy-threshold", "bracket"
|
|
207
|
+
]);
|
|
208
|
+
function defaultXYSVGRule(props, state, { d: baseD, i, lines, summaries, points, annotationLayer }) {
|
|
209
|
+
const { showLinePoints, defined, margin: baseMargin, size, svgAnnotationRules } = props;
|
|
210
|
+
const { xyFrameRender, xScale, yScale, xAccessor, yAccessor, axesData, annotatedSettings } = state;
|
|
211
|
+
let screenCoordinates = [];
|
|
212
|
+
const idAccessor = annotatedSettings.lineIDAccessor;
|
|
213
|
+
if (baseD.type === "highlight") {
|
|
214
|
+
return (0, xyframeRules_1.svgHighlight)({
|
|
215
|
+
d: baseD,
|
|
216
|
+
i,
|
|
217
|
+
idAccessor,
|
|
218
|
+
lines,
|
|
219
|
+
summaries,
|
|
220
|
+
points,
|
|
221
|
+
xScale,
|
|
222
|
+
yScale,
|
|
223
|
+
xyFrameRender,
|
|
224
|
+
defined
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
const d = baseD.coordinates
|
|
228
|
+
? baseD
|
|
229
|
+
: (0, lineDrawing_1.findPointByID)({
|
|
230
|
+
point: baseD,
|
|
231
|
+
idAccessor,
|
|
232
|
+
lines,
|
|
233
|
+
xScale,
|
|
234
|
+
projectedX: coordinateNames_1.projectedX,
|
|
235
|
+
xAccessor
|
|
236
|
+
});
|
|
237
|
+
if (!d)
|
|
238
|
+
return null;
|
|
239
|
+
const margin = (0, frameFunctions_1.calculateMargin)({
|
|
240
|
+
margin: baseMargin,
|
|
241
|
+
axes: axesData,
|
|
242
|
+
title: annotatedSettings.title,
|
|
243
|
+
size: size
|
|
244
|
+
});
|
|
245
|
+
const { adjustedPosition, adjustedSize } = (0, frameFunctions_1.adjustedPositionSize)({
|
|
246
|
+
size: size,
|
|
247
|
+
margin
|
|
248
|
+
});
|
|
249
|
+
if (!d.coordinates && !d.bounds) {
|
|
250
|
+
screenCoordinates = [
|
|
251
|
+
(0, lineDrawing_1.relativeX)({
|
|
252
|
+
point: d,
|
|
253
|
+
projectedXMiddle: coordinateNames_1.projectedXMiddle,
|
|
254
|
+
projectedX: coordinateNames_1.projectedX,
|
|
255
|
+
xAccessor,
|
|
256
|
+
xScale
|
|
257
|
+
}) || 0,
|
|
258
|
+
(0, lineDrawing_1.relativeY)({
|
|
259
|
+
point: d,
|
|
260
|
+
projectedYMiddle: coordinateNames_1.projectedYMiddle,
|
|
261
|
+
projectedY: coordinateNames_1.projectedY,
|
|
262
|
+
yAccessor,
|
|
263
|
+
yScale,
|
|
264
|
+
showLinePoints
|
|
265
|
+
}) || 0
|
|
266
|
+
];
|
|
267
|
+
}
|
|
268
|
+
else if (!d.bounds) {
|
|
269
|
+
screenCoordinates = d.coordinates.reduce((coords, p) => {
|
|
270
|
+
const xCoordinate = (0, lineDrawing_1.relativeX)({
|
|
271
|
+
point: p,
|
|
272
|
+
projectedXMiddle: coordinateNames_1.projectedXMiddle,
|
|
273
|
+
projectedX: coordinateNames_1.projectedX,
|
|
274
|
+
xAccessor,
|
|
275
|
+
xScale
|
|
276
|
+
});
|
|
277
|
+
const yCoordinate = (0, lineDrawing_1.relativeY)({
|
|
278
|
+
point: p,
|
|
279
|
+
projectedYMiddle: coordinateNames_1.projectedYMiddle,
|
|
280
|
+
projectedY: coordinateNames_1.projectedY,
|
|
281
|
+
yAccessor,
|
|
282
|
+
yScale
|
|
283
|
+
});
|
|
284
|
+
if (Array.isArray(yCoordinate)) {
|
|
285
|
+
return [
|
|
286
|
+
...coords,
|
|
287
|
+
[xCoordinate, Math.min(...yCoordinate)],
|
|
288
|
+
[xCoordinate, Math.max(...yCoordinate)]
|
|
289
|
+
];
|
|
290
|
+
}
|
|
291
|
+
else if (Array.isArray(xCoordinate)) {
|
|
292
|
+
return [
|
|
293
|
+
...coords,
|
|
294
|
+
[Math.min(...xCoordinate), yCoordinate],
|
|
295
|
+
[Math.max(...xCoordinate), yCoordinate]
|
|
296
|
+
];
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
return [...coords, [xCoordinate, yCoordinate]];
|
|
300
|
+
}
|
|
301
|
+
}, []);
|
|
302
|
+
}
|
|
303
|
+
const { voronoiHover } = annotationLayer;
|
|
304
|
+
const customSVG = svgAnnotationRules &&
|
|
305
|
+
svgAnnotationRules({
|
|
306
|
+
d,
|
|
307
|
+
i,
|
|
308
|
+
screenCoordinates,
|
|
309
|
+
xScale,
|
|
310
|
+
yScale,
|
|
311
|
+
xAccessor,
|
|
312
|
+
yAccessor,
|
|
313
|
+
xyFrameProps: props,
|
|
314
|
+
xyFrameState: state,
|
|
315
|
+
summaries,
|
|
316
|
+
points,
|
|
317
|
+
lines,
|
|
318
|
+
voronoiHover,
|
|
319
|
+
adjustedPosition,
|
|
320
|
+
adjustedSize,
|
|
321
|
+
annotationLayer
|
|
322
|
+
});
|
|
323
|
+
if (svgAnnotationRules !== undefined && customSVG !== null) {
|
|
324
|
+
return customSVG;
|
|
325
|
+
}
|
|
326
|
+
else if (d.type === "desaturation-layer") {
|
|
327
|
+
return (0, baseRules_1.desaturationLayer)({
|
|
328
|
+
style: d.style instanceof Function ? d.style(d, i) : d.style,
|
|
329
|
+
size: adjustedSize,
|
|
330
|
+
i,
|
|
331
|
+
key: d.key
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
else if (d.type === "xy" || d.type === "frame-hover") {
|
|
335
|
+
return (0, xyframeRules_1.svgXYAnnotation)({ d, i, screenCoordinates });
|
|
336
|
+
}
|
|
337
|
+
else if (typeof d.type === "function" || annotationTypeStrings.has(d.type)) {
|
|
338
|
+
return (0, xyframeRules_1.basicReactAnnotation)({ d, screenCoordinates, i });
|
|
339
|
+
}
|
|
340
|
+
else if (d.type === "enclose") {
|
|
341
|
+
return (0, xyframeRules_1.svgEncloseAnnotation)({ d, screenCoordinates, i });
|
|
342
|
+
}
|
|
343
|
+
else if (d.type === "enclose-rect") {
|
|
344
|
+
return (0, xyframeRules_1.svgRectEncloseAnnotation)({ d, screenCoordinates, i });
|
|
345
|
+
}
|
|
346
|
+
else if (d.type === "enclose-hull") {
|
|
347
|
+
return (0, xyframeRules_1.svgHullEncloseAnnotation)({ d, screenCoordinates, i });
|
|
348
|
+
}
|
|
349
|
+
else if (d.type === "x") {
|
|
350
|
+
return (0, xyframeRules_1.svgXAnnotation)({
|
|
351
|
+
d,
|
|
352
|
+
screenCoordinates,
|
|
353
|
+
i,
|
|
354
|
+
adjustedSize
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
else if (d.type === "y") {
|
|
358
|
+
return (0, xyframeRules_1.svgYAnnotation)({
|
|
359
|
+
d,
|
|
360
|
+
screenCoordinates,
|
|
361
|
+
i,
|
|
362
|
+
adjustedSize,
|
|
363
|
+
adjustedPosition
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
else if (d.type === "bounds") {
|
|
367
|
+
return (0, xyframeRules_1.svgBoundsAnnotation)({
|
|
368
|
+
d,
|
|
369
|
+
i,
|
|
370
|
+
adjustedSize,
|
|
371
|
+
xAccessor,
|
|
372
|
+
yAccessor,
|
|
373
|
+
xScale,
|
|
374
|
+
yScale
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
else if (d.type === "line") {
|
|
378
|
+
return (0, xyframeRules_1.svgLineAnnotation)({ d, i, screenCoordinates });
|
|
379
|
+
}
|
|
380
|
+
else if (d.type === "area") {
|
|
381
|
+
return (0, xyframeRules_1.svgAreaAnnotation)({
|
|
382
|
+
d,
|
|
383
|
+
i,
|
|
384
|
+
xScale,
|
|
385
|
+
xAccessor,
|
|
386
|
+
yScale,
|
|
387
|
+
yAccessor,
|
|
388
|
+
annotationLayer
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
else if (d.type === "horizontal-points") {
|
|
392
|
+
return (0, xyframeRules_1.svgHorizontalPointsAnnotation)({
|
|
393
|
+
d,
|
|
394
|
+
lines: lines.data,
|
|
395
|
+
points: points.data,
|
|
396
|
+
xScale,
|
|
397
|
+
yScale,
|
|
398
|
+
pointStyle: points.styleFn
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
else if (d.type === "vertical-points") {
|
|
402
|
+
return (0, xyframeRules_1.svgVerticalPointsAnnotation)({
|
|
403
|
+
d,
|
|
404
|
+
lines: lines.data,
|
|
405
|
+
points: points.data,
|
|
406
|
+
xScale,
|
|
407
|
+
yScale,
|
|
408
|
+
pointStyle: points.styleFn
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
return null;
|
|
412
|
+
}
|
|
413
|
+
function defaultXYHTMLRule(props, state, { d: baseD, i, lines, summaries, points, annotationLayer }) {
|
|
414
|
+
const { xAccessor, yAccessor, xScale, yScale, annotatedSettings, axesData } = state;
|
|
415
|
+
const { voronoiHover } = annotationLayer;
|
|
416
|
+
let screenCoordinates = [];
|
|
417
|
+
const { tooltipContent, optimizeCustomTooltipPosition, htmlAnnotationRules, size, showLinePoints, margin: baseMargin } = props;
|
|
418
|
+
const idAccessor = annotatedSettings.lineIDAccessor;
|
|
419
|
+
const d = (0, lineDrawing_1.findPointByID)({
|
|
420
|
+
point: baseD,
|
|
421
|
+
idAccessor,
|
|
422
|
+
lines,
|
|
423
|
+
xScale,
|
|
424
|
+
projectedX: coordinateNames_1.projectedX,
|
|
425
|
+
xAccessor
|
|
426
|
+
});
|
|
427
|
+
if (!d) {
|
|
428
|
+
return null;
|
|
429
|
+
}
|
|
430
|
+
const xCoord = d[coordinateNames_1.projectedXMiddle] || d[coordinateNames_1.projectedX] || (0, multiAccessorUtils_1.findFirstAccessorValue)(xAccessor, d);
|
|
431
|
+
const yCoord = d[coordinateNames_1.projectedYMiddle] || d[coordinateNames_1.projectedY] || (0, multiAccessorUtils_1.findFirstAccessorValue)(yAccessor, d);
|
|
432
|
+
const xString = xCoord && xCoord.toString ? xCoord.toString() : xCoord;
|
|
433
|
+
const yString = yCoord && yCoord.toString ? yCoord.toString() : yCoord;
|
|
434
|
+
const margin = (0, frameFunctions_1.calculateMargin)({
|
|
435
|
+
margin: baseMargin,
|
|
436
|
+
axes: axesData,
|
|
437
|
+
title: annotatedSettings.title,
|
|
438
|
+
size: size
|
|
439
|
+
});
|
|
440
|
+
const { adjustedPosition, adjustedSize } = (0, frameFunctions_1.adjustedPositionSize)({
|
|
441
|
+
size,
|
|
442
|
+
margin
|
|
443
|
+
});
|
|
444
|
+
if (!d.coordinates) {
|
|
445
|
+
screenCoordinates = [
|
|
446
|
+
xScale(xCoord) || 0,
|
|
447
|
+
(0, lineDrawing_1.relativeY)({
|
|
448
|
+
point: d,
|
|
449
|
+
projectedYMiddle: coordinateNames_1.projectedYMiddle,
|
|
450
|
+
projectedY: coordinateNames_1.projectedY,
|
|
451
|
+
showLinePoints,
|
|
452
|
+
yAccessor,
|
|
453
|
+
yScale
|
|
454
|
+
}) || 0
|
|
455
|
+
];
|
|
456
|
+
}
|
|
457
|
+
else {
|
|
458
|
+
screenCoordinates = d.coordinates.map((p) => {
|
|
459
|
+
const foundP = (0, lineDrawing_1.findPointByID)({
|
|
460
|
+
point: { x: 0, y: 0, ...p },
|
|
461
|
+
idAccessor,
|
|
462
|
+
lines,
|
|
463
|
+
xScale,
|
|
464
|
+
projectedX: coordinateNames_1.projectedX,
|
|
465
|
+
xAccessor
|
|
466
|
+
});
|
|
467
|
+
return [
|
|
468
|
+
(xScale((0, multiAccessorUtils_1.findFirstAccessorValue)(xAccessor, d)) || 0) +
|
|
469
|
+
adjustedPosition[0],
|
|
470
|
+
((0, lineDrawing_1.relativeY)({
|
|
471
|
+
point: foundP,
|
|
472
|
+
projectedYMiddle: coordinateNames_1.projectedYMiddle,
|
|
473
|
+
projectedY: coordinateNames_1.projectedY,
|
|
474
|
+
yAccessor,
|
|
475
|
+
yScale
|
|
476
|
+
}) || 0) + adjustedPosition[1]
|
|
477
|
+
];
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
const customAnnotation = htmlAnnotationRules &&
|
|
481
|
+
htmlAnnotationRules({
|
|
482
|
+
d,
|
|
483
|
+
i,
|
|
484
|
+
screenCoordinates,
|
|
485
|
+
xScale,
|
|
486
|
+
yScale,
|
|
487
|
+
xAccessor,
|
|
488
|
+
yAccessor,
|
|
489
|
+
xyFrameProps: props,
|
|
490
|
+
xyFrameState: state,
|
|
491
|
+
summaries,
|
|
492
|
+
points,
|
|
493
|
+
lines,
|
|
494
|
+
voronoiHover,
|
|
495
|
+
adjustedPosition,
|
|
496
|
+
adjustedSize,
|
|
497
|
+
annotationLayer
|
|
498
|
+
});
|
|
499
|
+
if (htmlAnnotationRules && customAnnotation !== null) {
|
|
500
|
+
return customAnnotation;
|
|
501
|
+
}
|
|
502
|
+
if (d.type === "frame-hover") {
|
|
503
|
+
let content = (React.createElement("div", { className: "tooltip-content", "data-testid": "tooltip-content" },
|
|
504
|
+
React.createElement("p", { key: "html-annotation-content-1" }, xString),
|
|
505
|
+
React.createElement("p", { key: "html-annotation-content-2" }, yString),
|
|
506
|
+
d.percent ? (React.createElement("p", { key: "html-annotation-content-3" },
|
|
507
|
+
Math.floor(d.percent * 1000) / 10,
|
|
508
|
+
"%")) : null));
|
|
509
|
+
if (d.type === "frame-hover" && tooltipContent) {
|
|
510
|
+
content = optimizeCustomTooltipPosition ? (React.createElement(TooltipPositioner_1.default, { tooltipContent: tooltipContent, tooltipContentArgs: d })) : (tooltipContent(d));
|
|
511
|
+
}
|
|
512
|
+
return (0, xyframeRules_1.htmlTooltipAnnotation)({
|
|
513
|
+
content,
|
|
514
|
+
screenCoordinates,
|
|
515
|
+
i,
|
|
516
|
+
d,
|
|
517
|
+
adjustedSize
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
return null;
|
|
521
|
+
}
|
|
522
|
+
XYFrameInner.displayName = "XYFrame";
|
|
523
|
+
const XYFrame = React.memo(XYFrameInner);
|
|
524
|
+
exports.default = XYFrame;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.bumpAnnotations = bumpAnnotations;
|
|
7
|
+
const d3labeler_1 = __importDefault(require("./d3labeler"));
|
|
8
|
+
const basicLabelSizeFunction = (noteData, characterWidth, lineHeight, padding) => {
|
|
9
|
+
const text = noteData.note.label || noteData.note.title;
|
|
10
|
+
const textLength = text.length;
|
|
11
|
+
const wrap = noteData.note.wrap || 120;
|
|
12
|
+
const width = Math.min(wrap, textLength * characterWidth) + padding * 2;
|
|
13
|
+
const height = Math.ceil((textLength * characterWidth) / 120) * lineHeight + padding * 2;
|
|
14
|
+
return [width, height];
|
|
15
|
+
};
|
|
16
|
+
function bumpAnnotations(adjustableNotes, processor, size, propsPointSizeFunction, propsLabelSizeFunction) {
|
|
17
|
+
const { padding = 1, characterWidth = 8, lineHeight = 20, iterations = 500, pointSizeFunction = propsPointSizeFunction, labelSizeFunction = propsLabelSizeFunction || basicLabelSizeFunction } = processor;
|
|
18
|
+
const labels = adjustableNotes.map((d, i) => {
|
|
19
|
+
const anchorX = (d.props.noteData.x[0] || d.props.noteData.x) +
|
|
20
|
+
(d.props.noteData.dx !== undefined
|
|
21
|
+
? d.props.noteData.dx
|
|
22
|
+
: ((i % 3) - 1) * -10);
|
|
23
|
+
const anchorY = (d.props.noteData.y[0] || d.props.noteData.y) +
|
|
24
|
+
(d.props.noteData.dy !== undefined
|
|
25
|
+
? d.props.noteData.dy
|
|
26
|
+
: ((i % 3) - 1) * 10);
|
|
27
|
+
const [labelWidth, labelHeight] = labelSizeFunction(d.props.noteData, characterWidth, lineHeight, padding);
|
|
28
|
+
return {
|
|
29
|
+
x: anchorX,
|
|
30
|
+
y: anchorY,
|
|
31
|
+
above: anchorY < d.props.noteData.y,
|
|
32
|
+
left: anchorX < d.props.noteData.x,
|
|
33
|
+
width: labelWidth,
|
|
34
|
+
height: labelHeight,
|
|
35
|
+
type: "label",
|
|
36
|
+
name: "",
|
|
37
|
+
originalNote: d
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
const points = adjustableNotes.map(d => ({
|
|
41
|
+
x: d.props.noteData.x,
|
|
42
|
+
y: d.props.noteData.y,
|
|
43
|
+
fx: d.props.noteData.x,
|
|
44
|
+
fy: d.props.noteData.y,
|
|
45
|
+
r: (pointSizeFunction && pointSizeFunction(d.props.noteData)) || 5,
|
|
46
|
+
type: "point",
|
|
47
|
+
originalNote: d
|
|
48
|
+
}));
|
|
49
|
+
const instantiatedLabeler = (0, d3labeler_1.default)();
|
|
50
|
+
instantiatedLabeler.label(labels);
|
|
51
|
+
instantiatedLabeler.anchor(points);
|
|
52
|
+
instantiatedLabeler.width(size[0]);
|
|
53
|
+
instantiatedLabeler.height(size[1]);
|
|
54
|
+
instantiatedLabeler.start(iterations);
|
|
55
|
+
labels.forEach(d => {
|
|
56
|
+
if (d.type === "label") {
|
|
57
|
+
const adjusted = adjustedXY(d.originalNote.props.noteData, d, padding);
|
|
58
|
+
d.originalNote.props.noteData.nx = adjusted[0];
|
|
59
|
+
d.originalNote.props.noteData.ny = adjusted[1];
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
return adjustableNotes;
|
|
63
|
+
}
|
|
64
|
+
function adjustedXY(note, calculated, padding) {
|
|
65
|
+
if (note.y > calculated.y) {
|
|
66
|
+
//below
|
|
67
|
+
return [
|
|
68
|
+
calculated.x + calculated.width / 2 + padding / 2,
|
|
69
|
+
calculated.y - calculated.height + padding / 2
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
return [calculated.x + calculated.width / 2, calculated.y];
|
|
73
|
+
}
|