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,249 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.axisLines = exports.baselineGenerator = exports.axisLabels = void 0;
|
|
37
|
+
exports.generateTickValues = generateTickValues;
|
|
38
|
+
exports.axisPieces = axisPieces;
|
|
39
|
+
const React = __importStar(require("react"));
|
|
40
|
+
const horizontalTornTickGenerator = (width, ticks, y, orient) => {
|
|
41
|
+
const step = width / ticks;
|
|
42
|
+
let currentStep = 0;
|
|
43
|
+
let tickPath = `M0,${y}`;
|
|
44
|
+
const mod = orient === "right" ? -1 : 1;
|
|
45
|
+
while (currentStep <= width) {
|
|
46
|
+
tickPath += `L${currentStep},${y}`;
|
|
47
|
+
if (currentStep < width) {
|
|
48
|
+
tickPath += `L${currentStep + step / 2},${y + 10 * mod}`;
|
|
49
|
+
}
|
|
50
|
+
currentStep += step;
|
|
51
|
+
}
|
|
52
|
+
return tickPath;
|
|
53
|
+
};
|
|
54
|
+
const verticalTornTickGenerator = (height, ticks, x, orient) => {
|
|
55
|
+
const step = height / ticks;
|
|
56
|
+
let currentStep = 0;
|
|
57
|
+
let tickPath = `M${x},0`;
|
|
58
|
+
const mod = orient === "bottom" ? -1 : 1;
|
|
59
|
+
while (currentStep <= height) {
|
|
60
|
+
tickPath += `L${x},${currentStep}`;
|
|
61
|
+
if (currentStep < height) {
|
|
62
|
+
tickPath += `L${x + 10 * mod},${currentStep + step / 2}`;
|
|
63
|
+
}
|
|
64
|
+
currentStep += step;
|
|
65
|
+
}
|
|
66
|
+
return tickPath;
|
|
67
|
+
};
|
|
68
|
+
const generateTornBaseline = (orient, baselineSettings) => {
|
|
69
|
+
let tornD = "";
|
|
70
|
+
const { x1, x2, y1, y2 } = baselineSettings;
|
|
71
|
+
if (orient === "left" || orient === "right") {
|
|
72
|
+
const calcWidth = Math.abs(x2 - x1);
|
|
73
|
+
const ticks = Math.ceil(calcWidth / 40);
|
|
74
|
+
tornD = horizontalTornTickGenerator(calcWidth, ticks, orient === "right" ? 0 : y1, orient);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
const calcHeight = Math.abs(y2 - y1);
|
|
78
|
+
const ticks = Math.ceil(calcHeight / 40);
|
|
79
|
+
tornD = verticalTornTickGenerator(calcHeight, ticks, x1, orient);
|
|
80
|
+
}
|
|
81
|
+
return tornD;
|
|
82
|
+
};
|
|
83
|
+
const defaultTickLineGenerator = ({ xy, orient, i, className = "", jaggedBase }) => {
|
|
84
|
+
let genD = `M${xy.x1},${xy.y1}L${xy.x2},${xy.y2}`;
|
|
85
|
+
if (jaggedBase && i === 0) {
|
|
86
|
+
genD = generateTornBaseline(orient, xy);
|
|
87
|
+
}
|
|
88
|
+
return (React.createElement("path", { key: i, fill: "none", stroke: "currentColor", strokeWidth: "1px", d: genD, className: `tick-line tick ${orient} ${className}` }));
|
|
89
|
+
};
|
|
90
|
+
const outboundTickLineGenerator = ({ xy, orient, i, className = "" }) => {
|
|
91
|
+
const tickLength = 8;
|
|
92
|
+
let genD = `M-4,${xy.y1}L${xy.x1},${xy.y2}`;
|
|
93
|
+
if (orient === "left") {
|
|
94
|
+
genD = `M${xy.x1 - tickLength},${xy.y1}L${xy.x1},${xy.y2}`;
|
|
95
|
+
}
|
|
96
|
+
else if (orient === "right") {
|
|
97
|
+
genD = `M${xy.x2},${xy.y1}L${xy.x2 + tickLength},${xy.y2}`;
|
|
98
|
+
}
|
|
99
|
+
else if (orient === "top") {
|
|
100
|
+
genD = `M${xy.x1},${xy.y1 - tickLength}L${xy.x1},${xy.y1}`;
|
|
101
|
+
}
|
|
102
|
+
else if (orient === "bottom") {
|
|
103
|
+
genD = `M${xy.x1},${xy.y2}L${xy.x1},${xy.y2 + tickLength}`;
|
|
104
|
+
}
|
|
105
|
+
return (React.createElement("path", { key: i, fill: "none", stroke: "currentColor", strokeWidth: "1px", d: genD, className: `outbound-tick-line tick ${orient} ${className}` }));
|
|
106
|
+
};
|
|
107
|
+
function generateTickValues(tickValues, ticks, scale) {
|
|
108
|
+
const axisSize = Math.abs(scale.range()[1] - scale.range()[0]);
|
|
109
|
+
if (!tickValues) {
|
|
110
|
+
if (!ticks) {
|
|
111
|
+
ticks = Math.max(1, Math.floor(axisSize / 40));
|
|
112
|
+
}
|
|
113
|
+
tickValues = (scale.ticks && scale.ticks(ticks)) || scale.domain();
|
|
114
|
+
}
|
|
115
|
+
return tickValues;
|
|
116
|
+
}
|
|
117
|
+
function axisPieces({ renderMode = () => undefined, padding = 5, scale, ticks, tickValues = generateTickValues(undefined, ticks, scale), orient = "left", size, footer = false, tickSize = footer
|
|
118
|
+
? -10
|
|
119
|
+
: ["top", "bottom"].find((d) => d === orient)
|
|
120
|
+
? (size ? size[1] : 0)
|
|
121
|
+
: (size ? size[0] : 0), jaggedBase }) {
|
|
122
|
+
//returns x1 (start of line), x2 (end of line) associated with the value of the tick
|
|
123
|
+
let axisDomain = [], position1, position2, domain1, domain2, tposition1, tposition2, textPositionMod = 0, textPositionMod2 = 0, defaultAnchor = "middle";
|
|
124
|
+
switch (orient) {
|
|
125
|
+
case "top":
|
|
126
|
+
position1 = "x1";
|
|
127
|
+
position2 = "x2";
|
|
128
|
+
domain1 = "y1";
|
|
129
|
+
domain2 = "y2";
|
|
130
|
+
axisDomain = [0, tickSize];
|
|
131
|
+
tposition1 = "tx";
|
|
132
|
+
tposition2 = "ty";
|
|
133
|
+
textPositionMod -= 20 - padding;
|
|
134
|
+
break;
|
|
135
|
+
case "bottom":
|
|
136
|
+
position1 = "x1";
|
|
137
|
+
position2 = "x2";
|
|
138
|
+
domain1 = "y2";
|
|
139
|
+
domain2 = "y1";
|
|
140
|
+
axisDomain = size ? [size[1], size[1] - tickSize] : [0, -tickSize];
|
|
141
|
+
tposition1 = "tx";
|
|
142
|
+
tposition2 = "ty";
|
|
143
|
+
textPositionMod += 20 + padding;
|
|
144
|
+
break;
|
|
145
|
+
case "right":
|
|
146
|
+
position1 = "y2";
|
|
147
|
+
position2 = "y1";
|
|
148
|
+
domain1 = "x2";
|
|
149
|
+
domain2 = "x1";
|
|
150
|
+
axisDomain = size ? [size[0], size[0] - tickSize] : [0, -tickSize];
|
|
151
|
+
tposition1 = "ty";
|
|
152
|
+
tposition2 = "tx";
|
|
153
|
+
textPositionMod += 5 + padding;
|
|
154
|
+
textPositionMod2 += 5;
|
|
155
|
+
defaultAnchor = "start";
|
|
156
|
+
break;
|
|
157
|
+
//left
|
|
158
|
+
default:
|
|
159
|
+
position1 = "y1";
|
|
160
|
+
position2 = "y2";
|
|
161
|
+
domain1 = "x1";
|
|
162
|
+
domain2 = "x2";
|
|
163
|
+
axisDomain = [0, tickSize];
|
|
164
|
+
tposition1 = "ty";
|
|
165
|
+
tposition2 = "tx";
|
|
166
|
+
textPositionMod -= 5 + padding;
|
|
167
|
+
textPositionMod2 += 5;
|
|
168
|
+
defaultAnchor = "end";
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
let generatedTicks = tickValues instanceof Function ? tickValues({ orient }) : tickValues;
|
|
172
|
+
if (jaggedBase &&
|
|
173
|
+
generatedTicks.find((t) => t === scale.domain()[0]) === undefined) {
|
|
174
|
+
generatedTicks = [scale.domain()[0], ...generatedTicks];
|
|
175
|
+
}
|
|
176
|
+
return generatedTicks.map((tick, i) => {
|
|
177
|
+
const tickPosition = scale(tick);
|
|
178
|
+
return {
|
|
179
|
+
[position1]: tickPosition,
|
|
180
|
+
[position2]: tickPosition,
|
|
181
|
+
[domain1]: axisDomain[0],
|
|
182
|
+
[domain2]: axisDomain[1],
|
|
183
|
+
[tposition1]: tickPosition + textPositionMod2,
|
|
184
|
+
[tposition2]: axisDomain[0] + textPositionMod,
|
|
185
|
+
defaultAnchor,
|
|
186
|
+
renderMode: renderMode(tick, i),
|
|
187
|
+
value: tick
|
|
188
|
+
};
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
const axisLabels = ({ axisParts, tickFormat, rotate = 0, center = false, orient }) => {
|
|
192
|
+
return axisParts.map((axisPart, i) => {
|
|
193
|
+
let renderedValue = tickFormat(axisPart.value, i);
|
|
194
|
+
if (typeof renderedValue !== "object" || renderedValue instanceof Date) {
|
|
195
|
+
renderedValue = (React.createElement("text", { textAnchor: axisPart.defaultAnchor, className: "axis-label" }, renderedValue.toString ? renderedValue.toString() : renderedValue));
|
|
196
|
+
}
|
|
197
|
+
let textX = axisPart.tx;
|
|
198
|
+
let textY = axisPart.ty;
|
|
199
|
+
if (center) {
|
|
200
|
+
switch (orient) {
|
|
201
|
+
case "right":
|
|
202
|
+
textX -= (axisPart.x2 - axisPart.x1) / 2;
|
|
203
|
+
break;
|
|
204
|
+
case "left":
|
|
205
|
+
textX += (axisPart.x2 - axisPart.x1) / 2;
|
|
206
|
+
break;
|
|
207
|
+
case "top":
|
|
208
|
+
textY += (axisPart.y2 - axisPart.y1) / 2;
|
|
209
|
+
break;
|
|
210
|
+
case "bottom":
|
|
211
|
+
textY -= (axisPart.y2 - axisPart.y1) / 2;
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return (React.createElement("g", { key: i, pointerEvents: "none", transform: `translate(${textX},${textY}) rotate(${rotate})`, className: "axis-label" }, renderedValue));
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
exports.axisLabels = axisLabels;
|
|
219
|
+
const baselineGenerator = (orient, size, className) => {
|
|
220
|
+
const offsets = {
|
|
221
|
+
left: { x: 0, y: 0, width: 0, height: size ? size[1] : 0 },
|
|
222
|
+
right: { x: size ? size[0] : 0, y: 0, width: 0, height: size ? size[1] : 0 },
|
|
223
|
+
top: { x: 0, y: 0, width: size ? size[0] : 0, height: 0 },
|
|
224
|
+
bottom: { x: 0, y: size ? size[1] : 0, width: size ? size[0] : 0, height: 0 }
|
|
225
|
+
};
|
|
226
|
+
const orientOffset = offsets[orient];
|
|
227
|
+
return (React.createElement("line", { key: "baseline", className: `axis-baseline ${className}`, stroke: "currentColor", strokeLinecap: "square", x1: orientOffset.x, x2: orientOffset.x + orientOffset.width, y1: orientOffset.y, y2: orientOffset.y + orientOffset.height }));
|
|
228
|
+
};
|
|
229
|
+
exports.baselineGenerator = baselineGenerator;
|
|
230
|
+
const axisLines = ({ axisParts, orient, tickLineGenerator = defaultTickLineGenerator, className, jaggedBase, scale, showOutboundTickLines = false }) => {
|
|
231
|
+
const axisLines = axisParts.map((axisPart, i) => tickLineGenerator({
|
|
232
|
+
xy: axisPart,
|
|
233
|
+
orient,
|
|
234
|
+
i,
|
|
235
|
+
className,
|
|
236
|
+
jaggedBase,
|
|
237
|
+
scale
|
|
238
|
+
}));
|
|
239
|
+
const outboundAxisLines = showOutboundTickLines
|
|
240
|
+
? axisParts.map((axisPart, i) => outboundTickLineGenerator({
|
|
241
|
+
xy: axisPart,
|
|
242
|
+
orient,
|
|
243
|
+
i,
|
|
244
|
+
className
|
|
245
|
+
}))
|
|
246
|
+
: [];
|
|
247
|
+
return [...axisLines, outboundAxisLines];
|
|
248
|
+
};
|
|
249
|
+
exports.axisLines = axisLines;
|
|
@@ -0,0 +1,435 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.curveHash = void 0;
|
|
37
|
+
exports.lineGeneratorDecorator = lineGeneratorDecorator;
|
|
38
|
+
exports.createPoints = createPoints;
|
|
39
|
+
exports.createLines = createLines;
|
|
40
|
+
exports.createSummaries = createSummaries;
|
|
41
|
+
exports.clonedAppliedElement = clonedAppliedElement;
|
|
42
|
+
const React = __importStar(require("react"));
|
|
43
|
+
const d3_shape_1 = require("d3-shape");
|
|
44
|
+
const areaDrawing_1 = require("../svg/areaDrawing");
|
|
45
|
+
exports.curveHash = {
|
|
46
|
+
step: d3_shape_1.curveStep,
|
|
47
|
+
stepbefore: d3_shape_1.curveStepBefore,
|
|
48
|
+
stepafter: d3_shape_1.curveStepAfter,
|
|
49
|
+
cardinal: d3_shape_1.curveCardinal,
|
|
50
|
+
basis: d3_shape_1.curveBasis,
|
|
51
|
+
linear: d3_shape_1.curveLinear,
|
|
52
|
+
catmullrom: d3_shape_1.curveCatmullRom,
|
|
53
|
+
monotone: d3_shape_1.curveMonotoneY,
|
|
54
|
+
monotonex: d3_shape_1.curveMonotoneX,
|
|
55
|
+
monotoney: d3_shape_1.curveMonotoneY,
|
|
56
|
+
natural: d3_shape_1.curveNatural
|
|
57
|
+
};
|
|
58
|
+
function lineGeneratorDecorator({ generator, projectedCoordinateNames, defined, xScale, yScale, interpolator, simpleLine }) {
|
|
59
|
+
const { x, y, yTop, yBottom, xBottom, xTop } = projectedCoordinateNames;
|
|
60
|
+
generator.x((d) => xScale(d[x])).curve(interpolator);
|
|
61
|
+
if (simpleLine) {
|
|
62
|
+
generator.y((d) => yScale(d[y]));
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
generator.y0((d) => yScale(d[yBottom])).y1((d) => yScale(d[yTop]));
|
|
66
|
+
generator.x0((d) => xScale(d[xBottom])).x1((d) => xScale(d[xTop]));
|
|
67
|
+
}
|
|
68
|
+
if (defined) {
|
|
69
|
+
generator.defined((p, q) => defined(p, q));
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
generator.defined((p) => !p._xyFrameUndefined);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function createPoints({ xScale, yScale, canvasDrawing, data, projectedCoordinateNames, customMark, canvasRender, styleFn, classFn, renderKeyFn, renderMode, showLinePoints: baseShowLinePoints }) {
|
|
76
|
+
const { y, x, xMiddle, yMiddle, yTop, yBottom } = projectedCoordinateNames;
|
|
77
|
+
const showLinePoints = baseShowLinePoints === true ? undefined : baseShowLinePoints;
|
|
78
|
+
const whichPoints = {
|
|
79
|
+
top: yTop,
|
|
80
|
+
bottom: yBottom
|
|
81
|
+
};
|
|
82
|
+
const whichWay = whichPoints[showLinePoints];
|
|
83
|
+
const mappedPoints = [];
|
|
84
|
+
data.forEach((d, i) => {
|
|
85
|
+
const dX = xScale(d[xMiddle] !== undefined ? d[xMiddle] : d[x]);
|
|
86
|
+
const dY = yScale(d[whichWay] !== undefined
|
|
87
|
+
? d[whichWay]
|
|
88
|
+
: d[yMiddle] !== undefined
|
|
89
|
+
? d[yMiddle]
|
|
90
|
+
: d[y]);
|
|
91
|
+
const pointAriaLabel = `Point at x ${d.x} and y ${d.y}`;
|
|
92
|
+
// CUSTOM MARK IMPLEMENTATION
|
|
93
|
+
const renderedCustomMark = !customMark
|
|
94
|
+
? undefined
|
|
95
|
+
: React.isValidElement(customMark)
|
|
96
|
+
? customMark
|
|
97
|
+
: customMark({ d: d.data, xy: d, i, xScale, yScale });
|
|
98
|
+
const markProps = customMark
|
|
99
|
+
? { ...renderedCustomMark.props, "aria-label": pointAriaLabel }
|
|
100
|
+
: {
|
|
101
|
+
key: `piece-${i}`,
|
|
102
|
+
markType: "circle",
|
|
103
|
+
r: 2,
|
|
104
|
+
"aria-label": pointAriaLabel
|
|
105
|
+
};
|
|
106
|
+
if (renderedCustomMark &&
|
|
107
|
+
renderedCustomMark.props &&
|
|
108
|
+
!renderedCustomMark.props.markType &&
|
|
109
|
+
(!canvasRender || canvasRender(d.data, i) !== true)) {
|
|
110
|
+
mappedPoints.push(React.createElement("g", { transform: `translate(${dX},${dY})`, key: renderKeyFn ? renderKeyFn(d.data, i) : `custom-point-mark-${i}`, style: styleFn ? styleFn(d.data, i) : {}, className: classFn ? classFn(d.data, i) : "" }, renderedCustomMark));
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
if (canvasRender && canvasRender(d.data, i) === true) {
|
|
114
|
+
const canvasPoint = {
|
|
115
|
+
type: "point",
|
|
116
|
+
baseClass: "frame-piece",
|
|
117
|
+
tx: dX,
|
|
118
|
+
ty: dY,
|
|
119
|
+
d,
|
|
120
|
+
i,
|
|
121
|
+
markProps,
|
|
122
|
+
styleFn,
|
|
123
|
+
renderFn: renderMode,
|
|
124
|
+
classFn
|
|
125
|
+
};
|
|
126
|
+
canvasDrawing.push(canvasPoint);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
const yCoordinates = Array.isArray(d[y])
|
|
130
|
+
? d[y].map((p) => yScale(p))
|
|
131
|
+
: [dY];
|
|
132
|
+
yCoordinates.forEach((yc, yi) => {
|
|
133
|
+
const xCoordinates = Array.isArray(d[x])
|
|
134
|
+
? d[x].map((p) => xScale(p))
|
|
135
|
+
: [dX];
|
|
136
|
+
xCoordinates.forEach((xc, xi) => {
|
|
137
|
+
mappedPoints.push(clonedAppliedElement({
|
|
138
|
+
baseClass: "frame-piece",
|
|
139
|
+
tx: xc,
|
|
140
|
+
ty: yc,
|
|
141
|
+
d: (d.data && { ...d, ...d.data }) || d,
|
|
142
|
+
i: yi === 0 && xi === 0 ? i : `${i}-${yi}-${xi}`,
|
|
143
|
+
markProps,
|
|
144
|
+
styleFn,
|
|
145
|
+
renderKeyFn,
|
|
146
|
+
classFn,
|
|
147
|
+
yi
|
|
148
|
+
}));
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
return mappedPoints;
|
|
155
|
+
}
|
|
156
|
+
function createLines({ xScale, yScale, canvasDrawing, data, projectedCoordinateNames, customMark, canvasRender, styleFn, classFn, renderMode, renderKeyFn, type, defined, ariaLabel, axesData = [] }) {
|
|
157
|
+
const xAxis = axesData.find((d) => d.orient === "bottom" || d.orient === "top");
|
|
158
|
+
const yAxis = axesData.find((d) => d.orient === "left" || d.orient === "right");
|
|
159
|
+
const xAxisFormatter = (xAxis && xAxis.tickFormat) || ((d) => d);
|
|
160
|
+
const yAxisFormatter = (yAxis && yAxis.tickFormat) || ((d) => d);
|
|
161
|
+
const customLine = typeof type === "object" ? type : { type };
|
|
162
|
+
const interpolator = typeof customLine.interpolator === "string"
|
|
163
|
+
? exports.curveHash[customLine.interpolator]
|
|
164
|
+
: customLine.interpolator || d3_shape_1.curveLinear;
|
|
165
|
+
const lineGenerator = customLine.simpleLine ? (0, d3_shape_1.line)() : (0, d3_shape_1.area)();
|
|
166
|
+
lineGeneratorDecorator({
|
|
167
|
+
projectedCoordinateNames,
|
|
168
|
+
defined,
|
|
169
|
+
interpolator,
|
|
170
|
+
generator: lineGenerator,
|
|
171
|
+
xScale,
|
|
172
|
+
yScale,
|
|
173
|
+
simpleLine: customLine.simpleLine
|
|
174
|
+
});
|
|
175
|
+
const dynamicLineGenerator = (interpolator.dynamicInterpolator &&
|
|
176
|
+
((d, i) => {
|
|
177
|
+
const dynLineGenerator = (0, d3_shape_1.area)();
|
|
178
|
+
lineGeneratorDecorator({
|
|
179
|
+
projectedCoordinateNames,
|
|
180
|
+
defined,
|
|
181
|
+
interpolator: interpolator.dynamicInterpolator(d, i),
|
|
182
|
+
generator: dynLineGenerator,
|
|
183
|
+
xScale,
|
|
184
|
+
yScale,
|
|
185
|
+
simpleLine: customLine.simpleLine
|
|
186
|
+
});
|
|
187
|
+
return dynLineGenerator;
|
|
188
|
+
})) ||
|
|
189
|
+
(() => lineGenerator);
|
|
190
|
+
const mappedLines = [];
|
|
191
|
+
data.forEach((d, i) => {
|
|
192
|
+
const mappedDataForLines = d.data.map((p) => ({ ...p.data, ...p }));
|
|
193
|
+
if (customMark && typeof customMark === "function") {
|
|
194
|
+
//shim to make customLineMark work until Semiotic 2
|
|
195
|
+
const compatibleData = {
|
|
196
|
+
...d,
|
|
197
|
+
data: mappedDataForLines
|
|
198
|
+
};
|
|
199
|
+
mappedLines.push(customMark({ d: compatibleData, i, xScale, yScale, canvasDrawing }));
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
const builtInDisplayProps = {};
|
|
203
|
+
if (customLine.simpleLine) {
|
|
204
|
+
builtInDisplayProps.fill = "none";
|
|
205
|
+
builtInDisplayProps.stroke = "black";
|
|
206
|
+
}
|
|
207
|
+
const pathString = dynamicLineGenerator(d, i)(mappedDataForLines);
|
|
208
|
+
const markProps = {
|
|
209
|
+
...builtInDisplayProps,
|
|
210
|
+
markType: "path",
|
|
211
|
+
d: pathString,
|
|
212
|
+
"aria-label": d.data &&
|
|
213
|
+
d.data.length > 0 &&
|
|
214
|
+
ariaLabel &&
|
|
215
|
+
`${d.data.length} point ${ariaLabel.items} starting value ${yAxisFormatter(d.data[0].y)} at ${xAxisFormatter(d.data[0].x)} ending value ${yAxisFormatter(d.data[d.data.length - 1].y)} at ${xAxisFormatter(d.data[d.data.length - 1].x)}`
|
|
216
|
+
};
|
|
217
|
+
if (canvasRender && canvasRender(d, i) === true) {
|
|
218
|
+
const canvasLine = {
|
|
219
|
+
type: "line",
|
|
220
|
+
baseClass: "xyframe-line",
|
|
221
|
+
tx: 0,
|
|
222
|
+
ty: 0,
|
|
223
|
+
d,
|
|
224
|
+
i,
|
|
225
|
+
markProps,
|
|
226
|
+
styleFn,
|
|
227
|
+
renderFn: renderMode,
|
|
228
|
+
classFn
|
|
229
|
+
};
|
|
230
|
+
canvasDrawing.push(canvasLine);
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
let moddedStyleFn = styleFn;
|
|
234
|
+
if (customLine.type === "area" && customLine.enclosed !== true) {
|
|
235
|
+
moddedStyleFn = (d, i) => ({ ...styleFn(d, i), stroke: "none" });
|
|
236
|
+
}
|
|
237
|
+
mappedLines.push(clonedAppliedElement({
|
|
238
|
+
baseClass: "xyframe-line",
|
|
239
|
+
d,
|
|
240
|
+
i,
|
|
241
|
+
markProps,
|
|
242
|
+
styleFn: moddedStyleFn,
|
|
243
|
+
renderKeyFn,
|
|
244
|
+
classFn
|
|
245
|
+
}));
|
|
246
|
+
if (customLine.type === "area" && customLine.enclosed !== true) {
|
|
247
|
+
const topperStyleFn = (d, i) => ({ ...styleFn(d, i), fill: "none" });
|
|
248
|
+
const topperLineGenerator = (0, d3_shape_1.line)();
|
|
249
|
+
lineGeneratorDecorator({
|
|
250
|
+
projectedCoordinateNames,
|
|
251
|
+
defined,
|
|
252
|
+
interpolator: interpolator,
|
|
253
|
+
generator: topperLineGenerator,
|
|
254
|
+
xScale,
|
|
255
|
+
yScale,
|
|
256
|
+
simpleLine: true
|
|
257
|
+
});
|
|
258
|
+
const topperMarkProps = {
|
|
259
|
+
...markProps,
|
|
260
|
+
d: topperLineGenerator(mappedDataForLines)
|
|
261
|
+
};
|
|
262
|
+
const topperKeyFn = renderKeyFn
|
|
263
|
+
? (d, i, yi) => `${renderKeyFn(d, i, yi)}-top`
|
|
264
|
+
: undefined;
|
|
265
|
+
mappedLines.push(clonedAppliedElement({
|
|
266
|
+
baseClass: "xyframe-line-top",
|
|
267
|
+
d,
|
|
268
|
+
i,
|
|
269
|
+
markProps: topperMarkProps,
|
|
270
|
+
styleFn: topperStyleFn,
|
|
271
|
+
renderKeyFn: topperKeyFn,
|
|
272
|
+
classFn
|
|
273
|
+
}));
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
if (customLine.type === "difference" && data.length === 2) {
|
|
279
|
+
//Create the overlay line for the difference chart
|
|
280
|
+
const diffdataA = data[0].data.map((basedata, baseI) => {
|
|
281
|
+
const linePoint = basedata.yTop > data[1].data[baseI].yTop
|
|
282
|
+
? basedata.yTop
|
|
283
|
+
: basedata.yBottom;
|
|
284
|
+
return {
|
|
285
|
+
x: basedata.x,
|
|
286
|
+
y: linePoint,
|
|
287
|
+
yBottom: linePoint,
|
|
288
|
+
yTop: linePoint
|
|
289
|
+
};
|
|
290
|
+
});
|
|
291
|
+
const diffdataB = data[0].data.map((basedata, baseI) => {
|
|
292
|
+
const linePoint = data[1].data[baseI].yTop > basedata.yTop
|
|
293
|
+
? data[1].data[baseI].yTop
|
|
294
|
+
: data[1].data[baseI].yBottom;
|
|
295
|
+
return {
|
|
296
|
+
x: basedata.x,
|
|
297
|
+
y: linePoint,
|
|
298
|
+
yBottom: linePoint,
|
|
299
|
+
yTop: linePoint
|
|
300
|
+
};
|
|
301
|
+
});
|
|
302
|
+
const doClassname = classFn
|
|
303
|
+
? `xyframe-line ${classFn(diffdataA)}`
|
|
304
|
+
: "xyframe-line";
|
|
305
|
+
const overLine = (0, d3_shape_1.line)();
|
|
306
|
+
lineGeneratorDecorator({
|
|
307
|
+
projectedCoordinateNames,
|
|
308
|
+
defined,
|
|
309
|
+
interpolator,
|
|
310
|
+
generator: overLine,
|
|
311
|
+
xScale,
|
|
312
|
+
yScale,
|
|
313
|
+
simpleLine: true
|
|
314
|
+
});
|
|
315
|
+
// let baseStyle = props.lineStyle ? props.lineStyle(diffdata, 0) : {}
|
|
316
|
+
const diffOverlayA = (React.createElement("path", { key: "xyline-diff-a", className: `${doClassname} difference-overlay-a`, d: overLine(diffdataA), style: { fill: "none", pointerEvents: "none" } }));
|
|
317
|
+
mappedLines.push(diffOverlayA);
|
|
318
|
+
const diffOverlayB = (React.createElement("path", { key: "xyline-diff-b", className: `${doClassname} difference-overlay-b`, d: overLine(diffdataB), style: { fill: "none", pointerEvents: "none" } }));
|
|
319
|
+
mappedLines.push(diffOverlayB);
|
|
320
|
+
}
|
|
321
|
+
return mappedLines;
|
|
322
|
+
}
|
|
323
|
+
function createSummaries({ xScale, yScale, canvasDrawing, data, canvasRender, styleFn, classFn, renderKeyFn, renderMode, customMark }) {
|
|
324
|
+
const summaryClass = classFn || (() => "");
|
|
325
|
+
const summaryStyle = styleFn || (() => ({}));
|
|
326
|
+
const renderFn = renderMode;
|
|
327
|
+
if (!Array.isArray(data)) {
|
|
328
|
+
data = [data];
|
|
329
|
+
}
|
|
330
|
+
const renderedSummaries = [];
|
|
331
|
+
data.forEach((d, i) => {
|
|
332
|
+
let className = "xyframe-summary";
|
|
333
|
+
if (summaryClass) {
|
|
334
|
+
className = `xyframe-summary ${summaryClass(d)}`;
|
|
335
|
+
}
|
|
336
|
+
let drawD = "";
|
|
337
|
+
let shouldBeValid = false;
|
|
338
|
+
if (typeof d.customMark === "string" ||
|
|
339
|
+
React.isValidElement(d.customMark)) {
|
|
340
|
+
drawD = d.customMark;
|
|
341
|
+
shouldBeValid = true;
|
|
342
|
+
}
|
|
343
|
+
else if (d.type === "MultiPolygon") {
|
|
344
|
+
const polycoords = d.coordinates;
|
|
345
|
+
polycoords.forEach((coord) => {
|
|
346
|
+
coord.forEach((c) => {
|
|
347
|
+
drawD += `M${c
|
|
348
|
+
.map((p) => `${xScale(p[0])},${yScale(p[1])}`)
|
|
349
|
+
.join("L")}Z `;
|
|
350
|
+
});
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
else if (customMark) {
|
|
354
|
+
const xyfCoords = d._xyfCoordinates;
|
|
355
|
+
const projectedCoordinates = xyfCoords.map((p) => [
|
|
356
|
+
xScale(p[0]),
|
|
357
|
+
yScale(p[1])
|
|
358
|
+
]);
|
|
359
|
+
// CUSTOM MARK IMPLEMENTATION
|
|
360
|
+
drawD = customMark({
|
|
361
|
+
d,
|
|
362
|
+
i,
|
|
363
|
+
classFn: summaryClass,
|
|
364
|
+
styleFn: summaryStyle,
|
|
365
|
+
renderFn,
|
|
366
|
+
projectedCoordinates,
|
|
367
|
+
xScale,
|
|
368
|
+
yScale,
|
|
369
|
+
bounds: (0, areaDrawing_1.shapeBounds)(projectedCoordinates)
|
|
370
|
+
});
|
|
371
|
+
shouldBeValid = true;
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
const xyfCoords = d._xyfCoordinates;
|
|
375
|
+
if (d.curve) {
|
|
376
|
+
const lineDrawing = (0, d3_shape_1.line)()
|
|
377
|
+
.x((d) => xScale(d[0]))
|
|
378
|
+
.y((d) => yScale(d[1]))
|
|
379
|
+
.curve(d.curve);
|
|
380
|
+
drawD = lineDrawing(xyfCoords);
|
|
381
|
+
}
|
|
382
|
+
else {
|
|
383
|
+
drawD = `M${xyfCoords
|
|
384
|
+
.map((p) => `${xScale(p[0])},${yScale(p[1])}`)
|
|
385
|
+
.join("L")}Z`;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
const renderKey = renderKeyFn ? renderKeyFn(d, i) : `summary-${i}`;
|
|
389
|
+
if (shouldBeValid && React.isValidElement(drawD)) {
|
|
390
|
+
renderedSummaries.push(drawD);
|
|
391
|
+
}
|
|
392
|
+
else if (canvasRender && canvasRender(d, i) === true) {
|
|
393
|
+
const canvasSummary = {
|
|
394
|
+
type: "summary",
|
|
395
|
+
baseClass: "xyframe-summary",
|
|
396
|
+
tx: 0,
|
|
397
|
+
ty: 0,
|
|
398
|
+
d,
|
|
399
|
+
i,
|
|
400
|
+
markProps: { markType: "path", d: drawD },
|
|
401
|
+
styleFn: summaryStyle,
|
|
402
|
+
renderFn,
|
|
403
|
+
classFn: () => className
|
|
404
|
+
};
|
|
405
|
+
canvasDrawing.push(canvasSummary);
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
renderedSummaries.push(React.createElement("path", { "data-testid": "xyframe-summary", key: renderKey, className: className, d: drawD, style: summaryStyle(d, i) }));
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
return renderedSummaries;
|
|
412
|
+
}
|
|
413
|
+
function clonedAppliedElement({ tx, ty, d, i, markProps, styleFn, classFn, renderKeyFn, baseClass, yi }) {
|
|
414
|
+
markProps.style = styleFn ? styleFn(d, i, yi) : {};
|
|
415
|
+
markProps.className = baseClass;
|
|
416
|
+
markProps.key = renderKeyFn
|
|
417
|
+
? renderKeyFn(d, i, yi)
|
|
418
|
+
: `${baseClass}-${d.key === undefined ? i : d.key}`;
|
|
419
|
+
if (tx || ty) {
|
|
420
|
+
markProps.transform = `translate(${tx || 0},${ty || 0})`;
|
|
421
|
+
}
|
|
422
|
+
if (classFn) {
|
|
423
|
+
markProps.className = `${baseClass} ${classFn(d, i, yi)}`;
|
|
424
|
+
}
|
|
425
|
+
if (markProps.style.r) {
|
|
426
|
+
markProps.r = markProps.style.r;
|
|
427
|
+
}
|
|
428
|
+
markProps["data-testid"] = baseClass;
|
|
429
|
+
if (!markProps.markType) {
|
|
430
|
+
const RenderableMark = markProps;
|
|
431
|
+
return React.createElement(RenderableMark);
|
|
432
|
+
}
|
|
433
|
+
const { markType, ...restProps } = markProps;
|
|
434
|
+
return React.createElement(markType, restProps);
|
|
435
|
+
}
|