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,473 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calculateDataExtent = void 0;
|
|
4
|
+
exports.stringToFn = stringToFn;
|
|
5
|
+
exports.stringToArrayFn = stringToArrayFn;
|
|
6
|
+
const lineDrawing_1 = require("../svg/lineDrawing");
|
|
7
|
+
const coordinateNames_1 = require("../constants/coordinateNames");
|
|
8
|
+
const lineDrawing_2 = require("../svg/lineDrawing");
|
|
9
|
+
const areaDrawing_1 = require("../svg/areaDrawing");
|
|
10
|
+
const unflowedFunctions_1 = require("./unflowedFunctions");
|
|
11
|
+
const baseDefinedFunction = () => true;
|
|
12
|
+
const whichPointsHashY = {
|
|
13
|
+
top: coordinateNames_1.projectedYTop,
|
|
14
|
+
bottom: coordinateNames_1.projectedYBottom,
|
|
15
|
+
orphan: coordinateNames_1.projectedY
|
|
16
|
+
};
|
|
17
|
+
const whichPointsHashX = {
|
|
18
|
+
top: coordinateNames_1.projectedXTop,
|
|
19
|
+
bottom: coordinateNames_1.projectedXBottom,
|
|
20
|
+
orphan: coordinateNames_1.projectedX
|
|
21
|
+
};
|
|
22
|
+
const builtInTransformations = {
|
|
23
|
+
stackedarea: lineDrawing_2.stackedArea,
|
|
24
|
+
"stackedarea-invert": lineDrawing_2.stackedArea,
|
|
25
|
+
stackedpercent: lineDrawing_2.stackedArea,
|
|
26
|
+
"stackedpercent-invert": lineDrawing_2.stackedArea,
|
|
27
|
+
linepercent: lineDrawing_2.stackedArea,
|
|
28
|
+
difference: lineDrawing_2.differenceLine,
|
|
29
|
+
bumparea: lineDrawing_2.bumpChart,
|
|
30
|
+
bumpline: lineDrawing_2.bumpChart,
|
|
31
|
+
"bumparea-invert": lineDrawing_2.bumpChart,
|
|
32
|
+
line: lineDrawing_2.lineChart,
|
|
33
|
+
area: lineDrawing_2.lineChart,
|
|
34
|
+
cumulative: lineDrawing_2.cumulativeLine,
|
|
35
|
+
"cumulative-reverse": lineDrawing_2.cumulativeLine
|
|
36
|
+
};
|
|
37
|
+
function stringToFn(accessor, defaultAccessor, raw) {
|
|
38
|
+
if (!accessor && defaultAccessor) {
|
|
39
|
+
return defaultAccessor;
|
|
40
|
+
}
|
|
41
|
+
else if (typeof accessor === "object") {
|
|
42
|
+
return () => accessor;
|
|
43
|
+
}
|
|
44
|
+
else if (accessor instanceof Function) {
|
|
45
|
+
return accessor;
|
|
46
|
+
}
|
|
47
|
+
else if (raw === true) {
|
|
48
|
+
const castAccessor = accessor;
|
|
49
|
+
return () => castAccessor;
|
|
50
|
+
}
|
|
51
|
+
else if (typeof accessor === "string") {
|
|
52
|
+
return (d) => (d ? d[accessor] : undefined);
|
|
53
|
+
}
|
|
54
|
+
return () => undefined;
|
|
55
|
+
}
|
|
56
|
+
function stringToArrayFn(accessor, defaultAccessor, raw) {
|
|
57
|
+
if (accessor === undefined) {
|
|
58
|
+
return [stringToFn(undefined, defaultAccessor, raw)];
|
|
59
|
+
}
|
|
60
|
+
let arrayOfAccessors = [];
|
|
61
|
+
if (Array.isArray(accessor)) {
|
|
62
|
+
arrayOfAccessors = accessor;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
arrayOfAccessors = [accessor];
|
|
66
|
+
}
|
|
67
|
+
return arrayOfAccessors.map((a) => stringToFn(a, defaultAccessor, raw));
|
|
68
|
+
}
|
|
69
|
+
function rebuildFullDatasetWithSummaries(fullDataset, projectedSummaries) {
|
|
70
|
+
const rebuilt = [];
|
|
71
|
+
for (const d of projectedSummaries) {
|
|
72
|
+
rebuilt.push({ ...d });
|
|
73
|
+
}
|
|
74
|
+
for (const d of fullDataset) {
|
|
75
|
+
if (!d.parentSummary) {
|
|
76
|
+
rebuilt.push(d);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return rebuilt;
|
|
80
|
+
}
|
|
81
|
+
const calculateDataExtent = ({ lineDataAccessor, xAccessor, yAccessor, summaries, points, lines, lineType, showLinePoints, showSummaryPoints, xExtent, yExtent, invertX, invertY, summaryDataAccessor, summaryType, adjustedSize: size, margin, summaryStyleFn, summaryClassFn, summaryRenderModeFn, chartSize, filterRenderedLines, filterRenderedSummaries, filterRenderedPoints, defined = baseDefinedFunction, annotations = [] }) => {
|
|
82
|
+
let fullDataset = [];
|
|
83
|
+
let initialProjectedLines = [];
|
|
84
|
+
let projectedPoints = [], projectedLines = [], projectedSummaries = [];
|
|
85
|
+
if (points) {
|
|
86
|
+
xAccessor.forEach((actualXAccessor, xIndex) => {
|
|
87
|
+
yAccessor.forEach((actualYAccessor, yIndex) => {
|
|
88
|
+
let i = 0;
|
|
89
|
+
for (const d of points) {
|
|
90
|
+
const x = actualXAccessor(d, i);
|
|
91
|
+
const y = actualYAccessor(d, i);
|
|
92
|
+
const projectedPoint = { x, y, data: d, xIndex, yIndex };
|
|
93
|
+
if (Array.isArray(y)) {
|
|
94
|
+
projectedPoint[coordinateNames_1.projectedYBottom] = Math.min(...y);
|
|
95
|
+
projectedPoint[coordinateNames_1.projectedYTop] = Math.max(...y);
|
|
96
|
+
projectedPoint[coordinateNames_1.projectedYMiddle] =
|
|
97
|
+
(projectedPoint[coordinateNames_1.projectedYBottom] +
|
|
98
|
+
projectedPoint[coordinateNames_1.projectedYTop]) /
|
|
99
|
+
2;
|
|
100
|
+
}
|
|
101
|
+
if (Array.isArray(x)) {
|
|
102
|
+
projectedPoint[coordinateNames_1.projectedXBottom] = Math.min(...x);
|
|
103
|
+
projectedPoint[coordinateNames_1.projectedXTop] = Math.max(...x);
|
|
104
|
+
projectedPoint[coordinateNames_1.projectedXMiddle] =
|
|
105
|
+
(projectedPoint[coordinateNames_1.projectedXBottom] +
|
|
106
|
+
projectedPoint[coordinateNames_1.projectedXTop]) /
|
|
107
|
+
2;
|
|
108
|
+
}
|
|
109
|
+
projectedPoints.push(projectedPoint);
|
|
110
|
+
i++;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
for (const d of projectedPoints) {
|
|
115
|
+
fullDataset.push({
|
|
116
|
+
...d,
|
|
117
|
+
[coordinateNames_1.projectedX]: d[coordinateNames_1.projectedXTop] || d[coordinateNames_1.projectedXBottom] || d.x,
|
|
118
|
+
[coordinateNames_1.projectedY]: d[coordinateNames_1.projectedYTop] || d[coordinateNames_1.projectedYBottom] || d.y
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (lines) {
|
|
123
|
+
initialProjectedLines = (0, lineDrawing_1.projectLineData)({
|
|
124
|
+
data: lines,
|
|
125
|
+
lineDataAccessor,
|
|
126
|
+
xProp: coordinateNames_1.projectedX,
|
|
127
|
+
xPropTop: coordinateNames_1.projectedXTop,
|
|
128
|
+
xPropBottom: coordinateNames_1.projectedXBottom,
|
|
129
|
+
yProp: coordinateNames_1.projectedY,
|
|
130
|
+
yPropTop: coordinateNames_1.projectedYTop,
|
|
131
|
+
yPropBottom: coordinateNames_1.projectedYBottom,
|
|
132
|
+
xAccessor,
|
|
133
|
+
yAccessor
|
|
134
|
+
});
|
|
135
|
+
const optionsObject = {
|
|
136
|
+
xProp: coordinateNames_1.projectedX,
|
|
137
|
+
yProp: coordinateNames_1.projectedY,
|
|
138
|
+
yPropMiddle: coordinateNames_1.projectedYMiddle,
|
|
139
|
+
yPropTop: coordinateNames_1.projectedYTop,
|
|
140
|
+
yPropBottom: coordinateNames_1.projectedYBottom,
|
|
141
|
+
xPropMiddle: coordinateNames_1.projectedXMiddle,
|
|
142
|
+
xPropTop: coordinateNames_1.projectedXTop,
|
|
143
|
+
xPropBottom: coordinateNames_1.projectedXBottom
|
|
144
|
+
};
|
|
145
|
+
projectedLines = lineTransformation(lineType, optionsObject)(initialProjectedLines);
|
|
146
|
+
for (const d of projectedLines) {
|
|
147
|
+
for (let q = 0; q < d.data.length; q++) {
|
|
148
|
+
const p = d.data[q];
|
|
149
|
+
if (!defined(Object.assign({}, p.data, p), q))
|
|
150
|
+
continue;
|
|
151
|
+
const mappedP = {
|
|
152
|
+
parentLine: d,
|
|
153
|
+
y: p.y,
|
|
154
|
+
x: p.x,
|
|
155
|
+
xTop: p.xTop,
|
|
156
|
+
xMiddle: p.xMiddle,
|
|
157
|
+
xBottom: p.xBottom,
|
|
158
|
+
yTop: p.yTop,
|
|
159
|
+
yMiddle: p.yMiddle,
|
|
160
|
+
yBottom: p.yBottom,
|
|
161
|
+
data: p.data
|
|
162
|
+
};
|
|
163
|
+
if (p.percent) {
|
|
164
|
+
mappedP.percent = p.percent;
|
|
165
|
+
}
|
|
166
|
+
fullDataset.push(mappedP);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (showLinePoints) {
|
|
170
|
+
const whichPointsX = showLinePoints === true
|
|
171
|
+
? coordinateNames_1.projectedXMiddle
|
|
172
|
+
: whichPointsHashX[showLinePoints];
|
|
173
|
+
const whichPointsY = showLinePoints === true
|
|
174
|
+
? coordinateNames_1.projectedYMiddle
|
|
175
|
+
: whichPointsHashY[showLinePoints];
|
|
176
|
+
projectedLines.forEach((d) => {
|
|
177
|
+
d.data
|
|
178
|
+
.filter((p, q) => {
|
|
179
|
+
const isDefined = defined(Object.assign({}, p.data, p));
|
|
180
|
+
if (isDefined) {
|
|
181
|
+
if (showLinePoints === "orphan") {
|
|
182
|
+
const prePoint = d.data[q - 1];
|
|
183
|
+
const postPoint = d.data[q + 1];
|
|
184
|
+
if ((!prePoint ||
|
|
185
|
+
!defined(Object.assign({}, prePoint.data, prePoint))) &&
|
|
186
|
+
(!postPoint ||
|
|
187
|
+
!defined(Object.assign({}, postPoint.data, postPoint)))) {
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
return true;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
})
|
|
202
|
+
.forEach((p) => {
|
|
203
|
+
projectedPoints.push({
|
|
204
|
+
...p,
|
|
205
|
+
parentLine: d,
|
|
206
|
+
[coordinateNames_1.projectedY]: p[whichPointsY] !== undefined
|
|
207
|
+
? p[whichPointsY]
|
|
208
|
+
: p[coordinateNames_1.projectedYMiddle] !== undefined
|
|
209
|
+
? p[coordinateNames_1.projectedYMiddle]
|
|
210
|
+
: p[coordinateNames_1.projectedYBottom] !== undefined
|
|
211
|
+
? p[coordinateNames_1.projectedYBottom]
|
|
212
|
+
: p.y,
|
|
213
|
+
[coordinateNames_1.projectedX]: p[whichPointsX] !== undefined
|
|
214
|
+
? p[whichPointsX]
|
|
215
|
+
: p[coordinateNames_1.projectedXMiddle] !== undefined
|
|
216
|
+
? p[coordinateNames_1.projectedXMiddle]
|
|
217
|
+
: p[coordinateNames_1.projectedXBottom] !== undefined
|
|
218
|
+
? p[coordinateNames_1.projectedXBottom]
|
|
219
|
+
: p.y
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
if (summaries) {
|
|
226
|
+
projectedSummaries = (0, lineDrawing_1.projectSummaryData)({
|
|
227
|
+
data: summaries,
|
|
228
|
+
summaryDataAccessor,
|
|
229
|
+
xAccessor,
|
|
230
|
+
yAccessor
|
|
231
|
+
});
|
|
232
|
+
projectedSummaries.forEach((d) => {
|
|
233
|
+
const baseData = d._baseData;
|
|
234
|
+
if (d._xyfCoordinates.length > 0 && d._xyfCoordinates[0][0][0]) {
|
|
235
|
+
d._xyfCoordinates[0].forEach((multi) => {
|
|
236
|
+
if (Array.isArray(multi)) {
|
|
237
|
+
multi
|
|
238
|
+
.map((p, q) => Object.assign({ parentSummary: d }, baseData[q], {
|
|
239
|
+
[coordinateNames_1.projectedX]: p[0],
|
|
240
|
+
[coordinateNames_1.projectedY]: p[1]
|
|
241
|
+
}))
|
|
242
|
+
.forEach((e) => {
|
|
243
|
+
if (showSummaryPoints) {
|
|
244
|
+
projectedPoints.push({
|
|
245
|
+
x: 0,
|
|
246
|
+
...e,
|
|
247
|
+
[coordinateNames_1.projectedY]: e[coordinateNames_1.projectedYTop] || e[coordinateNames_1.projectedYBottom] || e[coordinateNames_1.projectedY]
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
fullDataset.push({ x: 0, y: 0, ...e });
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
else if (d._xyfCoordinates.length > 0) {
|
|
256
|
+
if (Array.isArray(d._xyfCoordinates)) {
|
|
257
|
+
const coordArray = d._xyfCoordinates;
|
|
258
|
+
coordArray
|
|
259
|
+
.map((p, q) => ({
|
|
260
|
+
parentSummary: d,
|
|
261
|
+
...baseData[q],
|
|
262
|
+
[coordinateNames_1.projectedX]: p[0],
|
|
263
|
+
[coordinateNames_1.projectedY]: p[1]
|
|
264
|
+
}))
|
|
265
|
+
.forEach((e) => {
|
|
266
|
+
if (showSummaryPoints) {
|
|
267
|
+
projectedPoints.push({
|
|
268
|
+
x: 0,
|
|
269
|
+
...e,
|
|
270
|
+
[coordinateNames_1.projectedY]: e[coordinateNames_1.projectedYTop] || e[coordinateNames_1.projectedYBottom] || e[coordinateNames_1.projectedY]
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
fullDataset.push({ x: 0, y: 0, ...e });
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
let suitableXAnnotations = [];
|
|
280
|
+
let suitableYAnnotations = [];
|
|
281
|
+
if (xExtent &&
|
|
282
|
+
!Array.isArray(xExtent) &&
|
|
283
|
+
xExtent.includeAnnotations === true) {
|
|
284
|
+
xAccessor.forEach((actualXAccessor) => {
|
|
285
|
+
annotations.forEach((annotation, annotationIndex) => {
|
|
286
|
+
const x = actualXAccessor(annotation, annotationIndex);
|
|
287
|
+
if (isFinite(x)) {
|
|
288
|
+
suitableXAnnotations.push({
|
|
289
|
+
[coordinateNames_1.projectedX]: x
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
if (yExtent &&
|
|
296
|
+
!Array.isArray(yExtent) &&
|
|
297
|
+
yExtent.includeAnnotations === true) {
|
|
298
|
+
yAccessor.forEach((actualYAccessor) => {
|
|
299
|
+
annotations.forEach((annotation, annotationIndex) => {
|
|
300
|
+
const y = actualYAccessor(annotation, annotationIndex);
|
|
301
|
+
if (isFinite(y)) {
|
|
302
|
+
suitableYAnnotations.push({
|
|
303
|
+
[coordinateNames_1.projectedY]: y
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
// Single-pass extent calculation over fullDataset + annotations
|
|
310
|
+
let xMinVal;
|
|
311
|
+
let xMaxVal;
|
|
312
|
+
let yMinVal;
|
|
313
|
+
let yMaxVal;
|
|
314
|
+
for (const d of fullDataset) {
|
|
315
|
+
const xLo = d[coordinateNames_1.projectedXBottom] === undefined
|
|
316
|
+
? d[coordinateNames_1.projectedX]
|
|
317
|
+
: Math.min(d[coordinateNames_1.projectedXTop], d[coordinateNames_1.projectedXBottom]);
|
|
318
|
+
const xHi = d[coordinateNames_1.projectedXTop] === undefined
|
|
319
|
+
? d[coordinateNames_1.projectedX]
|
|
320
|
+
: Math.max(d[coordinateNames_1.projectedXBottom], d[coordinateNames_1.projectedXTop]);
|
|
321
|
+
const yLo = d[coordinateNames_1.projectedYBottom] === undefined
|
|
322
|
+
? d[coordinateNames_1.projectedY]
|
|
323
|
+
: Math.min(d[coordinateNames_1.projectedYTop], d[coordinateNames_1.projectedYBottom]);
|
|
324
|
+
const yHi = d[coordinateNames_1.projectedYTop] === undefined
|
|
325
|
+
? d[coordinateNames_1.projectedY]
|
|
326
|
+
: Math.max(d[coordinateNames_1.projectedYBottom], d[coordinateNames_1.projectedYTop]);
|
|
327
|
+
if (xLo !== undefined && (xMinVal === undefined || xLo < xMinVal))
|
|
328
|
+
xMinVal = xLo;
|
|
329
|
+
if (xHi !== undefined && (xMaxVal === undefined || xHi > xMaxVal))
|
|
330
|
+
xMaxVal = xHi;
|
|
331
|
+
if (yLo !== undefined && (yMinVal === undefined || yLo < yMinVal))
|
|
332
|
+
yMinVal = yLo;
|
|
333
|
+
if (yHi !== undefined && (yMaxVal === undefined || yHi > yMaxVal))
|
|
334
|
+
yMaxVal = yHi;
|
|
335
|
+
}
|
|
336
|
+
for (const d of suitableXAnnotations) {
|
|
337
|
+
const v = d[coordinateNames_1.projectedX];
|
|
338
|
+
if (v !== undefined && (xMinVal === undefined || v < xMinVal))
|
|
339
|
+
xMinVal = v;
|
|
340
|
+
if (v !== undefined && (xMaxVal === undefined || v > xMaxVal))
|
|
341
|
+
xMaxVal = v;
|
|
342
|
+
}
|
|
343
|
+
for (const d of suitableYAnnotations) {
|
|
344
|
+
const v = d[coordinateNames_1.projectedY];
|
|
345
|
+
if (v !== undefined && (yMinVal === undefined || v < yMinVal))
|
|
346
|
+
yMinVal = v;
|
|
347
|
+
if (v !== undefined && (yMaxVal === undefined || v > yMaxVal))
|
|
348
|
+
yMaxVal = v;
|
|
349
|
+
}
|
|
350
|
+
const calculatedXExtent = [xMinVal, xMaxVal];
|
|
351
|
+
const calculatedYExtent = [yMinVal, yMaxVal];
|
|
352
|
+
const actualXExtent = (0, unflowedFunctions_1.extentValue)(xExtent);
|
|
353
|
+
const actualYExtent = (0, unflowedFunctions_1.extentValue)(yExtent);
|
|
354
|
+
const xMin = actualXExtent && actualXExtent[0] !== undefined
|
|
355
|
+
? actualXExtent[0]
|
|
356
|
+
: calculatedXExtent[0];
|
|
357
|
+
const xMax = actualXExtent && actualXExtent[1] !== undefined
|
|
358
|
+
? actualXExtent[1]
|
|
359
|
+
: calculatedXExtent[1];
|
|
360
|
+
const yMin = actualYExtent && actualYExtent[0] !== undefined
|
|
361
|
+
? actualYExtent[0]
|
|
362
|
+
: calculatedYExtent[0];
|
|
363
|
+
const yMax = actualYExtent && actualYExtent[1] !== undefined
|
|
364
|
+
? actualYExtent[1]
|
|
365
|
+
: calculatedYExtent[1];
|
|
366
|
+
let finalYExtent = [yMin, yMax];
|
|
367
|
+
let finalXExtent = [xMin, xMax];
|
|
368
|
+
if (invertX && !(actualXExtent && actualXExtent.length === 2)) {
|
|
369
|
+
finalXExtent = [finalXExtent[1], finalXExtent[0]];
|
|
370
|
+
}
|
|
371
|
+
if ((lineType.type === "bumpline" || invertY) &&
|
|
372
|
+
!(actualYExtent && actualYExtent.length === 2)) {
|
|
373
|
+
finalYExtent = [finalYExtent[1], finalYExtent[0]];
|
|
374
|
+
}
|
|
375
|
+
if (summaryType.type && summaryType.type === "contour") {
|
|
376
|
+
projectedSummaries = (0, areaDrawing_1.contouring)({
|
|
377
|
+
summaryType,
|
|
378
|
+
data: projectedSummaries,
|
|
379
|
+
finalXExtent,
|
|
380
|
+
finalYExtent
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
else if (summaryType.type && summaryType.type === "linebounds") {
|
|
384
|
+
projectedSummaries = (0, areaDrawing_1.lineBounding)({
|
|
385
|
+
summaryType,
|
|
386
|
+
data: projectedSummaries,
|
|
387
|
+
defined
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
else if (summaryType.type && summaryType.type === "hexbin") {
|
|
391
|
+
projectedSummaries = (0, areaDrawing_1.hexbinning)({
|
|
392
|
+
summaryType,
|
|
393
|
+
data: projectedSummaries[0],
|
|
394
|
+
processedData: summaries && !!summaries[0].processedData,
|
|
395
|
+
preprocess: false,
|
|
396
|
+
finalXExtent,
|
|
397
|
+
finalYExtent,
|
|
398
|
+
size,
|
|
399
|
+
margin,
|
|
400
|
+
styleFn: summaryStyleFn,
|
|
401
|
+
classFn: summaryClassFn,
|
|
402
|
+
renderFn: summaryRenderModeFn,
|
|
403
|
+
chartSize
|
|
404
|
+
});
|
|
405
|
+
fullDataset = rebuildFullDatasetWithSummaries(fullDataset, projectedSummaries);
|
|
406
|
+
}
|
|
407
|
+
else if (summaryType.type && summaryType.type === "heatmap") {
|
|
408
|
+
projectedSummaries = (0, areaDrawing_1.heatmapping)({
|
|
409
|
+
summaryType,
|
|
410
|
+
data: projectedSummaries[0],
|
|
411
|
+
processedData: summaries && !!summaries[0].processedData,
|
|
412
|
+
preprocess: false,
|
|
413
|
+
finalXExtent,
|
|
414
|
+
finalYExtent,
|
|
415
|
+
size,
|
|
416
|
+
margin,
|
|
417
|
+
styleFn: summaryStyleFn,
|
|
418
|
+
classFn: summaryClassFn,
|
|
419
|
+
renderFn: summaryRenderModeFn,
|
|
420
|
+
chartSize
|
|
421
|
+
});
|
|
422
|
+
fullDataset = rebuildFullDatasetWithSummaries(fullDataset, projectedSummaries);
|
|
423
|
+
}
|
|
424
|
+
else if (summaryType.type && summaryType.type === "trendline") {
|
|
425
|
+
projectedSummaries = (0, areaDrawing_1.trendlining)({
|
|
426
|
+
summaryType,
|
|
427
|
+
data: projectedSummaries[0],
|
|
428
|
+
preprocess: summaries && !!summaries[0].processedData,
|
|
429
|
+
finalXExtent
|
|
430
|
+
});
|
|
431
|
+
fullDataset = rebuildFullDatasetWithSummaries(fullDataset, projectedSummaries);
|
|
432
|
+
}
|
|
433
|
+
if (filterRenderedLines) {
|
|
434
|
+
projectedLines = projectedLines.filter(filterRenderedLines);
|
|
435
|
+
fullDataset = fullDataset.filter((d, i) => {
|
|
436
|
+
return !d.parentLine || filterRenderedLines(d.parentLine, i, []);
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
if (filterRenderedPoints) {
|
|
440
|
+
fullDataset = fullDataset.filter(filterRenderedPoints);
|
|
441
|
+
}
|
|
442
|
+
if (filterRenderedSummaries) {
|
|
443
|
+
projectedSummaries = projectedSummaries.filter(filterRenderedSummaries);
|
|
444
|
+
fullDataset = fullDataset.filter((d, i) => {
|
|
445
|
+
return !d.parentSummary || filterRenderedSummaries(d.parentSummary, i, []);
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
return {
|
|
449
|
+
xExtent: finalXExtent,
|
|
450
|
+
yExtent: finalYExtent,
|
|
451
|
+
projectedLines,
|
|
452
|
+
projectedPoints,
|
|
453
|
+
projectedSummaries,
|
|
454
|
+
fullDataset,
|
|
455
|
+
calculatedXExtent,
|
|
456
|
+
calculatedYExtent
|
|
457
|
+
};
|
|
458
|
+
};
|
|
459
|
+
exports.calculateDataExtent = calculateDataExtent;
|
|
460
|
+
const differenceCatch = (olineType, data) => {
|
|
461
|
+
if (!builtInTransformations[olineType] ||
|
|
462
|
+
(olineType === "difference" && data.length !== 2)) {
|
|
463
|
+
return "line";
|
|
464
|
+
}
|
|
465
|
+
return olineType;
|
|
466
|
+
};
|
|
467
|
+
function lineTransformation(lineType, options) {
|
|
468
|
+
return (data) => builtInTransformations[differenceCatch(lineType.type, data)]({
|
|
469
|
+
...lineType,
|
|
470
|
+
...options,
|
|
471
|
+
data
|
|
472
|
+
});
|
|
473
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findFirstAccessorValue = void 0;
|
|
4
|
+
const findFirstAccessorValue = (accessorArray, data) => {
|
|
5
|
+
for (let i = 0; i < accessorArray.length; i++) {
|
|
6
|
+
const valueCheck = accessorArray[i](data);
|
|
7
|
+
if (valueCheck !== undefined &&
|
|
8
|
+
!Number.isNaN(valueCheck) &&
|
|
9
|
+
valueCheck !== null)
|
|
10
|
+
return valueCheck;
|
|
11
|
+
}
|
|
12
|
+
return undefined;
|
|
13
|
+
};
|
|
14
|
+
exports.findFirstAccessorValue = findFirstAccessorValue;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createNetworkPipelineCache = createNetworkPipelineCache;
|
|
7
|
+
const memoize_one_1 = __importDefault(require("memoize-one"));
|
|
8
|
+
const frameFunctions_1 = require("../svg/frameFunctions");
|
|
9
|
+
const dataFunctions_1 = require("./dataFunctions");
|
|
10
|
+
const functions_1 = require("../generic_utilities/functions");
|
|
11
|
+
function createNetworkPipelineCache() {
|
|
12
|
+
return {
|
|
13
|
+
marginCalc: (0, memoize_one_1.default)((margin, title, size) => {
|
|
14
|
+
const calculatedMargin = (0, frameFunctions_1.calculateMargin)({ margin, title, size });
|
|
15
|
+
const { adjustedPosition, adjustedSize } = (0, frameFunctions_1.adjustedPositionSize)({
|
|
16
|
+
size,
|
|
17
|
+
margin: calculatedMargin
|
|
18
|
+
});
|
|
19
|
+
return { margin: calculatedMargin, adjustedPosition, adjustedSize };
|
|
20
|
+
}),
|
|
21
|
+
accessorConversions: (0, memoize_one_1.default)((nodeIDAccessor, sourceAccessor, targetAccessor, nodeSizeAccessor, edgeWidthAccessor) => ({
|
|
22
|
+
nodeIDAccessor: (0, dataFunctions_1.stringToFn)(nodeIDAccessor, (d) => d ? d.id : undefined),
|
|
23
|
+
sourceAccessor: (0, dataFunctions_1.stringToFn)(sourceAccessor, (d) => d.source),
|
|
24
|
+
targetAccessor: (0, dataFunctions_1.stringToFn)(targetAccessor, (d) => d.target),
|
|
25
|
+
nodeSizeAccessor: typeof nodeSizeAccessor === "number"
|
|
26
|
+
? (0, functions_1.genericFunction)(nodeSizeAccessor)
|
|
27
|
+
: (0, dataFunctions_1.stringToFn)(nodeSizeAccessor, (0, functions_1.genericFunction)(5)),
|
|
28
|
+
edgeWidthAccessor: (0, dataFunctions_1.stringToFn)(edgeWidthAccessor, (d) => d.weight || 1),
|
|
29
|
+
})),
|
|
30
|
+
nodeStyleFns: (0, memoize_one_1.default)((nodeStyle, nodeClass, nodeRenderMode, canvasNodes) => ({
|
|
31
|
+
nodeStyleFn: (0, dataFunctions_1.stringToFn)(nodeStyle, () => ({}), true),
|
|
32
|
+
nodeClassFn: (0, dataFunctions_1.stringToFn)(nodeClass, () => "", true),
|
|
33
|
+
nodeRenderModeFn: (0, dataFunctions_1.stringToFn)(nodeRenderMode, undefined, true),
|
|
34
|
+
nodeCanvasRenderFn: canvasNodes ? (0, dataFunctions_1.stringToFn)(canvasNodes, undefined, true) : undefined,
|
|
35
|
+
})),
|
|
36
|
+
edgeStyleFns: (0, memoize_one_1.default)((edgeStyle, edgeClass, edgeRenderMode, canvasEdges) => ({
|
|
37
|
+
edgeStyleFn: (0, dataFunctions_1.stringToFn)(edgeStyle, () => ({}), true),
|
|
38
|
+
edgeClassFn: (0, dataFunctions_1.stringToFn)(edgeClass, () => "", true),
|
|
39
|
+
edgeRenderModeFn: (0, dataFunctions_1.stringToFn)(edgeRenderMode, undefined, true),
|
|
40
|
+
edgeCanvasRenderFn: canvasEdges ? (0, dataFunctions_1.stringToFn)(canvasEdges, undefined, true) : undefined,
|
|
41
|
+
})),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createOrdinalPipelineCache = createOrdinalPipelineCache;
|
|
7
|
+
const memoize_one_1 = __importDefault(require("memoize-one"));
|
|
8
|
+
const frameFunctions_1 = require("../svg/frameFunctions");
|
|
9
|
+
const dataFunctions_1 = require("./dataFunctions");
|
|
10
|
+
function createOrdinalPipelineCache() {
|
|
11
|
+
return {
|
|
12
|
+
marginCalc: (0, memoize_one_1.default)((margin, axes, title, oLabel, projection, size) => {
|
|
13
|
+
const calculatedMargin = (0, frameFunctions_1.calculateMargin)({ margin, axes, title, oLabel, projection, size });
|
|
14
|
+
const { adjustedPosition, adjustedSize } = (0, frameFunctions_1.adjustedPositionSize)({
|
|
15
|
+
size,
|
|
16
|
+
margin: calculatedMargin,
|
|
17
|
+
projection
|
|
18
|
+
});
|
|
19
|
+
return { margin: calculatedMargin, adjustedPosition, adjustedSize };
|
|
20
|
+
}),
|
|
21
|
+
structureData: (0, memoize_one_1.default)((data, renderKey, oAccessor, rAccessor, originalRAccessor, originalOAccessor, multiAxis) => {
|
|
22
|
+
return (0, frameFunctions_1.keyAndObjectifyBarData)({
|
|
23
|
+
data,
|
|
24
|
+
renderKey,
|
|
25
|
+
oAccessor,
|
|
26
|
+
rAccessor,
|
|
27
|
+
originalRAccessor,
|
|
28
|
+
originalOAccessor,
|
|
29
|
+
multiAxis
|
|
30
|
+
});
|
|
31
|
+
}),
|
|
32
|
+
accessorConversions: (0, memoize_one_1.default)((baseOAccessor, baseRAccessor, baseRenderKey, basePieceIDAccessor) => ({
|
|
33
|
+
oAccessor: (0, dataFunctions_1.stringToArrayFn)(baseOAccessor, (d) => d.renderKey),
|
|
34
|
+
rAccessor: (0, dataFunctions_1.stringToArrayFn)(baseRAccessor, (d) => d.value || 1),
|
|
35
|
+
renderKey: (0, dataFunctions_1.stringToFn)(baseRenderKey, (d, i) => i),
|
|
36
|
+
pieceIDAccessor: (0, dataFunctions_1.stringToFn)(basePieceIDAccessor, () => ""),
|
|
37
|
+
})),
|
|
38
|
+
styleFns: (0, memoize_one_1.default)((baseConnectorStyle, baseSummaryStyle, baseStyle, basePieceClass, baseSummaryClass, baseConnectorClass, baseRenderMode, baseSummaryRenderMode, baseConnectorRenderMode, canvasPieces, canvasSummaries, canvasConnectors) => ({
|
|
39
|
+
connectorStyle: (0, dataFunctions_1.stringToFn)(baseConnectorStyle, () => ({}), true),
|
|
40
|
+
summaryStyle: (0, dataFunctions_1.stringToFn)(baseSummaryStyle, () => ({}), true),
|
|
41
|
+
pieceStyle: (0, dataFunctions_1.stringToFn)(baseStyle, () => ({}), true),
|
|
42
|
+
pieceClass: (0, dataFunctions_1.stringToFn)(basePieceClass, () => "", true),
|
|
43
|
+
summaryClass: (0, dataFunctions_1.stringToFn)(baseSummaryClass, () => "", true),
|
|
44
|
+
connectorClass: (0, dataFunctions_1.stringToFn)(baseConnectorClass, () => "", true),
|
|
45
|
+
pieceRenderMode: (0, dataFunctions_1.stringToFn)(baseRenderMode, undefined, true),
|
|
46
|
+
summaryRenderMode: (0, dataFunctions_1.stringToFn)(baseSummaryRenderMode, undefined, true),
|
|
47
|
+
connectorRenderMode: (0, dataFunctions_1.stringToFn)(baseConnectorRenderMode, undefined, true),
|
|
48
|
+
pieceCanvasRender: (0, dataFunctions_1.stringToFn)(canvasPieces, undefined, true),
|
|
49
|
+
summaryCanvasRender: (0, dataFunctions_1.stringToFn)(canvasSummaries, undefined, true),
|
|
50
|
+
connectorCanvasRender: (0, dataFunctions_1.stringToFn)(canvasConnectors, undefined, true),
|
|
51
|
+
})),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createXYPipelineCache = createXYPipelineCache;
|
|
7
|
+
const memoize_one_1 = __importDefault(require("memoize-one"));
|
|
8
|
+
const frameFunctions_1 = require("../svg/frameFunctions");
|
|
9
|
+
const dataFunctions_1 = require("./dataFunctions");
|
|
10
|
+
const emptyObjectReturnFunction = () => ({});
|
|
11
|
+
const emptyStringReturnFunction = () => "";
|
|
12
|
+
function createXYPipelineCache() {
|
|
13
|
+
return {
|
|
14
|
+
annotatedSettings: (0, memoize_one_1.default)((xAccessor, yAccessor, summaryDataAccessor, lineDataAccessor, renderKey, lineType, summaryType, lineIDAccessor) => ({
|
|
15
|
+
xAccessor: (0, dataFunctions_1.stringToArrayFn)(xAccessor, (d) => d[0]),
|
|
16
|
+
yAccessor: (0, dataFunctions_1.stringToArrayFn)(yAccessor, (d) => d[1]),
|
|
17
|
+
summaryDataAccessor: (0, dataFunctions_1.stringToArrayFn)(summaryDataAccessor, (d) => (Array.isArray(d) ? d : d.coordinates)),
|
|
18
|
+
lineDataAccessor: (0, dataFunctions_1.stringToArrayFn)(lineDataAccessor, (d) => (Array.isArray(d) ? d : d.coordinates)),
|
|
19
|
+
renderKeyFn: (0, dataFunctions_1.stringToFn)(renderKey, (d, i) => `line-${i}`, true),
|
|
20
|
+
lineIDAccessor: (0, dataFunctions_1.stringToFn)(lineIDAccessor, (l) => l.semioticLineID),
|
|
21
|
+
})),
|
|
22
|
+
marginCalc: (0, memoize_one_1.default)((margin, axes, title, size) => {
|
|
23
|
+
const calculatedMargin = (0, frameFunctions_1.calculateMargin)({ margin, axes, title, size });
|
|
24
|
+
const { adjustedPosition, adjustedSize } = (0, frameFunctions_1.adjustedPositionSize)({
|
|
25
|
+
size,
|
|
26
|
+
margin: calculatedMargin
|
|
27
|
+
});
|
|
28
|
+
return { margin: calculatedMargin, adjustedPosition, adjustedSize };
|
|
29
|
+
}),
|
|
30
|
+
summaryStyleFns: (0, memoize_one_1.default)((summaryStyle, summaryClass, summaryRenderMode) => ({
|
|
31
|
+
summaryStyleFn: (0, dataFunctions_1.stringToFn)(summaryStyle, emptyObjectReturnFunction, true),
|
|
32
|
+
summaryClassFn: (0, dataFunctions_1.stringToFn)(summaryClass, emptyStringReturnFunction, true),
|
|
33
|
+
summaryRenderModeFn: (0, dataFunctions_1.stringToFn)(summaryRenderMode, undefined, true),
|
|
34
|
+
})),
|
|
35
|
+
lineStyleFns: (0, memoize_one_1.default)((lineStyle, lineClass, lineRenderMode, canvasLines) => ({
|
|
36
|
+
styleFn: (0, dataFunctions_1.stringToFn)(lineStyle, emptyObjectReturnFunction, true),
|
|
37
|
+
classFn: (0, dataFunctions_1.stringToFn)(lineClass, emptyStringReturnFunction, true),
|
|
38
|
+
renderMode: (0, dataFunctions_1.stringToFn)(lineRenderMode, undefined, true),
|
|
39
|
+
canvasRender: (0, dataFunctions_1.stringToFn)(canvasLines, undefined, true),
|
|
40
|
+
})),
|
|
41
|
+
pointStyleFns: (0, memoize_one_1.default)((pointStyle, pointClass, pointRenderMode, canvasPoints) => ({
|
|
42
|
+
styleFn: (0, dataFunctions_1.stringToFn)(pointStyle, emptyObjectReturnFunction, true),
|
|
43
|
+
classFn: (0, dataFunctions_1.stringToFn)(pointClass, emptyStringReturnFunction, true),
|
|
44
|
+
renderMode: (0, dataFunctions_1.stringToFn)(pointRenderMode, undefined, true),
|
|
45
|
+
canvasRender: (0, dataFunctions_1.stringToFn)(canvasPoints, undefined, true),
|
|
46
|
+
})),
|
|
47
|
+
summaryCanvasRender: (0, memoize_one_1.default)((canvasSummaries) => (0, dataFunctions_1.stringToFn)(canvasSummaries, undefined, true)),
|
|
48
|
+
};
|
|
49
|
+
}
|