@d3plus/core 4.5.0 → 4.6.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/README.md +3698 -1074
- package/es/index.js +3 -3
- package/es/index.js.map +1 -1
- package/es/internal.js +6 -1
- package/es/internal.js.map +1 -1
- package/es/src/charts/BarChart/index.js +8 -1
- package/es/src/charts/BarChart/index.js.map +1 -1
- package/es/src/charts/BoxWhisker/index.js +5 -0
- package/es/src/charts/BoxWhisker/index.js.map +1 -1
- package/es/src/charts/Chord/emit.js +55 -3
- package/es/src/charts/Chord/emit.js.map +1 -1
- package/es/src/charts/Chord/index.js +15 -0
- package/es/src/charts/Chord/index.js.map +1 -1
- package/es/src/charts/Geomap/applyLayout.js +17 -10
- package/es/src/charts/Geomap/applyLayout.js.map +1 -1
- package/es/src/charts/Geomap/index.js +5 -1
- package/es/src/charts/Geomap/index.js.map +1 -1
- package/es/src/charts/Histogram/binData.js +225 -0
- package/es/src/charts/Histogram/binData.js.map +1 -0
- package/es/src/charts/Histogram/index.js +271 -0
- package/es/src/charts/Histogram/index.js.map +1 -0
- package/es/src/charts/Network/applyLayout.js +52 -4
- package/es/src/charts/Network/applyLayout.js.map +1 -1
- package/es/src/charts/Network/emit.js +4 -4
- package/es/src/charts/Network/emit.js.map +1 -1
- package/es/src/charts/Network/index.js +6 -1
- package/es/src/charts/Network/index.js.map +1 -1
- package/es/src/charts/Pack/emit.js +37 -2
- package/es/src/charts/Pack/emit.js.map +1 -1
- package/es/src/charts/Pack/index.js +13 -0
- package/es/src/charts/Pack/index.js.map +1 -1
- package/es/src/charts/Pie/applyLayout.js +20 -2
- package/es/src/charts/Pie/applyLayout.js.map +1 -1
- package/es/src/charts/Pie/emit.js +274 -33
- package/es/src/charts/Pie/emit.js.map +1 -1
- package/es/src/charts/Pie/index.js +46 -1
- package/es/src/charts/Pie/index.js.map +1 -1
- package/es/src/charts/Plot/discreteSpan.js +42 -0
- package/es/src/charts/Plot/discreteSpan.js.map +1 -0
- package/es/src/charts/Plot/draw.js +3 -1
- package/es/src/charts/Plot/draw.js.map +1 -1
- package/es/src/charts/Plot/index.js +129 -14
- package/es/src/charts/Plot/index.js.map +1 -1
- package/es/src/charts/Plot/pipeline.js +47 -20
- package/es/src/charts/Plot/pipeline.js.map +1 -1
- package/es/src/charts/Plot/pipelineDomains.js +84 -8
- package/es/src/charts/Plot/pipelineDomains.js.map +1 -1
- package/es/src/charts/Plot/shapeDefaults.js +3 -3
- package/es/src/charts/Plot/shapeDefaults.js.map +1 -1
- package/es/src/charts/Plot/sharedHover.js +431 -0
- package/es/src/charts/Plot/sharedHover.js.map +1 -0
- package/es/src/charts/Plot/sharedHoverScene.js +230 -0
- package/es/src/charts/Plot/sharedHoverScene.js.map +1 -0
- package/es/src/charts/Plot/sharedTooltip.js +163 -0
- package/es/src/charts/Plot/sharedTooltip.js.map +1 -0
- package/es/src/charts/Plot/stackShareLabels.js +137 -0
- package/es/src/charts/Plot/stackShareLabels.js.map +1 -0
- package/es/src/charts/Plot/stackShareTooltip.js +31 -0
- package/es/src/charts/Plot/stackShareTooltip.js.map +1 -0
- package/es/src/charts/Plot/trendLines.js +367 -0
- package/es/src/charts/Plot/trendLines.js.map +1 -0
- package/es/src/charts/Plot/trendScene.js +220 -0
- package/es/src/charts/Plot/trendScene.js.map +1 -0
- package/es/src/charts/Plot/trendTooltip.js +160 -0
- package/es/src/charts/Plot/trendTooltip.js.map +1 -0
- package/es/src/charts/Priestley/emit.js +32 -3
- package/es/src/charts/Priestley/emit.js.map +1 -1
- package/es/src/charts/Radar/index.js +15 -2
- package/es/src/charts/Radar/index.js.map +1 -1
- package/es/src/charts/RadialMatrix/index.js +17 -1
- package/es/src/charts/RadialMatrix/index.js.map +1 -1
- package/es/src/charts/Rings/applyLayout.js +72 -116
- package/es/src/charts/Rings/applyLayout.js.map +1 -1
- package/es/src/charts/Rings/emit.js +2 -3
- package/es/src/charts/Rings/emit.js.map +1 -1
- package/es/src/charts/Rings/index.js +13 -2
- package/es/src/charts/Rings/index.js.map +1 -1
- package/es/src/charts/Rings/ringsSizing.js +189 -0
- package/es/src/charts/Rings/ringsSizing.js.map +1 -0
- package/es/src/charts/StackedArea/index.js +8 -1
- package/es/src/charts/StackedArea/index.js.map +1 -1
- package/es/src/charts/Tree/emit.js +2 -2
- package/es/src/charts/Tree/emit.js.map +1 -1
- package/es/src/charts/Tree/index.js +5 -3
- package/es/src/charts/Tree/index.js.map +1 -1
- package/es/src/charts/Treemap/emit.js +56 -3
- package/es/src/charts/Treemap/emit.js.map +1 -1
- package/es/src/charts/definition/ChartDefinition.js.map +1 -1
- package/es/src/charts/definition/makeChart.js +8 -1
- package/es/src/charts/definition/makeChart.js.map +1 -1
- package/es/src/charts/drawSteps/backControl.js +17 -2
- package/es/src/charts/drawSteps/backControl.js.map +1 -1
- package/es/src/charts/drawSteps/bottomRightControls.js +193 -0
- package/es/src/charts/drawSteps/bottomRightControls.js.map +1 -0
- package/es/src/charts/drawSteps/bottomRightControlsMarkup.js +161 -0
- package/es/src/charts/drawSteps/bottomRightControlsMarkup.js.map +1 -0
- package/es/src/charts/drawSteps/minimap.js +34 -9
- package/es/src/charts/drawSteps/minimap.js.map +1 -1
- package/es/src/charts/drawSteps/zoomControls.js +3 -0
- package/es/src/charts/drawSteps/zoomControls.js.map +1 -1
- package/es/src/charts/events/click.shape.js +24 -1
- package/es/src/charts/events/click.shape.js.map +1 -1
- package/es/src/charts/events/mouseenter.js +3 -0
- package/es/src/charts/events/mouseenter.js.map +1 -1
- package/es/src/charts/events/mouseleave.js +3 -0
- package/es/src/charts/events/mouseleave.js.map +1 -1
- package/es/src/charts/events/mousemove.shape.js +2 -0
- package/es/src/charts/events/mousemove.shape.js.map +1 -1
- package/es/src/charts/features/axes.js +4 -1
- package/es/src/charts/features/axes.js.map +1 -1
- package/es/src/charts/features/emitHelpers.js +24 -0
- package/es/src/charts/features/emitHelpers.js.map +1 -1
- package/es/src/charts/features/features.js +6 -2
- package/es/src/charts/features/features.js.map +1 -1
- package/es/src/charts/features/featuresLegend.js +13 -5
- package/es/src/charts/features/featuresLegend.js.map +1 -1
- package/es/src/charts/features/plotPaint.js +51 -24
- package/es/src/charts/features/plotPaint.js.map +1 -1
- package/es/src/charts/features/shapeEmit.js +20 -2
- package/es/src/charts/features/shapeEmit.js.map +1 -1
- package/es/src/charts/index.js +1 -0
- package/es/src/charts/index.js.map +1 -1
- package/es/src/charts/pipeline/drillMorph.js +159 -0
- package/es/src/charts/pipeline/drillMorph.js.map +1 -0
- package/es/src/charts/pipeline/runChartDraw.js +35 -1
- package/es/src/charts/pipeline/runChartDraw.js.map +1 -1
- package/es/src/charts/pipeline/runVizPipeline.js +16 -1
- package/es/src/charts/pipeline/runVizPipeline.js.map +1 -1
- package/es/src/charts/pipeline/vizDrawPure.js +20 -0
- package/es/src/charts/pipeline/vizDrawPure.js.map +1 -1
- package/es/src/charts/viz/Viz.js +64 -8
- package/es/src/charts/viz/Viz.js.map +1 -1
- package/es/src/charts/viz/VizBase.js +29 -1
- package/es/src/charts/viz/VizBase.js.map +1 -1
- package/es/src/charts/viz/VizBaseConfig.js +9 -1
- package/es/src/charts/viz/VizBaseConfig.js.map +1 -1
- package/es/src/charts/viz/ordinalColor.js +2 -2
- package/es/src/charts/viz/ordinalColor.js.map +1 -1
- package/es/src/charts/viz/vizDefaults.js +27 -8
- package/es/src/charts/viz/vizDefaults.js.map +1 -1
- package/es/src/charts/viz/vizRender.js +54 -4
- package/es/src/charts/viz/vizRender.js.map +1 -1
- package/es/src/charts/viz/vizTypes.js.map +1 -1
- package/es/src/charts/viz/vizVisibility.js +145 -0
- package/es/src/charts/viz/vizVisibility.js.map +1 -0
- package/es/src/components/Axis/Axis.js +8 -8
- package/es/src/components/Axis/Axis.js.map +1 -1
- package/es/src/components/ColorScale/ColorScale.js +11 -11
- package/es/src/components/ColorScale/ColorScale.js.map +1 -1
- package/es/src/components/ColorScale/colorScaleScale.js +22 -10
- package/es/src/components/ColorScale/colorScaleScale.js.map +1 -1
- package/es/src/components/Legend/Legend.js +8 -5
- package/es/src/components/Legend/Legend.js.map +1 -1
- package/es/src/components/Legend/legendConfig.js +1 -1
- package/es/src/components/Legend/legendConfig.js.map +1 -1
- package/es/src/components/Legend/legendRender.js +29 -22
- package/es/src/components/Legend/legendRender.js.map +1 -1
- package/es/src/components/SizeLegend/SizeLegend.js +411 -0
- package/es/src/components/SizeLegend/SizeLegend.js.map +1 -0
- package/es/src/components/SizeLegend/sizeLegendLayout.js +285 -0
- package/es/src/components/SizeLegend/sizeLegendLayout.js.map +1 -0
- package/es/src/components/Timeline/timelineConfig.js +8 -4
- package/es/src/components/Timeline/timelineConfig.js.map +1 -1
- package/es/src/components/Timeline/timelineRender.js +1 -2
- package/es/src/components/Timeline/timelineRender.js.map +1 -1
- package/es/src/components/Tooltip.js +27 -7
- package/es/src/components/Tooltip.js.map +1 -1
- package/es/src/components/index.js +1 -0
- package/es/src/components/index.js.map +1 -1
- package/es/src/shapes/Box.js +4 -2
- package/es/src/shapes/Box.js.map +1 -1
- package/es/src/shapes/Shape.js +1 -1
- package/es/src/shapes/Shape.js.map +1 -1
- package/es/src/shapes/Whisker.js +3 -2
- package/es/src/shapes/Whisker.js.map +1 -1
- package/es/src/shapes/validateShapeConfig.js +141 -0
- package/es/src/shapes/validateShapeConfig.js.map +1 -0
- package/es/src/utils/BaseClass.js +134 -4
- package/es/src/utils/BaseClass.js.map +1 -1
- package/es/src/utils/D3plusConfig.js.map +1 -1
- package/es/src/utils/configDefault.js +17 -0
- package/es/src/utils/configDefault.js.map +1 -0
- package/es/src/utils/configPrep.js +2 -1
- package/es/src/utils/configPrep.js.map +1 -1
- package/es/src/utils/configWarnings.js +37 -0
- package/es/src/utils/configWarnings.js.map +1 -0
- package/es/src/utils/index.js +1 -0
- package/es/src/utils/index.js.map +1 -1
- package/package.json +11 -10
- package/types/index.d.ts +4 -4
- package/types/internal.d.ts +8 -1
- package/types/src/charts/BarChart/index.d.ts +2 -1
- package/types/src/charts/Geomap/applyLayout.d.ts +9 -1
- package/types/src/charts/Histogram/binData.d.ts +37 -0
- package/types/src/charts/Histogram/index.d.ts +14 -0
- package/types/src/charts/Network/applyLayout.d.ts +8 -0
- package/types/src/charts/Plot/discreteSpan.d.ts +9 -0
- package/types/src/charts/Plot/index.d.ts +39 -0
- package/types/src/charts/Plot/pipeline.d.ts +14 -0
- package/types/src/charts/Plot/sharedHover.d.ts +79 -0
- package/types/src/charts/Plot/sharedHoverScene.d.ts +11 -0
- package/types/src/charts/Plot/sharedTooltip.d.ts +26 -0
- package/types/src/charts/Plot/stackShareLabels.d.ts +21 -0
- package/types/src/charts/Plot/stackShareTooltip.d.ts +9 -0
- package/types/src/charts/Plot/trendLines.d.ts +70 -0
- package/types/src/charts/Plot/trendScene.d.ts +18 -0
- package/types/src/charts/Plot/trendTooltip.d.ts +19 -0
- package/types/src/charts/Rings/applyLayout.d.ts +9 -0
- package/types/src/charts/Rings/ringsSizing.d.ts +49 -0
- package/types/src/charts/StackedArea/index.d.ts +2 -1
- package/types/src/charts/definition/ChartDefinition.d.ts +30 -0
- package/types/src/charts/definition/makeChart.d.ts +2 -1
- package/types/src/charts/drawSteps/bottomRightControls.d.ts +26 -0
- package/types/src/charts/drawSteps/bottomRightControlsMarkup.d.ts +108 -0
- package/types/src/charts/features/emitHelpers.d.ts +8 -0
- package/types/src/charts/features/plotPaint.d.ts +25 -0
- package/types/src/charts/index.d.ts +1 -0
- package/types/src/charts/pipeline/drillMorph.d.ts +29 -0
- package/types/src/charts/pipeline/runVizPipeline.d.ts +8 -0
- package/types/src/charts/viz/Viz.d.ts +18 -1
- package/types/src/charts/viz/VizBase.d.ts +13 -0
- package/types/src/charts/viz/VizBaseConfig.d.ts +5 -1
- package/types/src/charts/viz/vizTypes.d.ts +147 -3
- package/types/src/charts/viz/vizVisibility.d.ts +34 -0
- package/types/src/components/Legend/legendRender.d.ts +8 -2
- package/types/src/components/SizeLegend/SizeLegend.d.ts +107 -0
- package/types/src/components/SizeLegend/sizeLegendLayout.d.ts +101 -0
- package/types/src/components/Tooltip.d.ts +18 -3
- package/types/src/components/index.d.ts +1 -0
- package/types/src/shapes/validateShapeConfig.d.ts +10 -0
- package/types/src/utils/BaseClass.d.ts +15 -1
- package/types/src/utils/D3plusConfig.d.ts +98 -0
- package/types/src/utils/configDefault.d.ts +11 -0
- package/types/src/utils/configWarnings.d.ts +28 -0
- package/types/src/utils/index.d.ts +2 -1
- package/umd/d3plus-core.full.js +7104 -2602
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +2860 -1583
- package/umd/d3plus-core.js +3682 -441
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +1656 -719
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/charts/Plot/draw.ts"],"sourcesContent":["/**\n `drawPlot` — Plot's layout/measure orchestration, extracted from the\n class body. Allocates throwaway measure-only axes, threads the data\n through the `pipeline.ts` stages, computes the padding the axes need,\n runs the base `Viz` draw, then hands a fully-populated context to\n `_paint`.\n*/\nimport {groups} from \"d3-array\";\n\nimport type {DataPoint} from \"@d3plus/data\";\n\nimport {AxisBottom, AxisLeft, AxisTop, TextBox} from \"../../components/index.js\";\nimport type {Axis} from \"../../components/index.js\";\nimport * as shapes from \"../../shapes/index.js\";\nimport type {D3Scale} from \"../../utils/index.js\";\n\nimport {measureAxes} from \"../features/axes.js\";\nimport type {LineLabelMeasurement} from \"../features/axes.js\";\nimport type {LabelWidth, PlotPaintContext} from \"../features/plotPaint.js\";\nimport Viz from \"../viz/Viz.js\";\nimport {runStages} from \"../pipeline/stages.js\";\nimport type {PlotConfigScales, PlotScales} from \"../pipeline/stages.js\";\nimport type {VizInstance} from \"../viz/vizTypes.js\";\nimport {\n computePlotAxisValues,\n computePlotInitialDomains,\n computePlotScales,\n extendPlotOppScales,\n formatPlotData,\n measurePlotLineLabels,\n preparePlotAxisLayout,\n} from \"./pipeline.js\";\n\n/** A formatted Plot data row (the PlotDatum shape produced by `formatPlotData`). */\ntype Row = Record<string, unknown>;\n/** The four configured scales threaded between the layout stages. */\ntype Scales = {x: D3Scale; y: D3Scale; x2: D3Scale; y2: D3Scale};\n\nconst testLineShape = new shapes.Line();\nconst testTextBox = new TextBox();\n\nconst superDraw = (viz: VizInstance, callback?: () => void) =>\n (Viz.prototype._draw as (...args: unknown[]) => unknown).call(viz, callback);\n\n/** Runs format + per-axis-value stages; returns formatted data and axis-value bundles. */\nfunction runPlotDataStages(viz: VizInstance) {\n const plotCtx = runStages({viz}, [formatPlotData, computePlotAxisValues]);\n // Time flags (xTime/x2Time/yTime/y2Time) are written onto `viz` by\n // `formatPlotData` and read directly via `viz._xTime` etc. downstream.\n return {\n data: plotCtx.plotFormattedData!,\n axisData: plotCtx.plotAxisData!,\n x2Exists: plotCtx.x2Exists!,\n y2Exists: plotCtx.y2Exists!,\n xData: plotCtx.xData!,\n x2Data: plotCtx.x2Data!,\n yData: plotCtx.yData!,\n y2Data: plotCtx.y2Data!,\n stackGroup: plotCtx.plotStackGroup!,\n };\n}\n\n/** Runs domain + scale stages; returns domains, stack data, and scale bundles. */\nfunction runPlotLayoutStages(\n viz: VizInstance,\n data: Row[],\n axisData: Row[],\n stackGroup: (d: DataPoint, i: number) => string,\n axisValues: {xData: unknown[]; x2Data: unknown[]; yData: unknown[]; y2Data: unknown[]},\n) {\n const {xData, x2Data, yData, y2Data} = axisValues;\n // Stacked/non-stacked domain construction + domain/scale setup are stages\n // on `plotDef`. Run them together and read all the outputs the paint phase\n // below needs.\n const layoutCtx = runStages(\n {\n viz,\n plotFormattedData: data,\n plotAxisData: axisData,\n xData,\n x2Data,\n yData,\n y2Data,\n plotStackGroup: stackGroup,\n },\n [computePlotInitialDomains, computePlotScales],\n );\n return {\n plotInitialDomains: layoutCtx.plotInitialDomains!,\n plotDiscreteKeys: layoutCtx.plotDiscreteKeys!,\n plotStackData: layoutCtx.plotStackData!,\n plotStackKeys: layoutCtx.plotStackKeys!,\n plotDomains: layoutCtx.plotDomains!,\n plotScales: layoutCtx.plotScales!,\n plotConfigScales: layoutCtx.plotConfigScales!,\n plotOpps: layoutCtx.plotOpps!,\n };\n}\n\n/** Extends opposite-axis scales via buffers; returns the reassigned x/y/x2/y2. */\nfunction runPlotExtendScales(\n viz: VizInstance,\n data: Row[],\n axisData: Row[],\n layoutCtx: {plotScales: PlotScales; plotConfigScales: PlotConfigScales},\n scales: Scales,\n): Scales {\n // Opposite-axis scale extension via buffers lives in the\n // `extendPlotOppScales` stage. Reassigns x/y/x2/y2 from the stage's\n // returned scales bundle.\n const extCtx = runStages(\n {\n viz,\n plotFormattedData: data,\n plotAxisData: axisData,\n plotScales: {...layoutCtx.plotScales, ...scales},\n plotConfigScales: layoutCtx.plotConfigScales,\n },\n [extendPlotOppScales],\n );\n const ext = extCtx.plotScales!;\n return {x: ext.x, y: ext.y, x2: ext.x2, y2: ext.y2};\n}\n\n/** Runs axis-layout prep; returns domains, default configs, show flags, ticks, and bar labels. */\nfunction runPlotAxisPrep(\n viz: VizInstance,\n axisData: Row[],\n layoutCtx: {plotScales: PlotScales},\n scales: Scales,\n exists: {x2Exists: boolean; y2Exists: boolean},\n axisValues: {x2Data: unknown[]; y2Data: unknown[]; yData: unknown[]},\n) {\n const {x2Exists, y2Exists} = exists;\n const {x2Data, y2Data, yData} = axisValues;\n // Axis-layout-prep lives in `preparePlotAxisLayout`.\n // Produces xDomain/yDomain/etc., defaultConfig/showX/showY, yC, barLabels,\n // and the four ticks arrays (null when ticks show, [] when redundant).\n const prepCtx = runStages(\n {\n viz,\n plotAxisData: axisData,\n plotScales: {...layoutCtx.plotScales, ...scales},\n x2Exists,\n y2Exists,\n x2Data,\n y2Data,\n yData,\n },\n [preparePlotAxisLayout],\n );\n return {\n plotDefaultConfig: prepCtx.plotDefaultConfig!,\n plotDefaultX2Config: prepCtx.plotDefaultX2Config!,\n plotDefaultY2Config: prepCtx.plotDefaultY2Config!,\n plotShowX: prepCtx.plotShowX!,\n plotShowY: prepCtx.plotShowY!,\n plotYC: prepCtx.plotYC!,\n plotBarLabels: prepCtx.plotBarLabels!,\n plotXTicks: prepCtx.plotXTicks!,\n plotX2Ticks: prepCtx.plotX2Ticks!,\n plotYTicks: prepCtx.plotYTicks!,\n plotY2Ticks: prepCtx.plotY2Ticks!,\n plotXDomain: prepCtx.plotXDomain!,\n plotX2Domain: prepCtx.plotX2Domain!,\n plotYDomain: prepCtx.plotYDomain!,\n plotY2Domain: prepCtx.plotY2Domain!,\n };\n}\n\n/** Builds the line-label width measure callback for the four-axis margin solve. */\nfunction makePlotLineLabelMeasure(\n viz: VizInstance,\n data: Row[],\n layoutCtx: {plotScales: PlotScales; plotConfigScales: PlotConfigScales},\n y2Exists: boolean,\n testAxes: {xTest: Axis; yTest: Axis},\n): () => LineLabelMeasurement {\n const {xTest, yTest} = testAxes;\n return () => {\n const lineLabelCtx = runStages(\n {\n viz,\n plotFormattedData: data,\n plotScales: layoutCtx.plotScales,\n plotConfigScales: layoutCtx.plotConfigScales,\n plotTestAxes: {xTest, yTest},\n plotLineLabelTest: {testLineShape, testTextBox},\n y2Exists,\n },\n [measurePlotLineLabels],\n );\n return {\n labelWidths: lineLabelCtx.plotLabelWidths as LabelWidth[],\n largestLabel: lineLabelCtx.plotLargestLabel,\n xRangeMax: lineLabelCtx.plotXRangeMax,\n };\n };\n}\n\nexport function drawPlot(viz: VizInstance, callback?: () => void) {\n if (!viz._filteredData.length && !viz._annotations?.length) {\n // Empty data: still run super._draw so the chart shell (title /\n // legend / total / timeline / colorScale) refreshes — features\n // tear down their DOM via .data([]) in their layout body, and\n // vizDrawPure resets _chartScene/_featurePanels/_shapes. Without\n // this, the previous render's chart shell (incl. aria-labels)\n // lingers in the DOM and toScene() emits stale nodes.\n superDraw(viz, callback);\n return viz;\n }\n\n // Throwaway measure-only axes. Allocated per draw, configured + measured\n // below, then garbage-collected when the function returns. Plot no longer\n // owns long-lived Axis instances just to compute layout. gridSize(0)\n // signals \"labels-only\" measure: the production axes (`_xAxis`,\n // `_yAxis`, …) handle grid rendering with their default gridSize.\n const xTest = new AxisBottom().align(\"end\").gridSize(0);\n const x2Test = new AxisTop().align(\"start\").gridSize(0);\n const yTest = new AxisLeft().align(\"start\").gridSize(0);\n const y2Test = new AxisLeft().align(\"end\").gridSize(0);\n\n // Plot's data-format + time-axis + sizeScale prep extracted to the\n // `formatPlotData` TransformStage, and per-axis values extracted to\n // `computePlotAxisValues`. Both run here; downstream paint code reads\n // their outputs from the returned context.\n const {data, axisData, x2Exists, y2Exists, xData, x2Data, yData, y2Data, stackGroup} = runPlotDataStages(viz);\n\n const height = viz.schema.height - viz._margin.top - viz._margin.bottom,\n opp = viz.schema.discrete ? (viz.schema.discrete === \"x\" ? \"y\" : \"x\") : undefined,\n width = viz.schema.width - viz._margin.left - viz._margin.right;\n\n // xData/x2Data/yData/y2Data computed by `computePlotAxisValues` stage.\n\n const layoutCtx = runPlotLayoutStages(viz, data, axisData, stackGroup, {xData, x2Data, yData, y2Data});\n const domains = layoutCtx.plotDomains;\n const discreteKeys = layoutCtx.plotDiscreteKeys;\n const stackData = layoutCtx.plotStackData;\n const stackKeys = layoutCtx.plotStackKeys;\n let {x, y, x2, y2} = layoutCtx.plotScales;\n const {xScale, yScale} = layoutCtx.plotScales;\n const {xConfigScale, yConfigScale, x2ConfigScale, y2ConfigScale} = layoutCtx.plotConfigScales;\n\n const shapeData = groups(\n data,\n (d: Row) => d.shape as string,\n ).sort(([a], [b]) => viz.schema.shapeSort(a, b));\n\n ({x, y, x2, y2} = runPlotExtendScales(viz, data, axisData, layoutCtx, {x, y, x2, y2}));\n\n const prepCtx = runPlotAxisPrep(viz, axisData, layoutCtx, {x, y, x2, y2}, {x2Exists, y2Exists}, {x2Data, y2Data, yData});\n const xDomain = prepCtx.plotXDomain as number[];\n const x2Domain = prepCtx.plotX2Domain as number[];\n const yDomain = prepCtx.plotYDomain as number[];\n const y2Domain = prepCtx.plotY2Domain as number[];\n const defaultConfig = prepCtx.plotDefaultConfig;\n const defaultX2Config = prepCtx.plotDefaultX2Config;\n const defaultY2Config = prepCtx.plotDefaultY2Config;\n const showX = prepCtx.plotShowX;\n const showY = prepCtx.plotShowY;\n const yC = prepCtx.plotYC;\n const xTicks = prepCtx.plotXTicks;\n const x2Ticks = prepCtx.plotX2Ticks;\n const yTicks = prepCtx.plotYTicks;\n const y2Ticks = prepCtx.plotY2Ticks;\n const barLabels = prepCtx.plotBarLabels;\n\n // Test axes use `.measure()` instead of `.select(testGroup).render()` —\n // pure layout pass, zero DOM creation. The coupled four-axis margin\n // solve lives in `measureAxes` (charts/axes.ts); the line-label width\n // measure (Plot-pipeline-specific) interleaves mid-solve via the\n // injected callback. `showLineLabels` is read by the shape-emission\n // block downstream.\n const showLineLabels = viz.schema.lineLabels && !y2Exists;\n const measureLineLabels = makePlotLineLabelMeasure(viz, data, layoutCtx, y2Exists, {xTest, yTest});\n\n const {\n yBounds,\n y2Bounds,\n yWidth,\n y2Width,\n xC,\n xRangeMax,\n labelWidths,\n largestLabel,\n xTestRange,\n x2TestRange,\n x2Height,\n xOffsetLeft,\n xOffsetRight,\n topOffset,\n xHeight,\n } = measureAxes(\n viz,\n {\n xTest, yTest, x2Test, y2Test,\n xDomain, x2Domain, yDomain, y2Domain,\n xTicks, x2Ticks, yTicks, y2Ticks,\n xConfigScale, x2ConfigScale, yConfigScale, y2ConfigScale,\n defaultX2Config, defaultY2Config, yC, showX, showY,\n x2Exists, y2Exists, height, width, xData,\n xScalePadding: x.padding ? x.padding() : 0,\n },\n measureLineLabels,\n );\n\n superDraw(viz, callback);\n const horizontalMargin = viz._margin.left + viz._margin.right;\n const verticalMargin = viz._margin.top + viz._margin.bottom;\n // The local layout types (DomainValue domains, D3Scale scales, dynamically-\n // keyed rows) are broader than PlotPaintContext's; the emit reads each field\n // as the concrete type its producer guaranteed, so bridge at this boundary.\n const pCtx = {\n domains, shapeData, axisData, data, discreteKeys, stackData, stackKeys,\n x, y, x2, y2, xScale, yScale, xConfigScale, yConfigScale, x2ConfigScale, y2ConfigScale,\n xDomain, yDomain, x2Domain, y2Domain, xData, yData, x2Data, y2Data, x2Exists, y2Exists,\n showX, showY, defaultConfig, defaultX2Config, defaultY2Config, yC, xC,\n xTicks, yTicks, x2Ticks, y2Ticks, labelWidths, largestLabel, xRangeMax,\n xTest, yTest, x2Test, y2Test, yBounds, y2Bounds, yWidth, y2Width, xHeight, x2Height,\n xOffsetLeft, xOffsetRight, topOffset, xTestRange, x2TestRange, height, width,\n opp, barLabels, showLineLabels, stackGroup, horizontalMargin, verticalMargin,\n } as unknown as PlotPaintContext;\n return viz._paint!(pCtx);\n}\n"],"names":["groups","AxisBottom","AxisLeft","AxisTop","TextBox","shapes","measureAxes","Viz","runStages","computePlotAxisValues","computePlotInitialDomains","computePlotScales","extendPlotOppScales","formatPlotData","measurePlotLineLabels","preparePlotAxisLayout","testLineShape","Line","testTextBox","superDraw","viz","callback","prototype","_draw","call","runPlotDataStages","plotCtx","data","plotFormattedData","axisData","plotAxisData","x2Exists","y2Exists","xData","x2Data","yData","y2Data","stackGroup","plotStackGroup","runPlotLayoutStages","axisValues","layoutCtx","plotInitialDomains","plotDiscreteKeys","plotStackData","plotStackKeys","plotDomains","plotScales","plotConfigScales","plotOpps","runPlotExtendScales","scales","extCtx","ext","x","y","x2","y2","runPlotAxisPrep","exists","prepCtx","plotDefaultConfig","plotDefaultX2Config","plotDefaultY2Config","plotShowX","plotShowY","plotYC","plotBarLabels","plotXTicks","plotX2Ticks","plotYTicks","plotY2Ticks","plotXDomain","plotX2Domain","plotYDomain","plotY2Domain","makePlotLineLabelMeasure","testAxes","xTest","yTest","lineLabelCtx","plotTestAxes","plotLineLabelTest","labelWidths","plotLabelWidths","largestLabel","plotLargestLabel","xRangeMax","plotXRangeMax","drawPlot","_filteredData","length","_annotations","align","gridSize","x2Test","y2Test","height","schema","_margin","top","bottom","opp","discrete","undefined","width","left","right","domains","discreteKeys","stackData","stackKeys","xScale","yScale","xConfigScale","yConfigScale","x2ConfigScale","y2ConfigScale","shapeData","d","shape","sort","a","b","shapeSort","xDomain","x2Domain","yDomain","y2Domain","defaultConfig","defaultX2Config","defaultY2Config","showX","showY","yC","xTicks","x2Ticks","yTicks","y2Ticks","barLabels","showLineLabels","lineLabels","measureLineLabels","xScalePadding","padding","yBounds","y2Bounds","yWidth","y2Width","xC","xTestRange","x2TestRange","x2Height","xOffsetLeft","xOffsetRight","topOffset","xHeight","horizontalMargin","verticalMargin","pCtx","_paint"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;AAMA,GACA,SAAQA,MAAM,QAAO,WAAW;AAIhC,SAAQC,UAAU,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,QAAO,4BAA4B;AAEjF,YAAYC,YAAY,wBAAwB;AAGhD,SAAQC,WAAW,QAAO,sBAAsB;AAGhD,OAAOC,SAAS,gBAAgB;AAChC,SAAQC,SAAS,QAAO,wBAAwB;AAGhD,SACEC,qBAAqB,EACrBC,yBAAyB,EACzBC,iBAAiB,EACjBC,mBAAmB,EACnBC,cAAc,EACdC,qBAAqB,EACrBC,qBAAqB,QAChB,gBAAgB;AAOvB,IAAMC,gBAAgB,IAAIX,OAAOY,IAAI;AACrC,IAAMC,cAAc,IAAId;AAExB,IAAMe,YAAY,mBAACC,KAAkBC;WACnC,AAACd,IAAIe,SAAS,CAACC,KAAK,CAAqCC,IAAI,CAACJ,KAAKC;;AAErE,wFAAwF,GACxF,SAASI,kBAAkBL,GAAgB;IACzC,IAAMM,UAAUlB,UAAU;QAACY,KAAAA;IAAG,GAAG;QAACP;QAAgBJ;KAAsB;IACxE,mEAAmE;IACnE,uEAAuE;IACvE,OAAO;QACLkB,MAAMD,QAAQE,iBAAiB;QAC/BC,UAAUH,QAAQI,YAAY;QAC9BC,UAAUL,QAAQK,QAAQ;QAC1BC,UAAUN,QAAQM,Q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C,IAAAA;QAAIC,IAAAA;QAAIuD,QAAAA;QAAQC,QAAAA;QAAQC,cAAAA;QAAcC,cAAAA;QAAcC,eAAAA;QAAeC,eAAAA;QACzEQ,SAAAA;QAASE,SAAAA;QAASD,UAAAA;QAAUE,UAAAA;QAAU/F,OAAAA;QAAOE,OAAAA;QAAOD,QAAAA;QAAQE,QAAAA;QAAQL,UAAAA;QAAUC,UAAAA;QAC9EoG,OAAAA;QAAOC,OAAAA;QAAOJ,eAAAA;QAAeC,iBAAAA;QAAiBC,iBAAAA;QAAiBG,IAAAA;QAAIe,IAAAA;QACnEd,QAAAA;QAAQE,QAAAA;QAAQD,SAAAA;QAASE,SAAAA;QAASvD,aAAAA;QAAaE,cAAAA;QAAcE,WAAAA;QAC7DT,OAAAA;QAAOC,OAAAA;QAAOgB,QAAAA;QAAQC,QAAAA;QAAQiD,SAAAA;QAASC,UAAAA;QAAUC,QAAAA;QAAQC,SAAAA;QAASQ,SAAAA;QAASJ,UAAAA;QAC3EC,aAAAA;QAAaC,cAAAA;QAAcC,WAAAA;QAAWL,YAAAA;QAAYC,aAAAA;QAAatD,QAAAA;QAAQQ,OAAAA;QACvEH,KAAAA;QAAKqC,WAAAA;QAAWC,gBAAAA;QAAgBvG,YAAAA;QAAYwH,kBAAAA;QAAkBC,gBAAAA;IAChE;IACA,OAAO1I,IAAI4I,MAAM,CAAED;AACrB"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/charts/Plot/draw.ts"],"sourcesContent":["/**\n `drawPlot` — Plot's layout/measure orchestration, extracted from the\n class body. Allocates throwaway measure-only axes, threads the data\n through the `pipeline.ts` stages, computes the padding the axes need,\n runs the base `Viz` draw, then hands a fully-populated context to\n `_paint`.\n*/\nimport {groups} from \"d3-array\";\n\nimport type {DataPoint} from \"@d3plus/data\";\n\nimport {AxisBottom, AxisLeft, AxisTop, TextBox} from \"../../components/index.js\";\nimport type {Axis} from \"../../components/index.js\";\nimport * as shapes from \"../../shapes/index.js\";\nimport type {D3Scale} from \"../../utils/index.js\";\n\nimport {measureAxes} from \"../features/axes.js\";\nimport type {LineLabelMeasurement} from \"../features/axes.js\";\nimport type {LabelWidth, PlotPaintContext} from \"../features/plotPaint.js\";\nimport Viz from \"../viz/Viz.js\";\nimport {runStages} from \"../pipeline/stages.js\";\nimport type {PlotConfigScales, PlotScales} from \"../pipeline/stages.js\";\nimport type {VizInstance} from \"../viz/vizTypes.js\";\nimport {\n computePlotAxisValues,\n computePlotInitialDomains,\n computePlotScales,\n extendPlotOppScales,\n formatPlotData,\n measurePlotLineLabels,\n preparePlotAxisLayout,\n} from \"./pipeline.js\";\nimport {computePlotTrendFits} from \"./trendLines.js\";\n\n/** A formatted Plot data row (the PlotDatum shape produced by `formatPlotData`). */\ntype Row = Record<string, unknown>;\n/** The four configured scales threaded between the layout stages. */\ntype Scales = {x: D3Scale; y: D3Scale; x2: D3Scale; y2: D3Scale};\n\nconst testLineShape = new shapes.Line();\nconst testTextBox = new TextBox();\n\nconst superDraw = (viz: VizInstance, callback?: () => void) =>\n (Viz.prototype._draw as (...args: unknown[]) => unknown).call(viz, callback);\n\n/** Runs format + per-axis-value stages; returns formatted data and axis-value bundles. */\nfunction runPlotDataStages(viz: VizInstance) {\n const plotCtx = runStages({viz}, [formatPlotData, computePlotAxisValues, computePlotTrendFits]);\n // Time flags (xTime/x2Time/yTime/y2Time) are written onto `viz` by\n // `formatPlotData` and read directly via `viz._xTime` etc. downstream.\n return {\n data: plotCtx.plotFormattedData!,\n axisData: plotCtx.plotAxisData!,\n x2Exists: plotCtx.x2Exists!,\n y2Exists: plotCtx.y2Exists!,\n xData: plotCtx.xData!,\n x2Data: plotCtx.x2Data!,\n yData: plotCtx.yData!,\n y2Data: plotCtx.y2Data!,\n stackGroup: plotCtx.plotStackGroup!,\n };\n}\n\n/** Runs domain + scale stages; returns domains, stack data, and scale bundles. */\nfunction runPlotLayoutStages(\n viz: VizInstance,\n data: Row[],\n axisData: Row[],\n stackGroup: (d: DataPoint, i: number) => string,\n axisValues: {xData: unknown[]; x2Data: unknown[]; yData: unknown[]; y2Data: unknown[]},\n) {\n const {xData, x2Data, yData, y2Data} = axisValues;\n // Stacked/non-stacked domain construction + domain/scale setup are stages\n // on `plotDef`. Run them together and read all the outputs the paint phase\n // below needs.\n const layoutCtx = runStages(\n {\n viz,\n plotFormattedData: data,\n plotAxisData: axisData,\n xData,\n x2Data,\n yData,\n y2Data,\n plotStackGroup: stackGroup,\n },\n [computePlotInitialDomains, computePlotScales],\n );\n return {\n plotInitialDomains: layoutCtx.plotInitialDomains!,\n plotDiscreteKeys: layoutCtx.plotDiscreteKeys!,\n plotStackData: layoutCtx.plotStackData!,\n plotStackKeys: layoutCtx.plotStackKeys!,\n plotDomains: layoutCtx.plotDomains!,\n plotScales: layoutCtx.plotScales!,\n plotConfigScales: layoutCtx.plotConfigScales!,\n plotOpps: layoutCtx.plotOpps!,\n };\n}\n\n/** Extends opposite-axis scales via buffers; returns the reassigned x/y/x2/y2. */\nfunction runPlotExtendScales(\n viz: VizInstance,\n data: Row[],\n axisData: Row[],\n layoutCtx: {plotScales: PlotScales; plotConfigScales: PlotConfigScales},\n scales: Scales,\n): Scales {\n // Opposite-axis scale extension via buffers lives in the\n // `extendPlotOppScales` stage. Reassigns x/y/x2/y2 from the stage's\n // returned scales bundle.\n const extCtx = runStages(\n {\n viz,\n plotFormattedData: data,\n plotAxisData: axisData,\n plotScales: {...layoutCtx.plotScales, ...scales},\n plotConfigScales: layoutCtx.plotConfigScales,\n },\n [extendPlotOppScales],\n );\n const ext = extCtx.plotScales!;\n return {x: ext.x, y: ext.y, x2: ext.x2, y2: ext.y2};\n}\n\n/** Runs axis-layout prep; returns domains, default configs, show flags, ticks, and bar labels. */\nfunction runPlotAxisPrep(\n viz: VizInstance,\n axisData: Row[],\n layoutCtx: {plotScales: PlotScales},\n scales: Scales,\n exists: {x2Exists: boolean; y2Exists: boolean},\n axisValues: {x2Data: unknown[]; y2Data: unknown[]; yData: unknown[]},\n) {\n const {x2Exists, y2Exists} = exists;\n const {x2Data, y2Data, yData} = axisValues;\n // Axis-layout-prep lives in `preparePlotAxisLayout`.\n // Produces xDomain/yDomain/etc., defaultConfig/showX/showY, yC, barLabels,\n // and the four ticks arrays (null when ticks show, [] when redundant).\n const prepCtx = runStages(\n {\n viz,\n plotAxisData: axisData,\n plotScales: {...layoutCtx.plotScales, ...scales},\n x2Exists,\n y2Exists,\n x2Data,\n y2Data,\n yData,\n },\n [preparePlotAxisLayout],\n );\n return {\n plotDefaultConfig: prepCtx.plotDefaultConfig!,\n plotDefaultX2Config: prepCtx.plotDefaultX2Config!,\n plotDefaultY2Config: prepCtx.plotDefaultY2Config!,\n plotShowX: prepCtx.plotShowX!,\n plotShowY: prepCtx.plotShowY!,\n plotYC: prepCtx.plotYC!,\n plotBarLabels: prepCtx.plotBarLabels!,\n plotXTicks: prepCtx.plotXTicks!,\n plotX2Ticks: prepCtx.plotX2Ticks!,\n plotYTicks: prepCtx.plotYTicks!,\n plotY2Ticks: prepCtx.plotY2Ticks!,\n plotXDomain: prepCtx.plotXDomain!,\n plotX2Domain: prepCtx.plotX2Domain!,\n plotYDomain: prepCtx.plotYDomain!,\n plotY2Domain: prepCtx.plotY2Domain!,\n };\n}\n\n/** Builds the line-label width measure callback for the four-axis margin solve. */\nfunction makePlotLineLabelMeasure(\n viz: VizInstance,\n data: Row[],\n layoutCtx: {plotScales: PlotScales; plotConfigScales: PlotConfigScales},\n y2Exists: boolean,\n testAxes: {xTest: Axis; yTest: Axis},\n): () => LineLabelMeasurement {\n const {xTest, yTest} = testAxes;\n return () => {\n const lineLabelCtx = runStages(\n {\n viz,\n plotFormattedData: data,\n plotScales: layoutCtx.plotScales,\n plotConfigScales: layoutCtx.plotConfigScales,\n plotTestAxes: {xTest, yTest},\n plotLineLabelTest: {testLineShape, testTextBox},\n y2Exists,\n },\n [measurePlotLineLabels],\n );\n return {\n labelWidths: lineLabelCtx.plotLabelWidths as LabelWidth[],\n largestLabel: lineLabelCtx.plotLargestLabel,\n xRangeMax: lineLabelCtx.plotXRangeMax,\n };\n };\n}\n\nexport function drawPlot(viz: VizInstance, callback?: () => void) {\n if (!viz._filteredData.length && !viz._annotations?.length) {\n // Empty data: still run super._draw so the chart shell (title /\n // legend / total / timeline / colorScale) refreshes — features\n // tear down their DOM via .data([]) in their layout body, and\n // vizDrawPure resets _chartScene/_featurePanels/_shapes. Without\n // this, the previous render's chart shell (incl. aria-labels)\n // lingers in the DOM and toScene() emits stale nodes.\n superDraw(viz, callback);\n return viz;\n }\n\n // Throwaway measure-only axes. Allocated per draw, configured + measured\n // below, then garbage-collected when the function returns. Plot no longer\n // owns long-lived Axis instances just to compute layout. gridSize(0)\n // signals \"labels-only\" measure: the production axes (`_xAxis`,\n // `_yAxis`, …) handle grid rendering with their default gridSize.\n const xTest = new AxisBottom().align(\"end\").gridSize(0);\n const x2Test = new AxisTop().align(\"start\").gridSize(0);\n const yTest = new AxisLeft().align(\"start\").gridSize(0);\n const y2Test = new AxisLeft().align(\"end\").gridSize(0);\n\n // Plot's data-format + time-axis + sizeScale prep extracted to the\n // `formatPlotData` TransformStage, and per-axis values extracted to\n // `computePlotAxisValues`. Both run here; downstream paint code reads\n // their outputs from the returned context.\n const {data, axisData, x2Exists, y2Exists, xData, x2Data, yData, y2Data, stackGroup} = runPlotDataStages(viz);\n\n const height = viz.schema.height - viz._margin.top - viz._margin.bottom,\n opp = viz.schema.discrete ? (viz.schema.discrete === \"x\" ? \"y\" : \"x\") : undefined,\n width = viz.schema.width - viz._margin.left - viz._margin.right;\n\n // xData/x2Data/yData/y2Data computed by `computePlotAxisValues` stage.\n\n const layoutCtx = runPlotLayoutStages(viz, data, axisData, stackGroup, {xData, x2Data, yData, y2Data});\n const domains = layoutCtx.plotDomains;\n const discreteKeys = layoutCtx.plotDiscreteKeys;\n const stackData = layoutCtx.plotStackData;\n const stackKeys = layoutCtx.plotStackKeys;\n let {x, y, x2, y2} = layoutCtx.plotScales;\n const {xScale, yScale} = layoutCtx.plotScales;\n const {xConfigScale, yConfigScale, x2ConfigScale, y2ConfigScale} = layoutCtx.plotConfigScales;\n\n const shapeData = groups(\n data,\n (d: Row) => d.shape as string,\n ).sort(([a], [b]) => viz.schema.shapeSort(a, b));\n\n ({x, y, x2, y2} = runPlotExtendScales(viz, data, axisData, layoutCtx, {x, y, x2, y2}));\n\n const prepCtx = runPlotAxisPrep(viz, axisData, layoutCtx, {x, y, x2, y2}, {x2Exists, y2Exists}, {x2Data, y2Data, yData});\n const xDomain = prepCtx.plotXDomain as number[];\n const x2Domain = prepCtx.plotX2Domain as number[];\n const yDomain = prepCtx.plotYDomain as number[];\n const y2Domain = prepCtx.plotY2Domain as number[];\n const defaultConfig = prepCtx.plotDefaultConfig;\n const defaultX2Config = prepCtx.plotDefaultX2Config;\n const defaultY2Config = prepCtx.plotDefaultY2Config;\n const showX = prepCtx.plotShowX;\n const showY = prepCtx.plotShowY;\n const yC = prepCtx.plotYC;\n const xTicks = prepCtx.plotXTicks;\n const x2Ticks = prepCtx.plotX2Ticks;\n const yTicks = prepCtx.plotYTicks;\n const y2Ticks = prepCtx.plotY2Ticks;\n const barLabels = prepCtx.plotBarLabels;\n\n // Test axes use `.measure()` instead of `.select(testGroup).render()` —\n // pure layout pass, zero DOM creation. The coupled four-axis margin\n // solve lives in `measureAxes` (charts/axes.ts); the line-label width\n // measure (Plot-pipeline-specific) interleaves mid-solve via the\n // injected callback. `showLineLabels` is read by the shape-emission\n // block downstream.\n const showLineLabels = viz.schema.lineLabels && !y2Exists;\n const measureLineLabels = makePlotLineLabelMeasure(viz, data, layoutCtx, y2Exists, {xTest, yTest});\n\n const {\n yBounds,\n y2Bounds,\n yWidth,\n y2Width,\n xC,\n xRangeMax,\n labelWidths,\n largestLabel,\n xTestRange,\n x2TestRange,\n x2Height,\n xOffsetLeft,\n xOffsetRight,\n topOffset,\n xHeight,\n } = measureAxes(\n viz,\n {\n xTest, yTest, x2Test, y2Test,\n xDomain, x2Domain, yDomain, y2Domain,\n xTicks, x2Ticks, yTicks, y2Ticks,\n xConfigScale, x2ConfigScale, yConfigScale, y2ConfigScale,\n defaultX2Config, defaultY2Config, yC, showX, showY,\n x2Exists, y2Exists, height, width, xData,\n xScalePadding: x.padding ? x.padding() : 0,\n },\n measureLineLabels,\n );\n\n superDraw(viz, callback);\n const horizontalMargin = viz._margin.left + viz._margin.right;\n const verticalMargin = viz._margin.top + viz._margin.bottom;\n // The local layout types (DomainValue domains, D3Scale scales, dynamically-\n // keyed rows) are broader than PlotPaintContext's; the emit reads each field\n // as the concrete type its producer guaranteed, so bridge at this boundary.\n const pCtx = {\n domains, shapeData, axisData, data, discreteKeys, stackData, stackKeys,\n x, y, x2, y2, xScale, yScale, xConfigScale, yConfigScale, x2ConfigScale, y2ConfigScale,\n xDomain, yDomain, x2Domain, y2Domain, xData, yData, x2Data, y2Data, x2Exists, y2Exists,\n showX, showY, defaultConfig, defaultX2Config, defaultY2Config, yC, xC,\n xTicks, yTicks, x2Ticks, y2Ticks, labelWidths, largestLabel, xRangeMax,\n xTest, yTest, x2Test, y2Test, yBounds, y2Bounds, yWidth, y2Width, xHeight, x2Height,\n xOffsetLeft, xOffsetRight, topOffset, xTestRange, x2TestRange, height, width,\n opp, barLabels, showLineLabels, stackGroup, horizontalMargin, verticalMargin,\n } as unknown as PlotPaintContext;\n return viz._paint!(pCtx);\n}\n"],"names":["groups","AxisBottom","AxisLeft","AxisTop","TextBox","shapes","measureAxes","Viz","runStages","computePlotAxisValues","computePlotInitialDomains","computePlotScales","extendPlotOppScales","formatPlotData","measurePlotLineLabels","preparePlotAxisLayout","computePlotTrendFits","testLineShape","Line","testTextBox","superDraw","viz","callback","prototype","_draw","call","runPlotDataStages","plotCtx","data","plotFormattedData","axisData","plotAxisData","x2Exists","y2Exists","xData","x2Data","yData","y2Data","stackGroup","plotStackGroup","runPlotLayoutStages","axisValues","layoutCtx","plotInitialDomains","plotDiscreteKeys","plotStackData","plotStackKeys","plotDomains","plotScales","plotConfigScales","plotOpps","runPlotExtendScales","scales","extCtx","ext","x","y","x2","y2","runPlotAxisPrep","exists","prepCtx","plotDefaultConfig","plotDefaultX2Config","plotDefaultY2Config","plotShowX","plotShowY","plotYC","plotBarLabels","plotXTicks","plotX2Ticks","plotYTicks","plotY2Ticks","plotXDomain","plotX2Domain","plotYDomain","plotY2Domain","makePlotLineLabelMeasure","testAxes","xTest","yTest","lineLabelCtx","plotTestAxes","plotLineLabelTest","labelWidths","plotLabelWidths","largestLabel","plotLargestLabel","xRangeMax","plotXRangeMax","drawPlot","_filteredData","length","_annotations","align","gridSize","x2Test","y2Test","height","schema","_margin","top","bottom","opp","discrete","undefined","width","left","right","domains","discreteKeys","stackData","stackKeys","xScale","yScale","xConfigScale","yConfigScale","x2ConfigScale","y2ConfigScale","shapeData","d","shape","sort","a","b","shapeSort","xDomain","x2Domain","yDomain","y2Domain","defaultConfig","defaultX2Config","defaultY2Config","showX","showY","yC","xTicks","x2Ticks","yTicks","y2Ticks","barLabels","showLineLabels","lineLabels","measureLineLabels","xScalePadding","padding","yBounds","y2Bounds","yWidth","y2Width","xC","xTestRange","x2TestRange","x2Height","xOffsetLeft","xOffsetRight","topOffset","xHeight","horizontalMargin","verticalMargin","pCtx","_paint"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;AAMA,GACA,SAAQA,MAAM,QAAO,WAAW;AAIhC,SAAQC,UAAU,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,QAAO,4BAA4B;AAEjF,YAAYC,YAAY,wBAAwB;AAGhD,SAAQC,WAAW,QAAO,sBAAsB;AAGhD,OAAOC,SAAS,gBAAgB;AAChC,SAAQC,SAAS,QAAO,wBAAwB;AAGhD,SACEC,qBAAqB,EACrBC,yBAAyB,EACzBC,iBAAiB,EACjBC,mBAAmB,EACnBC,cAAc,EACdC,qBAAqB,EACrBC,qBAAqB,QAChB,gBAAgB;A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WAAAA;QAAWC,gBAAAA;QAAgBvG,YAAAA;QAAYwH,kBAAAA;QAAkBC,gBAAAA;IAChE;IACA,OAAO1I,IAAI4I,MAAM,CAAED;AACrB"}
|
|
@@ -3,6 +3,9 @@ function _array_like_to_array(arr, len) {
|
|
|
3
3
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
4
|
return arr2;
|
|
5
5
|
}
|
|
6
|
+
function _array_with_holes(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return arr;
|
|
8
|
+
}
|
|
6
9
|
function _array_without_holes(arr) {
|
|
7
10
|
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
8
11
|
}
|
|
@@ -35,6 +38,19 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
35
38
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
36
39
|
return Constructor;
|
|
37
40
|
}
|
|
41
|
+
function _define_property(obj, key, value) {
|
|
42
|
+
if (key in obj) {
|
|
43
|
+
Object.defineProperty(obj, key, {
|
|
44
|
+
value: value,
|
|
45
|
+
enumerable: true,
|
|
46
|
+
configurable: true,
|
|
47
|
+
writable: true
|
|
48
|
+
});
|
|
49
|
+
} else {
|
|
50
|
+
obj[key] = value;
|
|
51
|
+
}
|
|
52
|
+
return obj;
|
|
53
|
+
}
|
|
38
54
|
function _get(target, property, receiver) {
|
|
39
55
|
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
40
56
|
_get = Reflect.get;
|
|
@@ -81,6 +97,33 @@ function _instanceof(left, right) {
|
|
|
81
97
|
function _iterable_to_array(iter) {
|
|
82
98
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
83
99
|
}
|
|
100
|
+
function _iterable_to_array_limit(arr, i) {
|
|
101
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
102
|
+
if (_i == null) return;
|
|
103
|
+
var _arr = [];
|
|
104
|
+
var _n = true;
|
|
105
|
+
var _d = false;
|
|
106
|
+
var _s, _e;
|
|
107
|
+
try {
|
|
108
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
109
|
+
_arr.push(_s.value);
|
|
110
|
+
if (i && _arr.length === i) break;
|
|
111
|
+
}
|
|
112
|
+
} catch (err) {
|
|
113
|
+
_d = true;
|
|
114
|
+
_e = err;
|
|
115
|
+
} finally{
|
|
116
|
+
try {
|
|
117
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
118
|
+
} finally{
|
|
119
|
+
if (_d) throw _e;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return _arr;
|
|
123
|
+
}
|
|
124
|
+
function _non_iterable_rest() {
|
|
125
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
126
|
+
}
|
|
84
127
|
function _non_iterable_spread() {
|
|
85
128
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
86
129
|
}
|
|
@@ -97,6 +140,9 @@ function _set_prototype_of(o, p) {
|
|
|
97
140
|
};
|
|
98
141
|
return _set_prototype_of(o, p);
|
|
99
142
|
}
|
|
143
|
+
function _sliced_to_array(arr, i) {
|
|
144
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
145
|
+
}
|
|
100
146
|
function _super_prop_base(object, property) {
|
|
101
147
|
while(!Object.prototype.hasOwnProperty.call(object, property)){
|
|
102
148
|
object = _get_prototype_of(object);
|
|
@@ -131,7 +177,7 @@ function _is_native_reflect_construct() {
|
|
|
131
177
|
import pkg from "open-color/open-color.js";
|
|
132
178
|
import { zoomTransform } from "d3-zoom";
|
|
133
179
|
var openColor = pkg.theme;
|
|
134
|
-
import { colorAssign, colorContrast
|
|
180
|
+
import { colorAssign, colorContrast } from "@d3plus/color";
|
|
135
181
|
import { assign, backgroundColor } from "@d3plus/dom";
|
|
136
182
|
import { AxisBottom, AxisLeft, AxisRight, AxisTop } from "../../components/index.js";
|
|
137
183
|
import { accessor, constant } from "../../utils/index.js";
|
|
@@ -173,6 +219,10 @@ var plotSchema = [
|
|
|
173
219
|
key: "stacked",
|
|
174
220
|
coerce: "identity"
|
|
175
221
|
},
|
|
222
|
+
{
|
|
223
|
+
key: "tooltipShared",
|
|
224
|
+
coerce: "identity"
|
|
225
|
+
},
|
|
176
226
|
{
|
|
177
227
|
key: "xCutoff",
|
|
178
228
|
coerce: "identity"
|
|
@@ -214,11 +264,14 @@ var plotSchema = [
|
|
|
214
264
|
coerce: "identity"
|
|
215
265
|
}
|
|
216
266
|
];
|
|
217
|
-
import { plotDef } from "./pipeline.js";
|
|
267
|
+
import { plotDef, plotSizeLegendScale } from "./pipeline.js";
|
|
218
268
|
import { drawPlot } from "./draw.js";
|
|
219
269
|
import { plotShapeDefaults } from "./shapeDefaults.js";
|
|
220
270
|
import { resolveStackOffset, resolveStackOrder, stackOffsetDiverging, stackOrderTotalDescending } from "./stackHelpers.js";
|
|
221
271
|
import { paintZoomablePlot, zoomPlot } from "./plotZoom.js";
|
|
272
|
+
import { trendLineDefaults } from "./trendLines.js";
|
|
273
|
+
import { contentPoint, handleSharedHover } from "./sharedHover.js";
|
|
274
|
+
import { appendSharedHoverNodes } from "./sharedHoverScene.js";
|
|
222
275
|
import Viz from "../viz/Viz.js";
|
|
223
276
|
import { default as BarBuffer } from "../plotBuffers/Bar.js";
|
|
224
277
|
import { default as BoxBuffer } from "../plotBuffers/Box.js";
|
|
@@ -238,7 +291,7 @@ var Plot = /*#__PURE__*/ function(Viz1) {
|
|
|
238
291
|
function Plot() {
|
|
239
292
|
_class_call_check(this, Plot);
|
|
240
293
|
var _this;
|
|
241
|
-
_this = _call_super(this, Plot);
|
|
294
|
+
_this = _call_super(this, Plot), _define_property(_this, "_trendLine", plotDef.defaults.trendLine), _define_property(_this, "_trendLineConfig", trendLineDefaults());
|
|
242
295
|
// E4: install identity-coerce accessors on Plot.prototype. Defaults
|
|
243
296
|
// are still applied below imperatively from plotDef; installFluent
|
|
244
297
|
// skips slots that are already set, so the constructor wins.
|
|
@@ -268,6 +321,11 @@ var Plot = /*#__PURE__*/ function(Viz1) {
|
|
|
268
321
|
},
|
|
269
322
|
fillOpacity: constant(0.5)
|
|
270
323
|
};
|
|
324
|
+
_this._crosshairConfig = {
|
|
325
|
+
stroke: openColor.colors.gray[500],
|
|
326
|
+
strokeDasharray: "4 3",
|
|
327
|
+
strokeWidth: 1
|
|
328
|
+
};
|
|
271
329
|
_this._discreteCutoff = defaults.discreteCutoff;
|
|
272
330
|
_this._groupPadding = defaults.groupPadding;
|
|
273
331
|
_this._labelConnectorConfig = {
|
|
@@ -276,7 +334,7 @@ var Plot = /*#__PURE__*/ function(Viz1) {
|
|
|
276
334
|
_this._labelPosition = constant("auto");
|
|
277
335
|
_this._lineMarkerConfig = {
|
|
278
336
|
fill: function fill(d, i) {
|
|
279
|
-
return colorAssign(_this._id(d, i));
|
|
337
|
+
return colorAssign(_this._id(d, i), _this.schema.colorDefaults);
|
|
280
338
|
},
|
|
281
339
|
r: constant(3)
|
|
282
340
|
};
|
|
@@ -300,6 +358,7 @@ var Plot = /*#__PURE__*/ function(Viz1) {
|
|
|
300
358
|
_this.schema.shapeSort = function(a, b) {
|
|
301
359
|
return _this._shapeOrder.indexOf(a) - _this._shapeOrder.indexOf(b);
|
|
302
360
|
};
|
|
361
|
+
_this.schema.tooltipShared = defaults.tooltipShared;
|
|
303
362
|
_this.schema.sizeMax = 20;
|
|
304
363
|
_this.schema.sizeMin = 5;
|
|
305
364
|
_this.schema.sizeScale = "sqrt";
|
|
@@ -326,8 +385,8 @@ var Plot = /*#__PURE__*/ function(Viz1) {
|
|
|
326
385
|
var position = _this._xAxis._getPosition.bind(_this._xAxis)(d.id);
|
|
327
386
|
if (range[0] === position) return "transparent";
|
|
328
387
|
var bg = _this._select ? backgroundColor(_this._select.node()) : "rgb(255, 255, 255)";
|
|
329
|
-
var contrast = colorContrast(bg);
|
|
330
|
-
return contrast === colorDefaults.dark ? openColor.colors.gray[200] : openColor.colors.gray[600];
|
|
388
|
+
var contrast = colorContrast(bg, _this.schema.colorDefaults);
|
|
389
|
+
return contrast === _this.schema.colorDefaults.dark ? openColor.colors.gray[200] : openColor.colors.gray[600];
|
|
331
390
|
}
|
|
332
391
|
}
|
|
333
392
|
};
|
|
@@ -348,8 +407,8 @@ var Plot = /*#__PURE__*/ function(Viz1) {
|
|
|
348
407
|
var position = _this._yAxis._getPosition.bind(_this._yAxis)(d.id);
|
|
349
408
|
if (range[range.length - 1] === position) return "transparent";
|
|
350
409
|
var bg = _this._select ? backgroundColor(_this._select.node()) : "rgb(255, 255, 255)";
|
|
351
|
-
var contrast = colorContrast(bg);
|
|
352
|
-
return contrast === colorDefaults.dark ? openColor.colors.gray[200] : openColor.colors.gray[600];
|
|
410
|
+
var contrast = colorContrast(bg, _this.schema.colorDefaults);
|
|
411
|
+
return contrast === _this.schema.colorDefaults.dark ? openColor.colors.gray[200] : openColor.colors.gray[600];
|
|
353
412
|
}
|
|
354
413
|
}
|
|
355
414
|
};
|
|
@@ -436,6 +495,7 @@ var Plot = /*#__PURE__*/ function(Viz1) {
|
|
|
436
495
|
}
|
|
437
496
|
}
|
|
438
497
|
(_scene_root_children = scene.root.children).unshift.apply(_scene_root_children, _to_consumable_array(axisNodes));
|
|
498
|
+
appendSharedHoverNodes(this, scene);
|
|
439
499
|
return scene;
|
|
440
500
|
}
|
|
441
501
|
},
|
|
@@ -570,11 +630,7 @@ var Plot = /*#__PURE__*/ function(Viz1) {
|
|
|
570
630
|
@private
|
|
571
631
|
*/ key: "_nearestInteractionPoint",
|
|
572
632
|
value: function _nearestInteractionPoint(points, point) {
|
|
573
|
-
var
|
|
574
|
-
var scale = t && t.scale ? t.scale : 1;
|
|
575
|
-
var c = this._chartTransform;
|
|
576
|
-
var cx = (point[0] - (t ? t.x : 0)) / scale - (c ? c.x : 0);
|
|
577
|
-
var cy = (point[1] - (t ? t.y : 0)) / scale - (c ? c.y : 0);
|
|
633
|
+
var _contentPoint = _sliced_to_array(contentPoint(this, point), 2), cx = _contentPoint[0], cy = _contentPoint[1];
|
|
578
634
|
var axis = this.schema.discrete === "y" ? "y" : "x";
|
|
579
635
|
var target = axis === "y" ? cy : cx;
|
|
580
636
|
var best = null;
|
|
@@ -608,6 +664,18 @@ var Plot = /*#__PURE__*/ function(Viz1) {
|
|
|
608
664
|
},
|
|
609
665
|
{
|
|
610
666
|
/**
|
|
667
|
+
Drives the shared multi-series tooltip + crosshair: while the pointer is
|
|
668
|
+
inside the plot area, snaps to the nearest discrete position and, when
|
|
669
|
+
two or more series share it, shows them all in one tooltip (suppressing
|
|
670
|
+
the single-shape tooltip). Clears on leaving the plot area or the chart.
|
|
671
|
+
@private
|
|
672
|
+
*/ key: "_sharedHover",
|
|
673
|
+
value: function _sharedHover(event) {
|
|
674
|
+
handleSharedHover(this, event);
|
|
675
|
+
}
|
|
676
|
+
},
|
|
677
|
+
{
|
|
678
|
+
/**
|
|
611
679
|
Extends the draw behavior of the abstract Viz class.
|
|
612
680
|
@private
|
|
613
681
|
*/ key: "_draw",
|
|
@@ -617,6 +685,15 @@ var Plot = /*#__PURE__*/ function(Viz1) {
|
|
|
617
685
|
},
|
|
618
686
|
{
|
|
619
687
|
/**
|
|
688
|
+
The bubble radius scale, for the size legend (see `plotSizeLegendScale`).
|
|
689
|
+
@private
|
|
690
|
+
*/ key: "_sizeLegendScale",
|
|
691
|
+
value: function _sizeLegendScale() {
|
|
692
|
+
return plotSizeLegendScale(this);
|
|
693
|
+
}
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
/**
|
|
620
697
|
Paint phase: production axis rendering, shape buffer setup, and shape
|
|
621
698
|
emission with event handlers. Receives all cross-phase locals from
|
|
622
699
|
_draw via `pCtx` (so this method has zero coupling to _draw's local
|
|
@@ -763,6 +840,41 @@ Additionally, each config object can also contain an optional "layer" key, which
|
|
|
763
840
|
},
|
|
764
841
|
{
|
|
765
842
|
/**
|
|
843
|
+
Paint for the shared tooltip's crosshair guide line (`stroke`,
|
|
844
|
+
`strokeWidth`, `strokeDasharray`, `strokeOpacity`, …). Merged into the
|
|
845
|
+
current config.
|
|
846
|
+
*/ key: "crosshairConfig",
|
|
847
|
+
value: function crosshairConfig(_) {
|
|
848
|
+
return arguments.length ? (this._crosshairConfig = assign(this._crosshairConfig, _), this) : this._crosshairConfig;
|
|
849
|
+
}
|
|
850
|
+
},
|
|
851
|
+
{
|
|
852
|
+
/**
|
|
853
|
+
Draws an automatic trend line fit to the plotted data: `true` (or `"linear"`) for a least-squares line, or one of `"exponential"`, `"logarithmic"`, `"power"`, or `"polynomial"`. By default each series gets its own line in its color; see `trendLineConfig` for grouping, a confidence band, and styling. On a chart with a discrete axis, the line runs along that axis, fitting categories by their order. Set to `false` (the default) to remove.
|
|
854
|
+
*/ key: "trendLine",
|
|
855
|
+
value: function trendLine(_) {
|
|
856
|
+
return arguments.length ? (this._trendLine = _, this) : this._trendLine;
|
|
857
|
+
}
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
/**
|
|
861
|
+
Options for the trend lines drawn by `trendLine`, merged into the current config:
|
|
862
|
+
- `group`: `"series"` (default) fits one line per series, colored to match it; `"all"` fits a single line to every point.
|
|
863
|
+
- `order`: the polynomial degree when `trendLine` is `"polynomial"` (default `2`).
|
|
864
|
+
- `confidence`: draws a confidence band around a linear fit (default `false`).
|
|
865
|
+
- `confidenceLevel`: the band's confidence level (default `0.95`).
|
|
866
|
+
- `confidenceConfig`: Area shape config for the band (default `{fillOpacity: 0.15}`; fill defaults to the line color).
|
|
867
|
+
- `tooltip`: shows the fitted equation and R² when hovering a line (default `true`).
|
|
868
|
+
- Any other key (`stroke`, `strokeWidth`, `strokeDasharray`, …) styles the Line shape.
|
|
869
|
+
|
|
870
|
+
Stacked charts always fit one line to the stack totals.
|
|
871
|
+
*/ key: "trendLineConfig",
|
|
872
|
+
value: function trendLineConfig(_) {
|
|
873
|
+
return arguments.length ? (this._trendLineConfig = assign(this._trendLineConfig, _), this) : this._trendLineConfig;
|
|
874
|
+
}
|
|
875
|
+
},
|
|
876
|
+
{
|
|
877
|
+
/**
|
|
766
878
|
Shape config for the Circle shapes drawn by the lineMarkers method.
|
|
767
879
|
*/ key: "lineMarkerConfig",
|
|
768
880
|
value: function lineMarkerConfig(_) {
|
|
@@ -782,7 +894,10 @@ Additionally, each config object can also contain an optional "layer" key, which
|
|
|
782
894
|
Sets the size of bubbles to the given Number, data key, or function.
|
|
783
895
|
*/ key: "size",
|
|
784
896
|
value: function size(_) {
|
|
785
|
-
|
|
897
|
+
if (!arguments.length) return this._size;
|
|
898
|
+
this._size = typeof _ === "function" || !_ ? _ : accessor(_);
|
|
899
|
+
this._sizeKey = typeof _ === "string" ? _ : undefined;
|
|
900
|
+
return this;
|
|
786
901
|
}
|
|
787
902
|
},
|
|
788
903
|
{
|