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,695 @@
|
|
|
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.svgOrdinalLine = exports.svgRectEncloseRule = exports.htmlColumnHoverRule = exports.htmlFrameHoverRule = exports.svgCategoryRule = exports.svgRRule = exports.svgEncloseRule = exports.basicReactAnnotationRule = exports.svgORRule = exports.screenProject = exports.findIDPiece = exports.svgHighlightRule = exports.getColumnScreenCoordinates = void 0;
|
|
40
|
+
const React = __importStar(require("react"));
|
|
41
|
+
const Annotation_1 = __importDefault(require("../Annotation"));
|
|
42
|
+
const d3_hierarchy_1 = require("d3-hierarchy");
|
|
43
|
+
const d3_array_1 = require("d3-array");
|
|
44
|
+
const pieceDrawing_1 = require("../svg/pieceDrawing");
|
|
45
|
+
const baseRules_1 = require("./baseRules");
|
|
46
|
+
const multiAccessorUtils_1 = require("../data/multiAccessorUtils");
|
|
47
|
+
const d3_shape_1 = require("d3-shape");
|
|
48
|
+
const general_1 = require("../visualizationLayerBehavior/general");
|
|
49
|
+
const TooltipPositioner_1 = __importDefault(require("../TooltipPositioner"));
|
|
50
|
+
const derivePieceValue = (accessor, piece) => {
|
|
51
|
+
const pieceVal = accessor(piece);
|
|
52
|
+
return (pieceVal && pieceVal.toString && pieceVal.toString()) || pieceVal;
|
|
53
|
+
};
|
|
54
|
+
function polarToCartesian(centerX, centerY, radius, angleInDegrees) {
|
|
55
|
+
const angleInRadians = ((angleInDegrees - 90) * Math.PI) / 180.0;
|
|
56
|
+
return {
|
|
57
|
+
x: centerX + radius * Math.cos(angleInRadians),
|
|
58
|
+
y: centerY + radius * Math.sin(angleInRadians)
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function pieContentGenerator({ column }) {
|
|
62
|
+
return (React.createElement("div", { className: "tooltip-content", "data-testid": "tooltip-content" },
|
|
63
|
+
React.createElement("p", { key: "or-annotation-1" }, column.name),
|
|
64
|
+
React.createElement("p", { key: "or-annotation-2" }, `${(column.pct * 100).toFixed(0)}%`)));
|
|
65
|
+
}
|
|
66
|
+
function arcBracket({ x, y, radius, startAngle, endAngle, inset, outset, curly = true }) {
|
|
67
|
+
const start = polarToCartesian(x, y, radius + outset, endAngle);
|
|
68
|
+
const end = polarToCartesian(x, y, radius + outset, startAngle);
|
|
69
|
+
const innerStart = polarToCartesian(x, y, radius + outset - inset, endAngle);
|
|
70
|
+
const innerEnd = polarToCartesian(x, y, radius + outset - inset, startAngle);
|
|
71
|
+
const angleSize = endAngle - startAngle;
|
|
72
|
+
const largeArcFlag = angleSize <= 180 ? "0" : "1";
|
|
73
|
+
let d;
|
|
74
|
+
if (curly) {
|
|
75
|
+
const curlyOffset = Math.min(10, angleSize / 4);
|
|
76
|
+
const middleLeft = polarToCartesian(x, y, radius + outset, (startAngle + endAngle) / 2 + curlyOffset);
|
|
77
|
+
const middle = polarToCartesian(x, y, radius + outset + 10, (startAngle + endAngle) / 2);
|
|
78
|
+
const middleRight = polarToCartesian(x, y, radius + outset, (startAngle + endAngle) / 2 - curlyOffset);
|
|
79
|
+
d = [
|
|
80
|
+
"M",
|
|
81
|
+
innerStart.x,
|
|
82
|
+
innerStart.y,
|
|
83
|
+
"L",
|
|
84
|
+
start.x,
|
|
85
|
+
start.y,
|
|
86
|
+
"A",
|
|
87
|
+
radius + outset,
|
|
88
|
+
radius + outset,
|
|
89
|
+
0,
|
|
90
|
+
0,
|
|
91
|
+
0,
|
|
92
|
+
middleLeft.x,
|
|
93
|
+
middleLeft.y,
|
|
94
|
+
"A",
|
|
95
|
+
radius + outset,
|
|
96
|
+
radius + outset,
|
|
97
|
+
1,
|
|
98
|
+
0,
|
|
99
|
+
1,
|
|
100
|
+
middle.x,
|
|
101
|
+
middle.y,
|
|
102
|
+
"A",
|
|
103
|
+
radius + outset,
|
|
104
|
+
radius + outset,
|
|
105
|
+
1,
|
|
106
|
+
0,
|
|
107
|
+
1,
|
|
108
|
+
middleRight.x,
|
|
109
|
+
middleRight.y,
|
|
110
|
+
"A",
|
|
111
|
+
radius + outset,
|
|
112
|
+
radius + outset,
|
|
113
|
+
0,
|
|
114
|
+
0,
|
|
115
|
+
0,
|
|
116
|
+
end.x,
|
|
117
|
+
end.y,
|
|
118
|
+
"L",
|
|
119
|
+
innerEnd.x,
|
|
120
|
+
innerEnd.y
|
|
121
|
+
].join(" ");
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
d = [
|
|
125
|
+
"M",
|
|
126
|
+
innerStart.x,
|
|
127
|
+
innerStart.y,
|
|
128
|
+
"L",
|
|
129
|
+
start.x,
|
|
130
|
+
start.y,
|
|
131
|
+
"A",
|
|
132
|
+
radius + outset,
|
|
133
|
+
radius + outset,
|
|
134
|
+
0,
|
|
135
|
+
largeArcFlag,
|
|
136
|
+
0,
|
|
137
|
+
end.x,
|
|
138
|
+
end.y,
|
|
139
|
+
"L",
|
|
140
|
+
innerEnd.x,
|
|
141
|
+
innerEnd.y
|
|
142
|
+
].join(" ");
|
|
143
|
+
}
|
|
144
|
+
const midAngle = (startAngle + endAngle) / 2;
|
|
145
|
+
let textOffset, largeTextArcFlag, finalTextEnd, finalTextStart, arcFlip;
|
|
146
|
+
const lowerArc = midAngle > 90 && midAngle < 270;
|
|
147
|
+
if (lowerArc) {
|
|
148
|
+
textOffset = 12;
|
|
149
|
+
largeTextArcFlag = endAngle - startAngle <= 180 ? "0" : "1";
|
|
150
|
+
arcFlip = 0;
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
largeTextArcFlag = endAngle - startAngle <= 180 ? "0" : "1";
|
|
154
|
+
textOffset = 5;
|
|
155
|
+
arcFlip = 1;
|
|
156
|
+
}
|
|
157
|
+
textOffset += curly ? 10 : 0;
|
|
158
|
+
const textStart = polarToCartesian(x, y, radius + outset + textOffset, endAngle);
|
|
159
|
+
const textEnd = polarToCartesian(x, y, radius + outset + textOffset, startAngle);
|
|
160
|
+
if (lowerArc) {
|
|
161
|
+
finalTextStart = textStart;
|
|
162
|
+
finalTextEnd = textEnd;
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
finalTextStart = textEnd;
|
|
166
|
+
finalTextEnd = textStart;
|
|
167
|
+
}
|
|
168
|
+
const textD = [
|
|
169
|
+
"M",
|
|
170
|
+
finalTextStart.x,
|
|
171
|
+
finalTextStart.y,
|
|
172
|
+
"A",
|
|
173
|
+
radius + outset + textOffset,
|
|
174
|
+
radius + outset + textOffset,
|
|
175
|
+
arcFlip,
|
|
176
|
+
largeTextArcFlag,
|
|
177
|
+
arcFlip,
|
|
178
|
+
finalTextEnd.x,
|
|
179
|
+
finalTextEnd.y
|
|
180
|
+
].join(" ");
|
|
181
|
+
return { arcPath: d, textArcPath: textD };
|
|
182
|
+
}
|
|
183
|
+
const getColumnScreenCoordinates = ({ d, projectedColumns, oAccessor, summaryType, type, projection, adjustedPosition, adjustedSize }) => {
|
|
184
|
+
const column = typeof d.column === "object"
|
|
185
|
+
? d.column
|
|
186
|
+
: projectedColumns[d.facetColumn] ||
|
|
187
|
+
projectedColumns[(0, multiAccessorUtils_1.findFirstAccessorValue)(oAccessor, d)];
|
|
188
|
+
if (!column) {
|
|
189
|
+
return { coordinates: [0, 0], pieces: undefined, column: undefined };
|
|
190
|
+
}
|
|
191
|
+
const pieces = column.pieceData || column.pieces;
|
|
192
|
+
const positionValue = (summaryType.type && summaryType.type !== "none") ||
|
|
193
|
+
["swarm", "point", "clusterbar", "timeline"].find((p) => p === type.type)
|
|
194
|
+
? (0, d3_array_1.max)(pieces.map((p) => p.scaledValue))
|
|
195
|
+
: projection === "horizontal"
|
|
196
|
+
? (0, d3_array_1.max)(pieces.map((p) => p.value >= 0 ? p.scaledValue + p.bottom : p.bottom))
|
|
197
|
+
: (0, d3_array_1.min)(pieces.map((p) => p.value >= 0 ? p.bottom - p.scaledValue : p.bottom));
|
|
198
|
+
let xPosition = column.middle + adjustedPosition[0];
|
|
199
|
+
let yPosition = (summaryType.type && summaryType.type !== "none") ||
|
|
200
|
+
["swarm", "point", "clusterbar", "timeline"].find((p) => p === type.type)
|
|
201
|
+
? adjustedSize[1] - positionValue
|
|
202
|
+
: positionValue;
|
|
203
|
+
yPosition += 10;
|
|
204
|
+
if (projection === "horizontal") {
|
|
205
|
+
yPosition = column.middle;
|
|
206
|
+
xPosition = positionValue + adjustedPosition[0];
|
|
207
|
+
}
|
|
208
|
+
else if (projection === "radial") {
|
|
209
|
+
const { pieArc } = column;
|
|
210
|
+
const { translate, outerPoint, centroid } = pieArc;
|
|
211
|
+
xPosition = (centroid[0] + outerPoint[0]) / 2 + translate[0];
|
|
212
|
+
yPosition = (centroid[1] + outerPoint[1]) / 2 + translate[1];
|
|
213
|
+
}
|
|
214
|
+
return { coordinates: [xPosition, yPosition], pieces, column };
|
|
215
|
+
};
|
|
216
|
+
exports.getColumnScreenCoordinates = getColumnScreenCoordinates;
|
|
217
|
+
const svgHighlightRule = ({ d, pieceIDAccessor, orFrameRender, oAccessor }) => {
|
|
218
|
+
const thisID = pieceIDAccessor(d);
|
|
219
|
+
const thisO = (0, multiAccessorUtils_1.findFirstAccessorValue)(oAccessor, d);
|
|
220
|
+
const { pieces } = orFrameRender;
|
|
221
|
+
const { styleFn } = pieces;
|
|
222
|
+
const foundPieces = (pieces &&
|
|
223
|
+
pieces.data
|
|
224
|
+
.filter((p) => {
|
|
225
|
+
return ((thisID === undefined ||
|
|
226
|
+
pieceIDAccessor({ ...p.piece, ...p.piece.data }) === thisID) &&
|
|
227
|
+
(thisO === undefined ||
|
|
228
|
+
(0, multiAccessorUtils_1.findFirstAccessorValue)(oAccessor, p.piece.data) === thisO));
|
|
229
|
+
})
|
|
230
|
+
.map((p, q) => {
|
|
231
|
+
let styleObject = {
|
|
232
|
+
style: styleFn({ ...p.piece, ...p.piece.data })
|
|
233
|
+
};
|
|
234
|
+
if (d.style && typeof d.style === "function") {
|
|
235
|
+
styleObject = {
|
|
236
|
+
style: {
|
|
237
|
+
...styleObject,
|
|
238
|
+
...d.style({ ...p.piece, ...p.piece.data })
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
else if (d.style) {
|
|
243
|
+
styleObject = { style: { ...styleObject, ...d.style } };
|
|
244
|
+
}
|
|
245
|
+
const styledD = { ...p.renderElement, ...styleObject };
|
|
246
|
+
const className = `highlight-annotation ${(d.class &&
|
|
247
|
+
typeof d.class === "function" &&
|
|
248
|
+
d.class(p.piece.data, q)) ||
|
|
249
|
+
(d.class && d.class) ||
|
|
250
|
+
""}`;
|
|
251
|
+
if (React.isValidElement(p.renderElement)) {
|
|
252
|
+
return React.cloneElement(p.renderElement, {
|
|
253
|
+
...styleObject,
|
|
254
|
+
className
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
const { markType, ...restProps } = styledD;
|
|
258
|
+
return React.createElement(markType || 'path', {
|
|
259
|
+
fill: "none",
|
|
260
|
+
stroke: "currentColor",
|
|
261
|
+
strokeWidth: "2px",
|
|
262
|
+
key: `highlight-piece-${q}`,
|
|
263
|
+
...restProps,
|
|
264
|
+
className
|
|
265
|
+
});
|
|
266
|
+
})) ||
|
|
267
|
+
[];
|
|
268
|
+
return [...foundPieces];
|
|
269
|
+
};
|
|
270
|
+
exports.svgHighlightRule = svgHighlightRule;
|
|
271
|
+
const findIDPiece = (pieceIDAccessor, oColumn, d) => {
|
|
272
|
+
const foundIDValue = pieceIDAccessor(d);
|
|
273
|
+
const pieceID = foundIDValue === "" && d.rName ? d.rName : foundIDValue;
|
|
274
|
+
const basePieces = oColumn &&
|
|
275
|
+
oColumn.pieceData.filter((r) => r.rName === pieceID || pieceIDAccessor(r.data) === pieceID);
|
|
276
|
+
if (pieceID === "" ||
|
|
277
|
+
basePieces === undefined ||
|
|
278
|
+
basePieces === false ||
|
|
279
|
+
basePieces.length !== 1)
|
|
280
|
+
return d;
|
|
281
|
+
const basePiece = basePieces[0];
|
|
282
|
+
const reactAnnotationProps = [
|
|
283
|
+
"type",
|
|
284
|
+
"label",
|
|
285
|
+
"note",
|
|
286
|
+
"connector",
|
|
287
|
+
"disabled",
|
|
288
|
+
"color",
|
|
289
|
+
"subject"
|
|
290
|
+
];
|
|
291
|
+
if (basePiece) {
|
|
292
|
+
reactAnnotationProps.forEach((prop) => {
|
|
293
|
+
if (d[prop])
|
|
294
|
+
basePiece[prop] = d[prop];
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
return basePiece;
|
|
298
|
+
};
|
|
299
|
+
exports.findIDPiece = findIDPiece;
|
|
300
|
+
const screenProject = ({ p, adjustedSize, rScale, oColumn, rAccessor, idPiece, projection, rScaleType }) => {
|
|
301
|
+
const basePValue = (0, multiAccessorUtils_1.findFirstAccessorValue)(rAccessor, p) || p.value;
|
|
302
|
+
const pValue = Array.isArray(basePValue)
|
|
303
|
+
? Math.max(...basePValue)
|
|
304
|
+
: basePValue;
|
|
305
|
+
let o;
|
|
306
|
+
if (oColumn) {
|
|
307
|
+
o = oColumn.middle;
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
o = 0;
|
|
311
|
+
}
|
|
312
|
+
if (oColumn && projection === "radial") {
|
|
313
|
+
return (0, pieceDrawing_1.pointOnArcAtAngle)([adjustedSize[0] / 2, adjustedSize[1] / 2], oColumn.pct_middle, idPiece && (idPiece.x === undefined ? idPiece.scaledValue : idPiece.x)
|
|
314
|
+
? idPiece.x / 2 || (idPiece.bottom + idPiece.scaledValue / 2) / 2
|
|
315
|
+
: pValue / 2);
|
|
316
|
+
}
|
|
317
|
+
if (projection === "horizontal") {
|
|
318
|
+
return [
|
|
319
|
+
idPiece && idPiece.scaledEndValue
|
|
320
|
+
? idPiece.scaledEndValue
|
|
321
|
+
: idPiece && idPiece.scaledValue
|
|
322
|
+
? idPiece.value >= 0
|
|
323
|
+
? idPiece.bottom + idPiece.scaledValue
|
|
324
|
+
: idPiece.bottom
|
|
325
|
+
: rScale(pValue),
|
|
326
|
+
o
|
|
327
|
+
];
|
|
328
|
+
}
|
|
329
|
+
const newScale = rScaleType
|
|
330
|
+
.copy()
|
|
331
|
+
.domain(rScale.domain())
|
|
332
|
+
.range(rScale.range().reverse());
|
|
333
|
+
return [
|
|
334
|
+
o,
|
|
335
|
+
idPiece && (idPiece.x === undefined ? idPiece.scaledValue : idPiece.x)
|
|
336
|
+
? idPiece.y === undefined
|
|
337
|
+
? idPiece.value >= 0
|
|
338
|
+
? idPiece.bottom - idPiece.scaledValue
|
|
339
|
+
: idPiece.bottom
|
|
340
|
+
: idPiece.y
|
|
341
|
+
: newScale(pValue)
|
|
342
|
+
];
|
|
343
|
+
};
|
|
344
|
+
exports.screenProject = screenProject;
|
|
345
|
+
const svgORRule = ({ d, i, screenCoordinates, projection }) => {
|
|
346
|
+
return (React.createElement("text", { key: `${d.label}annotationtext${i}`, x: parseInt(screenCoordinates[0] + (projection === "horizontal" ? 10 : 0)), y: parseInt(screenCoordinates[1] + (projection === "vertical" ? 10 : 0)), className: `annotation annotation-or-label ${d.className || ""}`, "data-testid": "annotation-or-label", textAnchor: "middle" }, d.label));
|
|
347
|
+
};
|
|
348
|
+
exports.svgORRule = svgORRule;
|
|
349
|
+
const basicReactAnnotationRule = ({ d, i, screenCoordinates }) => {
|
|
350
|
+
const noteData = Object.assign({
|
|
351
|
+
dx: 0,
|
|
352
|
+
dy: 0,
|
|
353
|
+
note: { label: d.label, orientation: d.orientation, align: d.align },
|
|
354
|
+
connector: { end: "arrow" }
|
|
355
|
+
}, d, {
|
|
356
|
+
x: screenCoordinates[0],
|
|
357
|
+
y: screenCoordinates[1],
|
|
358
|
+
type: typeof d.type === "function" ? d.type : undefined,
|
|
359
|
+
screenCoordinates
|
|
360
|
+
});
|
|
361
|
+
if (d.fixedX)
|
|
362
|
+
noteData.x = d.fixedX;
|
|
363
|
+
if (d.fixedY)
|
|
364
|
+
noteData.y = d.fixedY;
|
|
365
|
+
return React.createElement(Annotation_1.default, { key: d.key || `annotation-${i}`, noteData: noteData });
|
|
366
|
+
};
|
|
367
|
+
exports.basicReactAnnotationRule = basicReactAnnotationRule;
|
|
368
|
+
const svgEncloseRule = ({ d, i, screenCoordinates }) => {
|
|
369
|
+
const circle = (0, d3_hierarchy_1.packEnclose)(screenCoordinates.map((p) => ({ x: p[0], y: p[1], r: 2 })));
|
|
370
|
+
return (0, baseRules_1.circleEnclosure)({ d, i, circle });
|
|
371
|
+
};
|
|
372
|
+
exports.svgEncloseRule = svgEncloseRule;
|
|
373
|
+
const svgRRule = ({ d, i, screenCoordinates, rScale, rAccessor, adjustedSize, adjustedPosition, projection }) => {
|
|
374
|
+
let x, y, xPosition, yPosition, subject, dx, dy;
|
|
375
|
+
if (projection === "radial") {
|
|
376
|
+
return (React.createElement(Annotation_1.default, { key: d.key || `annotation-${i}`, noteData: Object.assign({
|
|
377
|
+
dx: 50,
|
|
378
|
+
dy: 50,
|
|
379
|
+
note: { label: d.label },
|
|
380
|
+
connector: { end: "arrow" }
|
|
381
|
+
}, d, {
|
|
382
|
+
type: "callout-circle",
|
|
383
|
+
subject: {
|
|
384
|
+
radius: rScale((0, multiAccessorUtils_1.findFirstAccessorValue)(rAccessor, d)) / 2,
|
|
385
|
+
radiusPadding: 0
|
|
386
|
+
},
|
|
387
|
+
x: adjustedSize[0] / 2,
|
|
388
|
+
y: adjustedSize[1] / 2
|
|
389
|
+
}) }));
|
|
390
|
+
}
|
|
391
|
+
else if (projection === "horizontal") {
|
|
392
|
+
dx = 50;
|
|
393
|
+
dy = 50;
|
|
394
|
+
yPosition = d.offset || i * 25;
|
|
395
|
+
x = screenCoordinates[0];
|
|
396
|
+
y = yPosition;
|
|
397
|
+
subject = {
|
|
398
|
+
x,
|
|
399
|
+
y1: 0,
|
|
400
|
+
y2: adjustedSize[1] + adjustedPosition[1]
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
dx = 50;
|
|
405
|
+
dy = -20;
|
|
406
|
+
xPosition = d.offset || i * 25;
|
|
407
|
+
y = screenCoordinates[1];
|
|
408
|
+
x = xPosition;
|
|
409
|
+
subject = {
|
|
410
|
+
y,
|
|
411
|
+
x1: 0,
|
|
412
|
+
x2: adjustedSize[0] + adjustedPosition[0]
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
const noteData = Object.assign({
|
|
416
|
+
dx,
|
|
417
|
+
dy,
|
|
418
|
+
note: { label: d.label },
|
|
419
|
+
connector: { end: "arrow" }
|
|
420
|
+
}, d, {
|
|
421
|
+
type: "xy-threshold",
|
|
422
|
+
x,
|
|
423
|
+
y,
|
|
424
|
+
subject
|
|
425
|
+
});
|
|
426
|
+
return React.createElement(Annotation_1.default, { key: d.key || `annotation-${i}`, noteData: noteData });
|
|
427
|
+
};
|
|
428
|
+
exports.svgRRule = svgRRule;
|
|
429
|
+
const svgCategoryRule = ({ projection, d, i, categories, adjustedSize }) => {
|
|
430
|
+
const { bracketType = "curly", position = projection === "vertical" ? "top" : "left", depth = 30, offset = 0, padding = 0 } = d;
|
|
431
|
+
const actualCategories = Array.isArray(d.categories)
|
|
432
|
+
? d.categories
|
|
433
|
+
: [d.categories];
|
|
434
|
+
const cats = actualCategories.map((c) => categories[c]);
|
|
435
|
+
if (projection === "radial") {
|
|
436
|
+
const arcPadding = padding / adjustedSize[1];
|
|
437
|
+
const leftX = (0, d3_array_1.min)(cats.map((p) => p.pct_start + p.pct_padding / 2 + arcPadding / 2));
|
|
438
|
+
const rightX = (0, d3_array_1.max)(cats.map((p) => p.pct_start + p.pct - p.pct_padding / 2 - arcPadding / 2));
|
|
439
|
+
const chartSize = Math.min(adjustedSize[0], adjustedSize[1]) / 2;
|
|
440
|
+
const centerX = adjustedSize[0] / 2;
|
|
441
|
+
const centerY = adjustedSize[1] / 2;
|
|
442
|
+
const { arcPath, textArcPath } = arcBracket({
|
|
443
|
+
x: 0,
|
|
444
|
+
y: 0,
|
|
445
|
+
radius: chartSize,
|
|
446
|
+
startAngle: leftX * 360,
|
|
447
|
+
endAngle: rightX * 360,
|
|
448
|
+
inset: depth,
|
|
449
|
+
outset: offset,
|
|
450
|
+
curly: bracketType === "curly"
|
|
451
|
+
});
|
|
452
|
+
const textPathID = `text-path-${i}-${Math.random()}`;
|
|
453
|
+
return (React.createElement("g", { className: "category-annotation annotation", transform: `translate(${centerX},${centerY})` },
|
|
454
|
+
React.createElement("path", { d: arcPath, fill: "none", stroke: "currentColor" }),
|
|
455
|
+
React.createElement("path", { id: textPathID, d: textArcPath, style: { display: "none" } }),
|
|
456
|
+
React.createElement("text", { "font-size": "12.5" },
|
|
457
|
+
React.createElement("textPath", { startOffset: "50%", textAnchor: "middle", xlinkHref: `#${textPathID}` }, d.label))));
|
|
458
|
+
}
|
|
459
|
+
else {
|
|
460
|
+
const leftX = (0, d3_array_1.min)(cats.map((p) => p.x));
|
|
461
|
+
const rightX = (0, d3_array_1.max)(cats.map((p) => p.x + p.width));
|
|
462
|
+
if (projection === "vertical") {
|
|
463
|
+
let yPosition = position === "top" ? 0 : adjustedSize[1];
|
|
464
|
+
yPosition += position === "top" ? -offset : offset;
|
|
465
|
+
const noteData = {
|
|
466
|
+
type: "bracket",
|
|
467
|
+
y: yPosition,
|
|
468
|
+
x: leftX - padding,
|
|
469
|
+
note: {
|
|
470
|
+
title: d.title || d.label,
|
|
471
|
+
label: d.title ? d.label : undefined
|
|
472
|
+
},
|
|
473
|
+
subject: {
|
|
474
|
+
type: bracketType,
|
|
475
|
+
width: rightX - leftX + padding * 2,
|
|
476
|
+
depth: position === "top" ? -depth : depth
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
return React.createElement(Annotation_1.default, { key: d.key || `annotation-${i}`, noteData: noteData });
|
|
480
|
+
}
|
|
481
|
+
else if (projection === "horizontal") {
|
|
482
|
+
let yPosition = position === "left" ? 0 : adjustedSize[0];
|
|
483
|
+
yPosition += position === "left" ? -offset : offset;
|
|
484
|
+
const noteData = {
|
|
485
|
+
type: "bracket",
|
|
486
|
+
x: yPosition,
|
|
487
|
+
y: leftX - padding,
|
|
488
|
+
note: {
|
|
489
|
+
title: d.title || d.label,
|
|
490
|
+
label: d.title ? d.label : undefined
|
|
491
|
+
},
|
|
492
|
+
subject: {
|
|
493
|
+
type: bracketType,
|
|
494
|
+
height: rightX - leftX + padding * 2,
|
|
495
|
+
depth: position === "left" ? -depth : depth
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
return React.createElement(Annotation_1.default, { key: d.key || `annotation-${i}`, noteData: noteData });
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
exports.svgCategoryRule = svgCategoryRule;
|
|
503
|
+
const htmlFrameHoverRule = ({ d, i, rAccessor, oAccessor, projection, tooltipContent, optimizeCustomTooltipPosition, pieceIDAccessor, projectedColumns, adjustedSize, rScale, type, rScaleType }) => {
|
|
504
|
+
tooltipContent =
|
|
505
|
+
tooltipContent === "pie"
|
|
506
|
+
? () => pieContentGenerator({
|
|
507
|
+
column: d.column
|
|
508
|
+
})
|
|
509
|
+
: tooltipContent;
|
|
510
|
+
//To string because React gives a DOM error if it gets a date
|
|
511
|
+
let contentFill;
|
|
512
|
+
const pO = (0, multiAccessorUtils_1.findFirstAccessorValue)(oAccessor, d) || d.column;
|
|
513
|
+
const oColumn = projectedColumns[pO];
|
|
514
|
+
const idPiece = (0, exports.findIDPiece)(pieceIDAccessor, oColumn, d);
|
|
515
|
+
if (!idPiece) {
|
|
516
|
+
return null;
|
|
517
|
+
}
|
|
518
|
+
const screenCoordinates = ((type.type === "clusterbar" ||
|
|
519
|
+
type.type === "point" ||
|
|
520
|
+
type.type === "swarm") &&
|
|
521
|
+
d.x !== undefined &&
|
|
522
|
+
d.y !== undefined) ||
|
|
523
|
+
d.isSummaryData
|
|
524
|
+
? [d.x, d.y]
|
|
525
|
+
: (0, exports.screenProject)({
|
|
526
|
+
p: d,
|
|
527
|
+
adjustedSize,
|
|
528
|
+
rScale,
|
|
529
|
+
oColumn,
|
|
530
|
+
rAccessor,
|
|
531
|
+
idPiece,
|
|
532
|
+
projection,
|
|
533
|
+
rScaleType
|
|
534
|
+
});
|
|
535
|
+
if (d.isSummaryData) {
|
|
536
|
+
let summaryContent = d.label;
|
|
537
|
+
if (d.pieces && d.pieces.length !== 0) {
|
|
538
|
+
if (d.pieces.length === 1) {
|
|
539
|
+
summaryContent = [];
|
|
540
|
+
rAccessor.forEach((actualRAccessor) => {
|
|
541
|
+
summaryContent.push(actualRAccessor(d.pieces[0].data));
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
else {
|
|
545
|
+
summaryContent = [];
|
|
546
|
+
rAccessor.forEach((actualRAccessor) => {
|
|
547
|
+
const pieceData = (0, d3_array_1.extent)(d.pieces.map((p) => p.data).map(actualRAccessor));
|
|
548
|
+
summaryContent.push(`From ${pieceData[0]} to ${pieceData[1]}`);
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
const summaryLabel = React.createElement("p", { key: "html-annotation-content-2" }, summaryContent);
|
|
553
|
+
contentFill = [
|
|
554
|
+
React.createElement("p", { key: "html-annotation-content-1" }, d.key),
|
|
555
|
+
summaryLabel,
|
|
556
|
+
React.createElement("p", { key: "html-annotation-content-3" }, d.value)
|
|
557
|
+
];
|
|
558
|
+
}
|
|
559
|
+
else if (d.data) {
|
|
560
|
+
contentFill = [];
|
|
561
|
+
oAccessor.forEach((actualOAccessor, i) => {
|
|
562
|
+
if (idPiece.data) {
|
|
563
|
+
const pieceOVal = derivePieceValue(actualOAccessor, idPiece.data);
|
|
564
|
+
contentFill.push(React.createElement("p", { key: `html-annotation-content-o-${i}` }, pieceOVal));
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
rAccessor.forEach((actualRAccessor, i) => {
|
|
568
|
+
if (idPiece.data) {
|
|
569
|
+
const pieceRVal = derivePieceValue(actualRAccessor, idPiece.data);
|
|
570
|
+
contentFill.push(React.createElement("p", { key: `html-annotation-content-r-${i}` }, pieceRVal));
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
else if (d.label) {
|
|
575
|
+
contentFill = d.label;
|
|
576
|
+
}
|
|
577
|
+
let content = (React.createElement("div", { className: "tooltip-content", "data-testid": "tooltip-content" }, contentFill));
|
|
578
|
+
if (d.type === "frame-hover" && tooltipContent && idPiece) {
|
|
579
|
+
const tooltipContentArgs = {
|
|
580
|
+
...idPiece,
|
|
581
|
+
...idPiece.data,
|
|
582
|
+
column: oColumn,
|
|
583
|
+
pieces: oColumn ? oColumn.pieceData.map(p => p.data) : []
|
|
584
|
+
};
|
|
585
|
+
content = optimizeCustomTooltipPosition ? (React.createElement(TooltipPositioner_1.default, { tooltipContent: tooltipContent, tooltipContentArgs: tooltipContentArgs })) : (tooltipContent(tooltipContentArgs));
|
|
586
|
+
}
|
|
587
|
+
const xPos = parseInt(screenCoordinates[0]);
|
|
588
|
+
const flipped = adjustedSize && xPos > adjustedSize[0] / 2;
|
|
589
|
+
const tooltipStyle = {
|
|
590
|
+
position: "absolute",
|
|
591
|
+
top: `${parseInt(screenCoordinates[1])}px`
|
|
592
|
+
};
|
|
593
|
+
if (flipped) {
|
|
594
|
+
tooltipStyle.right = `${adjustedSize[0] - xPos}px`;
|
|
595
|
+
}
|
|
596
|
+
else {
|
|
597
|
+
tooltipStyle.left = `${xPos}px`;
|
|
598
|
+
}
|
|
599
|
+
return (React.createElement("div", { key: `xylabel-${i}`, className: `annotation annotation-or-label ${projection} ${d.className || ""}`, "data-testid": "annotation-or-label", style: tooltipStyle }, content));
|
|
600
|
+
};
|
|
601
|
+
exports.htmlFrameHoverRule = htmlFrameHoverRule;
|
|
602
|
+
const htmlColumnHoverRule = ({ d, i, summaryType, oAccessor, type, adjustedPosition, adjustedSize, projection, tooltipContent, optimizeCustomTooltipPosition, projectedColumns }) => {
|
|
603
|
+
//we need to ignore negative pieces to make sure the hover behavior populates on top of the positive bar
|
|
604
|
+
const { coordinates: [xPosition, yPosition], pieces, column } = (0, exports.getColumnScreenCoordinates)({
|
|
605
|
+
d,
|
|
606
|
+
projectedColumns,
|
|
607
|
+
oAccessor,
|
|
608
|
+
summaryType,
|
|
609
|
+
type,
|
|
610
|
+
projection,
|
|
611
|
+
adjustedPosition,
|
|
612
|
+
adjustedSize
|
|
613
|
+
});
|
|
614
|
+
if (column === undefined) {
|
|
615
|
+
return null;
|
|
616
|
+
}
|
|
617
|
+
//To string because React gives a DOM error if it gets a date
|
|
618
|
+
const oContent = [];
|
|
619
|
+
oAccessor.forEach((actualOAccessor, i) => {
|
|
620
|
+
if (pieces[0].data) {
|
|
621
|
+
const pieceOVal = derivePieceValue(actualOAccessor, pieces[0].data);
|
|
622
|
+
oContent.push(React.createElement("p", { key: `or-annotation-o-${i}` }, pieceOVal));
|
|
623
|
+
}
|
|
624
|
+
});
|
|
625
|
+
let content = (React.createElement("div", { className: "tooltip-content", "data-testid": "tooltip-content" },
|
|
626
|
+
oContent,
|
|
627
|
+
React.createElement("p", { key: "or-annotation-2" }, (0, d3_array_1.sum)(pieces.map((p) => p.value).filter((p) => p > 0)))));
|
|
628
|
+
if (d.type === "column-hover" && tooltipContent) {
|
|
629
|
+
if (tooltipContent === "pie") {
|
|
630
|
+
tooltipContent = pieContentGenerator;
|
|
631
|
+
}
|
|
632
|
+
const tooltipContentArgs = {
|
|
633
|
+
...d,
|
|
634
|
+
pieces: pieces.map((p) => p.data),
|
|
635
|
+
column,
|
|
636
|
+
oAccessor
|
|
637
|
+
};
|
|
638
|
+
content = optimizeCustomTooltipPosition ? (React.createElement(TooltipPositioner_1.default, { tooltipContent: tooltipContent, tooltipContentArgs: tooltipContentArgs })) : (tooltipContent(tooltipContentArgs));
|
|
639
|
+
}
|
|
640
|
+
else if (d.label) {
|
|
641
|
+
content = (React.createElement("div", { className: "tooltip-content", "data-testid": "tooltip-content" }, d.label));
|
|
642
|
+
}
|
|
643
|
+
const xPos = parseInt(xPosition);
|
|
644
|
+
const flipped = adjustedSize && xPos > adjustedSize[0] / 2;
|
|
645
|
+
const tooltipStyle = {
|
|
646
|
+
position: "absolute",
|
|
647
|
+
top: `${parseInt(yPosition)}px`
|
|
648
|
+
};
|
|
649
|
+
if (flipped) {
|
|
650
|
+
tooltipStyle.right = `${adjustedSize[0] - xPos}px`;
|
|
651
|
+
}
|
|
652
|
+
else {
|
|
653
|
+
tooltipStyle.left = `${xPos}px`;
|
|
654
|
+
}
|
|
655
|
+
return (React.createElement("div", { key: `orlabel-${i}`, className: `annotation annotation-or-label ${projection} ${d.className || ""}`, "data-testid": "annotation-or-label", style: tooltipStyle }, content));
|
|
656
|
+
};
|
|
657
|
+
exports.htmlColumnHoverRule = htmlColumnHoverRule;
|
|
658
|
+
const svgRectEncloseRule = ({ d, i, screenCoordinates }) => {
|
|
659
|
+
const bboxNodes = screenCoordinates.map((p) => {
|
|
660
|
+
return {
|
|
661
|
+
x0: (p.x0 = p[0]),
|
|
662
|
+
x1: (p.x1 = p[0]),
|
|
663
|
+
y0: (p.y0 = p[1]),
|
|
664
|
+
y1: (p.y1 = p[1])
|
|
665
|
+
};
|
|
666
|
+
});
|
|
667
|
+
return (0, baseRules_1.rectangleEnclosure)({ bboxNodes, d, i });
|
|
668
|
+
};
|
|
669
|
+
exports.svgRectEncloseRule = svgRectEncloseRule;
|
|
670
|
+
const svgOrdinalLine = ({ screenCoordinates, d, voronoiHover }) => {
|
|
671
|
+
const lineGenerator = (0, d3_shape_1.line)()
|
|
672
|
+
.x((d) => d[0])
|
|
673
|
+
.y((d) => d[1]);
|
|
674
|
+
if (d.curve) {
|
|
675
|
+
const interpolator = general_1.curveHash[d.curve] || d.curve;
|
|
676
|
+
lineGenerator.curve(interpolator);
|
|
677
|
+
}
|
|
678
|
+
const lineStyle = typeof d.lineStyle === "function" ? d.lineStyle(d) : d.lineStyle || {};
|
|
679
|
+
return (React.createElement("g", { key: "ordinal-line-annotation" },
|
|
680
|
+
React.createElement("path", { stroke: "currentColor", fill: "none", style: lineStyle, d: lineGenerator(screenCoordinates) }),
|
|
681
|
+
(d.points || d.interactive) &&
|
|
682
|
+
screenCoordinates.map((p, q) => {
|
|
683
|
+
const pointStyle = typeof d.pointStyle === "function"
|
|
684
|
+
? d.pointStyle(d.coordinates[q], q)
|
|
685
|
+
: d.pointStyle || {};
|
|
686
|
+
return (React.createElement("g", { transform: `translate(${p[0]},${p[1]})`, key: `ordinal-line-point-${q}` },
|
|
687
|
+
d.points && (React.createElement("circle", { style: pointStyle, r: d.radius || 5, fill: "currentColor" })),
|
|
688
|
+
d.interactive && (React.createElement("circle", { style: { pointerEvents: "all" }, r: d.hoverRadius || 15, opacity: 0, onMouseEnter: () => voronoiHover({
|
|
689
|
+
type: "frame-hover",
|
|
690
|
+
...d.coordinates[q],
|
|
691
|
+
data: d.coordinates[q]
|
|
692
|
+
}), onMouseOut: () => voronoiHover() }))));
|
|
693
|
+
})));
|
|
694
|
+
};
|
|
695
|
+
exports.svgOrdinalLine = svgOrdinalLine;
|