@d3plus/core 4.12.0 → 4.13.0
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/es/index.js +2 -2
- package/es/internal.js +155 -21
- package/es/src/charts/Alluvial/emit.js +3 -2
- package/es/src/charts/ArcDiagram/applyLayout.js +17 -10
- package/es/src/charts/ArcDiagram/arcGeometry.js +21 -8
- package/es/src/charts/ArcDiagram/arcLoops.js +5 -2
- package/es/src/charts/ArcDiagram/arcNodeBox.js +89 -0
- package/es/src/charts/ArcDiagram/emit.js +56 -27
- package/es/src/charts/ArcDiagram/events.js +10 -6
- package/es/src/charts/ArcDiagram/index.js +1 -1
- package/es/src/charts/BarChart/index.js +11 -0
- package/es/src/charts/BoxWhisker/extras.js +95 -0
- package/es/src/charts/BoxWhisker/index.js +77 -6
- package/es/src/charts/BoxWhisker/outliers.js +3 -2
- package/es/src/charts/BoxWhisker/summary.js +14 -3
- package/es/src/charts/BoxWhisker/tooltip.js +114 -29
- package/es/src/charts/BubbleChart/emit.js +9 -5
- package/es/src/charts/BubbleMatrix/colorDefaults.js +58 -0
- package/es/src/charts/BubbleMatrix/index.js +52 -0
- package/es/src/charts/Bullet/emit.js +3 -2
- package/es/src/charts/BumpChart/areaBump.js +175 -0
- package/es/src/charts/BumpChart/index.js +84 -18
- package/es/src/charts/Calendar/applyLayout.js +1 -1
- package/es/src/charts/Calendar/calendarDates.js +21 -7
- package/es/src/charts/Calendar/emit.js +3 -2
- package/es/src/charts/Calendar/index.js +14 -1
- package/es/src/charts/Candlestick/index.js +2 -1
- package/es/src/charts/Candlestick/periods.js +52 -29
- package/es/src/charts/Candlestick/tooltip.js +5 -7
- package/es/src/charts/Chord/emit.js +3 -2
- package/es/src/charts/ConnectedScatter/index.js +39 -0
- package/es/src/charts/CyclePlot/cycleFacet.js +162 -0
- package/es/src/charts/CyclePlot/cycleMeans.js +54 -0
- package/es/src/charts/CyclePlot/cyclePeriods.js +99 -0
- package/es/src/charts/CyclePlot/cycleTooltip.js +67 -0
- package/es/src/charts/CyclePlot/index.js +197 -0
- package/es/src/charts/DensityPlot/densityCurves.js +139 -0
- package/es/src/charts/DensityPlot/densityPoint.js +10 -0
- package/es/src/charts/DensityPlot/index.js +235 -0
- package/es/src/charts/DensityPlot/rug.js +144 -0
- package/es/src/charts/DotPlot/dotLayout.js +165 -0
- package/es/src/charts/DotPlot/facetSize.js +40 -0
- package/es/src/charts/DotPlot/index.js +173 -0
- package/es/src/charts/DotPlot/placements.js +121 -0
- package/es/src/charts/DotPlot/tooltip.js +68 -0
- package/es/src/charts/Dumbbell/arrowGrays.js +46 -0
- package/es/src/charts/Dumbbell/categoryChange.js +124 -0
- package/es/src/charts/Dumbbell/changeEmit.js +291 -0
- package/es/src/charts/Dumbbell/changes.js +87 -0
- package/es/src/charts/Dumbbell/connectors.js +46 -0
- package/es/src/charts/Dumbbell/emit.js +51 -50
- package/es/src/charts/Dumbbell/gapSort.js +2 -1
- package/es/src/charts/Dumbbell/index.js +121 -5
- package/es/src/charts/Funnel/emit.js +3 -2
- package/es/src/charts/Gantt/applyLayout.js +31 -9
- package/es/src/charts/Gantt/criticalPath.js +202 -0
- package/es/src/charts/Gantt/emit.js +49 -15
- package/es/src/charts/Gantt/ganttCalendar.js +54 -0
- package/es/src/charts/Gantt/ganttCritical.js +106 -0
- package/es/src/charts/Gantt/ganttDecor.js +183 -60
- package/es/src/charts/Gantt/ganttSlack.js +14 -0
- package/es/src/charts/Gantt/ganttTooltip.js +91 -36
- package/es/src/charts/Gantt/index.js +59 -10
- package/es/src/charts/Gauge/emit.js +3 -2
- package/es/src/charts/Geomap/applyLayout.js +177 -19
- package/es/src/charts/Geomap/cartogram.js +50 -0
- package/es/src/charts/Geomap/cartogramContiguous.js +196 -0
- package/es/src/charts/Geomap/cartogramFields.js +63 -0
- package/es/src/charts/Geomap/cartogramLabels.js +109 -0
- package/es/src/charts/Geomap/cartogramLayout.js +186 -0
- package/es/src/charts/Geomap/cartogramLegend.js +73 -0
- package/es/src/charts/Geomap/cartogramRelax.js +251 -0
- package/es/src/charts/Geomap/densityEmit.js +93 -0
- package/es/src/charts/Geomap/densityFields.js +69 -0
- package/es/src/charts/Geomap/densityLayout.js +90 -0
- package/es/src/charts/Geomap/densityTooltip.js +98 -0
- package/es/src/charts/Geomap/dotDensity.js +157 -0
- package/es/src/charts/Geomap/dotDensityLayout.js +116 -0
- package/es/src/charts/Geomap/dotRenderer.js +49 -0
- package/es/src/charts/Geomap/drillDown.js +216 -0
- package/es/src/charts/Geomap/drillEmit.js +64 -0
- package/es/src/charts/Geomap/drillEvents.js +108 -0
- package/es/src/charts/Geomap/emit.js +64 -42
- package/es/src/charts/Geomap/flowEmit.js +27 -11
- package/es/src/charts/Geomap/flowEvents.js +3 -1
- package/es/src/charts/Geomap/flowFields.js +2 -2
- package/es/src/charts/Geomap/flowLinks.js +18 -10
- package/es/src/charts/Geomap/geoHexbin.js +144 -0
- package/es/src/charts/Geomap/geoHexbinZoom.js +110 -0
- package/es/src/charts/Geomap/index.js +71 -116
- package/es/src/charts/Geomap/pointCluster.js +246 -0
- package/es/src/charts/Geomap/pointClusterEmit.js +385 -0
- package/es/src/charts/Geomap/pointClusterLayout.js +170 -0
- package/es/src/charts/Geomap/pointClusterLinks.js +95 -0
- package/es/src/charts/Geomap/pointClusterZoom.js +253 -0
- package/es/src/charts/Geomap/pointLabels.js +12 -4
- package/es/src/charts/Geomap/pointRows.js +25 -0
- package/es/src/charts/Geomap/tileGrid.js +468 -0
- package/es/src/charts/Geomap/tileState.js +41 -0
- package/es/src/charts/Geomap/topojsonFluent.js +96 -0
- package/es/src/charts/Geomap/topojsonLevels.js +16 -0
- package/es/src/charts/Hexbin/contourLabels.js +25 -17
- package/es/src/charts/Hexbin/index.js +2 -1
- package/es/src/charts/Histogram/binData.js +5 -1
- package/es/src/charts/Histogram/index.js +4 -26
- package/es/src/charts/HorizonChart/emit.js +147 -0
- package/es/src/charts/HorizonChart/horizonBands.js +117 -0
- package/es/src/charts/HorizonChart/horizonColors.js +30 -0
- package/es/src/charts/HorizonChart/hover.js +147 -0
- package/es/src/charts/HorizonChart/index.js +220 -0
- package/es/src/charts/HorizonChart/measure.js +91 -0
- package/es/src/charts/HorizonChart/rowFilter.js +250 -0
- package/es/src/charts/HorizonChart/state.js +64 -0
- package/es/src/charts/Icicle/emit.js +3 -2
- package/es/src/charts/KPI/applyLayout.js +119 -0
- package/es/src/charts/KPI/delta.js +74 -0
- package/es/src/charts/KPI/emit.js +303 -0
- package/es/src/charts/KPI/index.js +192 -0
- package/es/src/charts/KPI/series.js +67 -0
- package/es/src/charts/KPI/tileLayout.js +134 -0
- package/es/src/charts/Lollipop/emit.js +2 -1
- package/es/src/charts/Marimekko/index.js +2 -1
- package/es/src/charts/Matrix/applyLayout.js +10 -4
- package/es/src/charts/Matrix/bubbles.js +133 -0
- package/es/src/charts/Matrix/emit.js +68 -25
- package/es/src/charts/Matrix/index.js +45 -4
- package/es/src/charts/Network/applyLayout.js +173 -82
- package/es/src/charts/Network/bundle.js +26 -6
- package/es/src/charts/Network/circleLayout.js +281 -0
- package/es/src/charts/Network/containNodes.js +72 -0
- package/es/src/charts/Network/emit.js +78 -18
- package/es/src/charts/Network/forceLayout.js +111 -0
- package/es/src/charts/Network/graph.js +45 -6
- package/es/src/charts/Network/index.js +111 -2
- package/es/src/charts/Network/liveForce.js +312 -0
- package/es/src/charts/Network/livePositions.js +180 -0
- package/es/src/charts/Network/networkDrag.js +156 -0
- package/es/src/charts/Pack/emit.js +3 -2
- package/es/src/charts/Pack/index.js +0 -14
- package/es/src/charts/ParallelCoordinates/emit.js +3 -2
- package/es/src/charts/Pareto/color.js +46 -0
- package/es/src/charts/Pareto/hover.js +54 -0
- package/es/src/charts/Pareto/index.js +170 -0
- package/es/src/charts/Pareto/labels.js +91 -0
- package/es/src/charts/Pareto/order.js +61 -0
- package/es/src/charts/Pareto/paretoSteps.js +84 -0
- package/es/src/charts/Pareto/state.js +158 -0
- package/es/src/charts/Parliament/index.js +68 -0
- package/es/src/charts/Pie/emit.js +3 -2
- package/es/src/charts/Plot/areaEnter.js +5 -3
- package/es/src/charts/Plot/areaLabelsAlong.js +10 -2
- package/es/src/charts/Plot/aspectRatio.js +92 -0
- package/es/src/charts/Plot/axisHover.js +4 -2
- package/es/src/charts/Plot/axisHoverAnchors.js +2 -1
- package/es/src/charts/Plot/axisHoverScene.js +138 -5
- package/es/src/charts/Plot/barConfidence.js +7 -6
- package/es/src/charts/Plot/barHitArea.js +121 -7
- package/es/src/charts/Plot/barLabelConfidence.js +50 -0
- package/es/src/charts/Plot/barLabelFit.js +2 -1
- package/es/src/charts/Plot/barWidth.js +10 -5
- package/es/src/charts/Plot/baselineBreak.js +15 -6
- package/es/src/charts/Plot/baselineDomain.js +13 -4
- package/es/src/charts/Plot/circleLabels.js +26 -16
- package/es/src/charts/Plot/confidenceAxes.js +100 -0
- package/es/src/charts/Plot/confidenceConfig.js +7 -2
- package/es/src/charts/Plot/confidenceTooltip.js +47 -4
- package/es/src/charts/Plot/connectGapsScene.js +2 -1
- package/es/src/charts/Plot/discreteDomain.js +27 -5
- package/es/src/charts/Plot/discreteSpan.js +10 -1
- package/es/src/charts/Plot/domainClip.js +74 -44
- package/es/src/charts/Plot/downsample.js +26 -0
- package/es/src/charts/Plot/draw.js +15 -2
- package/es/src/charts/Plot/fillBetween.js +2 -1
- package/es/src/charts/Plot/forecast.js +8 -4
- package/es/src/charts/Plot/forecastScene.js +6 -5
- package/es/src/charts/Plot/index.js +49 -18
- package/es/src/charts/Plot/inferDiscrete.js +72 -0
- package/es/src/charts/Plot/jitter.js +50 -0
- package/es/src/charts/Plot/labelPlacement.js +4 -3
- package/es/src/charts/Plot/lineBands.js +6 -1
- package/es/src/charts/Plot/lineLabelEmit.js +4 -3
- package/es/src/charts/Plot/lineLabelSides.js +8 -0
- package/es/src/charts/Plot/lineLabelsAlong.js +45 -31
- package/es/src/charts/Plot/marginalHover.js +141 -0
- package/es/src/charts/Plot/marginalLayout.js +102 -0
- package/es/src/charts/Plot/marginalPaint.js +105 -0
- package/es/src/charts/Plot/marginalScene.js +272 -0
- package/es/src/charts/Plot/marginalSeries.js +73 -0
- package/es/src/charts/Plot/marginalStats.js +219 -0
- package/es/src/charts/Plot/openDomainEnds.js +60 -0
- package/es/src/charts/Plot/orderPath.js +137 -0
- package/es/src/charts/Plot/orderPathScene.js +253 -0
- package/es/src/charts/Plot/outlierDetect.js +179 -0
- package/es/src/charts/Plot/outlierLabels.js +327 -0
- package/es/src/charts/Plot/outlierLines.js +93 -0
- package/es/src/charts/Plot/outlierScene.js +308 -0
- package/es/src/charts/Plot/outlierTooltip.js +69 -0
- package/es/src/charts/Plot/periodLabels.js +27 -0
- package/es/src/charts/Plot/pipeline.js +62 -24
- package/es/src/charts/Plot/pipelineAxisLayout.js +9 -7
- package/es/src/charts/Plot/pipelineDomains.js +64 -27
- package/es/src/charts/Plot/pipelineScales.js +37 -28
- package/es/src/charts/Plot/plotBreaks.js +38 -18
- package/es/src/charts/Plot/plotFacet.js +3 -1
- package/es/src/charts/Plot/plotInit.js +59 -3
- package/es/src/charts/Plot/plotLevels.js +183 -0
- package/es/src/charts/Plot/plotRangeBreaks.js +46 -9
- package/es/src/charts/Plot/plotShapes.js +60 -0
- package/es/src/charts/Plot/pointConfidence.js +186 -0
- package/es/src/charts/Plot/pointKey.js +10 -0
- package/es/src/charts/Plot/referenceDomains.js +11 -6
- package/es/src/charts/Plot/shapeAccessors.js +52 -0
- package/es/src/charts/Plot/shapeDefaults.js +32 -17
- package/es/src/charts/Plot/sharedHover.js +40 -12
- package/es/src/charts/Plot/sharedHoverScene.js +49 -13
- package/es/src/charts/Plot/sharedTooltip.js +55 -22
- package/es/src/charts/Plot/stackEnter.js +7 -3
- package/es/src/charts/Plot/stackLegendOrder.js +5 -2
- package/es/src/charts/Plot/stackNeutral.js +154 -0
- package/es/src/charts/Plot/stackShareTooltip.js +2 -1
- package/es/src/charts/Plot/stackThreshold.js +2 -1
- package/es/src/charts/Plot/swarm.js +8 -5
- package/es/src/charts/Plot/timeNestKeys.js +37 -0
- package/es/src/charts/Plot/trendLabels.js +45 -18
- package/es/src/charts/Plot/trendLines.js +78 -34
- package/es/src/charts/Plot/trendMovingAverage.js +135 -0
- package/es/src/charts/Plot/trendProjection.js +18 -6
- package/es/src/charts/Plot/trendScene.js +4 -1
- package/es/src/charts/Plot/trendTooltip.js +75 -20
- package/es/src/charts/PolarArea/emit.js +3 -2
- package/es/src/charts/Priestley/applyLayout.js +9 -5
- package/es/src/charts/Priestley/emit.js +3 -2
- package/es/src/charts/Priestley/timeAxis.js +13 -5
- package/es/src/charts/Radar/emit.js +3 -2
- package/es/src/charts/RadialArea/index.js +51 -0
- package/es/src/charts/RadialBar/emit.js +3 -2
- package/es/src/charts/RadialLine/angles.js +117 -0
- package/es/src/charts/RadialLine/applyLayout.js +204 -0
- package/es/src/charts/RadialLine/emit.js +66 -0
- package/es/src/charts/RadialLine/index.js +228 -0
- package/es/src/charts/RadialLine/paths.js +55 -0
- package/es/src/charts/RadialLine/points.js +80 -0
- package/es/src/charts/RadialLine/series.js +84 -0
- package/es/src/charts/RadialLine/seriesLabelNodes.js +116 -0
- package/es/src/charts/RadialLine/seriesLabels.js +91 -0
- package/es/src/charts/RadialLine/spokes.js +32 -0
- package/es/src/charts/RadialMatrix/emit.js +3 -2
- package/es/src/charts/RadialTree/index.js +33 -0
- package/es/src/charts/Rings/applyLayout.js +22 -6
- package/es/src/charts/Rings/emit.js +43 -23
- package/es/src/charts/Rings/index.js +1 -1
- package/es/src/charts/Rings/ringsCurves.js +10 -8
- package/es/src/charts/Rings/ringsLoops.js +4 -2
- package/es/src/charts/Rings/ringsSizing.js +21 -13
- package/es/src/charts/Sankey/applyLayout.js +4 -0
- package/es/src/charts/Sankey/circularLayout.js +14 -6
- package/es/src/charts/Sankey/emit.js +3 -2
- package/es/src/charts/Sankey/index.js +43 -0
- package/es/src/charts/Sankey/sankeyDrag.js +225 -0
- package/es/src/charts/Sankey/sankeyLayout.js +12 -0
- package/es/src/charts/Scatter/index.js +3 -2
- package/es/src/charts/ScatterMatrix/binEmit.js +59 -0
- package/es/src/charts/ScatterMatrix/index.js +253 -0
- package/es/src/charts/ScatterMatrix/matrixData.js +161 -0
- package/es/src/charts/ScatterMatrix/matrixFacet.js +76 -0
- package/es/src/charts/ScatterMatrix/matrixHover.js +36 -0
- package/es/src/charts/ScatterMatrix/matrixTooltip.js +45 -0
- package/es/src/charts/StripPlot/index.js +53 -0
- package/es/src/charts/Sunburst/emit.js +3 -2
- package/es/src/charts/TileGridMap/index.js +29 -0
- package/es/src/charts/Tree/applyLayout.js +91 -18
- package/es/src/charts/Tree/emit.js +56 -3
- package/es/src/charts/Tree/index.js +24 -3
- package/es/src/charts/Tree/nodeHeight.js +58 -0
- package/es/src/charts/Tree/radialLabels.js +61 -0
- package/es/src/charts/Tree/radialLayout.js +210 -0
- package/es/src/charts/Treemap/emit.js +3 -2
- package/es/src/charts/Venn/applyLayout.js +176 -0
- package/es/src/charts/Venn/circles.js +192 -0
- package/es/src/charts/Venn/ellipseFrame.js +57 -0
- package/es/src/charts/Venn/emit.js +142 -0
- package/es/src/charts/Venn/index.js +178 -0
- package/es/src/charts/Venn/nelderMead.js +59 -0
- package/es/src/charts/Venn/tooltip.js +22 -0
- package/es/src/charts/Venn/vennData.js +99 -0
- package/es/src/charts/Venn/vennEllipses.js +291 -0
- package/es/src/charts/Venn/vennFit.js +169 -0
- package/es/src/charts/Venn/vennLayout.js +252 -0
- package/es/src/charts/Venn/vennRegions.js +133 -0
- package/es/src/charts/Violin/emit.js +2 -1
- package/es/src/charts/Violin/index.js +2 -1
- package/es/src/charts/Waffle/applyLayout.js +45 -22
- package/es/src/charts/Waffle/arcEmit.js +153 -0
- package/es/src/charts/Waffle/arcLayout.js +122 -0
- package/es/src/charts/Waffle/arcStage.js +79 -0
- package/es/src/charts/Waffle/emit.js +9 -4
- package/es/src/charts/Waffle/index.js +88 -4
- package/es/src/charts/Waffle/tooltip.js +7 -2
- package/es/src/charts/Waterfall/connectors.js +5 -3
- package/es/src/charts/Waterfall/state.js +2 -1
- package/es/src/charts/WordCloud/applyLayout.js +157 -0
- package/es/src/charts/WordCloud/cloudLayout.js +128 -0
- package/es/src/charts/WordCloud/emit.js +96 -0
- package/es/src/charts/WordCloud/fontScale.js +34 -0
- package/es/src/charts/WordCloud/glyphMask.js +298 -0
- package/es/src/charts/WordCloud/index.js +174 -0
- package/es/src/charts/WordCloud/occupancy.js +99 -0
- package/es/src/charts/WordCloud/rotation.js +44 -0
- package/es/src/charts/WordCloud/size.js +15 -0
- package/es/src/charts/WordCloud/spiral.js +72 -0
- package/es/src/charts/definition/applyDefinition.js +6 -1
- package/es/src/charts/definition/declaresField.js +14 -0
- package/es/src/charts/definition/makeChart.js +10 -2
- package/es/src/charts/drawSteps/bottomRightControls.js +1 -1
- package/es/src/charts/drawSteps/bottomRightControlsMarkup.js +1 -1
- package/es/src/charts/drawSteps/gestureHover.js +10 -6
- package/es/src/charts/drawSteps/leavesSurface.js +12 -0
- package/es/src/charts/drawSteps/minimap.js +1 -1
- package/es/src/charts/drawSteps/selectActions.js +105 -0
- package/es/src/charts/drawSteps/selectGesture.js +318 -0
- package/es/src/charts/drawSteps/selectRegion.js +222 -0
- package/es/src/charts/drawSteps/selectState.js +118 -0
- package/es/src/charts/drawSteps/topLeftControls.js +4 -1
- package/es/src/charts/drawSteps/zoomControls.js +59 -19
- package/es/src/charts/drawSteps/zoomControlsMarkup.js +212 -39
- package/es/src/charts/drawSteps/zoomControlsMenu.js +140 -0
- package/es/src/charts/drawSteps/zoomDrag.js +3 -1
- package/es/src/charts/events/mouseleave.js +6 -3
- package/es/src/charts/events/mousemove.legend.js +10 -5
- package/es/src/charts/events/mousemove.shape.js +15 -6
- package/es/src/charts/facet/drawFacets.js +61 -22
- package/es/src/charts/facet/facetConfig.js +3 -1
- package/es/src/charts/facet/facetData.js +10 -2
- package/es/src/charts/facet/facetGrid.js +5 -1
- package/es/src/charts/facet/facetGutter.js +36 -7
- package/es/src/charts/facet/facetLayout.js +136 -0
- package/es/src/charts/facet/facetLayouts.js +574 -0
- package/es/src/charts/facet/facetScene.js +10 -3
- package/es/src/charts/features/annotationFrame.js +8 -3
- package/es/src/charts/features/axes.js +4 -2
- package/es/src/charts/features/axesFinal.js +92 -8
- package/es/src/charts/features/axesMeasure.js +7 -4
- package/es/src/charts/features/bareRegion.js +24 -0
- package/es/src/charts/features/boxGrid.js +39 -0
- package/es/src/charts/features/centerLabel.js +36 -17
- package/es/src/charts/features/circleLabelPlacement.js +288 -83
- package/es/src/charts/features/circleLabels.js +66 -14
- package/es/src/charts/features/colorScaleHover.js +7 -2
- package/es/src/charts/features/colorScaleTooltip.js +6 -21
- package/es/src/charts/features/colorScaleTop.js +12 -2
- package/es/src/charts/features/colorScaleValue.js +10 -1
- package/es/src/charts/features/curvedArrows.js +46 -28
- package/es/src/charts/features/edgeArrows.js +48 -18
- package/es/src/charts/features/emitHelpers.js +7 -2
- package/es/src/charts/features/features.js +25 -5
- package/es/src/charts/features/featuresColorScale.js +7 -4
- package/es/src/charts/features/featuresLegend.js +20 -0
- package/es/src/charts/features/hoverTicks.js +12 -7
- package/es/src/charts/features/keyHold.js +115 -0
- package/es/src/charts/features/keyTooltip.js +91 -0
- package/es/src/charts/features/labelLayering.js +149 -0
- package/es/src/charts/features/labelSlots.js +112 -0
- package/es/src/charts/features/linkInteraction.js +4 -1
- package/es/src/charts/features/linkLabelPath.js +2 -39
- package/es/src/charts/features/nodeDrag.js +175 -0
- package/es/src/charts/features/nodeKeys.js +117 -0
- package/es/src/charts/features/nodeOutline.js +41 -0
- package/es/src/charts/features/pathLabelBends.js +191 -0
- package/es/src/charts/features/plotAnnotations.js +8 -5
- package/es/src/charts/features/plotPaint.js +45 -13
- package/es/src/charts/features/rectNodeSize.js +41 -0
- package/es/src/charts/features/ringLabels.js +3 -1
- package/es/src/charts/features/selfLoops.js +33 -23
- package/es/src/charts/features/shapeEmit.js +104 -32
- package/es/src/charts/features/sharedFields.js +10 -5
- package/es/src/charts/features/spokeLabels.js +178 -0
- package/es/src/charts/features/swatchPaint.js +68 -0
- package/es/src/charts/features/thresholdMembers.js +8 -12
- package/es/src/charts/features/tooltipRows.js +76 -0
- package/es/src/charts/features/tooltipSwatch.js +81 -24
- package/es/src/charts/features/xAxisConfig.js +2 -1
- package/es/src/charts/helpers/densityChart.js +2 -7
- package/es/src/charts/helpers/valueTitle.js +13 -1
- package/es/src/charts/index.js +17 -0
- package/es/src/charts/partition/interaction.js +2 -2
- package/es/src/charts/pipeline/insetPlacement.js +13 -6
- package/es/src/charts/pipeline/preDrawData.js +80 -11
- package/es/src/charts/pipeline/runVizPipeline.js +5 -0
- package/es/src/charts/pipeline/stages.js +3 -2
- package/es/src/charts/pipeline/vizPreDraw.js +4 -0
- package/es/src/charts/plotBuffers/Circle.js +3 -2
- package/es/src/charts/plotBuffers/Line.js +6 -5
- package/es/src/charts/plotBuffers/Rect.js +3 -2
- package/es/src/charts/plotBuffers/Tick.js +12 -0
- package/es/src/charts/plotBuffers/defaultBuffers.js +3 -1
- package/es/src/charts/plotBuffers/rectLikeBuffer.js +4 -3
- package/es/src/charts/viz/Viz.js +32 -18
- package/es/src/charts/viz/VizBase.js +39 -38
- package/es/src/charts/viz/appendRows.js +90 -0
- package/es/src/charts/viz/dataChanged.js +19 -0
- package/es/src/charts/viz/discrete.js +9 -0
- package/es/src/charts/viz/focusTargets.js +25 -5
- package/es/src/charts/viz/groupByLevels.js +48 -0
- package/es/src/charts/viz/groupRow.js +27 -0
- package/es/src/charts/viz/hoverBand.js +40 -0
- package/es/src/charts/viz/interactionOpacity.js +134 -29
- package/es/src/charts/viz/keyboardNav.js +39 -9
- package/es/src/charts/viz/liftRaised.js +84 -0
- package/es/src/charts/viz/nearestHover.js +9 -2
- package/es/src/charts/viz/setCursor.js +12 -0
- package/es/src/charts/viz/simpleHover.js +3 -4
- package/es/src/charts/viz/userClick.js +11 -0
- package/es/src/charts/viz/vizDefaults.js +10 -0
- package/es/src/charts/viz/vizFields.js +7 -0
- package/es/src/charts/viz/vizTypes.js +1 -1
- package/es/src/components/Axis/Axis.js +85 -12
- package/es/src/components/Axis/AxisBottom.js +1 -0
- package/es/src/components/Axis/AxisLeft.js +1 -0
- package/es/src/components/Axis/AxisRight.js +1 -0
- package/es/src/components/Axis/AxisTop.js +1 -0
- package/es/src/components/Axis/axisDefaults.js +7 -0
- package/es/src/components/Axis/axisEndLabels.js +4 -1
- package/es/src/components/Axis/axisLabelSize.js +40 -16
- package/es/src/components/Axis/axisLabelThinning.js +69 -6
- package/es/src/components/Axis/axisLayout.js +5 -0
- package/es/src/components/Axis/axisLayoutLabels.js +11 -5
- package/es/src/components/Axis/axisLayoutScale.js +71 -25
- package/es/src/components/Axis/axisLevels.js +271 -0
- package/es/src/components/Axis/axisLimit.js +6 -0
- package/es/src/components/Axis/axisMinorTicks.js +280 -0
- package/es/src/components/Axis/axisPeriods.js +144 -0
- package/es/src/components/Axis/axisRangeBreaks.js +19 -10
- package/es/src/components/Axis/axisRender.js +71 -29
- package/es/src/components/Axis/axisRounding.js +24 -2
- package/es/src/components/Axis/axisScaleType.js +55 -0
- package/es/src/components/Axis/axisScene.js +90 -5
- package/es/src/components/Axis/axisTickLookups.js +30 -0
- package/es/src/components/Axis/axisTooltipTargets.js +23 -0
- package/es/src/components/Axis/labelSizeSession.js +23 -0
- package/es/src/components/Axis/rangeBreaks.js +10 -4
- package/es/src/components/Axis/timeValues.js +116 -19
- package/es/src/components/ColorScale/ColorScale.js +1 -0
- package/es/src/components/ColorScale/colorScaleScale.js +139 -41
- package/es/src/components/Legend/Legend.js +1 -0
- package/es/src/components/SizeLegend/SizeLegend.js +20 -1
- package/es/src/components/TextBox.js +1 -0
- package/es/src/components/Timeline/Timeline.js +11 -3
- package/es/src/components/Timeline/timelineRender.js +23 -13
- package/es/src/components/Tooltip.js +8 -1
- package/es/src/components/tooltipDom.js +73 -14
- package/es/src/fluent.js +77 -10
- package/es/src/shapes/Area.js +32 -1
- package/es/src/shapes/Bar.js +22 -1
- package/es/src/shapes/Box.js +72 -13
- package/es/src/shapes/Circle.js +1 -0
- package/es/src/shapes/Image.js +8 -1
- package/es/src/shapes/Line.js +45 -1
- package/es/src/shapes/Path.js +1 -0
- package/es/src/shapes/Rect.js +1 -0
- package/es/src/shapes/Shape.js +29 -8
- package/es/src/shapes/Tick.js +54 -0
- package/es/src/shapes/Whisker.js +1 -0
- package/es/src/shapes/boxExtraShapes.js +72 -0
- package/es/src/shapes/boxExtras.js +212 -0
- package/es/src/shapes/boxStyle.js +38 -5
- package/es/src/shapes/buildLabelData.js +2 -0
- package/es/src/shapes/downsample.js +150 -0
- package/es/src/shapes/hitAreaNode.js +6 -2
- package/es/src/shapes/index.js +1 -0
- package/es/src/shapes/pathSeries.js +51 -0
- package/es/src/utils/BaseClass.js +59 -57
- package/es/src/utils/jitter.js +33 -0
- package/es/src/utils/resetSetters.js +66 -0
- package/package.json +10 -10
- package/types/index.d.ts +5 -4
- package/types/internal.d.ts +253 -27
- package/types/src/charts/ArcDiagram/arcGeometry.d.ts +7 -3
- package/types/src/charts/ArcDiagram/arcLoops.d.ts +3 -1
- package/types/src/charts/ArcDiagram/arcNodeBox.d.ts +60 -0
- package/types/src/charts/ArcDiagram/emit.d.ts +5 -4
- package/types/src/charts/BoxWhisker/extras.d.ts +41 -0
- package/types/src/charts/BoxWhisker/summary.d.ts +1 -1
- package/types/src/charts/BoxWhisker/tooltip.d.ts +33 -4
- package/types/src/charts/BubbleChart/emit.d.ts +3 -3
- package/types/src/charts/BubbleMatrix/colorDefaults.d.ts +19 -0
- package/types/src/charts/BubbleMatrix/index.d.ts +18 -0
- package/types/src/charts/BumpChart/areaBump.d.ts +86 -0
- package/types/src/charts/BumpChart/index.d.ts +19 -1
- package/types/src/charts/Calendar/calendarDates.d.ts +8 -1
- package/types/src/charts/Candlestick/periods.d.ts +19 -8
- package/types/src/charts/ConnectedScatter/index.d.ts +17 -0
- package/types/src/charts/CyclePlot/cycleFacet.d.ts +61 -0
- package/types/src/charts/CyclePlot/cycleMeans.d.ts +32 -0
- package/types/src/charts/CyclePlot/cyclePeriods.d.ts +37 -0
- package/types/src/charts/CyclePlot/cycleTooltip.d.ts +47 -0
- package/types/src/charts/CyclePlot/index.d.ts +75 -0
- package/types/src/charts/DensityPlot/densityCurves.d.ts +84 -0
- package/types/src/charts/DensityPlot/densityPoint.d.ts +16 -0
- package/types/src/charts/DensityPlot/index.d.ts +33 -0
- package/types/src/charts/DensityPlot/rug.d.ts +57 -0
- package/types/src/charts/DotPlot/dotLayout.d.ts +95 -0
- package/types/src/charts/DotPlot/facetSize.d.ts +33 -0
- package/types/src/charts/DotPlot/index.d.ts +22 -0
- package/types/src/charts/DotPlot/placements.d.ts +28 -0
- package/types/src/charts/DotPlot/tooltip.d.ts +27 -0
- package/types/src/charts/Dumbbell/arrowGrays.d.ts +33 -0
- package/types/src/charts/Dumbbell/categoryChange.d.ts +66 -0
- package/types/src/charts/Dumbbell/changeEmit.d.ts +71 -0
- package/types/src/charts/Dumbbell/changes.d.ts +64 -0
- package/types/src/charts/Dumbbell/connectors.d.ts +43 -0
- package/types/src/charts/Dumbbell/emit.d.ts +17 -19
- package/types/src/charts/Dumbbell/index.d.ts +6 -2
- package/types/src/charts/Gantt/applyLayout.d.ts +14 -1
- package/types/src/charts/Gantt/criticalPath.d.ts +100 -0
- package/types/src/charts/Gantt/emit.d.ts +17 -1
- package/types/src/charts/Gantt/ganttCalendar.d.ts +37 -0
- package/types/src/charts/Gantt/ganttCritical.d.ts +53 -0
- package/types/src/charts/Gantt/ganttDecor.d.ts +32 -2
- package/types/src/charts/Gantt/ganttRows.d.ts +2 -0
- package/types/src/charts/Gantt/ganttSlack.d.ts +21 -0
- package/types/src/charts/Gantt/ganttTooltip.d.ts +35 -15
- package/types/src/charts/Gantt/index.d.ts +12 -6
- package/types/src/charts/Geomap/applyLayout.d.ts +19 -0
- package/types/src/charts/Geomap/cartogram.d.ts +58 -0
- package/types/src/charts/Geomap/cartogramContiguous.d.ts +59 -0
- package/types/src/charts/Geomap/cartogramFields.d.ts +16 -0
- package/types/src/charts/Geomap/cartogramLabels.d.ts +48 -0
- package/types/src/charts/Geomap/cartogramLayout.d.ts +71 -0
- package/types/src/charts/Geomap/cartogramLegend.d.ts +36 -0
- package/types/src/charts/Geomap/cartogramRelax.d.ts +29 -0
- package/types/src/charts/Geomap/densityEmit.d.ts +29 -0
- package/types/src/charts/Geomap/densityFields.d.ts +27 -0
- package/types/src/charts/Geomap/densityLayout.d.ts +49 -0
- package/types/src/charts/Geomap/densityTooltip.d.ts +48 -0
- package/types/src/charts/Geomap/dotDensity.d.ts +80 -0
- package/types/src/charts/Geomap/dotDensityLayout.d.ts +97 -0
- package/types/src/charts/Geomap/dotRenderer.d.ts +27 -0
- package/types/src/charts/Geomap/drillDown.d.ts +128 -0
- package/types/src/charts/Geomap/drillEmit.d.ts +37 -0
- package/types/src/charts/Geomap/drillEvents.d.ts +33 -0
- package/types/src/charts/Geomap/emit.d.ts +7 -0
- package/types/src/charts/Geomap/flowEmit.d.ts +5 -4
- package/types/src/charts/Geomap/flowLinks.d.ts +12 -1
- package/types/src/charts/Geomap/geoHexbin.d.ts +91 -0
- package/types/src/charts/Geomap/geoHexbinZoom.d.ts +76 -0
- package/types/src/charts/Geomap/index.d.ts +7 -0
- package/types/src/charts/Geomap/pointCluster.d.ts +108 -0
- package/types/src/charts/Geomap/pointClusterEmit.d.ts +106 -0
- package/types/src/charts/Geomap/pointClusterLayout.d.ts +123 -0
- package/types/src/charts/Geomap/pointClusterLinks.d.ts +21 -0
- package/types/src/charts/Geomap/pointClusterZoom.d.ts +89 -0
- package/types/src/charts/Geomap/pointLabels.d.ts +21 -3
- package/types/src/charts/Geomap/pointRows.d.ts +24 -0
- package/types/src/charts/Geomap/tileGrid.d.ts +98 -0
- package/types/src/charts/Geomap/tileState.d.ts +18 -0
- package/types/src/charts/Geomap/topojsonFluent.d.ts +9 -0
- package/types/src/charts/Geomap/topojsonLevels.d.ts +14 -0
- package/types/src/charts/Hexbin/contourLabels.d.ts +6 -5
- package/types/src/charts/Hexbin/settings.d.ts +7 -1
- package/types/src/charts/Histogram/binData.d.ts +6 -0
- package/types/src/charts/HorizonChart/emit.d.ts +20 -0
- package/types/src/charts/HorizonChart/horizonBands.d.ts +42 -0
- package/types/src/charts/HorizonChart/horizonColors.d.ts +25 -0
- package/types/src/charts/HorizonChart/hover.d.ts +52 -0
- package/types/src/charts/HorizonChart/index.d.ts +32 -0
- package/types/src/charts/HorizonChart/measure.d.ts +24 -0
- package/types/src/charts/HorizonChart/rowFilter.d.ts +88 -0
- package/types/src/charts/HorizonChart/state.d.ts +71 -0
- package/types/src/charts/KPI/applyLayout.d.ts +64 -0
- package/types/src/charts/KPI/delta.d.ts +62 -0
- package/types/src/charts/KPI/emit.d.ts +55 -0
- package/types/src/charts/KPI/index.d.ts +34 -0
- package/types/src/charts/KPI/series.d.ts +45 -0
- package/types/src/charts/KPI/tileLayout.d.ts +90 -0
- package/types/src/charts/Matrix/applyLayout.d.ts +2 -1
- package/types/src/charts/Matrix/bubbles.d.ts +87 -0
- package/types/src/charts/Matrix/emit.d.ts +3 -2
- package/types/src/charts/Matrix/index.d.ts +2 -1
- package/types/src/charts/Network/applyLayout.d.ts +24 -0
- package/types/src/charts/Network/bundle.d.ts +23 -16
- package/types/src/charts/Network/circleLayout.d.ts +149 -0
- package/types/src/charts/Network/containNodes.d.ts +35 -0
- package/types/src/charts/Network/emit.d.ts +20 -0
- package/types/src/charts/Network/forceLayout.d.ts +49 -0
- package/types/src/charts/Network/graph.d.ts +18 -2
- package/types/src/charts/Network/liveForce.d.ts +133 -0
- package/types/src/charts/Network/livePositions.d.ts +90 -0
- package/types/src/charts/Network/networkDrag.d.ts +55 -0
- package/types/src/charts/Pareto/color.d.ts +21 -0
- package/types/src/charts/Pareto/hover.d.ts +38 -0
- package/types/src/charts/Pareto/index.d.ts +22 -0
- package/types/src/charts/Pareto/labels.d.ts +40 -0
- package/types/src/charts/Pareto/order.d.ts +30 -0
- package/types/src/charts/Pareto/paretoSteps.d.ts +65 -0
- package/types/src/charts/Pareto/state.d.ts +93 -0
- package/types/src/charts/Parliament/index.d.ts +18 -0
- package/types/src/charts/Plot/areaLabelsAlong.d.ts +7 -0
- package/types/src/charts/Plot/aspectRatio.d.ts +68 -0
- package/types/src/charts/Plot/axisHover.d.ts +2 -0
- package/types/src/charts/Plot/axisHoverScene.d.ts +44 -1
- package/types/src/charts/Plot/barConfidence.d.ts +14 -1
- package/types/src/charts/Plot/barHitArea.d.ts +34 -7
- package/types/src/charts/Plot/barLabelConfidence.d.ts +25 -0
- package/types/src/charts/Plot/baselineBreak.d.ts +2 -1
- package/types/src/charts/Plot/baselineDomain.d.ts +5 -0
- package/types/src/charts/Plot/circleLabels.d.ts +8 -7
- package/types/src/charts/Plot/confidenceAxes.d.ts +63 -0
- package/types/src/charts/Plot/confidenceTooltip.d.ts +22 -0
- package/types/src/charts/Plot/discreteDomain.d.ts +13 -2
- package/types/src/charts/Plot/discreteSpan.d.ts +5 -0
- package/types/src/charts/Plot/domainClip.d.ts +15 -5
- package/types/src/charts/Plot/downsample.d.ts +16 -0
- package/types/src/charts/Plot/index.d.ts +17 -8
- package/types/src/charts/Plot/inferDiscrete.d.ts +31 -0
- package/types/src/charts/Plot/jitter.d.ts +45 -0
- package/types/src/charts/Plot/lineLabelSides.d.ts +19 -0
- package/types/src/charts/Plot/lineLabelsAlong.d.ts +19 -6
- package/types/src/charts/Plot/marginalHover.d.ts +26 -0
- package/types/src/charts/Plot/marginalLayout.d.ts +95 -0
- package/types/src/charts/Plot/marginalPaint.d.ts +54 -0
- package/types/src/charts/Plot/marginalScene.d.ts +67 -0
- package/types/src/charts/Plot/marginalSeries.d.ts +38 -0
- package/types/src/charts/Plot/marginalStats.d.ts +115 -0
- package/types/src/charts/Plot/openDomainEnds.d.ts +25 -0
- package/types/src/charts/Plot/orderPath.d.ts +100 -0
- package/types/src/charts/Plot/orderPathScene.d.ts +49 -0
- package/types/src/charts/Plot/outlierDetect.d.ts +87 -0
- package/types/src/charts/Plot/outlierLabels.d.ts +103 -0
- package/types/src/charts/Plot/outlierLines.d.ts +30 -0
- package/types/src/charts/Plot/outlierScene.d.ts +103 -0
- package/types/src/charts/Plot/outlierTooltip.d.ts +44 -0
- package/types/src/charts/Plot/periodLabels.d.ts +14 -0
- package/types/src/charts/Plot/pipeline.d.ts +2 -1
- package/types/src/charts/Plot/plotBreaks.d.ts +21 -6
- package/types/src/charts/Plot/plotInit.d.ts +7 -25
- package/types/src/charts/Plot/plotLevels.d.ts +120 -0
- package/types/src/charts/Plot/plotRangeBreaks.d.ts +28 -2
- package/types/src/charts/Plot/plotShapes.d.ts +42 -0
- package/types/src/charts/Plot/pointConfidence.d.ts +73 -0
- package/types/src/charts/Plot/pointKey.d.ts +9 -0
- package/types/src/charts/Plot/referenceDomains.d.ts +2 -1
- package/types/src/charts/Plot/shapeAccessors.d.ts +24 -0
- package/types/src/charts/Plot/sharedHover.d.ts +5 -0
- package/types/src/charts/Plot/sharedTooltip.d.ts +24 -6
- package/types/src/charts/Plot/stackEnter.d.ts +1 -1
- package/types/src/charts/Plot/stackLegendOrder.d.ts +4 -1
- package/types/src/charts/Plot/stackNeutral.d.ts +85 -0
- package/types/src/charts/Plot/swarm.d.ts +8 -4
- package/types/src/charts/Plot/timeNestKeys.d.ts +20 -0
- package/types/src/charts/Plot/trendLabels.d.ts +15 -6
- package/types/src/charts/Plot/trendLines.d.ts +40 -8
- package/types/src/charts/Plot/trendMovingAverage.d.ts +78 -0
- package/types/src/charts/Plot/trendProjection.d.ts +4 -2
- package/types/src/charts/Plot/trendTooltip.d.ts +24 -2
- package/types/src/charts/Priestley/timeAxis.d.ts +6 -3
- package/types/src/charts/RadialArea/index.d.ts +17 -0
- package/types/src/charts/RadialLine/angles.d.ts +67 -0
- package/types/src/charts/RadialLine/applyLayout.d.ts +70 -0
- package/types/src/charts/RadialLine/emit.d.ts +13 -0
- package/types/src/charts/RadialLine/index.d.ts +28 -0
- package/types/src/charts/RadialLine/paths.d.ts +37 -0
- package/types/src/charts/RadialLine/points.d.ts +43 -0
- package/types/src/charts/RadialLine/series.d.ts +63 -0
- package/types/src/charts/RadialLine/seriesLabelNodes.d.ts +26 -0
- package/types/src/charts/RadialLine/seriesLabels.d.ts +80 -0
- package/types/src/charts/RadialLine/spokes.d.ts +15 -0
- package/types/src/charts/RadialTree/index.d.ts +16 -0
- package/types/src/charts/Rings/emit.d.ts +6 -5
- package/types/src/charts/Rings/ringsCurves.d.ts +10 -14
- package/types/src/charts/Rings/ringsGraph.d.ts +3 -0
- package/types/src/charts/Rings/ringsSizing.d.ts +5 -2
- package/types/src/charts/Sankey/circularLayout.d.ts +3 -0
- package/types/src/charts/Sankey/sankeyDrag.d.ts +112 -0
- package/types/src/charts/Sankey/sankeyLayout.d.ts +8 -0
- package/types/src/charts/Scatter/index.d.ts +3 -2
- package/types/src/charts/ScatterMatrix/binEmit.d.ts +22 -0
- package/types/src/charts/ScatterMatrix/index.d.ts +80 -0
- package/types/src/charts/ScatterMatrix/matrixData.d.ts +93 -0
- package/types/src/charts/ScatterMatrix/matrixFacet.d.ts +32 -0
- package/types/src/charts/ScatterMatrix/matrixHover.d.ts +21 -0
- package/types/src/charts/ScatterMatrix/matrixTooltip.d.ts +32 -0
- package/types/src/charts/StripPlot/index.d.ts +16 -0
- package/types/src/charts/TileGridMap/index.d.ts +14 -0
- package/types/src/charts/Tree/index.d.ts +2 -2
- package/types/src/charts/Tree/nodeHeight.d.ts +41 -0
- package/types/src/charts/Tree/radialLabels.d.ts +24 -0
- package/types/src/charts/Tree/radialLayout.d.ts +129 -0
- package/types/src/charts/Venn/applyLayout.d.ts +91 -0
- package/types/src/charts/Venn/circles.d.ts +87 -0
- package/types/src/charts/Venn/ellipseFrame.d.ts +37 -0
- package/types/src/charts/Venn/emit.d.ts +36 -0
- package/types/src/charts/Venn/index.d.ts +30 -0
- package/types/src/charts/Venn/nelderMead.d.ts +28 -0
- package/types/src/charts/Venn/tooltip.d.ts +8 -0
- package/types/src/charts/Venn/vennData.d.ts +56 -0
- package/types/src/charts/Venn/vennEllipses.d.ts +93 -0
- package/types/src/charts/Venn/vennFit.d.ts +39 -0
- package/types/src/charts/Venn/vennLayout.d.ts +52 -0
- package/types/src/charts/Venn/vennRegions.d.ts +58 -0
- package/types/src/charts/Waffle/applyLayout.d.ts +4 -1
- package/types/src/charts/Waffle/arcEmit.d.ts +45 -0
- package/types/src/charts/Waffle/arcLayout.d.ts +82 -0
- package/types/src/charts/Waffle/arcStage.d.ts +60 -0
- package/types/src/charts/Waffle/emit.d.ts +2 -1
- package/types/src/charts/Waffle/index.d.ts +8 -2
- package/types/src/charts/Waffle/tooltip.d.ts +7 -2
- package/types/src/charts/Waterfall/connectors.d.ts +3 -2
- package/types/src/charts/WordCloud/applyLayout.d.ts +51 -0
- package/types/src/charts/WordCloud/cloudLayout.d.ts +95 -0
- package/types/src/charts/WordCloud/emit.d.ts +27 -0
- package/types/src/charts/WordCloud/fontScale.d.ts +20 -0
- package/types/src/charts/WordCloud/glyphMask.d.ts +95 -0
- package/types/src/charts/WordCloud/index.d.ts +31 -0
- package/types/src/charts/WordCloud/occupancy.d.ts +59 -0
- package/types/src/charts/WordCloud/rotation.d.ts +31 -0
- package/types/src/charts/WordCloud/size.d.ts +16 -0
- package/types/src/charts/WordCloud/spiral.d.ts +47 -0
- package/types/src/charts/definition/ChartDefinition.d.ts +13 -0
- package/types/src/charts/definition/declaresField.d.ts +9 -0
- package/types/src/charts/definition/makeChart.d.ts +2 -2
- package/types/src/charts/drawSteps/gestureHover.d.ts +2 -2
- package/types/src/charts/drawSteps/leavesSurface.d.ts +11 -0
- package/types/src/charts/drawSteps/selectActions.d.ts +58 -0
- package/types/src/charts/drawSteps/selectGesture.d.ts +60 -0
- package/types/src/charts/drawSteps/selectRegion.d.ts +86 -0
- package/types/src/charts/drawSteps/selectState.d.ts +51 -0
- package/types/src/charts/drawSteps/zoomControls.d.ts +17 -7
- package/types/src/charts/drawSteps/zoomControlsMarkup.d.ts +94 -21
- package/types/src/charts/drawSteps/zoomControlsMenu.d.ts +30 -0
- package/types/src/charts/drawSteps/zoomDrag.d.ts +2 -0
- package/types/src/charts/facet/drawFacets.d.ts +6 -3
- package/types/src/charts/facet/facetConfig.d.ts +35 -1
- package/types/src/charts/facet/facetData.d.ts +8 -2
- package/types/src/charts/facet/facetGrid.d.ts +12 -0
- package/types/src/charts/facet/facetGutter.d.ts +19 -5
- package/types/src/charts/facet/facetLayout.d.ts +79 -0
- package/types/src/charts/facet/facetLayouts.d.ts +21 -0
- package/types/src/charts/facet/facetScene.d.ts +4 -1
- package/types/src/charts/features/annotationFrame.d.ts +2 -0
- package/types/src/charts/features/axesFinal.d.ts +5 -2
- package/types/src/charts/features/bareRegion.d.ts +18 -0
- package/types/src/charts/features/boxGrid.d.ts +28 -0
- package/types/src/charts/features/centerLabel.d.ts +16 -2
- package/types/src/charts/features/circleLabelPlacement.d.ts +81 -11
- package/types/src/charts/features/circleLabels.d.ts +33 -3
- package/types/src/charts/features/colorScaleHover.d.ts +3 -2
- package/types/src/charts/features/colorScaleTooltip.d.ts +4 -9
- package/types/src/charts/features/colorScaleValue.d.ts +6 -0
- package/types/src/charts/features/curvedArrows.d.ts +28 -12
- package/types/src/charts/features/edgeArrows.d.ts +40 -30
- package/types/src/charts/features/emitHelpers.d.ts +6 -1
- package/types/src/charts/features/featuresColorScale.d.ts +6 -0
- package/types/src/charts/features/hoverTicks.d.ts +5 -2
- package/types/src/charts/features/keyHold.d.ts +41 -0
- package/types/src/charts/features/keyTooltip.d.ts +44 -0
- package/types/src/charts/features/labelLayering.d.ts +38 -0
- package/types/src/charts/features/labelSlots.d.ts +53 -0
- package/types/src/charts/features/linkLabelPath.d.ts +0 -7
- package/types/src/charts/features/nodeDrag.d.ts +51 -0
- package/types/src/charts/features/nodeKeys.d.ts +53 -0
- package/types/src/charts/features/nodeOutline.d.ts +34 -0
- package/types/src/charts/features/pathLabelBends.d.ts +78 -0
- package/types/src/charts/features/plotAnnotations.d.ts +2 -1
- package/types/src/charts/features/plotPaint.d.ts +5 -0
- package/types/src/charts/features/rectNodeSize.d.ts +42 -0
- package/types/src/charts/features/ringLabels.d.ts +3 -1
- package/types/src/charts/features/selfLoops.d.ts +10 -9
- package/types/src/charts/features/shapeEmit.d.ts +2 -0
- package/types/src/charts/features/sharedFields.d.ts +8 -4
- package/types/src/charts/features/spokeLabels.d.ts +123 -0
- package/types/src/charts/features/swatchPaint.d.ts +58 -0
- package/types/src/charts/features/thresholdMembers.d.ts +6 -6
- package/types/src/charts/features/tooltipRows.d.ts +50 -0
- package/types/src/charts/features/tooltipSwatch.d.ts +25 -11
- package/types/src/charts/helpers/valueTitle.d.ts +7 -0
- package/types/src/charts/index.d.ts +17 -0
- package/types/src/charts/pipeline/preDrawData.d.ts +26 -0
- package/types/src/charts/plotBuffers/Circle.d.ts +2 -1
- package/types/src/charts/plotBuffers/Rect.d.ts +2 -1
- package/types/src/charts/plotBuffers/Tick.d.ts +9 -0
- package/types/src/charts/plotBuffers/defaultBuffers.d.ts +2 -0
- package/types/src/charts/viz/VizBase.d.ts +32 -1
- package/types/src/charts/viz/appendRows.d.ts +49 -0
- package/types/src/charts/viz/dataChanged.d.ts +11 -0
- package/types/src/charts/viz/discrete.d.ts +19 -0
- package/types/src/charts/viz/focusTargets.d.ts +15 -1
- package/types/src/charts/viz/groupByLevels.d.ts +36 -0
- package/types/src/charts/viz/groupRow.d.ts +6 -0
- package/types/src/charts/viz/hoverBand.d.ts +28 -0
- package/types/src/charts/viz/interactionOpacity.d.ts +23 -2
- package/types/src/charts/viz/keyboardNav.d.ts +13 -0
- package/types/src/charts/viz/liftRaised.d.ts +23 -0
- package/types/src/charts/viz/setCursor.d.ts +12 -0
- package/types/src/charts/viz/simpleHover.d.ts +3 -3
- package/types/src/charts/viz/userClick.d.ts +8 -0
- package/types/src/charts/viz/vizFields.d.ts +7 -0
- package/types/src/charts/viz/vizTypes.d.ts +116 -2
- package/types/src/components/Axis/Axis.d.ts +35 -0
- package/types/src/components/Axis/axisDefaults.d.ts +2 -0
- package/types/src/components/Axis/axisLabelSize.d.ts +3 -3
- package/types/src/components/Axis/axisLabelThinning.d.ts +19 -1
- package/types/src/components/Axis/axisLayoutScale.d.ts +14 -2
- package/types/src/components/Axis/axisLevels.d.ts +137 -0
- package/types/src/components/Axis/axisMinorTicks.d.ts +83 -0
- package/types/src/components/Axis/axisPeriods.d.ts +45 -0
- package/types/src/components/Axis/axisRangeBreaks.d.ts +6 -2
- package/types/src/components/Axis/axisRounding.d.ts +15 -1
- package/types/src/components/Axis/axisScaleType.d.ts +32 -0
- package/types/src/components/Axis/axisScene.d.ts +15 -7
- package/types/src/components/Axis/axisTickLookups.d.ts +26 -0
- package/types/src/components/Axis/axisTooltipTargets.d.ts +16 -4
- package/types/src/components/Axis/labelSizeSession.d.ts +16 -0
- package/types/src/components/Axis/rangeBreaks.d.ts +6 -2
- package/types/src/components/Axis/timeValues.d.ts +48 -2
- package/types/src/components/ColorScale/colorScaleScale.d.ts +45 -0
- package/types/src/components/Tooltip.d.ts +11 -2
- package/types/src/components/tooltipDom.d.ts +24 -0
- package/types/src/fluent.d.ts +30 -1
- package/types/src/shapes/Bar.d.ts +7 -0
- package/types/src/shapes/Box.d.ts +15 -0
- package/types/src/shapes/Shape.d.ts +11 -0
- package/types/src/shapes/Tick.d.ts +20 -0
- package/types/src/shapes/boxExtraShapes.d.ts +40 -0
- package/types/src/shapes/boxExtras.d.ts +85 -0
- package/types/src/shapes/boxStyle.d.ts +25 -4
- package/types/src/shapes/downsample.d.ts +68 -0
- package/types/src/shapes/hitAreaNode.d.ts +2 -1
- package/types/src/shapes/index.d.ts +1 -0
- package/types/src/shapes/pathSeries.d.ts +35 -0
- package/types/src/shapes/shapeConfig.d.ts +70 -2
- package/types/src/utils/BaseClass.d.ts +18 -4
- package/types/src/utils/D3plusConfig.d.ts +991 -85
- package/types/src/utils/index.d.ts +1 -1
- package/types/src/utils/jitter.d.ts +23 -0
- package/types/src/utils/resetSetters.d.ts +23 -0
- package/umd/d3plus-core.full.js +98950 -68731
- package/umd/d3plus-core.full.min.js +2 -2
- package/umd/d3plus-core.js +77484 -48545
- package/umd/d3plus-core.min.js +2 -2
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Multi-level category axes: `x: ["year", "quarter"]` plots each row at
|
|
3
|
+
its quarter within its year. The axis labels each category with its
|
|
4
|
+
innermost level and each outer group once across the categories it
|
|
5
|
+
spans (see the Axis's `levels`), and tooltips name every level.
|
|
6
|
+
*/ import { defaultLevelFormat, hasLevels, levelFormatter, levelText } from "../../components/Axis/axisLevels.js";
|
|
7
|
+
import { fieldAccessor } from "../../utils/fieldAccessor.js";
|
|
8
|
+
/** Joins a category's level values into the one value the axis places. */ const SEPARATOR = "\u001F";
|
|
9
|
+
/** Joins the level names, or values, a tooltip shows (outermost first). */ export const LEVEL_JOIN = " / ";
|
|
10
|
+
/**
|
|
11
|
+
The accessor for a multi-level axis (outermost level first): each row's
|
|
12
|
+
category is its level values joined, so rows with the same quarter in
|
|
13
|
+
different years are different categories.
|
|
14
|
+
@param levels The data keys or accessors of each level, outermost first.
|
|
15
|
+
*/ export function levelAccessor(levels) {
|
|
16
|
+
const read = levels.map((level)=>typeof level === "function" ? level : fieldAccessor(level));
|
|
17
|
+
const seen = new Map();
|
|
18
|
+
const key = (values)=>{
|
|
19
|
+
const joined = values.map(levelText).join(SEPARATOR);
|
|
20
|
+
if (!seen.has(joined)) seen.set(joined, values);
|
|
21
|
+
return joined;
|
|
22
|
+
};
|
|
23
|
+
const category = (d, i)=>key(read.map((fn)=>fn(d, i)));
|
|
24
|
+
category.key = key;
|
|
25
|
+
category.keys = levels.map((level)=>typeof level === "string" ? level : undefined);
|
|
26
|
+
category.values = (value)=>seen.get(`${value}`) ?? `${value}`.split(SEPARATOR);
|
|
27
|
+
return category;
|
|
28
|
+
}
|
|
29
|
+
/** Whether a value is a multi-level axis accessor (see `levelAccessor`). */ export function isLevelAccessor(value) {
|
|
30
|
+
return typeof value === "function" && Array.isArray(value.keys) && typeof value.values === "function";
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
The accessor a Plot's axis reads its levels with, when that axis has
|
|
34
|
+
more than one (see `levelAccessor`).
|
|
35
|
+
@param viz The Plot.
|
|
36
|
+
@param axis The axis.
|
|
37
|
+
*/ export function plotLevels(viz, axis) {
|
|
38
|
+
const value = viz[`_${axis}`];
|
|
39
|
+
return isLevelAccessor(value) ? value : undefined;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
The accessor an `x`/`y` setting plots: the levels' joined categories for
|
|
43
|
+
a list of two or more levels, else the one level's key or accessor.
|
|
44
|
+
@param value The setting.
|
|
45
|
+
*/ export function axisAccessorInput(value) {
|
|
46
|
+
if (!Array.isArray(value)) return value;
|
|
47
|
+
return value.length > 1 ? levelAccessor(value) : value[0];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
How rows merging into one category merge a level's values: the value
|
|
51
|
+
they share, else every distinct one.
|
|
52
|
+
*/ export function sharedValue(rows, value) {
|
|
53
|
+
const values = new Map();
|
|
54
|
+
for (const row of rows){
|
|
55
|
+
const v = value(row);
|
|
56
|
+
// Dates at the same time are the same value.
|
|
57
|
+
const id = v instanceof Date ? +v : v;
|
|
58
|
+
if (!values.has(id)) values.set(id, v);
|
|
59
|
+
}
|
|
60
|
+
const list = Array.from(values.values());
|
|
61
|
+
return list.length === 1 ? list[0] : list;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
A user domain for a Plot axis with each list of level values in it (as
|
|
65
|
+
`[2023, "Q1"]`) read as the category it names; any other value, and the
|
|
66
|
+
domain of an axis with one level, as given.
|
|
67
|
+
@param viz The Plot.
|
|
68
|
+
@param axis The axis.
|
|
69
|
+
@param domain The domain.
|
|
70
|
+
*/ export function levelDomain(viz, axis, domain) {
|
|
71
|
+
const levels = plotLevels(viz, axis);
|
|
72
|
+
return levels ? domain.map((d)=>Array.isArray(d) ? levels.key(d) : d) : domain;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
Keeps each level a Plot's axes read by data key from being summed when
|
|
76
|
+
rows merge (see `sharedValue`), unless `aggs` sets how it merges.
|
|
77
|
+
@param viz The Plot.
|
|
78
|
+
*/ export function levelAggs(viz) {
|
|
79
|
+
for (const axis of [
|
|
80
|
+
"x",
|
|
81
|
+
"y"
|
|
82
|
+
]){
|
|
83
|
+
const levels = plotLevels(viz, axis);
|
|
84
|
+
if (!levels) continue;
|
|
85
|
+
for (const key of levels.keys)if (key !== undefined && !viz.schema.aggs[key]) viz.schema.aggs[key] = sharedValue;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/** Whether every value can be ordered as a number (numbers and Dates). */ const ordered = (values)=>values.every((v)=>typeof v === "number" && !isNaN(v) || v instanceof Date);
|
|
89
|
+
/**
|
|
90
|
+
A multi-level axis's categories with each group's together: grouped by
|
|
91
|
+
their outermost level, then within each group by the next, and so on.
|
|
92
|
+
Groups keep the order their first category has in `categories`, except
|
|
93
|
+
that, with `sort`, a level whose values are all numbers or Dates runs
|
|
94
|
+
in ascending order.
|
|
95
|
+
@param categories The categories, in order.
|
|
96
|
+
@param values Reads a category's level values, outermost first.
|
|
97
|
+
@param sort Whether to sort numeric levels.
|
|
98
|
+
*/ export function orderLevelCategories(categories, values, sort) {
|
|
99
|
+
const paths = categories.map(values);
|
|
100
|
+
const depth = Math.max(0, ...paths.map((path)=>path.length));
|
|
101
|
+
const order = (members, level)=>{
|
|
102
|
+
if (level >= depth || members.length < 2) return members;
|
|
103
|
+
const groups = new Map();
|
|
104
|
+
for (const i of members){
|
|
105
|
+
const value = paths[i][level];
|
|
106
|
+
const key = levelText(value);
|
|
107
|
+
const group = groups.get(key);
|
|
108
|
+
if (group) group.members.push(i);
|
|
109
|
+
else groups.set(key, {
|
|
110
|
+
value,
|
|
111
|
+
members: [
|
|
112
|
+
i
|
|
113
|
+
]
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
const list = Array.from(groups.values());
|
|
117
|
+
if (sort && ordered(list.map((g)=>g.value))) list.sort((a, b)=>+a.value - +b.value);
|
|
118
|
+
return list.flatMap((g)=>order(g.members, level + 1));
|
|
119
|
+
};
|
|
120
|
+
return order(categories.map((_, i)=>i), 0).map((i)=>categories[i]);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
A Plot axis's values with a multi-level axis's groups together (see
|
|
124
|
+
`orderLevelCategories`); numeric levels sort unless the axis has its own
|
|
125
|
+
sort (`xSort`/`ySort`). Any other axis's values are returned as given.
|
|
126
|
+
@param viz The Plot.
|
|
127
|
+
@param axis The axis.
|
|
128
|
+
@param categories Its values, in order.
|
|
129
|
+
*/ export function orderAxisLevels(viz, axis, categories) {
|
|
130
|
+
const levels = plotLevels(viz, axis);
|
|
131
|
+
return levels ? orderLevelCategories(categories, levels.values, !viz.schema[`${axis}Sort`]) : categories;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
The axis config a Plot's axis draws its levels with: `levels` reading
|
|
135
|
+
each category's level values, or `false` for an axis of one level.
|
|
136
|
+
@param viz The Plot.
|
|
137
|
+
@param axis The axis.
|
|
138
|
+
*/ export function levelAxisConfig(viz, axis) {
|
|
139
|
+
const levels = plotLevels(viz, axis);
|
|
140
|
+
return {
|
|
141
|
+
levels: levels ? levels.values : false
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
A multi-level category as text: its innermost level (formatted by the
|
|
146
|
+
axis's `tickFormat`) when it `stands in` for a tick label, else every
|
|
147
|
+
level, outermost first, joined by `LEVEL_JOIN`. Undefined for an axis
|
|
148
|
+
of one level.
|
|
149
|
+
@param viz The Plot.
|
|
150
|
+
@param axis The axis.
|
|
151
|
+
@param value The category.
|
|
152
|
+
@param tick Whether the text stands in for the axis's tick label.
|
|
153
|
+
*/ export function levelAxisValue(viz, axis, value, tick = false) {
|
|
154
|
+
const levels = plotLevels(viz, axis);
|
|
155
|
+
if (!levels) return undefined;
|
|
156
|
+
const path = levels.values(value);
|
|
157
|
+
const config = viz[`_${axis}Config`];
|
|
158
|
+
// The drawn axis writes Dates as its labels do (see `defaultLevelFormat`).
|
|
159
|
+
const drawn = viz[`_${axis}Axis`];
|
|
160
|
+
const ready = drawn && hasLevels(drawn) ? drawn : undefined;
|
|
161
|
+
const user = config?.levelFormat;
|
|
162
|
+
const outer = ready ? levelFormatter(ready) : typeof user === "function" ? (v, level)=>levelText(user(v, level)) : (v)=>levelText(v);
|
|
163
|
+
const plain = ready ? defaultLevelFormat(ready) : (v)=>levelText(v);
|
|
164
|
+
const last = path.length - 1;
|
|
165
|
+
const format = config?.tickFormat;
|
|
166
|
+
const innerText = typeof format === "function" ? levelText(format(path[last])) : plain(path[last], last);
|
|
167
|
+
if (tick) return innerText;
|
|
168
|
+
return [
|
|
169
|
+
...path.slice(0, -1).map((v, level)=>outer(v, level)),
|
|
170
|
+
innerText
|
|
171
|
+
].filter((text)=>text !== "").join(LEVEL_JOIN);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
A multi-level axis's name in a tooltip: the data keys of its levels,
|
|
175
|
+
outermost first, joined by `LEVEL_JOIN` (an accessor level has no
|
|
176
|
+
name). Undefined for an axis of one level.
|
|
177
|
+
@param viz The Plot.
|
|
178
|
+
@param axis The axis.
|
|
179
|
+
*/ export function levelAxisName(viz, axis) {
|
|
180
|
+
const levels = plotLevels(viz, axis);
|
|
181
|
+
if (!levels) return undefined;
|
|
182
|
+
return levels.keys.filter((key)=>key !== undefined).join(LEVEL_JOIN);
|
|
183
|
+
}
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
measured in the time that stays visible.
|
|
6
6
|
*/ import { extent } from "d3-array";
|
|
7
7
|
import { breakStyleOf } from "../../components/Axis/axisBreak.js";
|
|
8
|
+
import { isTimeScaleName } from "../../components/Axis/axisScaleType.js";
|
|
9
|
+
import { configUtc } from "../../components/Axis/timeValues.js";
|
|
8
10
|
import { brokenTimeScale } from "../../components/Axis/brokenTimeScale.js";
|
|
9
11
|
import { normalizeRangeBreaks, rangeBreakTest, rangeBreakTime } from "../../components/Axis/rangeBreaks.js";
|
|
10
12
|
import { warnConfigOnce } from "../../utils/configWarnings.js";
|
|
@@ -16,9 +18,19 @@ import { warnConfigOnce } from "../../utils/configWarnings.js";
|
|
|
16
18
|
];
|
|
17
19
|
/** An axis's `rangeBreaks` rules, from its axis config, when it plots time. */ export function plotRangeBreaks(viz, axis) {
|
|
18
20
|
const config = viz[`_${axis}Config`];
|
|
19
|
-
if (!viz[`_${axis}Time`] && config?.scale
|
|
21
|
+
if (!viz[`_${axis}Time`] && !isTimeScaleName(config?.scale)) return [];
|
|
20
22
|
return normalizeRangeBreaks(config?.rangeBreaks);
|
|
21
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
Whether an axis's config `scale` makes it a time axis without `time`:
|
|
26
|
+
the scale is `"time"` or `"utc"`, and `value` (the first row's) is a
|
|
27
|
+
valid Date or a string that reads as a date. Numbers stay as they are:
|
|
28
|
+
a time scale reads them as timestamps.
|
|
29
|
+
*/ export function scaleTimeAxis(viz, axis, value) {
|
|
30
|
+
const config = viz[`_${axis}Config`];
|
|
31
|
+
const scale = config?.scale;
|
|
32
|
+
return (scale === "time" || scale === "utc") && (value instanceof Date || typeof value === "string") && Number.isFinite(rangeBreakTime(value));
|
|
33
|
+
}
|
|
22
34
|
/**
|
|
23
35
|
Whether an axis's `rangeBreaks` make it a time axis without `time`: the
|
|
24
36
|
axis config has rules, and `value` (the first row's) reads as a date — a
|
|
@@ -31,23 +43,47 @@ import { warnConfigOnce } from "../../utils/configWarnings.js";
|
|
|
31
43
|
return (typeof value === "string" || typeof value === "number") && Number.isFinite(rangeBreakTime(value));
|
|
32
44
|
}
|
|
33
45
|
/**
|
|
34
|
-
The
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
*/ export function timelineRangeBreaks(viz) {
|
|
46
|
+
The axes that plot a chart's `time` values: those whose value on the
|
|
47
|
+
first row equals its time.
|
|
48
|
+
*/ export function timeValueAxes(viz) {
|
|
38
49
|
const row = viz._data?.[0];
|
|
39
50
|
const time = viz.schema.time;
|
|
40
51
|
if (!row || typeof time !== "function") return [];
|
|
41
52
|
const value = time(row, 0);
|
|
42
|
-
|
|
53
|
+
return AXES.filter((axis)=>{
|
|
43
54
|
const read = viz[`_${axis}`];
|
|
44
|
-
|
|
55
|
+
return typeof read === "function" && read(row, 0) === value;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
The `rangeBreaks` a chart's timeline takes by default: those of the axis
|
|
60
|
+
that plots the chart's `time` values (see `timeValueAxes`), else none.
|
|
61
|
+
*/ export function timelineRangeBreaks(viz) {
|
|
62
|
+
for (const axis of timeValueAxes(viz)){
|
|
45
63
|
const config = viz[`_${axis}Config`];
|
|
46
64
|
const rules = normalizeRangeBreaks(config?.rangeBreaks);
|
|
47
65
|
if (rules.length) return rules;
|
|
48
66
|
}
|
|
49
67
|
return [];
|
|
50
68
|
}
|
|
69
|
+
/** Whether a Plot axis reads its time in UTC (its axis config's `utc`). */ export const plotAxisUtc = (viz, axis)=>configUtc(viz[`_${axis}Config`]);
|
|
70
|
+
/**
|
|
71
|
+
Whether a chart reads its dates in UTC: any of its axes does (its axis
|
|
72
|
+
config's `utc`), or its timeline does (see `timelineUtc`). Small-multiple
|
|
73
|
+
titles that show dates follow it.
|
|
74
|
+
*/ export function chartUtc(viz) {
|
|
75
|
+
return AXES.some((axis)=>plotAxisUtc(viz, axis)) || timelineUtc(viz);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
Whether a chart's timeline, and the chart's `time` values, read time in
|
|
79
|
+
UTC: `timelineConfig.utc` when set, else whether an axis that plots the
|
|
80
|
+
`time` values does (see `timeValueAxes`), else the chart's own `utc`
|
|
81
|
+
(such as a Calendar's).
|
|
82
|
+
*/ export function timelineUtc(viz) {
|
|
83
|
+
const config = viz.schema.timelineConfig;
|
|
84
|
+
if (config && config.utc !== undefined) return Boolean(config.utc);
|
|
85
|
+
return timeValueAxes(viz).some((axis)=>plotAxisUtc(viz, axis)) || viz.schema.utc === true;
|
|
86
|
+
}
|
|
51
87
|
/** A plotted time value as a timestamp (`NaN` when it isn't one). */ const timeOf = (v)=>v instanceof Date || typeof v === "number" ? +v : NaN;
|
|
52
88
|
/**
|
|
53
89
|
The rows to draw: those whose time every time axis shows. Rows inside
|
|
@@ -60,7 +96,7 @@ import { warnConfigOnce } from "../../utils/configWarnings.js";
|
|
|
60
96
|
const times = out.map((d)=>timeOf(d[axis])).filter(Number.isFinite);
|
|
61
97
|
if (!times.length) return;
|
|
62
98
|
const [lo, hi] = extent(times);
|
|
63
|
-
const hidden = rangeBreakTest(rules, lo, hi);
|
|
99
|
+
const hidden = rangeBreakTest(rules, lo, hi, plotAxisUtc(viz, axis));
|
|
64
100
|
const kept = out.filter((d)=>!hidden(timeOf(d[axis])));
|
|
65
101
|
if (kept.length < out.length) warnConfigOnce(viz, `rangeBreaks-${axis}`, `Some data falls inside ${axis}Config.rangeBreaks and is not drawn.`);
|
|
66
102
|
out = kept;
|
|
@@ -77,7 +113,8 @@ import { warnConfigOnce } from "../../utils/configWarnings.js";
|
|
|
77
113
|
const config = viz[`_${axis}Config`];
|
|
78
114
|
const { space } = breakStyleOf(config?.breakConfig);
|
|
79
115
|
const broken = brokenTimeScale(rules, {
|
|
80
|
-
space
|
|
116
|
+
space,
|
|
117
|
+
utc: plotAxisUtc(viz, axis)
|
|
81
118
|
});
|
|
82
119
|
broken.domain(scale.domain());
|
|
83
120
|
broken.range(scale.range());
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
What a Plot's shapes ask of the chart around them: bars, areas, and boxes
|
|
3
|
+
stand on a discrete axis (see `inferDiscrete.ts`), bars and areas grow
|
|
4
|
+
from `0` as a BarChart's and AreaPlot's do, and only circles swarm.
|
|
5
|
+
|
|
6
|
+
@module
|
|
7
|
+
*/ import { warnConfigOnce } from "../../utils/configWarnings.js";
|
|
8
|
+
import { declaresField } from "../definition/declaresField.js";
|
|
9
|
+
/** The shapes that stand on a discrete axis, and draw nothing sensible without one. */ const DISCRETE_SHAPES = new Set([
|
|
10
|
+
"Area",
|
|
11
|
+
"Bar",
|
|
12
|
+
"Box"
|
|
13
|
+
]);
|
|
14
|
+
/** The shapes that grow from a baseline of `0` by default. */ const BASELINE_SHAPES = new Set([
|
|
15
|
+
"Area",
|
|
16
|
+
"Bar"
|
|
17
|
+
]);
|
|
18
|
+
/** The shape a swarm packs. */ const CIRCLE = new Set([
|
|
19
|
+
"Circle"
|
|
20
|
+
]);
|
|
21
|
+
/**
|
|
22
|
+
Whether any of a Plot's rows draws one of `shapes`.
|
|
23
|
+
@param viz The Plot.
|
|
24
|
+
@param rows Its data.
|
|
25
|
+
@param shapes The shape names to look for.
|
|
26
|
+
*/ export function drawsAnyShape(viz, rows, shapes) {
|
|
27
|
+
const shape = viz.schema.shape;
|
|
28
|
+
return typeof shape === "function" && rows.some((d, i)=>shapes.has(shape(d, i)));
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
Whether any of a Plot's rows draws a shape that stands on a discrete
|
|
32
|
+
axis: a Bar, Area, or Box.
|
|
33
|
+
@param viz The Plot.
|
|
34
|
+
@param rows Its data.
|
|
35
|
+
*/ export const drawsDiscreteShapes = (viz, rows)=>drawsAnyShape(viz, rows, DISCRETE_SHAPES);
|
|
36
|
+
/**
|
|
37
|
+
The baseline a Plot's bars and areas grow from when neither the chart nor
|
|
38
|
+
the user sets one: `0` when any row draws a Bar or Area, as on a BarChart
|
|
39
|
+
or AreaPlot, else undefined. A chart that declares its own `discrete`
|
|
40
|
+
axis (BumpChart's bands, a Ridgeline's or Violin's curves) lays its
|
|
41
|
+
shapes out itself, and gets none.
|
|
42
|
+
@param viz The Plot.
|
|
43
|
+
@param rows Its data.
|
|
44
|
+
*/ export function shapeBaseline(viz, rows) {
|
|
45
|
+
return viz.schema.baseline === undefined && viz._userBaseline === undefined && !declaresField(viz, "discrete") && drawsAnyShape(viz, rows, BASELINE_SHAPES) ? 0 : undefined;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
The `swarm` a Plot draws with: its setting, which packs only its circles
|
|
49
|
+
(bars, areas, and boxes beside them keep their places), or `false`, with
|
|
50
|
+
a one-time note, when it draws bars, areas, or boxes and no circles,
|
|
51
|
+
leaving nothing to swarm.
|
|
52
|
+
@param viz The Plot.
|
|
53
|
+
*/ export function plotSwarm(viz) {
|
|
54
|
+
const swarm = viz.schema.swarm;
|
|
55
|
+
if (!swarm || swarm === "auto") return swarm;
|
|
56
|
+
const rows = viz._data || [];
|
|
57
|
+
if (!drawsDiscreteShapes(viz, rows) || drawsAnyShape(viz, rows, CIRCLE)) return swarm;
|
|
58
|
+
warnConfigOnce(viz, "swarm-no-circles", "swarm packs a Plot's circles, and this one draws none, so there is nothing to swarm.");
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Error bars for a Plot's points. When `confidence` is set, each Circle
|
|
3
|
+
with a finite bound draws a stroke between its bounds, capped at each
|
|
4
|
+
end: along the value axis from the `confidence` pair (or a `{x, y}`
|
|
5
|
+
setting's value-axis bounds), and along the other axis from a `{x, y}`
|
|
6
|
+
setting's cross bounds, so a point with both draws a cross. The bars
|
|
7
|
+
follow each point where it is drawn (swarmed included) and
|
|
8
|
+
paint beneath it.
|
|
9
|
+
|
|
10
|
+
Like a bar's (see `barConfidence.ts`), a point's error bar is a Path
|
|
11
|
+
stamped as part of its point: the same datum and shape type, and its key
|
|
12
|
+
plus a `::confidence` suffix.
|
|
13
|
+
|
|
14
|
+
@module
|
|
15
|
+
*/ import { finite } from "@d3plus/math";
|
|
16
|
+
import { collectComputed, makeShape, shapeConfigFor } from "../features/emitHelpers.js";
|
|
17
|
+
import { capLength, clampErrorBar, CONFIDENCE_KEY_SUFFIX, errorBarDefaults, errorBarExtent, errorBarPath } from "./barConfidence.js";
|
|
18
|
+
import { confidenceValueAxis } from "./confidenceAxes.js";
|
|
19
|
+
/**
|
|
20
|
+
The SVG path of a point's error bars: a capped stroke between each
|
|
21
|
+
axis's bounds, through the point's center.
|
|
22
|
+
@param bars The point's layout.
|
|
23
|
+
@param cap The cap length, in pixels.
|
|
24
|
+
*/ export function pointErrorPath(bars, cap) {
|
|
25
|
+
let d = "";
|
|
26
|
+
const { x: bx, y: by } = bars.bounds;
|
|
27
|
+
if (by) d += errorBarPath("x", bars.x, cap, bars.y, by.lower, by.upper, by.caps);
|
|
28
|
+
if (bx) d += errorBarPath("y", bars.y, cap, bars.x, bx.lower, bx.upper, bx.caps);
|
|
29
|
+
return d;
|
|
30
|
+
}
|
|
31
|
+
/** One axis's bounds in pixels, held inside the axis's domain. */ function axisBounds(ctx, axis, lower, upper, at) {
|
|
32
|
+
if (!finite(lower) && !finite(upper)) return undefined;
|
|
33
|
+
const scale = axis === "x" ? ctx.x : ctx.y;
|
|
34
|
+
const px = (v)=>finite(v) ? scale(v) : undefined;
|
|
35
|
+
const extent = errorBarExtent(ctx, axis, scale);
|
|
36
|
+
const { lower: l, upper: u, caps } = clampErrorBar(px(lower), px(upper), at, axis === confidenceValueAxis(ctx.viz) ? extent : undefined);
|
|
37
|
+
return {
|
|
38
|
+
lower: l,
|
|
39
|
+
upper: u,
|
|
40
|
+
caps
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
The error bars of the point `d` drawn at `x`, `y` with radius `r`, in
|
|
45
|
+
pixels; null when it has no finite bound or the chart no `confidence`.
|
|
46
|
+
*/ function pointBars(ctx, d, key, x, y, r) {
|
|
47
|
+
const { viz } = ctx;
|
|
48
|
+
if (!viz._confidence && !viz._confidenceCross) return null;
|
|
49
|
+
const valueAxis = confidenceValueAxis(viz);
|
|
50
|
+
const crossAxis = valueAxis === "y" ? "x" : "y";
|
|
51
|
+
const at = {
|
|
52
|
+
x,
|
|
53
|
+
y
|
|
54
|
+
};
|
|
55
|
+
const value = axisBounds(ctx, valueAxis, d.lci, d.hci, at[valueAxis]);
|
|
56
|
+
const cross = axisBounds(ctx, crossAxis, d.clci, d.chci, at[crossAxis]);
|
|
57
|
+
if (!value && !cross) return null;
|
|
58
|
+
return {
|
|
59
|
+
key,
|
|
60
|
+
x,
|
|
61
|
+
y,
|
|
62
|
+
size: r * 2,
|
|
63
|
+
bounds: {
|
|
64
|
+
[valueAxis]: value,
|
|
65
|
+
[crossAxis]: cross
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/** Measures each painted point that has a finite bound. */ function layoutPointBars(ctx, nodes) {
|
|
70
|
+
const out = new Map();
|
|
71
|
+
for (const node of nodes){
|
|
72
|
+
if (node.type !== "circle" || `${node.key}`.endsWith("::hit")) continue;
|
|
73
|
+
const d = node.datum;
|
|
74
|
+
if (!d || out.has(d)) continue;
|
|
75
|
+
const t = node.transform ?? {};
|
|
76
|
+
const x = (t.x ?? 0) + node.cx, y = (t.y ?? 0) + node.cy;
|
|
77
|
+
const bars = pointBars(ctx, d, node.key, x, y, node.r);
|
|
78
|
+
if (bars) out.set(d, bars);
|
|
79
|
+
}
|
|
80
|
+
return out;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
The boxes a point's error bars cover: one per stroke (the line along each
|
|
84
|
+
bounded axis, and each cap), widened by half the stroke's width on every
|
|
85
|
+
side.
|
|
86
|
+
@param bars The point's layout.
|
|
87
|
+
@param cap The cap length, in pixels.
|
|
88
|
+
@param strokeWidth The error bars' stroke width, in pixels.
|
|
89
|
+
*/ export function pointErrorBoxes(bars, cap, strokeWidth) {
|
|
90
|
+
const pad = Math.max(0, strokeWidth) / 2;
|
|
91
|
+
const half = cap / 2;
|
|
92
|
+
const boxes = [];
|
|
93
|
+
const segment = (x1, y1, x2, y2)=>boxes.push({
|
|
94
|
+
x: Math.min(x1, x2) - pad,
|
|
95
|
+
y: Math.min(y1, y2) - pad,
|
|
96
|
+
width: Math.abs(x2 - x1) + pad * 2,
|
|
97
|
+
height: Math.abs(y2 - y1) + pad * 2
|
|
98
|
+
});
|
|
99
|
+
for (const axis of [
|
|
100
|
+
"x",
|
|
101
|
+
"y"
|
|
102
|
+
]){
|
|
103
|
+
const b = bars.bounds[axis];
|
|
104
|
+
if (!b) continue;
|
|
105
|
+
const at = bars[axis], across = axis === "y" ? bars.x : bars.y;
|
|
106
|
+
const a = finite(b.lower) ? b.lower : at;
|
|
107
|
+
const z = finite(b.upper) ? b.upper : at;
|
|
108
|
+
const line = (u1, v1, u2, v2)=>axis === "y" ? segment(v1, u1, v2, u2) : segment(u1, v1, u2, v2);
|
|
109
|
+
line(a, across, z, across);
|
|
110
|
+
for (const [bound, capped] of [
|
|
111
|
+
[
|
|
112
|
+
b.lower,
|
|
113
|
+
b.caps.lower
|
|
114
|
+
],
|
|
115
|
+
[
|
|
116
|
+
b.upper,
|
|
117
|
+
b.caps.upper
|
|
118
|
+
]
|
|
119
|
+
])if (finite(bound) && capped && half > 0) line(bound, across - half, bound, across + half);
|
|
120
|
+
}
|
|
121
|
+
return boxes;
|
|
122
|
+
}
|
|
123
|
+
/** The point error bars' style: `confidenceConfig` over the library's, for Circles. */ function pointBarConfig(ctx) {
|
|
124
|
+
const { viz } = ctx;
|
|
125
|
+
return shapeConfigFor(viz, "Circle", {
|
|
126
|
+
...errorBarDefaults(viz, "Circle"),
|
|
127
|
+
capWidth: "100%",
|
|
128
|
+
...viz._confidenceConfig ?? {}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
/** A config value, or an accessor's value for a row. */ const valueFor = (v, d, i)=>typeof v === "function" ? v(d, i) : v;
|
|
132
|
+
/**
|
|
133
|
+
The boxes every point's error bars cover, for labels beside points to
|
|
134
|
+
keep clear of (see `plotCircleLabels`). Empty when the chart draws none.
|
|
135
|
+
@param ctx The Plot shape-emit context the points are drawn with.
|
|
136
|
+
@param points Each point's row and its center and radius, in pixels.
|
|
137
|
+
*/ export function pointErrorObstacles(ctx, points) {
|
|
138
|
+
const { viz } = ctx;
|
|
139
|
+
if (!viz._confidence && !viz._confidenceCross) return [];
|
|
140
|
+
const config = pointBarConfig(ctx);
|
|
141
|
+
return points.flatMap(({ d, x, y, r }, i)=>{
|
|
142
|
+
const bars = pointBars(ctx, d, "", x, y, r);
|
|
143
|
+
if (!bars) return [];
|
|
144
|
+
const cap = capLength(valueFor(config.capWidth, d, i), bars.size);
|
|
145
|
+
const width = Number(valueFor(config.strokeWidth, d, i));
|
|
146
|
+
return pointErrorBoxes(bars, cap, Number.isFinite(width) ? width : 1);
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
Emits the error bars of a Plot's painted points, styled by
|
|
151
|
+
`confidenceConfig` (its top-level keys, overlaid by any nested under
|
|
152
|
+
`Circle`); a cap is as wide as its point unless `capWidth` sets it.
|
|
153
|
+
Empty when no point has a finite bound.
|
|
154
|
+
@param ctx The Plot shape-emit context the points were drawn with.
|
|
155
|
+
@param nodes The points' scene nodes.
|
|
156
|
+
*/ export function emitPointConfidence(ctx, nodes) {
|
|
157
|
+
const { viz } = ctx;
|
|
158
|
+
if (!viz._confidence && !viz._confidenceCross) return [];
|
|
159
|
+
const layouts = layoutPointBars(ctx, nodes);
|
|
160
|
+
if (!layouts.size) return [];
|
|
161
|
+
const config = pointBarConfig(ctx);
|
|
162
|
+
const capWidth = config.capWidth;
|
|
163
|
+
delete config.capWidth;
|
|
164
|
+
delete config.tooltip;
|
|
165
|
+
const layoutOf = (d)=>layouts.get(d);
|
|
166
|
+
const path = makeShape("Path").renderMode("compute").config(config).config({
|
|
167
|
+
d: (d, i)=>{
|
|
168
|
+
const l = layoutOf(d);
|
|
169
|
+
const cap = typeof capWidth === "function" ? capWidth(d, i) : capWidth;
|
|
170
|
+
return pointErrorPath(l, capLength(cap, l.size));
|
|
171
|
+
},
|
|
172
|
+
fill: "none",
|
|
173
|
+
hitArea: {
|
|
174
|
+
"stroke-width": 10
|
|
175
|
+
},
|
|
176
|
+
id: (d)=>`${layoutOf(d).key}${CONFIDENCE_KEY_SUFFIX}`,
|
|
177
|
+
label: false,
|
|
178
|
+
x: 0,
|
|
179
|
+
y: 0
|
|
180
|
+
}).data(Array.from(layouts.keys()));
|
|
181
|
+
viz._wirePlotShapeEvents(path, "Circle", ctx.events);
|
|
182
|
+
return collectComputed(path).map((node)=>({
|
|
183
|
+
...node,
|
|
184
|
+
shapeType: "Circle"
|
|
185
|
+
}));
|
|
186
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { vizDiscrete } from "../viz/discrete.js";
|
|
2
|
+
/**
|
|
3
|
+
The key a Plot's lines and areas give each point (see `Line.pointKey`):
|
|
4
|
+
its value on the discrete axis (or that axis's secondary axis), so a
|
|
5
|
+
redraw with more or fewer rows slides them along.
|
|
6
|
+
@param viz The chart.
|
|
7
|
+
*/ export function plotPointKey(viz) {
|
|
8
|
+
const axis = vizDiscrete(viz) === "y" ? "y" : "x";
|
|
9
|
+
return (d)=>d[`${axis}2`] ?? d[axis];
|
|
10
|
+
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
time axis into view. A domain end the user set stays put.
|
|
5
5
|
*/ import { date } from "@d3plus/dom";
|
|
6
6
|
import { expandReferenceBands, expandReferenceLines, REFERENCE_BAND, REFERENCE_LINE, referenceAxis } from "../features/referenceAnnotations.js";
|
|
7
|
+
import { plotAxisUtc } from "./plotRangeBreaks.js";
|
|
7
8
|
/**
|
|
8
9
|
The data-unit values reference lines and bands place on each axis, from
|
|
9
10
|
a list of annotations (`"plot"`-fraction entries and other kinds left
|
|
@@ -28,10 +29,12 @@ import { expandReferenceBands, expandReferenceLines, REFERENCE_BAND, REFERENCE_L
|
|
|
28
29
|
});
|
|
29
30
|
return out;
|
|
30
31
|
}
|
|
31
|
-
/** A value as a number on a continuous or time axis, or NaN. */ function numeric(value, time) {
|
|
32
|
+
/** A value as a number on a continuous or time axis, or NaN. */ function numeric(value, time, utc = false) {
|
|
32
33
|
if (value === undefined || value === null || value === "") return NaN;
|
|
33
34
|
if (time) {
|
|
34
|
-
const d = value instanceof Date ? value : date(value
|
|
35
|
+
const d = value instanceof Date ? value : date(value, {
|
|
36
|
+
utc
|
|
37
|
+
});
|
|
35
38
|
return d instanceof Date ? +d : NaN;
|
|
36
39
|
}
|
|
37
40
|
return typeof value === "number" || typeof value === "string" ? Number(value) : NaN;
|
|
@@ -43,16 +46,16 @@ import { expandReferenceBands, expandReferenceLines, REFERENCE_BAND, REFERENCE_L
|
|
|
43
46
|
itself when nothing changes.
|
|
44
47
|
@param domain The axis's `[start, end]` domain.
|
|
45
48
|
@param values The values to take in.
|
|
46
|
-
@param options Whether the axis is a time or log axis, and which ends may move.
|
|
49
|
+
@param options Whether the axis is a time (read in UTC, with `utc`) or log axis, and which ends may move.
|
|
47
50
|
*/ export function widenToValues(domain, values, options = {}) {
|
|
48
|
-
const { time = false, log = false, open = [
|
|
51
|
+
const { time = false, utc = false, log = false, open = [
|
|
49
52
|
true,
|
|
50
53
|
true
|
|
51
54
|
] } = options;
|
|
52
55
|
if (!domain || domain.length !== 2 || !values.length) return domain;
|
|
53
|
-
const ends = domain.map((d)=>numeric(d, time));
|
|
56
|
+
const ends = domain.map((d)=>numeric(d, time, utc));
|
|
54
57
|
if (!ends.every(Number.isFinite)) return domain;
|
|
55
|
-
const nums = values.map((v)=>numeric(v, time)).filter((n)=>Number.isFinite(n) && (!log || n > 0));
|
|
58
|
+
const nums = values.map((v)=>numeric(v, time, utc)).filter((n)=>Number.isFinite(n) && (!log || n > 0));
|
|
56
59
|
if (!nums.length) return domain;
|
|
57
60
|
const ascending = ends[0] <= ends[1];
|
|
58
61
|
const [loAt, hiAt] = ascending ? [
|
|
@@ -107,6 +110,7 @@ import { expandReferenceBands, expandReferenceLines, REFERENCE_BAND, REFERENCE_L
|
|
|
107
110
|
const values = referenceDomainValues([
|
|
108
111
|
...expandReferenceBands(viz.schema.referenceBands),
|
|
109
112
|
...expandReferenceLines(viz.schema.referenceLines),
|
|
113
|
+
...expandReferenceLines(viz._plotReferenceLines?.()),
|
|
110
114
|
...viz._annotations || []
|
|
111
115
|
]);
|
|
112
116
|
const out = {
|
|
@@ -125,6 +129,7 @@ import { expandReferenceBands, expandReferenceLines, REFERENCE_BAND, REFERENCE_L
|
|
|
125
129
|
const given = axis.length === 1 ? user[axis] ?? config : viz.schema[`${axis}Domain`] ?? config;
|
|
126
130
|
out[axis] = widenToValues(domain, values[axis], {
|
|
127
131
|
time: scales[axis].type === "Time",
|
|
132
|
+
utc: plotAxisUtc(viz, axis),
|
|
128
133
|
log: scales[axis].config === "log",
|
|
129
134
|
open: openDomainEnds(given)
|
|
130
135
|
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
A Plot reads the per-datum keys of its `shapeConfig` (a shape's `width`,
|
|
3
|
+
`height`, `r`, `x`, `y`, and `id`) as the Shape's own setters do: a
|
|
4
|
+
function as given, a string as the data field to read from each row, and
|
|
5
|
+
any other value as a constant.
|
|
6
|
+
*/ import accessor from "../../utils/accessor.js";
|
|
7
|
+
import constant from "../../utils/constant.js";
|
|
8
|
+
/** The keys a Shape reads per datum through an accessor (each is `coerce: "accessor"` on the Shape). */ const ACCESSOR_KEYS = [
|
|
9
|
+
"height",
|
|
10
|
+
"id",
|
|
11
|
+
"r",
|
|
12
|
+
"width",
|
|
13
|
+
"x",
|
|
14
|
+
"y"
|
|
15
|
+
];
|
|
16
|
+
/**
|
|
17
|
+
One accessor key's value as a function: a function as given, a string as
|
|
18
|
+
the data field it names, and anything else (but `undefined`) as a
|
|
19
|
+
constant.
|
|
20
|
+
@param value The key's value.
|
|
21
|
+
*/ export function shapeAccessor(value) {
|
|
22
|
+
if (value === undefined || typeof value === "function") return value;
|
|
23
|
+
return typeof value === "string" ? accessor(value) : constant(value);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
A copy of one shape's config (`shapeConfig.Rect`, or the shared keys)
|
|
27
|
+
with each accessor key made a function (see `shapeAccessor`); every other
|
|
28
|
+
key is kept as given.
|
|
29
|
+
@param config The shape's config.
|
|
30
|
+
*/ export function withShapeAccessors(config) {
|
|
31
|
+
if (!config || typeof config !== "object") return undefined;
|
|
32
|
+
const out = {
|
|
33
|
+
...config
|
|
34
|
+
};
|
|
35
|
+
for (const key of ACCESSOR_KEYS)if (key in out) out[key] = shapeAccessor(out[key]);
|
|
36
|
+
return out;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
A copy of a Plot's `shapeConfig` with the accessor keys made functions
|
|
40
|
+
(see `shapeAccessor`), both the shared ones and those of each shape
|
|
41
|
+
(`Rect`, `Circle`, …). Nested configs such as `labelConfig` are kept as
|
|
42
|
+
given.
|
|
43
|
+
@param shapeConfig The Plot's shape config.
|
|
44
|
+
*/ export function plotShapeAccessors(shapeConfig) {
|
|
45
|
+
const out = withShapeAccessors(shapeConfig);
|
|
46
|
+
if (!out) return shapeConfig;
|
|
47
|
+
for (const key of Object.keys(out)){
|
|
48
|
+
const value = out[key];
|
|
49
|
+
if (/^[A-Z]/.test(key) && value && typeof value === "object" && !Array.isArray(value)) out[key] = withShapeAccessors(value);
|
|
50
|
+
}
|
|
51
|
+
return out;
|
|
52
|
+
}
|