@d3plus/core 4.10.0 → 4.11.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 +1 -1
- package/es/internal.js +167 -8
- package/es/src/charts/Alluvial/aggregate.js +145 -0
- package/es/src/charts/Alluvial/applyLayout.js +125 -0
- package/es/src/charts/Alluvial/dimensions.js +56 -0
- package/es/src/charts/Alluvial/emit.js +73 -0
- package/es/src/charts/Alluvial/hover.js +101 -0
- package/es/src/charts/Alluvial/index.js +170 -0
- package/es/src/charts/Alluvial/layout.js +137 -0
- package/es/src/charts/Alluvial/meta.js +57 -0
- package/es/src/charts/Alluvial/titles.js +81 -0
- package/es/src/charts/ArcDiagram/applyLayout.js +386 -0
- package/es/src/charts/ArcDiagram/arcGeometry.js +275 -0
- package/es/src/charts/ArcDiagram/arcLabels.js +171 -0
- package/es/src/charts/ArcDiagram/arcLoops.js +78 -0
- package/es/src/charts/ArcDiagram/emit.js +178 -0
- package/es/src/charts/ArcDiagram/events.js +144 -0
- package/es/src/charts/ArcDiagram/index.js +215 -0
- package/es/src/charts/BarChart/index.js +14 -2
- package/es/src/charts/BoxWhisker/index.js +22 -0
- package/es/src/charts/BubbleChart/emit.js +31 -0
- package/es/src/charts/BubbleChart/index.js +54 -0
- package/es/src/charts/Calendar/emit.js +1 -1
- package/es/src/charts/Calendar/index.js +3 -2
- package/es/src/charts/Candlestick/buffer.js +6 -4
- package/es/src/charts/Candlestick/index.js +2 -1
- package/es/src/charts/Chord/applyLayout.js +56 -69
- package/es/src/charts/Chord/emit.js +55 -24
- package/es/src/charts/Chord/index.js +14 -10
- package/es/src/charts/Chord/labels.js +105 -0
- package/es/src/charts/Donut/index.js +5 -11
- package/es/src/charts/Dumbbell/index.js +2 -4
- package/es/src/charts/Gantt/applyLayout.js +162 -0
- package/es/src/charts/Gantt/emit.js +142 -0
- package/es/src/charts/Gantt/ganttDecor.js +207 -0
- package/es/src/charts/Gantt/ganttGeometry.js +107 -0
- package/es/src/charts/Gantt/ganttLabels.js +85 -0
- package/es/src/charts/Gantt/ganttRows.js +111 -0
- package/es/src/charts/Gantt/ganttTooltip.js +136 -0
- package/es/src/charts/Gantt/index.js +219 -0
- package/es/src/charts/Geomap/applyLayout.js +90 -49
- package/es/src/charts/Geomap/basemapTheme.js +3 -48
- package/es/src/charts/Geomap/emit.js +19 -2
- package/es/src/charts/Geomap/flowEmit.js +132 -0
- package/es/src/charts/Geomap/flowEvents.js +86 -0
- package/es/src/charts/Geomap/flowFields.js +91 -0
- package/es/src/charts/Geomap/flowGeometry.js +225 -0
- package/es/src/charts/Geomap/flowLinks.js +239 -0
- package/es/src/charts/Geomap/geoCache.js +180 -0
- package/es/src/charts/Geomap/globeKeys.js +131 -0
- package/es/src/charts/Geomap/globeRotate.js +208 -0
- package/es/src/charts/Geomap/index.js +51 -16
- package/es/src/charts/Geomap/pointLabels.js +107 -0
- package/es/src/charts/Hexbin/binning.js +103 -0
- package/es/src/charts/Hexbin/buffer.js +33 -0
- package/es/src/charts/Hexbin/contourLabels.js +234 -0
- package/es/src/charts/Hexbin/contours.js +48 -0
- package/es/src/charts/Hexbin/emit.js +142 -0
- package/es/src/charts/Hexbin/index.js +204 -0
- package/es/src/charts/Hexbin/layers.js +212 -0
- package/es/src/charts/Hexbin/settings.js +86 -0
- package/es/src/charts/Hexbin/tooltip.js +77 -0
- package/es/src/charts/Histogram/binData.js +31 -4
- package/es/src/charts/Histogram/index.js +32 -15
- package/es/src/charts/Histogram/labels.js +18 -0
- package/es/src/charts/Icicle/index.js +3 -3
- package/es/src/charts/LinePlot/index.js +7 -0
- package/es/src/charts/Marimekko/index.js +7 -4
- package/es/src/charts/Network/applyLayout.js +138 -94
- package/es/src/charts/Network/bundle.js +81 -0
- package/es/src/charts/Network/clusterLabels.js +423 -0
- package/es/src/charts/Network/clusters.js +290 -0
- package/es/src/charts/Network/emit.js +253 -70
- package/es/src/charts/Network/graph.js +117 -0
- package/es/src/charts/Network/graphFluent.js +79 -0
- package/es/src/charts/Network/index.js +86 -106
- package/es/src/charts/Network/minNodeDistance.js +64 -0
- package/es/src/charts/Network/polygonRows.js +44 -0
- package/es/src/charts/Pack/index.js +5 -1
- package/es/src/charts/Pie/applyLayout.js +86 -27
- package/es/src/charts/Pie/arcFit.js +152 -0
- package/es/src/charts/Pie/curvedLabels.js +134 -0
- package/es/src/charts/Pie/emit.js +43 -96
- package/es/src/charts/Pie/index.js +64 -31
- package/es/src/charts/Pie/labelRoom.js +154 -0
- package/es/src/charts/Pie/outsideLabels.js +224 -0
- package/es/src/charts/Pie/outsideNodes.js +267 -0
- package/es/src/charts/Pie/pieLabels.js +137 -0
- package/es/src/charts/Pie/sectorBox.js +223 -0
- package/es/src/charts/Pie/straightLabels.js +96 -0
- package/es/src/charts/Pie/straightLayout.js +215 -0
- package/es/src/charts/Plot/alongLegend.js +76 -0
- package/es/src/charts/Plot/areaLabelsAlong.js +333 -0
- package/es/src/charts/Plot/axisHoverScene.js +2 -1
- package/es/src/charts/Plot/axisValues.js +43 -0
- package/es/src/charts/Plot/barWidth.js +59 -11
- package/es/src/charts/Plot/circleLabels.js +98 -0
- package/es/src/charts/Plot/connectGaps.js +237 -0
- package/es/src/charts/Plot/connectGapsScene.js +188 -0
- package/es/src/charts/Plot/draw.js +8 -2
- package/es/src/charts/Plot/fillBetween.js +2 -1
- package/es/src/charts/Plot/forecastScene.js +3 -4
- package/es/src/charts/Plot/index.js +18 -10
- package/es/src/charts/Plot/labelPlacement.js +1 -1
- package/es/src/charts/Plot/lineLabelEmit.js +82 -0
- package/es/src/charts/Plot/lineLabelSides.js +51 -0
- package/es/src/charts/Plot/lineLabelSpread.js +65 -0
- package/es/src/charts/Plot/lineLabelsAlong.js +282 -0
- package/es/src/charts/Plot/pipeline.js +66 -19
- package/es/src/charts/Plot/pipelineAxisLayout.js +5 -1
- package/es/src/charts/Plot/pipelineDomains.js +16 -3
- package/es/src/charts/Plot/pipelineLineLabels.js +144 -52
- package/es/src/charts/Plot/pipelineScales.js +40 -8
- package/es/src/charts/Plot/plotFacet.js +12 -1
- package/es/src/charts/Plot/plotInit.js +34 -5
- package/es/src/charts/Plot/plotRangeBreaks.js +85 -0
- package/es/src/charts/Plot/referenceDomains.js +133 -0
- package/es/src/charts/Plot/shapeDefaults.js +10 -5
- package/es/src/charts/Plot/stackLegendOrder.js +176 -0
- package/es/src/charts/Plot/trendLabels.js +183 -0
- package/es/src/charts/Plot/trendLines.js +1 -0
- package/es/src/charts/Plot/trendScene.js +6 -3
- package/es/src/charts/Plot/trendTooltip.js +5 -1
- package/es/src/charts/PolarArea/index.js +2 -2
- package/es/src/charts/Priestley/applyLayout.js +14 -20
- package/es/src/charts/Priestley/index.js +4 -35
- package/es/src/charts/Priestley/timeAxis.js +100 -0
- package/es/src/charts/Radar/axisDecorations.js +49 -12
- package/es/src/charts/Radar/curvedLabels.js +187 -0
- package/es/src/charts/Radar/index.js +2 -3
- package/es/src/charts/RadialBar/curvedLabels.js +111 -0
- package/es/src/charts/RadialBar/emit.js +4 -1
- package/es/src/charts/RadialBar/index.js +16 -9
- package/es/src/charts/RadialBar/trackLayout.js +43 -13
- package/es/src/charts/RadialMatrix/index.js +3 -7
- package/es/src/charts/Rings/applyLayout.js +41 -24
- package/es/src/charts/Rings/emit.js +174 -58
- package/es/src/charts/Rings/index.js +61 -28
- package/es/src/charts/Rings/ringsGraph.js +28 -9
- package/es/src/charts/Rings/ringsLoops.js +73 -0
- package/es/src/charts/Rings/ringsParallel.js +166 -0
- package/es/src/charts/Sankey/applyLayout.js +116 -39
- package/es/src/charts/Sankey/circularLayout.js +208 -0
- package/es/src/charts/Sankey/circularLinks.js +301 -0
- package/es/src/charts/Sankey/emit.js +164 -94
- package/es/src/charts/Sankey/index.js +72 -75
- package/es/src/charts/Sankey/labels.js +80 -0
- package/es/src/charts/Sankey/ribbons.js +88 -0
- package/es/src/charts/Sankey/sankeyCycles.js +117 -0
- package/es/src/charts/Sankey/sankeyLayout.js +8 -3
- package/es/src/charts/Sankey/sankeyLinks.js +47 -0
- package/es/src/charts/Scatter/index.js +25 -0
- package/es/src/charts/SlopeChart/index.js +116 -0
- package/es/src/charts/SlopeChart/slope.js +95 -0
- package/es/src/charts/Streamgraph/index.js +51 -0
- package/es/src/charts/Sunburst/curvedLabels.js +74 -0
- package/es/src/charts/Sunburst/emit.js +74 -63
- package/es/src/charts/Sunburst/index.js +3 -3
- package/es/src/charts/Tree/index.js +2 -6
- package/es/src/charts/Treemap/index.js +2 -5
- package/es/src/charts/Violin/inner.js +3 -5
- package/es/src/charts/definition/makeChart.js +10 -2
- package/es/src/charts/drawSteps/backControl.js +17 -5
- package/es/src/charts/drawSteps/gestureHover.js +79 -0
- package/es/src/charts/drawSteps/minimap.js +6 -5
- package/es/src/charts/drawSteps/minimapMarkup.js +25 -9
- package/es/src/charts/drawSteps/searchControls.js +2 -1
- package/es/src/charts/drawSteps/searchControlsMarkup.js +11 -2
- package/es/src/charts/drawSteps/tableViewMarkup.js +17 -10
- package/es/src/charts/drawSteps/zoomControls.js +21 -5
- package/es/src/charts/events/click.legend.js +7 -2
- package/es/src/charts/events/click.shape.js +8 -1
- package/es/src/charts/events/mousemove.shape.js +5 -2
- package/es/src/charts/facet/drawFacets.js +14 -5
- package/es/src/charts/features/annotationFrame.js +179 -0
- package/es/src/charts/features/annotationText.js +83 -0
- package/es/src/charts/features/annotationTypes.js +10 -0
- package/es/src/charts/features/attributionFeature.js +6 -11
- package/es/src/charts/features/axes.js +2 -1
- package/es/src/charts/features/axesFinal.js +3 -1
- package/es/src/charts/features/axesMeasure.js +7 -4
- package/es/src/charts/features/calloutLayout.js +121 -0
- package/es/src/charts/features/calloutScene.js +155 -0
- package/es/src/charts/features/chartGeometry.js +1 -1
- package/es/src/charts/features/circleLabelPlacement.js +297 -0
- package/es/src/charts/features/circleLabels.js +207 -0
- package/es/src/charts/features/colorScaleBucket.js +2 -1
- package/es/src/charts/features/colorScaleHover.js +3 -2
- package/es/src/charts/features/colorScaleValue.js +97 -0
- package/es/src/charts/features/curvedArrows.js +158 -0
- package/es/src/charts/features/edgeArrows.js +160 -4
- package/es/src/charts/features/edgeBundling.js +442 -0
- package/es/src/charts/features/edgeBundlingSmooth.js +117 -0
- package/es/src/charts/features/ensureZoomDom.js +32 -8
- package/es/src/charts/features/features.js +32 -14
- package/es/src/charts/features/featuresColorScale.js +20 -6
- package/es/src/charts/features/featuresLegend.js +15 -24
- package/es/src/charts/features/legendKeys.js +64 -0
- package/es/src/charts/features/lineLabels.js +55 -46
- package/es/src/charts/features/linkBundle.js +19 -0
- package/es/src/charts/features/linkColor.js +72 -0
- package/es/src/charts/features/linkFields.js +86 -0
- package/es/src/charts/features/linkFocus.js +118 -0
- package/es/src/charts/features/linkInteraction.js +312 -0
- package/es/src/charts/features/linkKeys.js +20 -0
- package/es/src/charts/features/linkLabelGeometry.js +209 -0
- package/es/src/charts/features/linkLabelPath.js +162 -0
- package/es/src/charts/features/linkLabels.js +340 -0
- package/es/src/charts/features/linkWidths.js +32 -0
- package/es/src/charts/features/pathLabelGeometry.js +232 -0
- package/es/src/charts/features/pathLabels.js +50 -0
- package/es/src/charts/features/plotAnnotations.js +68 -17
- package/es/src/charts/features/plotPaint.js +38 -11
- package/es/src/charts/features/polyline.js +129 -0
- package/es/src/charts/features/referenceAnnotations.js +403 -0
- package/es/src/charts/features/referenceLabelPlacement.js +106 -0
- package/es/src/charts/features/ringLabelNodes.js +93 -0
- package/es/src/charts/features/ringLabels.js +222 -0
- package/es/src/charts/features/sceneBounds.js +26 -6
- package/es/src/charts/features/selfLoops.js +306 -0
- package/es/src/charts/features/shapeEmit.js +47 -31
- package/es/src/charts/features/sharedFields.js +15 -2
- package/es/src/charts/features/textHalo.js +29 -0
- package/es/src/charts/index.js +8 -0
- package/es/src/charts/partition/chartFields.js +2 -2
- package/es/src/charts/partition/interaction.js +9 -5
- package/es/src/charts/partition/zoom.js +7 -6
- package/es/src/charts/pipeline/insetPlacement.js +14 -6
- package/es/src/charts/pipeline/preDrawData.js +46 -3
- package/es/src/charts/pipeline/runVizPipeline.js +5 -0
- package/es/src/charts/pipeline/vizPreDraw.js +5 -3
- package/es/src/charts/plotBuffers/discreteBuffer.js +7 -4
- package/es/src/charts/polar/config.js +2 -3
- package/es/src/charts/viz/Viz.js +39 -36
- package/es/src/charts/viz/VizBase.js +18 -10
- package/es/src/charts/viz/backgroundInk.js +13 -7
- package/es/src/charts/viz/focusRing.js +104 -0
- package/es/src/charts/viz/focusTargets.js +208 -0
- package/es/src/charts/viz/history.js +74 -0
- package/es/src/charts/viz/keyboardNav.js +297 -0
- package/es/src/charts/viz/keyboardNavHost.js +95 -0
- package/es/src/charts/viz/loaderFormat.js +114 -0
- package/es/src/charts/viz/missingFields.js +2 -1
- package/es/src/charts/viz/mountTarget.js +9 -0
- package/es/src/charts/viz/nearestHover.js +183 -0
- package/es/src/charts/viz/nearestHoverSurface.js +92 -0
- package/es/src/charts/viz/ordinalColor.js +14 -12
- package/es/src/charts/viz/pageTheme.js +83 -0
- package/es/src/charts/viz/pointTooltipAnchor.js +59 -0
- package/es/src/charts/viz/pointVoronoi.js +124 -0
- package/es/src/charts/viz/reducedMotion.js +27 -0
- package/es/src/charts/viz/vizDataPolling.js +8 -3
- package/es/src/charts/viz/vizDefaults.js +15 -23
- package/es/src/charts/viz/vizFields.js +35 -0
- package/es/src/charts/viz/vizRender.js +43 -28
- package/es/src/charts/viz/vizTheme.js +96 -0
- package/es/src/charts/viz/vizVisibility.js +14 -0
- package/es/src/components/Axis/Axis.js +6 -0
- 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/axisBreak.js +4 -1
- package/es/src/components/Axis/axisDefaults.js +5 -9
- package/es/src/components/Axis/axisLayoutScale.js +7 -1
- package/es/src/components/Axis/axisRangeBreaks.js +77 -0
- package/es/src/components/Axis/brokenTimeScale.js +196 -0
- package/es/src/components/Axis/rangeBreaks.js +201 -0
- package/es/src/components/Axis/timeValues.js +19 -4
- package/es/src/components/ColorScale/ColorScale.js +15 -9
- package/es/src/components/ColorScale/bucketBounds.js +32 -3
- package/es/src/components/ColorScale/colorScaleHoverMark.js +3 -3
- package/es/src/components/ColorScale/colorScaleScale.js +28 -15
- package/es/src/components/Legend/Legend.js +3 -0
- package/es/src/components/Legend/legendConfig.js +2 -6
- package/es/src/components/SizeLegend/SizeLegend.js +1 -0
- package/es/src/components/TextBox.js +29 -65
- package/es/src/components/Timeline/Timeline.js +12 -3
- package/es/src/components/Timeline/timelineConfig.js +20 -10
- package/es/src/components/Timeline/timelineMode.js +26 -0
- package/es/src/components/Timeline/timelineRender.js +7 -3
- package/es/src/components/Tooltip.js +15 -5
- package/es/src/components/fontStack.js +20 -0
- package/es/src/components/textBoxLayout.js +58 -21
- package/es/src/components/textBoxPath.js +73 -0
- package/es/src/components/textBoxScene.js +223 -0
- package/es/src/components/textBoxWords.js +70 -0
- package/es/src/shapes/Area.js +1 -0
- package/es/src/shapes/Bar.js +1 -0
- package/es/src/shapes/Box.js +1 -0
- package/es/src/shapes/Circle.js +1 -0
- package/es/src/shapes/Line.js +1 -0
- package/es/src/shapes/Path.js +1 -0
- package/es/src/shapes/Rect.js +1 -0
- package/es/src/shapes/Shape.js +1 -0
- package/es/src/shapes/Whisker.js +1 -0
- package/es/src/utils/BaseClass.js +25 -12
- package/es/src/utils/configPrep.js +2 -1
- package/es/src/utils/constant.js +13 -1
- package/es/src/utils/displayName.js +12 -0
- package/es/src/utils/theme.js +190 -0
- package/es/src/utils/themeInk.js +68 -0
- package/package.json +14 -11
- package/types/index.d.ts +6 -2
- package/types/internal.d.ts +250 -8
- package/types/src/charts/Alluvial/aggregate.d.ts +98 -0
- package/types/src/charts/Alluvial/applyLayout.d.ts +67 -0
- package/types/src/charts/Alluvial/dimensions.d.ts +40 -0
- package/types/src/charts/Alluvial/emit.d.ts +9 -0
- package/types/src/charts/Alluvial/hover.d.ts +31 -0
- package/types/src/charts/Alluvial/index.d.ts +27 -0
- package/types/src/charts/Alluvial/layout.d.ts +70 -0
- package/types/src/charts/Alluvial/meta.d.ts +54 -0
- package/types/src/charts/Alluvial/titles.d.ts +33 -0
- package/types/src/charts/ArcDiagram/applyLayout.d.ts +70 -0
- package/types/src/charts/ArcDiagram/arcGeometry.d.ts +150 -0
- package/types/src/charts/ArcDiagram/arcLabels.d.ts +89 -0
- package/types/src/charts/ArcDiagram/arcLoops.d.ts +48 -0
- package/types/src/charts/ArcDiagram/emit.d.ts +23 -0
- package/types/src/charts/ArcDiagram/events.d.ts +28 -0
- package/types/src/charts/ArcDiagram/index.d.ts +28 -0
- package/types/src/charts/BubbleChart/emit.d.ts +20 -0
- package/types/src/charts/BubbleChart/index.d.ts +16 -0
- package/types/src/charts/Chord/applyLayout.d.ts +3 -0
- package/types/src/charts/Chord/labels.d.ts +66 -0
- package/types/src/charts/Donut/index.d.ts +2 -1
- package/types/src/charts/Gantt/applyLayout.d.ts +64 -0
- package/types/src/charts/Gantt/emit.d.ts +17 -0
- package/types/src/charts/Gantt/ganttDecor.d.ts +41 -0
- package/types/src/charts/Gantt/ganttGeometry.d.ts +57 -0
- package/types/src/charts/Gantt/ganttLabels.d.ts +41 -0
- package/types/src/charts/Gantt/ganttRows.d.ts +84 -0
- package/types/src/charts/Gantt/ganttTooltip.d.ts +57 -0
- package/types/src/charts/Gantt/index.d.ts +36 -0
- package/types/src/charts/Geomap/applyLayout.d.ts +8 -0
- package/types/src/charts/Geomap/basemapTheme.d.ts +2 -19
- package/types/src/charts/Geomap/emit.d.ts +2 -2
- package/types/src/charts/Geomap/flowEmit.d.ts +35 -0
- package/types/src/charts/Geomap/flowEvents.d.ts +20 -0
- package/types/src/charts/Geomap/flowFields.d.ts +7 -0
- package/types/src/charts/Geomap/flowGeometry.d.ts +91 -0
- package/types/src/charts/Geomap/flowLinks.d.ts +97 -0
- package/types/src/charts/Geomap/geoCache.d.ts +47 -0
- package/types/src/charts/Geomap/globeKeys.d.ts +41 -0
- package/types/src/charts/Geomap/globeRotate.d.ts +70 -0
- package/types/src/charts/Geomap/index.d.ts +3 -0
- package/types/src/charts/Geomap/pointLabels.d.ts +24 -0
- package/types/src/charts/Hexbin/binning.d.ts +64 -0
- package/types/src/charts/Hexbin/buffer.d.ts +18 -0
- package/types/src/charts/Hexbin/contourLabels.d.ts +95 -0
- package/types/src/charts/Hexbin/contours.d.ts +48 -0
- package/types/src/charts/Hexbin/emit.d.ts +23 -0
- package/types/src/charts/Hexbin/index.d.ts +25 -0
- package/types/src/charts/Hexbin/layers.d.ts +94 -0
- package/types/src/charts/Hexbin/settings.d.ts +122 -0
- package/types/src/charts/Hexbin/tooltip.d.ts +26 -0
- package/types/src/charts/Histogram/binData.d.ts +20 -1
- package/types/src/charts/Histogram/index.d.ts +3 -2
- package/types/src/charts/Histogram/labels.d.ts +7 -0
- package/types/src/charts/Marimekko/index.d.ts +2 -1
- package/types/src/charts/Network/bundle.d.ts +67 -0
- package/types/src/charts/Network/clusterLabels.d.ts +112 -0
- package/types/src/charts/Network/clusters.d.ts +115 -0
- package/types/src/charts/Network/graph.d.ts +65 -0
- package/types/src/charts/Network/graphFluent.d.ts +20 -0
- package/types/src/charts/Network/minNodeDistance.d.ts +18 -0
- package/types/src/charts/Network/polygonRows.d.ts +29 -0
- package/types/src/charts/Pie/applyLayout.d.ts +31 -3
- package/types/src/charts/Pie/arcFit.d.ts +63 -0
- package/types/src/charts/Pie/curvedLabels.d.ts +57 -0
- package/types/src/charts/Pie/labelRoom.d.ts +83 -0
- package/types/src/charts/Pie/outsideLabels.d.ts +119 -0
- package/types/src/charts/Pie/outsideNodes.d.ts +93 -0
- package/types/src/charts/Pie/pieLabels.d.ts +85 -0
- package/types/src/charts/Pie/sectorBox.d.ts +95 -0
- package/types/src/charts/Pie/straightLabels.d.ts +24 -0
- package/types/src/charts/Pie/straightLayout.d.ts +88 -0
- package/types/src/charts/Plot/alongLegend.d.ts +42 -0
- package/types/src/charts/Plot/areaLabelsAlong.d.ts +119 -0
- package/types/src/charts/Plot/axisValues.d.ts +24 -0
- package/types/src/charts/Plot/barWidth.d.ts +38 -4
- package/types/src/charts/Plot/circleLabels.d.ts +29 -0
- package/types/src/charts/Plot/connectGaps.d.ts +99 -0
- package/types/src/charts/Plot/connectGapsScene.d.ts +55 -0
- package/types/src/charts/Plot/forecastScene.d.ts +5 -0
- package/types/src/charts/Plot/index.d.ts +15 -8
- package/types/src/charts/Plot/lineLabelEmit.d.ts +48 -0
- package/types/src/charts/Plot/lineLabelSides.d.ts +50 -0
- package/types/src/charts/Plot/lineLabelSpread.d.ts +15 -0
- package/types/src/charts/Plot/lineLabelsAlong.d.ts +116 -0
- package/types/src/charts/Plot/pipeline.d.ts +15 -1
- package/types/src/charts/Plot/pipelineLineLabels.d.ts +68 -0
- package/types/src/charts/Plot/plotFacet.d.ts +5 -0
- package/types/src/charts/Plot/plotInit.d.ts +14 -0
- package/types/src/charts/Plot/plotRangeBreaks.d.ts +35 -0
- package/types/src/charts/Plot/referenceDomains.d.ts +49 -0
- package/types/src/charts/Plot/stackLegendOrder.d.ts +83 -0
- package/types/src/charts/Plot/trendLabels.d.ts +73 -0
- package/types/src/charts/Plot/trendTooltip.d.ts +6 -0
- package/types/src/charts/Priestley/timeAxis.d.ts +76 -0
- package/types/src/charts/Radar/axisDecorations.d.ts +7 -2
- package/types/src/charts/Radar/curvedLabels.d.ts +94 -0
- package/types/src/charts/RadialBar/curvedLabels.d.ts +31 -0
- package/types/src/charts/RadialBar/trackLayout.d.ts +34 -3
- package/types/src/charts/Rings/emit.d.ts +50 -0
- package/types/src/charts/Rings/ringsGraph.d.ts +10 -2
- package/types/src/charts/Rings/ringsLoops.d.ts +13 -0
- package/types/src/charts/Rings/ringsParallel.d.ts +43 -0
- package/types/src/charts/Sankey/circularLayout.d.ts +103 -0
- package/types/src/charts/Sankey/circularLinks.d.ts +178 -0
- package/types/src/charts/Sankey/emit.d.ts +58 -0
- package/types/src/charts/Sankey/labels.d.ts +19 -0
- package/types/src/charts/Sankey/ribbons.d.ts +36 -0
- package/types/src/charts/Sankey/sankeyCycles.d.ts +24 -0
- package/types/src/charts/Sankey/sankeyLayout.d.ts +6 -0
- package/types/src/charts/Sankey/sankeyLinks.d.ts +36 -0
- package/types/src/charts/Scatter/index.d.ts +15 -0
- package/types/src/charts/SlopeChart/index.d.ts +43 -0
- package/types/src/charts/SlopeChart/slope.d.ts +43 -0
- package/types/src/charts/Streamgraph/index.d.ts +28 -0
- package/types/src/charts/Sunburst/curvedLabels.d.ts +56 -0
- package/types/src/charts/definition/ChartDefinition.d.ts +13 -0
- package/types/src/charts/definition/makeChart.d.ts +3 -2
- package/types/src/charts/drawSteps/backControl.d.ts +7 -22
- package/types/src/charts/drawSteps/gestureHover.d.ts +33 -0
- package/types/src/charts/drawSteps/minimapMarkup.d.ts +5 -4
- package/types/src/charts/drawSteps/tableViewMarkup.d.ts +3 -1
- package/types/src/charts/drawSteps/zoomGesture.d.ts +32 -0
- package/types/src/charts/events/click.legend.d.ts +2 -1
- package/types/src/charts/facet/facetConfig.d.ts +4 -2
- package/types/src/charts/features/annotationFrame.d.ts +108 -0
- package/types/src/charts/features/annotationText.d.ts +57 -0
- package/types/src/charts/features/annotationTypes.d.ts +161 -0
- package/types/src/charts/features/axesMeasure.d.ts +4 -0
- package/types/src/charts/features/calloutLayout.d.ts +78 -0
- package/types/src/charts/features/calloutScene.d.ts +40 -0
- package/types/src/charts/features/chartGeometry.d.ts +1 -1
- package/types/src/charts/features/circleLabelPlacement.d.ts +97 -0
- package/types/src/charts/features/circleLabels.d.ts +130 -0
- package/types/src/charts/features/colorScaleValue.d.ts +35 -0
- package/types/src/charts/features/curvedArrows.d.ts +105 -0
- package/types/src/charts/features/edgeArrows.d.ts +74 -2
- package/types/src/charts/features/edgeBundling.d.ts +86 -0
- package/types/src/charts/features/edgeBundlingSmooth.d.ts +29 -0
- package/types/src/charts/features/ensureZoomDom.d.ts +19 -1
- package/types/src/charts/features/featuresLegend.d.ts +4 -3
- package/types/src/charts/features/legendKeys.d.ts +34 -0
- package/types/src/charts/features/lineLabels.d.ts +15 -12
- package/types/src/charts/features/linkBundle.d.ts +16 -0
- package/types/src/charts/features/linkColor.d.ts +48 -0
- package/types/src/charts/features/linkFields.d.ts +16 -0
- package/types/src/charts/features/linkFocus.d.ts +51 -0
- package/types/src/charts/features/linkInteraction.d.ts +183 -0
- package/types/src/charts/features/linkKeys.d.ts +11 -0
- package/types/src/charts/features/linkLabelGeometry.d.ts +67 -0
- package/types/src/charts/features/linkLabelPath.d.ts +85 -0
- package/types/src/charts/features/linkLabels.d.ts +77 -0
- package/types/src/charts/features/linkWidths.d.ts +19 -0
- package/types/src/charts/features/pathLabelGeometry.d.ts +99 -0
- package/types/src/charts/features/pathLabels.d.ts +41 -0
- package/types/src/charts/features/plotAnnotations.d.ts +23 -8
- package/types/src/charts/features/plotPaint.d.ts +17 -0
- package/types/src/charts/features/polyline.d.ts +32 -0
- package/types/src/charts/features/referenceAnnotations.d.ts +130 -0
- package/types/src/charts/features/referenceLabelPlacement.d.ts +58 -0
- package/types/src/charts/features/ringLabelNodes.d.ts +63 -0
- package/types/src/charts/features/ringLabels.d.ts +164 -0
- package/types/src/charts/features/sceneBounds.d.ts +6 -0
- package/types/src/charts/features/selfLoops.d.ts +165 -0
- package/types/src/charts/features/shapeEmit.d.ts +3 -1
- package/types/src/charts/features/sharedFields.d.ts +11 -2
- package/types/src/charts/features/textHalo.d.ts +14 -0
- package/types/src/charts/index.d.ts +8 -0
- package/types/src/charts/partition/interaction.d.ts +6 -3
- package/types/src/charts/partition/zoom.d.ts +4 -4
- package/types/src/charts/pipeline/preDrawData.d.ts +14 -1
- package/types/src/charts/pipeline/stages.d.ts +7 -0
- package/types/src/charts/plotBuffers/discreteBuffer.d.ts +0 -5
- package/types/src/charts/viz/Viz.d.ts +16 -2
- package/types/src/charts/viz/VizBase.d.ts +6 -6
- package/types/src/charts/viz/backgroundInk.d.ts +11 -4
- package/types/src/charts/viz/focusRing.d.ts +25 -0
- package/types/src/charts/viz/focusTargets.d.ts +56 -0
- package/types/src/charts/viz/history.d.ts +35 -0
- package/types/src/charts/viz/keyboardNav.d.ts +55 -0
- package/types/src/charts/viz/keyboardNavHost.d.ts +53 -0
- package/types/src/charts/viz/loaderFormat.d.ts +78 -0
- package/types/src/charts/viz/mountTarget.d.ts +7 -0
- package/types/src/charts/viz/nearestHover.d.ts +75 -0
- package/types/src/charts/viz/nearestHoverSurface.d.ts +21 -0
- package/types/src/charts/viz/ordinalColor.d.ts +10 -8
- package/types/src/charts/viz/pageTheme.d.ts +34 -0
- package/types/src/charts/viz/pointTooltipAnchor.d.ts +36 -0
- package/types/src/charts/viz/pointVoronoi.d.ts +65 -0
- package/types/src/charts/viz/reducedMotion.d.ts +25 -0
- package/types/src/charts/viz/vizDefaults.d.ts +0 -9
- package/types/src/charts/viz/vizFields.d.ts +32 -0
- package/types/src/charts/viz/vizRender.d.ts +2 -1
- package/types/src/charts/viz/vizTheme.d.ts +40 -0
- package/types/src/charts/viz/vizTypes.d.ts +84 -7
- package/types/src/charts/viz/vizVisibility.d.ts +6 -0
- package/types/src/components/Axis/Axis.d.ts +1 -0
- package/types/src/components/Axis/AxisBottom.d.ts +1 -0
- package/types/src/components/Axis/AxisLeft.d.ts +1 -0
- package/types/src/components/Axis/AxisRight.d.ts +1 -0
- package/types/src/components/Axis/AxisTop.d.ts +1 -0
- package/types/src/components/Axis/axisBreak.d.ts +2 -0
- package/types/src/components/Axis/axisRangeBreaks.d.ts +25 -0
- package/types/src/components/Axis/brokenTimeScale.d.ts +51 -0
- package/types/src/components/Axis/rangeBreaks.d.ts +82 -0
- package/types/src/components/Axis/timeValues.d.ts +1 -1
- package/types/src/components/ColorScale/ColorScale.d.ts +1 -0
- package/types/src/components/ColorScale/bucketBounds.d.ts +15 -1
- package/types/src/components/Legend/Legend.d.ts +1 -0
- package/types/src/components/SizeLegend/SizeLegend.d.ts +1 -0
- package/types/src/components/TextBox.d.ts +1 -0
- package/types/src/components/Timeline/Timeline.d.ts +1 -0
- package/types/src/components/Timeline/timelineConfig.d.ts +5 -0
- package/types/src/components/Timeline/timelineMode.d.ts +17 -0
- package/types/src/components/Tooltip.d.ts +4 -3
- package/types/src/components/fontStack.d.ts +10 -0
- package/types/src/components/textBoxLayout.d.ts +18 -9
- package/types/src/components/textBoxPath.d.ts +59 -0
- package/types/src/components/textBoxScene.d.ts +51 -0
- package/types/src/components/textBoxWords.d.ts +33 -0
- package/types/src/shapes/Area.d.ts +1 -0
- package/types/src/shapes/Bar.d.ts +1 -0
- package/types/src/shapes/Box.d.ts +1 -0
- package/types/src/shapes/Circle.d.ts +1 -0
- package/types/src/shapes/Line.d.ts +1 -0
- package/types/src/shapes/Path.d.ts +1 -0
- package/types/src/shapes/Rect.d.ts +1 -0
- package/types/src/shapes/Shape.d.ts +1 -0
- package/types/src/shapes/Whisker.d.ts +1 -0
- package/types/src/utils/BaseClass.d.ts +9 -0
- package/types/src/utils/D3plusConfig.d.ts +981 -30
- package/types/src/utils/configPrep.d.ts +2 -0
- package/types/src/utils/constant.d.ts +8 -0
- package/types/src/utils/displayName.d.ts +10 -0
- package/types/src/utils/index.d.ts +1 -1
- package/types/src/utils/theme.d.ts +170 -0
- package/types/src/utils/themeInk.d.ts +56 -0
- package/umd/d3plus-core.full.js +86811 -61031
- package/umd/d3plus-core.full.min.js +2 -2
- package/umd/d3plus-core.js +28392 -6498
- package/umd/d3plus-core.min.js +2 -2
- package/es/src/components/Axis/gridStroke.js +0 -10
- package/types/src/components/Axis/gridStroke.d.ts +0 -8
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
SlopeChart — a LinePlot comparing each series between two periods.
|
|
3
|
+
*/ import { assign } from "@d3plus/dom";
|
|
4
|
+
import { warnConfigOnce } from "../../utils/configWarnings.js";
|
|
5
|
+
import { makeChart } from "../definition/makeChart.js";
|
|
6
|
+
import LinePlot from "../LinePlot/index.js";
|
|
7
|
+
import { slopeColors, slopeDirections, slopePeriods } from "./slope.js";
|
|
8
|
+
/**
|
|
9
|
+
The value axis config that hides its labels, ticks, gridlines, and line:
|
|
10
|
+
each line's labels name its values.
|
|
11
|
+
*/ export const slopeValueAxis = {
|
|
12
|
+
barConfig: {
|
|
13
|
+
stroke: "transparent"
|
|
14
|
+
},
|
|
15
|
+
labels: [],
|
|
16
|
+
ticks: []
|
|
17
|
+
};
|
|
18
|
+
/** The chart's slope state, once its data has been prepared. */ const slopeState = (viz)=>viz.ctx.slope;
|
|
19
|
+
/** Formats a period for a warning. */ const periodText = (p)=>p instanceof Date ? p.toISOString().slice(0, 10) : `${p}`;
|
|
20
|
+
/**
|
|
21
|
+
Notes each series' direction, and warns when the data spans more than
|
|
22
|
+
two periods (every period is still drawn).
|
|
23
|
+
*/ export function prepareSlope(viz) {
|
|
24
|
+
const rows = viz._filteredData;
|
|
25
|
+
const x = viz._x;
|
|
26
|
+
const periods = slopePeriods(rows.map((d, i)=>x(d, i)));
|
|
27
|
+
if (periods.length > 2) warnConfigOnce(viz, "slopePeriods", `SlopeChart compares two periods, but its data has ${periods.length} (${periods.map(periodText).join(", ")}). Every period is drawn; filter the data to two periods to compare them.`);
|
|
28
|
+
viz.ctx.slope = {
|
|
29
|
+
directions: slopeDirections(rows, viz._id, x, viz._y)
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
The color `slopeColor` gives a row's series, or `undefined` when it is
|
|
34
|
+
off or the series has no direction yet.
|
|
35
|
+
*/ export function slopeFill(viz, d, i) {
|
|
36
|
+
const colors = slopeColors(viz.schema.slopeColor, Boolean(viz._theme?.dark), viz._theme?.textMuted);
|
|
37
|
+
if (!colors) return undefined;
|
|
38
|
+
while(d.__d3plus__ && d.data){
|
|
39
|
+
d = d.data;
|
|
40
|
+
i = d.i;
|
|
41
|
+
}
|
|
42
|
+
const direction = slopeState(viz)?.directions.get(`${viz._id(d, i)}`);
|
|
43
|
+
return direction ? colors[direction] : undefined;
|
|
44
|
+
}
|
|
45
|
+
export const slopeChartDef = {
|
|
46
|
+
name: "SlopeChart",
|
|
47
|
+
paintDriven: true,
|
|
48
|
+
setup: (viz)=>{
|
|
49
|
+
viz._lineMarkers = true;
|
|
50
|
+
viz._yConfig = assign({}, viz._yConfig ?? {}, slopeValueAxis);
|
|
51
|
+
// The hidden value axis takes no title from the `y` key.
|
|
52
|
+
viz._yTitle = null;
|
|
53
|
+
// Direction colors take over the fill every other color derives from.
|
|
54
|
+
const fill = viz.schema.shapeConfig.fill;
|
|
55
|
+
viz.schema.shapeConfig.fill = (d, i)=>slopeFill(viz, d, i) ?? (typeof fill === "function" ? fill(d, i) : fill);
|
|
56
|
+
// Markers take their line's color.
|
|
57
|
+
viz._lineMarkerConfig = assign({}, viz._lineMarkerConfig ?? {}, {
|
|
58
|
+
fill: (d, i)=>{
|
|
59
|
+
const { shapeConfig } = viz.schema;
|
|
60
|
+
const stroke = shapeConfig.Line?.stroke ?? shapeConfig.stroke;
|
|
61
|
+
return typeof stroke === "function" ? stroke(d, i) : stroke;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
const preDraw = viz._preDraw.bind(viz);
|
|
65
|
+
viz._preDraw = ()=>{
|
|
66
|
+
preDraw();
|
|
67
|
+
prepareSlope(viz);
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
ctx: {},
|
|
71
|
+
fields: [
|
|
72
|
+
/** SlopeChart badges only the x axis on hover: the value axis names no values. */ {
|
|
73
|
+
key: "axisHover",
|
|
74
|
+
default: "x"
|
|
75
|
+
},
|
|
76
|
+
/** SlopeChart has no legend by default: each line names its series at both ends. */ {
|
|
77
|
+
key: "legend",
|
|
78
|
+
default: false,
|
|
79
|
+
coerce: "const"
|
|
80
|
+
},
|
|
81
|
+
/** SlopeChart defaults to `"both"`. */ {
|
|
82
|
+
key: "lineLabels",
|
|
83
|
+
default: "both"
|
|
84
|
+
},
|
|
85
|
+
/** SlopeChart defaults to `{value: true}`. */ {
|
|
86
|
+
key: "lineLabelConfig",
|
|
87
|
+
merge: true,
|
|
88
|
+
default: {
|
|
89
|
+
value: true
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
/**
|
|
93
|
+
Colors each line by its direction between its first and last
|
|
94
|
+
period. `true` draws rising lines green, falling lines red, and flat
|
|
95
|
+
lines in the theme's muted text color, in shades that suit a light
|
|
96
|
+
or dark theme; an object sets any of `up`, `down`, and `flat`
|
|
97
|
+
itself. The legend and markers follow. Off by default.
|
|
98
|
+
*/ {
|
|
99
|
+
key: "slopeColor",
|
|
100
|
+
default: false
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
Creates a slope chart from an array of data: a LinePlot comparing each
|
|
106
|
+
series between two periods, with a line from its first value to its
|
|
107
|
+
second. Each line is labeled at both ends with its series name and value
|
|
108
|
+
(`lineLabels: "both"` with `lineLabelConfig: {value: true}`), labels that
|
|
109
|
+
would overlap are nudged apart on each side, and the value axis hides its
|
|
110
|
+
labels, ticks, and gridlines, since the labels carry the values (tooltips
|
|
111
|
+
still show them). The x axis shows the periods in the data; with more
|
|
112
|
+
than two, every period is drawn and a warning suggests filtering to two.
|
|
113
|
+
Markers sit at each end of every line. `slopeColor` colors each line by
|
|
114
|
+
whether it rose, fell, or stayed flat. For ranks rather than values, use
|
|
115
|
+
a two-period BumpChart, which labels its rank axes with the series names.
|
|
116
|
+
*/ export default makeChart(slopeChartDef, LinePlot);
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Pure helpers behind SlopeChart: the periods its data spans, each series'
|
|
3
|
+
direction between its first and last period, and the colors
|
|
4
|
+
`slopeColor` draws those directions in.
|
|
5
|
+
|
|
6
|
+
@module
|
|
7
|
+
*/ /** Which way a series moved between its first and last period. */ /** A period's sort key: a Date or number by value, anything else unsorted. */ const periodKey = (v)=>v instanceof Date ? +v : typeof v === "number" && Number.isFinite(v) ? v : undefined;
|
|
8
|
+
/**
|
|
9
|
+
The distinct periods among `values`, first to last: in time or numeric
|
|
10
|
+
order when every value is a Date or a number, else in the order they
|
|
11
|
+
first appear.
|
|
12
|
+
*/ export function slopePeriods(values) {
|
|
13
|
+
const seen = new Map();
|
|
14
|
+
for (const v of values){
|
|
15
|
+
if (v === undefined || v === null) continue;
|
|
16
|
+
const key = v instanceof Date ? +v : v;
|
|
17
|
+
if (!seen.has(key)) seen.set(key, v);
|
|
18
|
+
}
|
|
19
|
+
const periods = [
|
|
20
|
+
...seen.values()
|
|
21
|
+
];
|
|
22
|
+
return periods.every((p)=>periodKey(p) !== undefined) ? periods.sort((a, b)=>periodKey(a) - periodKey(b)) : periods;
|
|
23
|
+
}
|
|
24
|
+
/** The direction from `start` to `end`: flat when they are equal. */ export function slopeDirection(start, end) {
|
|
25
|
+
return end > start ? "up" : end < start ? "down" : "flat";
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
Each series' direction between its first and last period, keyed by the
|
|
29
|
+
series id as a string. A series with fewer than two periods is flat.
|
|
30
|
+
*/ export function slopeDirections(rows, id, x, y) {
|
|
31
|
+
const periods = slopePeriods(rows.map((d, i)=>x(d, i)));
|
|
32
|
+
const order = new Map(periods.map((p, i)=>[
|
|
33
|
+
p instanceof Date ? +p : p,
|
|
34
|
+
i
|
|
35
|
+
]));
|
|
36
|
+
const ends = new Map();
|
|
37
|
+
rows.forEach((d, i)=>{
|
|
38
|
+
const xv = x(d, i);
|
|
39
|
+
const rank = order.get(xv instanceof Date ? +xv : xv);
|
|
40
|
+
const value = Number(y(d, i));
|
|
41
|
+
if (rank === undefined || !Number.isFinite(value)) return;
|
|
42
|
+
const key = `${id(d, i)}`;
|
|
43
|
+
const entry = ends.get(key);
|
|
44
|
+
if (!entry) ends.set(key, {
|
|
45
|
+
first: [
|
|
46
|
+
rank,
|
|
47
|
+
value
|
|
48
|
+
],
|
|
49
|
+
last: [
|
|
50
|
+
rank,
|
|
51
|
+
value
|
|
52
|
+
]
|
|
53
|
+
});
|
|
54
|
+
else {
|
|
55
|
+
if (rank < entry.first[0]) entry.first = [
|
|
56
|
+
rank,
|
|
57
|
+
value
|
|
58
|
+
];
|
|
59
|
+
if (rank >= entry.last[0]) entry.last = [
|
|
60
|
+
rank,
|
|
61
|
+
value
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
const out = new Map();
|
|
66
|
+
ends.forEach(({ first, last }, key)=>out.set(key, slopeDirection(first[1], last[1])));
|
|
67
|
+
return out;
|
|
68
|
+
}
|
|
69
|
+
/** The default direction colors on a light background. */ export const slopeColorsLight = Object.freeze({
|
|
70
|
+
up: "#2f9e44",
|
|
71
|
+
down: "#e03131",
|
|
72
|
+
flat: "#767676"
|
|
73
|
+
});
|
|
74
|
+
/** The default direction colors on a dark background. */ export const slopeColorsDark = Object.freeze({
|
|
75
|
+
up: "#51cf66",
|
|
76
|
+
down: "#ff6b6b",
|
|
77
|
+
flat: "#adb5bd"
|
|
78
|
+
});
|
|
79
|
+
/**
|
|
80
|
+
The colors a `slopeColor` setting draws in, or `null` when it is off:
|
|
81
|
+
the defaults for a light or `dark` background (flat lines in `flat`, the
|
|
82
|
+
theme's muted text, when given), under any colors the setting names.
|
|
83
|
+
*/ export function slopeColors(setting, dark, flat) {
|
|
84
|
+
if (!setting) return null;
|
|
85
|
+
const base = {
|
|
86
|
+
...dark ? slopeColorsDark : slopeColorsLight,
|
|
87
|
+
...flat ? {
|
|
88
|
+
flat
|
|
89
|
+
} : {}
|
|
90
|
+
};
|
|
91
|
+
return setting === true ? base : {
|
|
92
|
+
...base,
|
|
93
|
+
...setting
|
|
94
|
+
};
|
|
95
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Streamgraph — a StackedArea flowing around a central baseline.
|
|
3
|
+
*/ import { assign } from "@d3plus/dom";
|
|
4
|
+
import { makeChart } from "../definition/makeChart.js";
|
|
5
|
+
import { resolveStackOffset, resolveStackOrder } from "../Plot/stackHelpers.js";
|
|
6
|
+
import StackedArea from "../StackedArea/index.js";
|
|
7
|
+
/**
|
|
8
|
+
The value axis config that hides its labels, ticks, and gridlines: the
|
|
9
|
+
stream's baseline moves, so its positions name no values.
|
|
10
|
+
*/ export const streamValueAxis = {
|
|
11
|
+
labels: [],
|
|
12
|
+
ticks: []
|
|
13
|
+
};
|
|
14
|
+
export const streamgraphDef = {
|
|
15
|
+
name: "Streamgraph",
|
|
16
|
+
paintDriven: true,
|
|
17
|
+
setup: (viz)=>{
|
|
18
|
+
viz._stackOffset = resolveStackOffset("silhouette");
|
|
19
|
+
viz._stackOrder = resolveStackOrder("insideOut");
|
|
20
|
+
viz._yConfig = assign({}, viz._yConfig ?? {}, streamValueAxis);
|
|
21
|
+
},
|
|
22
|
+
ctx: {},
|
|
23
|
+
fields: [
|
|
24
|
+
/** Hovering badges the x axis only: y positions name no values. */ {
|
|
25
|
+
key: "axisHover",
|
|
26
|
+
default: "x"
|
|
27
|
+
},
|
|
28
|
+
/** Layers flow along smooth curves through their points. */ {
|
|
29
|
+
key: "shapeConfig",
|
|
30
|
+
merge: true,
|
|
31
|
+
default: {
|
|
32
|
+
Area: {
|
|
33
|
+
curve: "monotoneX"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
Creates a streamgraph from an array of data: a StackedArea whose layers
|
|
41
|
+
flow around a central baseline instead of rising from zero. Layers stack
|
|
42
|
+
with `stackOffset: "silhouette"`, which centers every stack on the same
|
|
43
|
+
line, ordered `"insideOut"` (the largest layers in the middle) along
|
|
44
|
+
smooth `monotoneX` curves. The value axis hides its labels and gridlines,
|
|
45
|
+
since a moving baseline has no zero to read them from; each layer's
|
|
46
|
+
thickness carries its value, and tooltips show each value and its share
|
|
47
|
+
of the stack. Set `stackOffset("wiggle")` to keep each layer's slope as
|
|
48
|
+
steady as it can instead, at the cost of a stream that drifts up or down
|
|
49
|
+
as its total changes. Each layer is named along its own stream (see
|
|
50
|
+
`labelPosition`).
|
|
51
|
+
*/ export default makeChart(streamgraphDef, StackedArea);
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Where each Sunburst arc's label goes (see `labelPosition`): a straight
|
|
3
|
+
box along the ring or along the radius (`sunburstLabelBox`), or a curve
|
|
4
|
+
along the arc itself (`ringLabelFit`), whichever shows the label larger.
|
|
5
|
+
A curve reads like the box along the ring but follows it, so it wins that
|
|
6
|
+
tie; the box along the radius suits the narrow arcs of the outer rings,
|
|
7
|
+
where a name runs out of arc long before it runs out of ring.
|
|
8
|
+
*/ import { ringLabelFont, ringLabelNodes } from "../features/ringLabelNodes.js";
|
|
9
|
+
import { chooseRingLabel, ringLabelFit, ringLabelPosition } from "../features/ringLabels.js";
|
|
10
|
+
import { measureLabel } from "../partition/labelWords.js";
|
|
11
|
+
import { sunburstLabelBox } from "./labelFit.js";
|
|
12
|
+
/**
|
|
13
|
+
A label's one-line width at a font size, from its words measured at 1px.
|
|
14
|
+
@param metrics The label's words and space at a 1px font size.
|
|
15
|
+
*/ export function metricsWidth(metrics) {
|
|
16
|
+
const n = metrics.words.length;
|
|
17
|
+
const total = metrics.words.reduce((a, b)=>a + b, 0) + metrics.space * Math.max(0, n - 1);
|
|
18
|
+
return (fontSize)=>total * fontSize;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
Places every node's label, measured in the label font: a straight box,
|
|
22
|
+
a curve along its arc, or nothing when neither fits.
|
|
23
|
+
@param viz The chart.
|
|
24
|
+
@param nodes The laid-out nodes.
|
|
25
|
+
@param labelConfig The Path labelConfig.
|
|
26
|
+
@param inputs Each node's text and arc, and the font range.
|
|
27
|
+
*/ export function sunburstLabelPlacements(viz, nodes, labelConfig, inputs) {
|
|
28
|
+
const { fontMin, fontMax } = inputs;
|
|
29
|
+
const boxes = new Map();
|
|
30
|
+
const curves = new Map();
|
|
31
|
+
for (const node of nodes){
|
|
32
|
+
const metrics = measureLabel(inputs.labelOf(node), node.datum, labelConfig);
|
|
33
|
+
if (!metrics.words.length) continue;
|
|
34
|
+
const arc = inputs.arcOf(node);
|
|
35
|
+
const position = ringLabelPosition(viz, node.datum, node.i ?? 0);
|
|
36
|
+
const box = position === "along" ? null : sunburstLabelBox(arc, metrics, {
|
|
37
|
+
fontMin,
|
|
38
|
+
fontMax
|
|
39
|
+
});
|
|
40
|
+
const fit = position === "inside" || position === "outside" ? null : ringLabelFit(arc, metricsWidth(metrics), {
|
|
41
|
+
fontMin,
|
|
42
|
+
fontMax
|
|
43
|
+
});
|
|
44
|
+
const choice = chooseRingLabel(position, box ? {
|
|
45
|
+
fontSize: box.fontSize,
|
|
46
|
+
truncated: false
|
|
47
|
+
} : null, fit, box?.orientation === "radial" ? "straight" : "curved");
|
|
48
|
+
if (choice === "straight" && box) boxes.set(node, box);
|
|
49
|
+
if (choice === "curved" && fit) curves.set(node, fit);
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
boxes,
|
|
53
|
+
curves
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
The text nodes for the curved labels.
|
|
58
|
+
@param viz The chart.
|
|
59
|
+
@param curves Each curved node's fit.
|
|
60
|
+
@param labelConfig The Path labelConfig.
|
|
61
|
+
@param inputs Each node's text and text color.
|
|
62
|
+
*/ export function sunburstCurvedNodes(viz, curves, labelConfig, inputs) {
|
|
63
|
+
const labels = [
|
|
64
|
+
...curves
|
|
65
|
+
].map(([node, fit])=>({
|
|
66
|
+
key: `sunburst-curved-${node.id}`,
|
|
67
|
+
text: inputs.labelOf(node),
|
|
68
|
+
fit,
|
|
69
|
+
color: inputs.colorOf(node),
|
|
70
|
+
datum: node.datum,
|
|
71
|
+
index: node.i ?? 0
|
|
72
|
+
}));
|
|
73
|
+
return ringLabelNodes(viz, labels, ringLabelFont(labelConfig));
|
|
74
|
+
}
|
|
@@ -9,8 +9,9 @@ import { emitLabels } from "../../shapes/emitLabels.js";
|
|
|
9
9
|
import { resolveAccessor, shapeConfigFor, textureFill, userLabelConfig } from "../features/emitHelpers.js";
|
|
10
10
|
import { backgroundImageNodes } from "../features/backgroundImageEmit.js";
|
|
11
11
|
import { sunburstPadAngle } from "./geometry.js";
|
|
12
|
-
import {
|
|
13
|
-
import { labelMetrics
|
|
12
|
+
import { sunburstSplit } from "./labelFit.js";
|
|
13
|
+
import { labelMetrics } from "../partition/labelWords.js";
|
|
14
|
+
import { sunburstCurvedNodes, sunburstLabelPlacements } from "./curvedLabels.js";
|
|
14
15
|
import { partitionFillResolver } from "../partition/shade.js";
|
|
15
16
|
/** The polar geometry of one node, padded per the `padAngle`/`padPixel` config. */ export function sunburstArcGeometry(node, padAngle, padPixel) {
|
|
16
17
|
const isDisc = node.depth === 0;
|
|
@@ -35,19 +36,6 @@ import { partitionFillResolver } from "../partition/shade.js";
|
|
|
35
36
|
fill: viz.ctx.sunburstDefaultFill
|
|
36
37
|
}, "Path");
|
|
37
38
|
}
|
|
38
|
-
/** Where each node's label fits, measured in the label font; nodes without room are left out. */ function labelBoxes(viz, nodes, labelConfig, options) {
|
|
39
|
-
const { fontMin, fontMax, padAngle, padPixel } = options;
|
|
40
|
-
const boxes = new Map();
|
|
41
|
-
for (const node of nodes){
|
|
42
|
-
const metrics = measureLabel(sunburstLabel(viz, node), node.datum, labelConfig);
|
|
43
|
-
const box = sunburstLabelBox(sunburstArcGeometry(node, padAngle, padPixel), metrics, {
|
|
44
|
-
fontMin,
|
|
45
|
-
fontMax
|
|
46
|
-
});
|
|
47
|
-
if (box) boxes.set(node, box);
|
|
48
|
-
}
|
|
49
|
-
return boxes;
|
|
50
|
-
}
|
|
51
39
|
/**
|
|
52
40
|
Arcs a zoom-in removed stay for this frame, folding to zero width beneath
|
|
53
41
|
the arcs that grow into their place; they carry no datum, so they take no
|
|
@@ -79,6 +67,76 @@ import { partitionFillResolver } from "../partition/shade.js";
|
|
|
79
67
|
out: 0.06,
|
|
80
68
|
in: 0.06
|
|
81
69
|
};
|
|
70
|
+
/**
|
|
71
|
+
Every arc's label: straight in its box along the ring or the radius, or
|
|
72
|
+
curved along the arc (see `sunburstLabelPlacements`), in the color that
|
|
73
|
+
contrasts with its arc's fill.
|
|
74
|
+
*/ function sunburstLabels(viz, nodes, fillOf, pad) {
|
|
75
|
+
const { padAngle, padPixel } = pad;
|
|
76
|
+
const labelConfig = userLabelConfig(viz, "Path") ?? {};
|
|
77
|
+
const fontMin = typeof labelConfig.fontMin === "number" ? labelConfig.fontMin : 8;
|
|
78
|
+
const fontMax = typeof labelConfig.fontMax === "number" ? labelConfig.fontMax : 24;
|
|
79
|
+
const labelOf = (node)=>sunburstLabel(viz, node);
|
|
80
|
+
const { boxes, curves } = sunburstLabelPlacements(viz, nodes, labelConfig, {
|
|
81
|
+
labelOf,
|
|
82
|
+
arcOf: (node)=>sunburstArcGeometry(node, padAngle, padPixel),
|
|
83
|
+
fontMin,
|
|
84
|
+
fontMax
|
|
85
|
+
});
|
|
86
|
+
const labeled = nodes.filter((n)=>boxes.has(n));
|
|
87
|
+
const contrast = (node)=>colorContrast((node && fillOf(node)) ?? "rgb(255, 255, 255)", viz.schema.colorDefaults);
|
|
88
|
+
const labelNodes = emitLabels({
|
|
89
|
+
data: labeled,
|
|
90
|
+
label: (d)=>sunburstLabel(viz, d),
|
|
91
|
+
x: (d)=>boxes.get(d).x,
|
|
92
|
+
y: (d)=>boxes.get(d).y,
|
|
93
|
+
rotate: (d)=>boxes.get(d).rotate,
|
|
94
|
+
aes: ()=>({}),
|
|
95
|
+
id: (d)=>`sunburst-${d.id}`,
|
|
96
|
+
datum: (d)=>d.datum,
|
|
97
|
+
labelBounds: (d)=>{
|
|
98
|
+
const { width, height } = boxes.get(d);
|
|
99
|
+
return {
|
|
100
|
+
x: -width / 2,
|
|
101
|
+
y: -height / 2,
|
|
102
|
+
width,
|
|
103
|
+
height
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
labelConfig: {
|
|
107
|
+
fontMax,
|
|
108
|
+
fontMin,
|
|
109
|
+
// Words wrap only at spaces; the label box was sized for whole words.
|
|
110
|
+
split: sunburstSplit,
|
|
111
|
+
fontResize: true,
|
|
112
|
+
padding: 0,
|
|
113
|
+
textAnchor: "middle",
|
|
114
|
+
verticalAlign: "middle",
|
|
115
|
+
fontColor: (d)=>{
|
|
116
|
+
let row = d;
|
|
117
|
+
while(row && row.__d3plus__ && row.data)row = row.data;
|
|
118
|
+
return contrast(viz.ctx.sunburstNodes.get(row));
|
|
119
|
+
},
|
|
120
|
+
...labelConfig
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
// A label never glides along with its arc: when an animated draw moves,
|
|
124
|
+
// retexts, or resizes it, it fades out where it was and back in where it
|
|
125
|
+
// lands (see SUNBURST_LABEL_FADE). A label whose arc stays put stays put.
|
|
126
|
+
for (const n of labelNodes)n.fadeSwap = SUNBURST_LABEL_FADE;
|
|
127
|
+
const userColor = labelConfig.fontColor;
|
|
128
|
+
const curvedNodes = sunburstCurvedNodes(viz, curves, labelConfig, {
|
|
129
|
+
labelOf,
|
|
130
|
+
colorOf: (node)=>{
|
|
131
|
+
const color = resolveAccessor(userColor, node.datum, node.i ?? 0);
|
|
132
|
+
return typeof color === "string" ? color : contrast(node);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
return [
|
|
136
|
+
...labelNodes,
|
|
137
|
+
...curvedNodes
|
|
138
|
+
];
|
|
139
|
+
}
|
|
82
140
|
export const sunburstEmit = ({ viz, shapeData })=>{
|
|
83
141
|
const nodes = shapeData ?? [];
|
|
84
142
|
if (!nodes.length) return [];
|
|
@@ -121,57 +179,10 @@ export const sunburstEmit = ({ viz, shapeData })=>{
|
|
|
121
179
|
nodes[k].i ?? 0
|
|
122
180
|
]);
|
|
123
181
|
const ghosts = ghostNodes(viz, fillOf);
|
|
124
|
-
const
|
|
125
|
-
const fontMin = typeof labelConfig.fontMin === "number" ? labelConfig.fontMin : 8;
|
|
126
|
-
const fontMax = typeof labelConfig.fontMax === "number" ? labelConfig.fontMax : 24;
|
|
127
|
-
const boxes = labelBoxes(viz, nodes, labelConfig, {
|
|
128
|
-
fontMin,
|
|
129
|
-
fontMax,
|
|
182
|
+
const labelNodes = sunburstLabels(viz, nodes, fillOf, {
|
|
130
183
|
padAngle,
|
|
131
184
|
padPixel
|
|
132
185
|
});
|
|
133
|
-
const labeled = nodes.filter((n)=>boxes.has(n));
|
|
134
|
-
const labelNodes = emitLabels({
|
|
135
|
-
data: labeled,
|
|
136
|
-
label: (d)=>sunburstLabel(viz, d),
|
|
137
|
-
x: (d)=>boxes.get(d).x,
|
|
138
|
-
y: (d)=>boxes.get(d).y,
|
|
139
|
-
rotate: (d)=>boxes.get(d).rotate,
|
|
140
|
-
aes: ()=>({}),
|
|
141
|
-
id: (d)=>`sunburst-${d.id}`,
|
|
142
|
-
datum: (d)=>d.datum,
|
|
143
|
-
labelBounds: (d)=>{
|
|
144
|
-
const { width, height } = boxes.get(d);
|
|
145
|
-
return {
|
|
146
|
-
x: -width / 2,
|
|
147
|
-
y: -height / 2,
|
|
148
|
-
width,
|
|
149
|
-
height
|
|
150
|
-
};
|
|
151
|
-
},
|
|
152
|
-
labelConfig: {
|
|
153
|
-
fontMax,
|
|
154
|
-
fontMin,
|
|
155
|
-
// Words wrap only at spaces; the label box was sized for whole words.
|
|
156
|
-
split: sunburstSplit,
|
|
157
|
-
fontResize: true,
|
|
158
|
-
padding: 0,
|
|
159
|
-
textAnchor: "middle",
|
|
160
|
-
verticalAlign: "middle",
|
|
161
|
-
fontColor: (d)=>{
|
|
162
|
-
let row = d;
|
|
163
|
-
while(row && row.__d3plus__ && row.data)row = row.data;
|
|
164
|
-
const node = viz.ctx.sunburstNodes.get(row);
|
|
165
|
-
const fill = node ? fillOf(node) : undefined;
|
|
166
|
-
return colorContrast(fill ?? "rgb(255, 255, 255)", viz.schema.colorDefaults);
|
|
167
|
-
},
|
|
168
|
-
...labelConfig
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
// A label never glides along with its arc: when an animated draw moves,
|
|
172
|
-
// retexts, or resizes it, it fades out where it was and back in where it
|
|
173
|
-
// lands (see SUNBURST_LABEL_FADE). A label whose arc stays put stays put.
|
|
174
|
-
for (const n of labelNodes)n.fadeSwap = SUNBURST_LABEL_FADE;
|
|
175
186
|
return [
|
|
176
187
|
...ghosts,
|
|
177
188
|
...pathNodes,
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
- `partition.ts` — pure nesting + polar partition layout.
|
|
10
10
|
- `geometry.ts` — pure ring radii, pad angle, and label-fit math.
|
|
11
11
|
- `interaction.ts` — hover lineage, tooltip rows, and click-to-zoom.
|
|
12
|
-
*/ import
|
|
13
|
-
import accessor from "../../utils/accessor.js";
|
|
12
|
+
*/ import accessor from "../../utils/accessor.js";
|
|
14
13
|
import { centerChartTransform } from "../features/chartGeometry.js";
|
|
15
14
|
import { makeChart } from "../definition/makeChart.js";
|
|
16
15
|
import { rowLegend, shareRow } from "../features/sharedFields.js";
|
|
@@ -20,6 +19,7 @@ import { partitionShadeDefaults } from "../partition/shade.js";
|
|
|
20
19
|
import { applySunburstLayout } from "./applyLayout.js";
|
|
21
20
|
import { sunburstEmit } from "./emit.js";
|
|
22
21
|
import { sunburstInteraction } from "./interaction.js";
|
|
22
|
+
import { chartBackground } from "../viz/backgroundInk.js";
|
|
23
23
|
export const sunburstDef = {
|
|
24
24
|
name: "Sunburst",
|
|
25
25
|
layoutStage: applySunburstLayout,
|
|
@@ -130,7 +130,7 @@ export const sunburstDef = {
|
|
|
130
130
|
},
|
|
131
131
|
// A thin outline in the chart's background color separates
|
|
132
132
|
// neighboring arcs and rings by the same width everywhere.
|
|
133
|
-
stroke: ()=>
|
|
133
|
+
stroke: ()=>chartBackground(viz),
|
|
134
134
|
strokeWidth: 1
|
|
135
135
|
})
|
|
136
136
|
},
|
|
@@ -5,14 +5,13 @@
|
|
|
5
5
|
- `applyLayout.ts` — tree layout + label measure + link descriptors.
|
|
6
6
|
- `emit.ts` — Path (links) + per-shape-type scene nodes.
|
|
7
7
|
*/ import { tree } from "d3-hierarchy";
|
|
8
|
-
import { colorContrast } from "@d3plus/color";
|
|
9
|
-
import { backgroundColor } from "@d3plus/dom";
|
|
10
8
|
import constant from "../../utils/constant.js";
|
|
11
9
|
import { legendLabel } from "../features/legendLabel.js";
|
|
12
10
|
import { makeChart } from "../definition/makeChart.js";
|
|
13
11
|
import { applyTreeLayout } from "./applyLayout.js";
|
|
14
12
|
import { treeEmit } from "./emit.js";
|
|
15
13
|
import { sceneInsetRegion } from "../pipeline/insetPlacement.js";
|
|
14
|
+
import { backgroundInk } from "../viz/backgroundInk.js";
|
|
16
15
|
export const treeDef = {
|
|
17
16
|
name: "Tree",
|
|
18
17
|
layoutStage: applyTreeLayout,
|
|
@@ -59,10 +58,7 @@ export const treeDef = {
|
|
|
59
58
|
return viz._drawLabel(d, i);
|
|
60
59
|
},
|
|
61
60
|
labelConfig: {
|
|
62
|
-
fontColor: ()=>
|
|
63
|
-
const bg = viz._select ? backgroundColor(viz._select.node()) : "rgb(255, 255, 255)";
|
|
64
|
-
return colorContrast(bg, viz.schema.colorDefaults);
|
|
65
|
-
}
|
|
61
|
+
fontColor: ()=>backgroundInk(viz)
|
|
66
62
|
},
|
|
67
63
|
Path: {
|
|
68
64
|
fill: "none",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/ import { treemap, treemapBinary, treemapDice, treemapResquarify, treemapSlice, treemapSliceDice, treemapSquarify } from "d3-hierarchy";
|
|
14
14
|
import accessor from "../../utils/accessor.js";
|
|
15
15
|
import { fieldAccessor } from "../../utils/fieldAccessor.js";
|
|
16
|
-
import { rowLegend, shareRow } from "../features/sharedFields.js";
|
|
16
|
+
import { legendLargestFirst, rowLegend, shareRow } from "../features/sharedFields.js";
|
|
17
17
|
import { makeChart } from "../definition/makeChart.js";
|
|
18
18
|
import { applyTreemapLayout } from "./applyLayout.js";
|
|
19
19
|
import { treemapEmit } from "./emit.js";
|
|
@@ -135,10 +135,7 @@ export const treemapDef = {
|
|
|
135
135
|
},
|
|
136
136
|
{
|
|
137
137
|
key: "legendSort",
|
|
138
|
-
factory: (viz)=>
|
|
139
|
-
const sumFn = viz.schema.sum;
|
|
140
|
-
return (a, b)=>sumFn(b) - sumFn(a);
|
|
141
|
-
}
|
|
138
|
+
factory: (viz)=>legendLargestFirst(viz, "sum")
|
|
142
139
|
},
|
|
143
140
|
{
|
|
144
141
|
key: "legend",
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
What Violin draws inside each violin (`inner`): a narrow box plot, lines at
|
|
3
3
|
the quartiles, and/or the raw observations packed into a swarm.
|
|
4
|
-
*/ import {
|
|
5
|
-
import { densityAt } from "../helpers/densityData.js";
|
|
4
|
+
*/ import { densityAt } from "../helpers/densityData.js";
|
|
6
5
|
import { growFromLine, growRectsFromCenter } from "../helpers/densityEnter.js";
|
|
7
6
|
import { collectComputed, makeShape, shapeConfigFor } from "../features/emitHelpers.js";
|
|
8
7
|
import { fitSwarms } from "../Plot/swarmLayout.js";
|
|
9
|
-
import { backgroundInk } from "../viz/backgroundInk.js";
|
|
8
|
+
import { backgroundInk, chartBackground } from "../viz/backgroundInk.js";
|
|
10
9
|
import { violinEdges } from "./violinLayout.js";
|
|
11
10
|
/** The `inner` setting as a set of overlays. */ export function innerSet(inner) {
|
|
12
11
|
const list = Array.isArray(inner) ? inner : [
|
|
@@ -38,8 +37,7 @@ import { violinEdges } from "./violinLayout.js";
|
|
|
38
37
|
const widths = placed.map((p)=>p.slot.half * (p.slot.side === "both" ? 0.16 : 0.08));
|
|
39
38
|
const rectWidth = Math.max(3, Math.min(10, Math.min(...widths)));
|
|
40
39
|
const vertical = frame.vertical;
|
|
41
|
-
const
|
|
42
|
-
const background = node ? backgroundColor(node) : "#fff";
|
|
40
|
+
const background = chartBackground(viz);
|
|
43
41
|
const nodes = placed.map(({ row, meta, slot })=>{
|
|
44
42
|
const id = `density-box-${row.id}`;
|
|
45
43
|
const center = slot.side === "both" ? slot.center : slot.center + (slot.side === "start" ? -1 : 1) * Math.min(4, slot.half / 4);
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
`applyDefinition(this, def)`, its `_draw` runs the shared Viz pipeline
|
|
7
7
|
then the chart's own layout stage via `runChartDraw`, and its
|
|
8
8
|
`_thresholdFunction` / `_thresholdLegend` / `_sizeLegendScale` / `_insetRegion` /
|
|
9
|
-
`_colorScaleShape` delegate to `def.thresholdFunction` /
|
|
10
|
-
`def.sizeLegendScale` / `def.insetRegion` / `def.colorScaleShape`
|
|
9
|
+
`_tableData` / `_colorScaleShape` / `_pointMark` delegate to `def.thresholdFunction` /
|
|
10
|
+
`def.sizeLegendScale` / `def.insetRegion` / `def.tableData` / `def.colorScaleShape` /
|
|
11
|
+
`def.pointMark` if
|
|
11
12
|
present (else to the base chart's), `_facetHooks` layers `def.facet` over the base chart's, and
|
|
12
13
|
`toScene` passes the base chart's scene through `def.decorateScene`.
|
|
13
14
|
|
|
@@ -22,6 +23,7 @@ import Viz from "../viz/Viz.js";
|
|
|
22
23
|
specialization (e.g. `makeChart(donutDef, Pie)` for Donut).
|
|
23
24
|
*/ export function makeChart(def, Base = Viz) {
|
|
24
25
|
class Chart extends Base {
|
|
26
|
+
static _displayName = def.name;
|
|
25
27
|
constructor(){
|
|
26
28
|
super();
|
|
27
29
|
applyDefinition(this, def);
|
|
@@ -44,9 +46,15 @@ import Viz from "../viz/Viz.js";
|
|
|
44
46
|
_insetRegion() {
|
|
45
47
|
return def.insetRegion ? def.insetRegion(this) : super._insetRegion();
|
|
46
48
|
}
|
|
49
|
+
_tableData() {
|
|
50
|
+
return def.tableData ? def.tableData(this) : super._tableData();
|
|
51
|
+
}
|
|
47
52
|
_colorScaleShape(d, i) {
|
|
48
53
|
return def.colorScaleShape ? def.colorScaleShape(this, d, i) : super._colorScaleShape(d, i);
|
|
49
54
|
}
|
|
55
|
+
_pointMark(node) {
|
|
56
|
+
return def.pointMark ? def.pointMark(this, node) : super._pointMark(node);
|
|
57
|
+
}
|
|
50
58
|
_facetHooks() {
|
|
51
59
|
return def.facet ? {
|
|
52
60
|
...super._facetHooks(),
|