semiotic 3.0.0-beta.2 → 3.0.0-beta.4
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 +93 -753
- package/README.md +92 -7
- package/ai/dist/componentRegistry.js +26 -0
- package/ai/dist/{ai/mcp-server.js → mcp-server.js} +1 -1
- package/ai/dist/{ai/renderHOCToSVG.js → renderHOCToSVG.js} +2 -2
- package/dist/ChartContainer.d.ts +60 -0
- package/dist/DetailsPanel.d.ts +37 -0
- package/dist/LinkedCharts.d.ts +2 -0
- package/dist/Tooltip/Tooltip.d.ts +2 -2
- package/dist/charts/index.d.ts +1 -1
- package/dist/charts/ordinal/BarChart.d.ts +1 -0
- package/dist/charts/ordinal/BoxPlot.d.ts +1 -0
- package/dist/charts/ordinal/DonutChart.d.ts +1 -0
- package/dist/charts/ordinal/DotPlot.d.ts +1 -0
- package/dist/charts/ordinal/GroupedBarChart.d.ts +1 -0
- package/dist/charts/ordinal/Histogram.d.ts +1 -0
- package/dist/charts/ordinal/PieChart.d.ts +1 -0
- package/dist/charts/ordinal/RidgelinePlot.d.ts +1 -0
- package/dist/charts/ordinal/StackedBarChart.d.ts +1 -0
- package/dist/charts/ordinal/SwarmPlot.d.ts +1 -0
- package/dist/charts/ordinal/ViolinPlot.d.ts +1 -0
- package/dist/charts/realtime/RealtimeHeatmap.d.ts +11 -0
- package/dist/charts/realtime/RealtimeHistogram.d.ts +15 -1
- package/dist/charts/realtime/RealtimeLineChart.d.ts +6 -0
- package/dist/charts/realtime/RealtimeSwarmChart.d.ts +6 -0
- package/dist/charts/realtime/RealtimeWaterfallChart.d.ts +6 -0
- package/dist/charts/shared/annotationRules.d.ts +3 -0
- package/dist/charts/shared/colorUtils.d.ts +17 -11
- package/dist/charts/shared/hooks.d.ts +96 -1
- package/dist/charts/shared/loess.d.ts +13 -0
- package/dist/charts/shared/networkUtils.d.ts +31 -0
- package/dist/charts/shared/tooltipUtils.d.ts +16 -0
- package/dist/charts/shared/types.d.ts +17 -2
- package/dist/charts/shared/validateChartData.d.ts +2 -3
- package/dist/charts/shared/validateProps.d.ts +18 -0
- package/dist/charts/xy/AreaChart.d.ts +4 -0
- package/dist/charts/xy/BubbleChart.d.ts +6 -0
- package/dist/charts/xy/Heatmap.d.ts +4 -0
- package/dist/charts/xy/LineChart.d.ts +6 -0
- package/dist/charts/xy/Scatterplot.d.ts +4 -0
- package/dist/charts/xy/StackedAreaChart.d.ts +4 -0
- package/dist/data/fromVegaLite.d.ts +48 -0
- package/dist/export/chartConfig.d.ts +29 -0
- package/dist/export/selectionSerializer.d.ts +20 -0
- package/dist/geometry/sankeyLinks.d.ts +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/realtime/types.d.ts +20 -6
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai.d.ts +14 -0
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-data.d.ts +2 -0
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-network.d.ts +9 -19
- package/dist/semiotic-ordinal.d.ts +12 -14
- package/dist/semiotic-xy.d.ts +12 -18
- package/dist/semiotic.d.ts +16 -13
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/store/ObservationStore.d.ts +61 -0
- package/dist/store/SelectionStore.d.ts +9 -1
- package/dist/store/ThemeStore.d.ts +6 -1
- package/dist/store/TooltipStore.d.ts +3 -1
- package/dist/store/createStore.d.ts +4 -1
- package/dist/store/useObservation.d.ts +18 -0
- package/dist/stream/MarginalGraphics.d.ts +1 -1
- package/dist/stream/NetworkPipelineStore.d.ts +44 -0
- package/dist/stream/OrdinalCanvasHitTester.d.ts +1 -0
- package/dist/stream/OrdinalSVGOverlay.d.ts +6 -2
- package/dist/stream/ParticlePool.d.ts +2 -1
- package/dist/stream/PipelineStore.d.ts +11 -0
- package/dist/stream/SVGOverlay.d.ts +21 -2
- package/dist/stream/SceneGraph.d.ts +1 -1
- package/dist/stream/networkTypes.d.ts +58 -1
- package/dist/stream/ordinalTypes.d.ts +13 -0
- package/dist/stream/types.d.ts +14 -0
- package/dist/types/annotationTypes.d.ts +10 -0
- package/dist/types/networkTypes.d.ts +1 -2
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +30 -42
- package/ai/dist/ai/componentRegistry.js +0 -45
- package/ai/dist/src/components/Annotation.js +0 -358
- package/ai/dist/src/components/AnnotationLayer/AnnotationLayer.js +0 -369
- package/ai/dist/src/components/Axis/Axis.js +0 -374
- package/ai/dist/src/components/Axis/axisTitle.js +0 -14
- package/ai/dist/src/components/Axis/index.js +0 -7
- package/ai/dist/src/components/Axis/summaryGraphic.js +0 -37
- package/ai/dist/src/components/Brush.js +0 -84
- package/ai/dist/src/components/ChartErrorBoundary.js +0 -91
- package/ai/dist/src/components/DividedLine.js +0 -65
- package/ai/dist/src/components/Legend.js +0 -140
- package/ai/dist/src/components/LinkedCharts.js +0 -95
- package/ai/dist/src/components/ThemeProvider.js +0 -79
- package/ai/dist/src/components/Tooltip/Tooltip.js +0 -309
- package/ai/dist/src/components/TooltipPositioner/index.js +0 -132
- package/ai/dist/src/components/annotationLayerBehavior/annotationHandling.js +0 -73
- package/ai/dist/src/components/annotationLayerBehavior/d3labeler.js +0 -254
- package/ai/dist/src/components/annotationRules/baseRules.js +0 -150
- package/ai/dist/src/components/annotationRules/networkframeRules.js +0 -196
- package/ai/dist/src/components/annotationRules/xyframeRules.js +0 -297
- package/ai/dist/src/components/batchWork.js +0 -35
- package/ai/dist/src/components/charts/index.js +0 -109
- package/ai/dist/src/components/charts/network/ChordDiagram.js +0 -142
- package/ai/dist/src/components/charts/network/CirclePack.js +0 -108
- package/ai/dist/src/components/charts/network/ForceDirectedGraph.js +0 -121
- package/ai/dist/src/components/charts/network/SankeyDiagram.js +0 -155
- package/ai/dist/src/components/charts/network/TreeDiagram.js +0 -110
- package/ai/dist/src/components/charts/network/Treemap.js +0 -106
- package/ai/dist/src/components/charts/ordinal/BarChart.js +0 -156
- package/ai/dist/src/components/charts/ordinal/BoxPlot.js +0 -139
- package/ai/dist/src/components/charts/ordinal/DonutChart.js +0 -130
- package/ai/dist/src/components/charts/ordinal/DotPlot.js +0 -126
- package/ai/dist/src/components/charts/ordinal/GroupedBarChart.js +0 -129
- package/ai/dist/src/components/charts/ordinal/Histogram.js +0 -132
- package/ai/dist/src/components/charts/ordinal/PieChart.js +0 -128
- package/ai/dist/src/components/charts/ordinal/RidgelinePlot.js +0 -130
- package/ai/dist/src/components/charts/ordinal/StackedBarChart.js +0 -130
- package/ai/dist/src/components/charts/ordinal/SwarmPlot.js +0 -147
- package/ai/dist/src/components/charts/ordinal/ViolinPlot.js +0 -138
- package/ai/dist/src/components/charts/realtime/RealtimeHeatmap.js +0 -79
- package/ai/dist/src/components/charts/realtime/RealtimeHistogram.js +0 -114
- package/ai/dist/src/components/charts/realtime/RealtimeLineChart.js +0 -93
- package/ai/dist/src/components/charts/realtime/RealtimeSwarmChart.js +0 -105
- package/ai/dist/src/components/charts/realtime/RealtimeWaterfallChart.js +0 -106
- package/ai/dist/src/components/charts/shared/ChartError.js +0 -72
- package/ai/dist/src/components/charts/shared/colorUtils.js +0 -138
- package/ai/dist/src/components/charts/shared/formatUtils.js +0 -213
- package/ai/dist/src/components/charts/shared/hooks.js +0 -49
- package/ai/dist/src/components/charts/shared/legendUtils.js +0 -57
- package/ai/dist/src/components/charts/shared/selectionUtils.js +0 -67
- package/ai/dist/src/components/charts/shared/tooltipUtils.js +0 -79
- package/ai/dist/src/components/charts/shared/types.js +0 -2
- package/ai/dist/src/components/charts/shared/validateChartData.js +0 -82
- package/ai/dist/src/components/charts/shared/validateProps.js +0 -736
- package/ai/dist/src/components/charts/xy/AreaChart.js +0 -230
- package/ai/dist/src/components/charts/xy/BubbleChart.js +0 -251
- package/ai/dist/src/components/charts/xy/Heatmap.js +0 -235
- package/ai/dist/src/components/charts/xy/LineChart.js +0 -307
- package/ai/dist/src/components/charts/xy/MinimapChart.js +0 -298
- package/ai/dist/src/components/charts/xy/Scatterplot.js +0 -172
- package/ai/dist/src/components/charts/xy/ScatterplotMatrix.js +0 -426
- package/ai/dist/src/components/charts/xy/StackedAreaChart.js +0 -231
- package/ai/dist/src/components/constants/coordinateNames.js +0 -11
- package/ai/dist/src/components/constants/frame_props.js +0 -251
- package/ai/dist/src/components/data/dataFunctions.js +0 -487
- package/ai/dist/src/components/data/multiAccessorUtils.js +0 -14
- package/ai/dist/src/components/data/transforms.js +0 -143
- package/ai/dist/src/components/data/unflowedFunctions.js +0 -5
- package/ai/dist/src/components/export/exportChart.js +0 -121
- package/ai/dist/src/components/generic_utilities/functions.js +0 -5
- package/ai/dist/src/components/geometry/areaDrawing.js +0 -312
- package/ai/dist/src/components/geometry/contourLayout.js +0 -73
- package/ai/dist/src/components/geometry/hexbinLayout.js +0 -163
- package/ai/dist/src/components/geometry/lineDrawing.js +0 -356
- package/ai/dist/src/components/geometry/sankeyLinks.js +0 -331
- package/ai/dist/src/components/geometry/summaryLayouts.js +0 -136
- package/ai/dist/src/components/index.js +0 -18
- package/ai/dist/src/components/processing/InteractionItems.js +0 -223
- package/ai/dist/src/components/processing/hierarchyUtils.js +0 -104
- package/ai/dist/src/components/processing/layouts/chordLayout.js +0 -58
- package/ai/dist/src/components/processing/layouts/forceLayout.js +0 -142
- package/ai/dist/src/components/processing/layouts/hierarchyLayout.js +0 -31
- package/ai/dist/src/components/processing/layouts/index.js +0 -32
- package/ai/dist/src/components/processing/layouts/sankeyLayout.js +0 -96
- package/ai/dist/src/components/processing/layouts/simpleLayouts.js +0 -34
- package/ai/dist/src/components/processing/layouts/types.js +0 -2
- package/ai/dist/src/components/processing/networkDefaults.js +0 -39
- package/ai/dist/src/components/realtime/BinAccumulator.js +0 -36
- package/ai/dist/src/components/realtime/IncrementalExtent.js +0 -55
- package/ai/dist/src/components/realtime/RingBuffer.js +0 -104
- package/ai/dist/src/components/realtime/renderers/barRenderer.js +0 -133
- package/ai/dist/src/components/realtime/renderers/candlestickRenderer.js +0 -7
- package/ai/dist/src/components/realtime/renderers/lineRenderer.js +0 -164
- package/ai/dist/src/components/realtime/renderers/swarmRenderer.js +0 -91
- package/ai/dist/src/components/realtime/renderers/types.js +0 -2
- package/ai/dist/src/components/realtime/renderers/waterfallRenderer.js +0 -163
- package/ai/dist/src/components/realtime/types.js +0 -2
- package/ai/dist/src/components/semiotic-ai.js +0 -89
- package/ai/dist/src/components/semiotic-data.js +0 -12
- package/ai/dist/src/components/semiotic-network.js +0 -38
- package/ai/dist/src/components/semiotic-ordinal.js +0 -28
- package/ai/dist/src/components/semiotic-realtime.js +0 -30
- package/ai/dist/src/components/semiotic-server.js +0 -8
- package/ai/dist/src/components/semiotic-xy.js +0 -35
- package/ai/dist/src/components/semiotic.js +0 -109
- package/ai/dist/src/components/server/renderToStaticSVG.js +0 -594
- package/ai/dist/src/components/store/SelectionStore.js +0 -91
- package/ai/dist/src/components/store/ThemeStore.js +0 -78
- package/ai/dist/src/components/store/TooltipStore.js +0 -13
- package/ai/dist/src/components/store/createStore.js +0 -81
- package/ai/dist/src/components/store/useSelection.js +0 -133
- package/ai/dist/src/components/stream/CanvasHitTester.js +0 -164
- package/ai/dist/src/components/stream/DataSourceAdapter.js +0 -99
- package/ai/dist/src/components/stream/MarginalGraphics.js +0 -266
- package/ai/dist/src/components/stream/NetworkCanvasHitTester.js +0 -228
- package/ai/dist/src/components/stream/NetworkPipelineStore.js +0 -498
- package/ai/dist/src/components/stream/NetworkSVGOverlay.js +0 -70
- package/ai/dist/src/components/stream/NetworkSceneGraph.js +0 -38
- package/ai/dist/src/components/stream/OrdinalCanvasHitTester.js +0 -146
- package/ai/dist/src/components/stream/OrdinalPipelineStore.js +0 -786
- package/ai/dist/src/components/stream/OrdinalSVGOverlay.js +0 -130
- package/ai/dist/src/components/stream/ParticlePool.js +0 -174
- package/ai/dist/src/components/stream/PipelineStore.js +0 -1243
- package/ai/dist/src/components/stream/SVGOverlay.js +0 -129
- package/ai/dist/src/components/stream/SceneGraph.js +0 -132
- package/ai/dist/src/components/stream/StreamNetworkFrame.js +0 -561
- package/ai/dist/src/components/stream/StreamOrdinalFrame.js +0 -492
- package/ai/dist/src/components/stream/StreamXYFrame.js +0 -590
- package/ai/dist/src/components/stream/accessorUtils.js +0 -20
- package/ai/dist/src/components/stream/index.js +0 -32
- package/ai/dist/src/components/stream/layouts/chordLayoutPlugin.js +0 -352
- package/ai/dist/src/components/stream/layouts/forceLayoutPlugin.js +0 -230
- package/ai/dist/src/components/stream/layouts/hierarchyLayoutPlugin.js +0 -568
- package/ai/dist/src/components/stream/layouts/index.js +0 -28
- package/ai/dist/src/components/stream/layouts/sankeyLayoutPlugin.js +0 -245
- package/ai/dist/src/components/stream/networkTypes.js +0 -17
- package/ai/dist/src/components/stream/ordinalSceneBuilders/barScene.js +0 -126
- package/ai/dist/src/components/stream/ordinalSceneBuilders/connectorScene.js +0 -62
- package/ai/dist/src/components/stream/ordinalSceneBuilders/pieScene.js +0 -33
- package/ai/dist/src/components/stream/ordinalSceneBuilders/pointScene.js +0 -63
- package/ai/dist/src/components/stream/ordinalSceneBuilders/statisticalScene.js +0 -278
- package/ai/dist/src/components/stream/ordinalSceneBuilders/timelineScene.js +0 -30
- package/ai/dist/src/components/stream/ordinalSceneBuilders/types.js +0 -2
- package/ai/dist/src/components/stream/ordinalTypes.js +0 -2
- package/ai/dist/src/components/stream/renderers/areaCanvasRenderer.js +0 -48
- package/ai/dist/src/components/stream/renderers/barCanvasRenderer.js +0 -70
- package/ai/dist/src/components/stream/renderers/boxplotCanvasRenderer.js +0 -75
- package/ai/dist/src/components/stream/renderers/candlestickCanvasRenderer.js +0 -28
- package/ai/dist/src/components/stream/renderers/connectorCanvasRenderer.js +0 -47
- package/ai/dist/src/components/stream/renderers/heatmapCanvasRenderer.js +0 -31
- package/ai/dist/src/components/stream/renderers/lineCanvasRenderer.js +0 -140
- package/ai/dist/src/components/stream/renderers/networkArcRenderer.js +0 -38
- package/ai/dist/src/components/stream/renderers/networkCircleRenderer.js +0 -37
- package/ai/dist/src/components/stream/renderers/networkEdgeRenderer.js +0 -102
- package/ai/dist/src/components/stream/renderers/networkParticleRenderer.js +0 -63
- package/ai/dist/src/components/stream/renderers/networkRectRenderer.js +0 -35
- package/ai/dist/src/components/stream/renderers/pointCanvasRenderer.js +0 -38
- package/ai/dist/src/components/stream/renderers/swarmCanvasRenderer.js +0 -10
- package/ai/dist/src/components/stream/renderers/types.js +0 -2
- package/ai/dist/src/components/stream/renderers/violinCanvasRenderer.js +0 -47
- package/ai/dist/src/components/stream/renderers/waterfallCanvasRenderer.js +0 -38
- package/ai/dist/src/components/stream/renderers/wedgeCanvasRenderer.js +0 -33
- package/ai/dist/src/components/stream/types.js +0 -2
- package/ai/dist/src/components/types/annotationTypes.js +0 -2
- package/ai/dist/src/components/types/canvasTypes.js +0 -2
- package/ai/dist/src/components/types/generalTypes.js +0 -2
- package/ai/dist/src/components/types/interactionTypes.js +0 -2
- package/ai/dist/src/components/types/legendTypes.js +0 -2
- package/ai/dist/src/components/types/networkTypes.js +0 -2
- package/ai/dist/src/components/types/ordinalTypes.js +0 -2
- package/ai/dist/src/components/types/xyTypes.js +0 -2
- package/ai/dist/src/components/useBoundingRect.js +0 -24
- package/ai/dist/src/components/visualizationLayerBehavior/axis.js +0 -301
- package/ai/dist/src/components/visualizationLayerBehavior/general.js +0 -435
- package/ai/dist/src/setupTests.js +0 -4
- package/dist/AnnotationLayer/AnnotationLayer.d.ts +0 -25
- package/dist/Axis/Axis.d.ts +0 -7
- package/dist/Axis/axisTitle.d.ts +0 -10
- package/dist/Axis/index.d.ts +0 -2
- package/dist/Axis/summaryGraphic.d.ts +0 -17
- package/dist/Brush.d.ts +0 -12
- package/dist/DividedLine.d.ts +0 -16
- package/dist/TooltipPositioner/index.d.ts +0 -7
- package/dist/annotationLayerBehavior/annotationHandling.d.ts +0 -19
- package/dist/annotationLayerBehavior/d3labeler.d.ts +0 -9
- package/dist/annotationRules/baseRules.d.ts +0 -25
- package/dist/annotationRules/networkframeRules.d.ts +0 -48
- package/dist/annotationRules/xyframeRules.d.ts +0 -117
- package/dist/batchWork.d.ts +0 -6
- package/dist/constants/coordinateNames.d.ts +0 -8
- package/dist/constants/frame_props.d.ts +0 -13
- package/dist/data/dataFunctions.d.ts +0 -45
- package/dist/data/multiAccessorUtils.d.ts +0 -1
- package/dist/data/unflowedFunctions.d.ts +0 -1
- package/dist/generic_utilities/functions.d.ts +0 -1
- package/dist/geometry/areaDrawing.d.ts +0 -21
- package/dist/geometry/contourLayout.d.ts +0 -6
- package/dist/geometry/hexbinLayout.d.ts +0 -7
- package/dist/geometry/lineDrawing.d.ts +0 -71
- package/dist/geometry/summaryLayouts.d.ts +0 -45
- package/dist/index.d.ts +0 -1
- package/dist/network.js +0 -7495
- package/dist/network.js.map +0 -1
- package/dist/network.module.js +0 -7458
- package/dist/network.module.js.map +0 -1
- package/dist/ordinal.js +0 -6497
- package/dist/ordinal.js.map +0 -1
- package/dist/ordinal.module.js +0 -6465
- package/dist/ordinal.module.js.map +0 -1
- package/dist/processing/InteractionItems.d.ts +0 -13
- package/dist/processing/hierarchyUtils.d.ts +0 -16
- package/dist/processing/layouts/chordLayout.d.ts +0 -2
- package/dist/processing/layouts/forceLayout.d.ts +0 -3
- package/dist/processing/layouts/hierarchyLayout.d.ts +0 -10
- package/dist/processing/layouts/index.d.ts +0 -8
- package/dist/processing/layouts/sankeyLayout.d.ts +0 -8
- package/dist/processing/layouts/simpleLayouts.d.ts +0 -7
- package/dist/processing/layouts/types.d.ts +0 -17
- package/dist/processing/networkDefaults.d.ts +0 -36
- package/dist/realtime/renderers/barRenderer.d.ts +0 -2
- package/dist/realtime/renderers/candlestickRenderer.d.ts +0 -2
- package/dist/realtime/renderers/lineRenderer.d.ts +0 -2
- package/dist/realtime/renderers/swarmRenderer.d.ts +0 -2
- package/dist/realtime.js +0 -7072
- package/dist/realtime.js.map +0 -1
- package/dist/realtime.module.js +0 -7043
- package/dist/realtime.module.js.map +0 -1
- package/dist/semiotic-ai.js +0 -13323
- package/dist/semiotic-ai.js.map +0 -1
- package/dist/semiotic-ai.module.js +0 -13264
- package/dist/semiotic-ai.module.js.map +0 -1
- package/dist/semiotic-data.js +0 -141
- package/dist/semiotic-data.js.map +0 -1
- package/dist/semiotic-data.module.js +0 -136
- package/dist/semiotic-data.module.js.map +0 -1
- package/dist/semiotic.js +0 -16351
- package/dist/semiotic.js.map +0 -1
- package/dist/semiotic.module.js +0 -16265
- package/dist/semiotic.module.js.map +0 -1
- package/dist/server.js +0 -5191
- package/dist/server.js.map +0 -1
- package/dist/server.module.js +0 -5166
- package/dist/server.module.js.map +0 -1
- package/dist/stream/NetworkSceneGraph.d.ts +0 -14
- package/dist/stream/index.d.ts +0 -16
- package/dist/types/canvasTypes.d.ts +0 -9
- package/dist/types/xyTypes.d.ts +0 -24
- package/dist/useBoundingRect.d.ts +0 -2
- package/dist/visualizationLayerBehavior/axis.d.ts +0 -36
- package/dist/visualizationLayerBehavior/general.d.ts +0 -80
- package/dist/xy.js +0 -6993
- package/dist/xy.js.map +0 -1
- package/dist/xy.module.js +0 -6957
- package/dist/xy.module.js.map +0 -1
|
@@ -1,487 +0,0 @@
|
|
|
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("../geometry/lineDrawing");
|
|
7
|
-
const coordinateNames_1 = require("../constants/coordinateNames");
|
|
8
|
-
const lineDrawing_2 = require("../geometry/lineDrawing");
|
|
9
|
-
const areaDrawing_1 = require("../geometry/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
|
-
// Expand y extent to include the bounds so they aren't clipped
|
|
390
|
-
if (!(actualYExtent && actualYExtent.length === 2)) {
|
|
391
|
-
for (const summary of projectedSummaries) {
|
|
392
|
-
for (const coord of summary._xyfCoordinates) {
|
|
393
|
-
const yVal = coord[1];
|
|
394
|
-
if (yVal !== undefined && isFinite(yVal)) {
|
|
395
|
-
if (yVal < finalYExtent[0])
|
|
396
|
-
finalYExtent[0] = yVal;
|
|
397
|
-
if (yVal > finalYExtent[1])
|
|
398
|
-
finalYExtent[1] = yVal;
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
else if (summaryType.type && summaryType.type === "hexbin") {
|
|
405
|
-
projectedSummaries = (0, areaDrawing_1.hexbinning)({
|
|
406
|
-
summaryType,
|
|
407
|
-
data: projectedSummaries[0],
|
|
408
|
-
processedData: summaries && !!summaries[0].processedData,
|
|
409
|
-
preprocess: false,
|
|
410
|
-
finalXExtent,
|
|
411
|
-
finalYExtent,
|
|
412
|
-
size,
|
|
413
|
-
margin,
|
|
414
|
-
styleFn: summaryStyleFn,
|
|
415
|
-
classFn: summaryClassFn,
|
|
416
|
-
renderFn: summaryRenderModeFn,
|
|
417
|
-
chartSize
|
|
418
|
-
});
|
|
419
|
-
fullDataset = rebuildFullDatasetWithSummaries(fullDataset, projectedSummaries);
|
|
420
|
-
}
|
|
421
|
-
else if (summaryType.type && summaryType.type === "heatmap") {
|
|
422
|
-
projectedSummaries = (0, areaDrawing_1.heatmapping)({
|
|
423
|
-
summaryType,
|
|
424
|
-
data: projectedSummaries[0],
|
|
425
|
-
processedData: summaries && !!summaries[0].processedData,
|
|
426
|
-
preprocess: false,
|
|
427
|
-
finalXExtent,
|
|
428
|
-
finalYExtent,
|
|
429
|
-
size,
|
|
430
|
-
margin,
|
|
431
|
-
styleFn: summaryStyleFn,
|
|
432
|
-
classFn: summaryClassFn,
|
|
433
|
-
renderFn: summaryRenderModeFn,
|
|
434
|
-
chartSize
|
|
435
|
-
});
|
|
436
|
-
fullDataset = rebuildFullDatasetWithSummaries(fullDataset, projectedSummaries);
|
|
437
|
-
}
|
|
438
|
-
else if (summaryType.type && summaryType.type === "trendline") {
|
|
439
|
-
projectedSummaries = (0, areaDrawing_1.trendlining)({
|
|
440
|
-
summaryType,
|
|
441
|
-
data: projectedSummaries[0],
|
|
442
|
-
preprocess: summaries && !!summaries[0].processedData,
|
|
443
|
-
finalXExtent
|
|
444
|
-
});
|
|
445
|
-
fullDataset = rebuildFullDatasetWithSummaries(fullDataset, projectedSummaries);
|
|
446
|
-
}
|
|
447
|
-
if (filterRenderedLines) {
|
|
448
|
-
projectedLines = projectedLines.filter(filterRenderedLines);
|
|
449
|
-
fullDataset = fullDataset.filter((d, i) => {
|
|
450
|
-
return !d.parentLine || filterRenderedLines(d.parentLine, i, []);
|
|
451
|
-
});
|
|
452
|
-
}
|
|
453
|
-
if (filterRenderedPoints) {
|
|
454
|
-
fullDataset = fullDataset.filter(filterRenderedPoints);
|
|
455
|
-
}
|
|
456
|
-
if (filterRenderedSummaries) {
|
|
457
|
-
projectedSummaries = projectedSummaries.filter(filterRenderedSummaries);
|
|
458
|
-
fullDataset = fullDataset.filter((d, i) => {
|
|
459
|
-
return !d.parentSummary || filterRenderedSummaries(d.parentSummary, i, []);
|
|
460
|
-
});
|
|
461
|
-
}
|
|
462
|
-
return {
|
|
463
|
-
xExtent: finalXExtent,
|
|
464
|
-
yExtent: finalYExtent,
|
|
465
|
-
projectedLines,
|
|
466
|
-
projectedPoints,
|
|
467
|
-
projectedSummaries,
|
|
468
|
-
fullDataset,
|
|
469
|
-
calculatedXExtent,
|
|
470
|
-
calculatedYExtent
|
|
471
|
-
};
|
|
472
|
-
};
|
|
473
|
-
exports.calculateDataExtent = calculateDataExtent;
|
|
474
|
-
const differenceCatch = (olineType, data) => {
|
|
475
|
-
if (!builtInTransformations[olineType] ||
|
|
476
|
-
(olineType === "difference" && data.length !== 2)) {
|
|
477
|
-
return "line";
|
|
478
|
-
}
|
|
479
|
-
return olineType;
|
|
480
|
-
};
|
|
481
|
-
function lineTransformation(lineType, options) {
|
|
482
|
-
return (data) => builtInTransformations[differenceCatch(lineType.type, data)]({
|
|
483
|
-
...lineType,
|
|
484
|
-
...options,
|
|
485
|
-
data
|
|
486
|
-
});
|
|
487
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
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;
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Data transform helpers for common data shapes.
|
|
4
|
-
* Import from "semiotic/data"
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.bin = bin;
|
|
8
|
-
exports.rollup = rollup;
|
|
9
|
-
exports.groupBy = groupBy;
|
|
10
|
-
exports.pivot = pivot;
|
|
11
|
-
/**
|
|
12
|
-
* Bin continuous data into histogram-ready format.
|
|
13
|
-
* Returns array of { category, value } objects suitable for BarChart.
|
|
14
|
-
*/
|
|
15
|
-
function bin(data, options) {
|
|
16
|
-
const { field, bins = 10 } = options;
|
|
17
|
-
const values = data.map((d) => Number(d[field])).filter((v) => !isNaN(v));
|
|
18
|
-
if (values.length === 0)
|
|
19
|
-
return [];
|
|
20
|
-
const min = options.domain ? options.domain[0] : Math.min(...values);
|
|
21
|
-
const max = options.domain ? options.domain[1] : Math.max(...values);
|
|
22
|
-
if (min === max) {
|
|
23
|
-
return [{ category: `${min}-${max}`, value: values.length }];
|
|
24
|
-
}
|
|
25
|
-
const binWidth = (max - min) / bins;
|
|
26
|
-
const counts = new Array(bins).fill(0);
|
|
27
|
-
for (const v of values) {
|
|
28
|
-
let idx = Math.floor((v - min) / binWidth);
|
|
29
|
-
if (idx === bins)
|
|
30
|
-
idx = bins - 1;
|
|
31
|
-
if (idx >= 0 && idx < bins) {
|
|
32
|
-
counts[idx]++;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return counts.map((count, i) => {
|
|
36
|
-
const lo = min + i * binWidth;
|
|
37
|
-
const hi = lo + binWidth;
|
|
38
|
-
return {
|
|
39
|
-
category: `${formatNum(lo)}-${formatNum(hi)}`,
|
|
40
|
-
value: count
|
|
41
|
-
};
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Group and aggregate data.
|
|
46
|
-
* Returns array of { [groupBy]: string, value: number } objects.
|
|
47
|
-
*/
|
|
48
|
-
function rollup(data, options) {
|
|
49
|
-
const { groupBy: groupField, value: valueField, agg = "sum" } = options;
|
|
50
|
-
const groups = new Map();
|
|
51
|
-
for (const d of data) {
|
|
52
|
-
const key = String(d[groupField]);
|
|
53
|
-
if (!groups.has(key)) {
|
|
54
|
-
groups.set(key, []);
|
|
55
|
-
}
|
|
56
|
-
groups.get(key).push(Number(d[valueField]));
|
|
57
|
-
}
|
|
58
|
-
const result = [];
|
|
59
|
-
for (const [key, vals] of groups) {
|
|
60
|
-
let aggregated;
|
|
61
|
-
switch (agg) {
|
|
62
|
-
case "count":
|
|
63
|
-
aggregated = vals.length;
|
|
64
|
-
break;
|
|
65
|
-
case "mean":
|
|
66
|
-
aggregated = vals.reduce((a, b) => a + b, 0) / vals.length;
|
|
67
|
-
break;
|
|
68
|
-
case "min":
|
|
69
|
-
aggregated = Math.min(...vals);
|
|
70
|
-
break;
|
|
71
|
-
case "max":
|
|
72
|
-
aggregated = Math.max(...vals);
|
|
73
|
-
break;
|
|
74
|
-
case "sum":
|
|
75
|
-
default:
|
|
76
|
-
aggregated = vals.reduce((a, b) => a + b, 0);
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
result.push({ [groupField]: key, value: aggregated });
|
|
80
|
-
}
|
|
81
|
-
return result;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Group flat rows into line-chart-ready nested format.
|
|
85
|
-
* Returns array of { id, coordinates } objects for LineChart with lineBy.
|
|
86
|
-
*/
|
|
87
|
-
function groupBy(data, options) {
|
|
88
|
-
const { key, fields } = options;
|
|
89
|
-
const groups = new Map();
|
|
90
|
-
for (const d of data) {
|
|
91
|
-
const groupKey = String(d[key]);
|
|
92
|
-
if (!groups.has(groupKey)) {
|
|
93
|
-
groups.set(groupKey, []);
|
|
94
|
-
}
|
|
95
|
-
if (fields) {
|
|
96
|
-
const filtered = {};
|
|
97
|
-
for (const f of fields) {
|
|
98
|
-
if (f in d) {
|
|
99
|
-
filtered[f] = d[f];
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
groups.get(groupKey).push(filtered);
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
groups.get(groupKey).push({ ...d });
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
const result = [];
|
|
109
|
-
for (const [id, coordinates] of groups) {
|
|
110
|
-
result.push({ id, coordinates });
|
|
111
|
-
}
|
|
112
|
-
return result;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Pivot wide data to long format.
|
|
116
|
-
* Converts column-per-variable to row-per-variable.
|
|
117
|
-
*/
|
|
118
|
-
function pivot(data, options) {
|
|
119
|
-
const { columns, nameField = "name", valueField = "value" } = options;
|
|
120
|
-
const columnsSet = new Set(columns);
|
|
121
|
-
const result = [];
|
|
122
|
-
for (const row of data) {
|
|
123
|
-
const base = {};
|
|
124
|
-
for (const k of Object.keys(row)) {
|
|
125
|
-
if (!columnsSet.has(k)) {
|
|
126
|
-
base[k] = row[k];
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
for (const col of columns) {
|
|
130
|
-
result.push({
|
|
131
|
-
...base,
|
|
132
|
-
[nameField]: col,
|
|
133
|
-
[valueField]: row[col]
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return result;
|
|
138
|
-
}
|
|
139
|
-
/** Round to avoid long floating-point strings in bin labels. */
|
|
140
|
-
function formatNum(n) {
|
|
141
|
-
const rounded = Math.round(n * 1000) / 1000;
|
|
142
|
-
return String(rounded);
|
|
143
|
-
}
|