@d3plus/core 4.2.0 → 4.5.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 +2137 -953
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/internal.js +7 -1
- package/es/internal.js.map +1 -1
- package/es/src/charts/AreaPlot/index.js +1 -2
- package/es/src/charts/AreaPlot/index.js.map +1 -1
- package/es/src/charts/BarChart/index.js +1 -2
- package/es/src/charts/BarChart/index.js.map +1 -1
- package/es/src/charts/BoxWhisker/index.js +1 -2
- package/es/src/charts/BoxWhisker/index.js.map +1 -1
- package/es/src/charts/BumpChart/index.js +1 -2
- package/es/src/charts/BumpChart/index.js.map +1 -1
- package/es/src/charts/Chord/applyLayout.js +205 -0
- package/es/src/charts/Chord/applyLayout.js.map +1 -0
- package/es/src/charts/Chord/emit.js +168 -0
- package/es/src/charts/Chord/emit.js.map +1 -0
- package/es/src/charts/Chord/index.js +234 -0
- package/es/src/charts/Chord/index.js.map +1 -0
- package/es/src/charts/Geomap/basemapTheme.js +78 -0
- package/es/src/charts/Geomap/basemapTheme.js.map +1 -0
- package/es/src/charts/Geomap/emit.js +58 -9
- package/es/src/charts/Geomap/emit.js.map +1 -1
- package/es/src/charts/Geomap/index.js +93 -99
- package/es/src/charts/Geomap/index.js.map +1 -1
- package/es/src/charts/LinePlot/index.js +1 -2
- package/es/src/charts/LinePlot/index.js.map +1 -1
- package/es/src/charts/Matrix/emit.js +6 -0
- package/es/src/charts/Matrix/emit.js.map +1 -1
- package/es/src/charts/Matrix/index.js +1 -2
- package/es/src/charts/Matrix/index.js.map +1 -1
- package/es/src/charts/Network/emit.js +58 -24
- package/es/src/charts/Network/emit.js.map +1 -1
- package/es/src/charts/Network/index.js +34 -54
- package/es/src/charts/Network/index.js.map +1 -1
- package/es/src/charts/Pack/emit.js +3 -0
- package/es/src/charts/Pack/emit.js.map +1 -1
- package/es/src/charts/Pack/index.js +1 -2
- package/es/src/charts/Pack/index.js.map +1 -1
- package/es/src/charts/Pie/emit.js +6 -2
- package/es/src/charts/Pie/emit.js.map +1 -1
- package/es/src/charts/Pie/index.js +1 -2
- package/es/src/charts/Pie/index.js.map +1 -1
- package/es/src/charts/Plot/index.js +99 -4
- package/es/src/charts/Plot/index.js.map +1 -1
- package/es/src/charts/Plot/pipeline.js +25 -5
- package/es/src/charts/Plot/pipeline.js.map +1 -1
- package/es/src/charts/Plot/plotZoom.js +278 -0
- package/es/src/charts/Plot/plotZoom.js.map +1 -0
- package/es/src/charts/Priestley/emit.js +4 -0
- package/es/src/charts/Priestley/emit.js.map +1 -1
- package/es/src/charts/Priestley/index.js +1 -2
- package/es/src/charts/Priestley/index.js.map +1 -1
- package/es/src/charts/Radar/emit.js +4 -1
- package/es/src/charts/Radar/emit.js.map +1 -1
- package/es/src/charts/Radar/index.js +1 -2
- package/es/src/charts/Radar/index.js.map +1 -1
- package/es/src/charts/RadialMatrix/emit.js +6 -0
- package/es/src/charts/RadialMatrix/emit.js.map +1 -1
- package/es/src/charts/RadialMatrix/index.js +1 -2
- package/es/src/charts/RadialMatrix/index.js.map +1 -1
- package/es/src/charts/Rings/emit.js +74 -8
- package/es/src/charts/Rings/emit.js.map +1 -1
- package/es/src/charts/Rings/index.js +11 -3
- package/es/src/charts/Rings/index.js.map +1 -1
- package/es/src/charts/Sankey/emit.js +55 -11
- package/es/src/charts/Sankey/emit.js.map +1 -1
- package/es/src/charts/Sankey/index.js +8 -2
- package/es/src/charts/Sankey/index.js.map +1 -1
- package/es/src/charts/StackedArea/index.js +1 -2
- package/es/src/charts/StackedArea/index.js.map +1 -1
- package/es/src/charts/Tree/emit.js +8 -2
- package/es/src/charts/Tree/emit.js.map +1 -1
- package/es/src/charts/Tree/index.js +1 -2
- package/es/src/charts/Tree/index.js.map +1 -1
- package/es/src/charts/Treemap/index.js +1 -2
- package/es/src/charts/Treemap/index.js.map +1 -1
- package/es/src/charts/definition/ChartDefinition.js.map +1 -1
- package/es/src/charts/drawSteps/backControl.js +70 -0
- package/es/src/charts/drawSteps/backControl.js.map +1 -0
- package/es/src/charts/drawSteps/controlButtonStyle.js +108 -0
- package/es/src/charts/drawSteps/controlButtonStyle.js.map +1 -0
- package/es/src/charts/drawSteps/minimap.js +370 -0
- package/es/src/charts/drawSteps/minimap.js.map +1 -0
- package/es/src/charts/drawSteps/minimapMarkup.js +147 -0
- package/es/src/charts/drawSteps/minimapMarkup.js.map +1 -0
- package/es/src/charts/drawSteps/searchControls.js +358 -0
- package/es/src/charts/drawSteps/searchControls.js.map +1 -0
- package/es/src/charts/drawSteps/searchControlsMarkup.js +430 -0
- package/es/src/charts/drawSteps/searchControlsMarkup.js.map +1 -0
- package/es/src/charts/drawSteps/tableView.js +173 -0
- package/es/src/charts/drawSteps/tableView.js.map +1 -0
- package/es/src/charts/drawSteps/tableViewControl.js +39 -0
- package/es/src/charts/drawSteps/tableViewControl.js.map +1 -0
- package/es/src/charts/drawSteps/tableViewMarkup.js +647 -0
- package/es/src/charts/drawSteps/tableViewMarkup.js.map +1 -0
- package/es/src/charts/drawSteps/topLeftControls.js +73 -0
- package/es/src/charts/drawSteps/topLeftControls.js.map +1 -0
- package/es/src/charts/drawSteps/topLeftControlsMarkup.js +227 -0
- package/es/src/charts/drawSteps/topLeftControlsMarkup.js.map +1 -0
- package/es/src/charts/drawSteps/zoomControls.js +314 -175
- package/es/src/charts/drawSteps/zoomControls.js.map +1 -1
- package/es/src/charts/drawSteps/zoomControlsMarkup.js +280 -0
- package/es/src/charts/drawSteps/zoomControlsMarkup.js.map +1 -0
- package/es/src/charts/features/attributionFeature.js +137 -0
- package/es/src/charts/features/attributionFeature.js.map +1 -0
- package/es/src/charts/features/axes.js +20 -8
- package/es/src/charts/features/axes.js.map +1 -1
- package/es/src/charts/features/chartGeometry.js +16 -2
- package/es/src/charts/features/chartGeometry.js.map +1 -1
- package/es/src/charts/features/edgeArrows.js +155 -0
- package/es/src/charts/features/edgeArrows.js.map +1 -0
- package/es/src/charts/features/emitHelpers.js +8 -0
- package/es/src/charts/features/emitHelpers.js.map +1 -1
- package/es/src/charts/features/ensureZoomDom.js +63 -12
- package/es/src/charts/features/ensureZoomDom.js.map +1 -1
- package/es/src/charts/features/features.js +83 -110
- package/es/src/charts/features/features.js.map +1 -1
- package/es/src/charts/features/featuresLegend.js +45 -17
- package/es/src/charts/features/featuresLegend.js.map +1 -1
- package/es/src/charts/features/plotPaint.js +32 -7
- package/es/src/charts/features/plotPaint.js.map +1 -1
- package/es/src/charts/features/shapeEmit.js +3 -1
- package/es/src/charts/features/shapeEmit.js.map +1 -1
- package/es/src/charts/features/zoomExtent.js +185 -0
- package/es/src/charts/features/zoomExtent.js.map +1 -0
- package/es/src/charts/helpers/tileAttributions.js +26 -0
- package/es/src/charts/helpers/tileAttributions.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/runVizPipeline.js +33 -14
- package/es/src/charts/pipeline/runVizPipeline.js.map +1 -1
- package/es/src/charts/pipeline/vizDrawPure.js +32 -6
- package/es/src/charts/pipeline/vizDrawPure.js.map +1 -1
- package/es/src/charts/viz/Viz.js +102 -61
- package/es/src/charts/viz/Viz.js.map +1 -1
- package/es/src/charts/viz/VizBase.js +157 -4
- package/es/src/charts/viz/VizBase.js.map +1 -1
- package/es/src/charts/viz/VizBaseConfig.js +32 -2
- package/es/src/charts/viz/VizBaseConfig.js.map +1 -1
- package/es/src/charts/viz/interactionOpacity.js +4 -1
- package/es/src/charts/viz/interactionOpacity.js.map +1 -1
- package/es/src/charts/viz/vizDefaults.js +247 -51
- package/es/src/charts/viz/vizDefaults.js.map +1 -1
- package/es/src/charts/viz/vizRender.js +7 -3
- package/es/src/charts/viz/vizRender.js.map +1 -1
- package/es/src/charts/viz/vizTypes.js.map +1 -1
- package/es/src/components/Axis/Axis.js +10 -1
- package/es/src/components/Axis/Axis.js.map +1 -1
- package/es/src/components/Axis/axisLayoutLabels.js +2 -1
- package/es/src/components/Axis/axisLayoutLabels.js.map +1 -1
- package/es/src/components/Axis/axisRender.js +5 -1
- package/es/src/components/Axis/axisRender.js.map +1 -1
- package/es/src/components/Legend/legendConfig.js +86 -20
- package/es/src/components/Legend/legendConfig.js.map +1 -1
- package/es/src/shapes/Shape.js +12 -10
- package/es/src/shapes/Shape.js.map +1 -1
- package/es/src/shapes/hitAreaNode.js +31 -5
- package/es/src/shapes/hitAreaNode.js.map +1 -1
- package/es/src/shapes/interactionPoints.js +30 -0
- package/es/src/shapes/interactionPoints.js.map +1 -0
- package/es/src/utils/D3plusConfig.js.map +1 -1
- package/package.json +11 -10
- package/types/index.d.ts +1 -1
- package/types/internal.d.ts +8 -1
- package/types/src/charts/Chord/applyLayout.d.ts +43 -0
- package/types/src/charts/Chord/emit.d.ts +10 -0
- package/types/src/charts/Chord/index.d.ts +19 -0
- package/types/src/charts/Geomap/basemapTheme.d.ts +35 -0
- package/types/src/charts/Plot/index.d.ts +32 -2
- package/types/src/charts/Plot/pipeline.d.ts +2 -1
- package/types/src/charts/Plot/plotZoom.d.ts +65 -0
- package/types/src/charts/definition/ChartDefinition.d.ts +3 -1
- package/types/src/charts/drawSteps/backControl.d.ts +29 -0
- package/types/src/charts/drawSteps/controlButtonStyle.d.ts +45 -0
- package/types/src/charts/drawSteps/minimap.d.ts +19 -0
- package/types/src/charts/drawSteps/minimapMarkup.d.ts +45 -0
- package/types/src/charts/drawSteps/searchControls.d.ts +3 -0
- package/types/src/charts/drawSteps/searchControlsMarkup.d.ts +111 -0
- package/types/src/charts/drawSteps/tableView.d.ts +23 -0
- package/types/src/charts/drawSteps/tableViewControl.d.ts +21 -0
- package/types/src/charts/drawSteps/tableViewMarkup.d.ts +119 -0
- package/types/src/charts/drawSteps/topLeftControls.d.ts +32 -0
- package/types/src/charts/drawSteps/topLeftControlsMarkup.d.ts +72 -0
- package/types/src/charts/drawSteps/zoomControls.d.ts +48 -8
- package/types/src/charts/drawSteps/zoomControlsMarkup.d.ts +138 -0
- package/types/src/charts/features/attributionFeature.d.ts +21 -0
- package/types/src/charts/features/axes.d.ts +1 -1
- package/types/src/charts/features/chartGeometry.d.ts +9 -3
- package/types/src/charts/features/edgeArrows.d.ts +92 -0
- package/types/src/charts/features/emitHelpers.d.ts +11 -0
- package/types/src/charts/features/ensureZoomDom.d.ts +6 -2
- package/types/src/charts/features/features.d.ts +32 -17
- package/types/src/charts/features/featuresLegend.d.ts +15 -0
- package/types/src/charts/features/plotPaint.d.ts +15 -2
- package/types/src/charts/features/zoomExtent.d.ts +25 -0
- package/types/src/charts/index.d.ts +1 -0
- package/types/src/charts/pipeline/runVizPipeline.d.ts +6 -3
- package/types/src/charts/viz/Viz.d.ts +31 -1
- package/types/src/charts/viz/VizBase.d.ts +86 -4
- package/types/src/charts/viz/VizBaseConfig.d.ts +20 -2
- package/types/src/charts/viz/vizDefaults.d.ts +155 -0
- package/types/src/charts/viz/vizTypes.d.ts +75 -1
- package/types/src/components/Axis/Axis.d.ts +2 -0
- package/types/src/shapes/Shape.d.ts +2 -2
- package/types/src/shapes/hitAreaNode.d.ts +5 -4
- package/types/src/shapes/interactionPoints.d.ts +15 -0
- package/types/src/utils/D3plusConfig.d.ts +102 -8
- package/umd/d3plus-core.full.js +39793 -34875
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +5836 -4264
- package/umd/d3plus-core.js +13998 -9927
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +3716 -2264
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/charts/Pack/index.ts"],"sourcesContent":["/**\n Pack — d3-hierarchy circle-packing layout.\n\n Implementation files in this folder:\n - `applyLayout.ts` — chart-specific `TransformStage`.\n - `emit.ts` — Circle + label scene nodes from the laid-out data.\n - `recursionCircles.ts` — descendant-walk helper used by hover handlers.\n*/\n\nimport {pack} from \"d3-hierarchy\";\nimport type {HierarchyCircularNode} from \"d3-hierarchy\";\n\nimport type {DataPoint} from \"@d3plus/data\";\n\nimport accessor from \"../../utils/accessor.js\";\nimport constant from \"../../utils/constant.js\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/charts/Pack/index.ts"],"sourcesContent":["/**\n Pack — d3-hierarchy circle-packing layout.\n\n Implementation files in this folder:\n - `applyLayout.ts` — chart-specific `TransformStage`.\n - `emit.ts` — Circle + label scene nodes from the laid-out data.\n - `recursionCircles.ts` — descendant-walk helper used by hover handlers.\n*/\n\nimport {pack} from \"d3-hierarchy\";\nimport type {HierarchyCircularNode} from \"d3-hierarchy\";\n\nimport type {DataPoint} from \"@d3plus/data\";\n\nimport accessor from \"../../utils/accessor.js\";\nimport constant from \"../../utils/constant.js\";\nimport {subtitleFeature, titleFeature, totalFeature} from \"../features/features.js\";\nimport type {ChartDefinition} from \"../definition/ChartDefinition.js\";\nimport type {D3plusConfig} from \"../../utils/D3plusConfig.js\";\nimport {makeChart} from \"../definition/makeChart.js\";\nimport type {VizInstance} from \"../viz/vizTypes.js\";\n\nimport {applyPackLayout} from \"./applyLayout.js\";\nimport {packEmit} from \"./emit.js\";\nimport {recursionCircles} from \"./recursionCircles.js\";\n\ntype SortFn = (a: HierarchyCircularNode<DataPoint>, b: HierarchyCircularNode<DataPoint>) => number;\ntype HoverFn = (fn: (h: DataPoint) => boolean) => unknown;\n\nexport const packDef: ChartDefinition = {\n name: \"Pack\",\n\n features: [titleFeature, subtitleFeature, totalFeature],\n layoutStage: applyPackLayout,\n emit: packEmit,\n\n chartTransform: (viz: VizInstance) => ({\n x: viz._margin.left + ((viz.ctx.packOffsetX as number) ?? 0),\n y: viz._margin.top + ((viz.ctx.packOffsetY as number) ?? 0),\n }),\n\n // `hover` shadows the prototype method per-instance so it also drives\n // the legend's hover state. Method shadowing doesn't fit the field\n // model (it's a method, not a value with a default); setup is the\n // right escape hatch for the genuine method-override case.\n setup: (viz: VizInstance) => {\n const supHover = (viz as VizInstance & {hover: HoverFn}).hover.bind(viz);\n (viz as VizInstance & {hover: HoverFn}).hover = ((fn: (h: DataPoint) => boolean) => {\n supHover(fn);\n if (viz.schema.legend) {\n (viz._legendClass as {hover: (fn: unknown) => unknown}).hover(fn);\n }\n return viz;\n }) as HoverFn;\n },\n\n ctx: {\n pack: pack(),\n },\n\n fields: [\n {key: \"layoutPadding\", default: 1},\n {\n key: \"sort\",\n default: ((a, b) => (b.value ?? 0) - (a.value ?? 0)) as SortFn,\n },\n {\n key: \"sum\",\n default: accessor(\"value\"),\n coerce: v => (typeof v === \"function\" ? v : accessor(v as string)),\n },\n {\n key: \"packOpacity\",\n default: constant(0.25),\n coerce: v => (typeof v === \"function\" ? v : constant(v as number)),\n },\n {\n key: \"shape\",\n default: constant(\"Circle\"),\n coerce: v => (typeof v === \"function\" ? v : constant(v as string)),\n },\n {\n key: \"shapeConfig\",\n merge: true,\n factory: () => ({\n Circle: {\n label: (d: DataPoint) => {\n const node = d as DataPoint & {parent?: unknown; children?: unknown};\n return node.parent && !node.children ? (node.id as string | number) : false;\n },\n labelConfig: {fontResize: true},\n opacity: (d: DataPoint) => (d as DataPoint & {__d3plusOpacity__?: number}).__d3plusOpacity__,\n },\n }),\n },\n {\n key: \"legend\",\n coerce: \"const\",\n factory: (viz: VizInstance) => {\n const base = viz.schema.legend as (config: D3plusConfig, arr: DataPoint[]) => unknown;\n return (config: D3plusConfig, arr: DataPoint[]) => {\n if (arr.length === viz._filteredData.length) return false;\n return base.call(viz, config, arr);\n };\n },\n },\n {\n // `on` is the event bus — Viz seeded it with the default handlers,\n // Pack layers wrap-and-extend versions for the events that need\n // pack-specific hover behavior. `merge` keeps Viz's other handlers\n // intact.\n key: \"on\",\n merge: true,\n factory: (viz: VizInstance) => {\n const baseLegend = viz.schema.on[\"mousemove.legend\"] as (\n d: DataPoint, i: number, x: unknown, event: unknown,\n ) => void;\n const baseShape = viz.schema.on[\"mousemove.shape\"] as (\n d: DataPoint, i: number, x: unknown, event: unknown,\n ) => void;\n const callHover = (fn: (h: DataPoint) => boolean) =>\n (viz as VizInstance & {hover: HoverFn}).hover(fn);\n\n return {\n mouseenter: () => undefined,\n \"mousemove.legend\": (\n d: DataPoint, i: number, x: unknown, event: unknown,\n ) => {\n baseLegend(d, i, x, event);\n const ids = viz._ids(d, i);\n const hoverData = recursionCircles(d);\n callHover(h => {\n const matches = Object.keys(h)\n .filter(key => key !== \"value\")\n .every(key => {\n const v = d[key];\n return v != null && (v as unknown as unknown[]).includes(h[key]);\n });\n if (matches) hoverData.push(h);\n else if (ids.includes(h.key as string)) {\n hoverData.push(...recursionCircles(h, [h]));\n }\n return hoverData.includes(h);\n });\n },\n \"mousemove.shape\": (\n d: DataPoint, i: number, x: unknown, event: unknown,\n ) => {\n if (d.__d3plusTooltip__) baseShape(d, i, x, event);\n const hoverData = recursionCircles(d, [d]);\n callHover(h => hoverData.includes(h));\n },\n };\n },\n },\n ],\n};\n\n/**\n Uses the d3 pack layout to create a Circle Packing chart based on an array of data.\n*/\nexport default makeChart(packDef);\n"],"names":["pack","accessor","constant","subtitleFeature","titleFeature","totalFeature","makeChart","applyPackLayout","packEmit","recursionCircles","packDef","name","features","layoutStage","emit","chartTransform","viz","x","_margin","left","ctx","packOffsetX","y","top","packOffsetY","setup","supHover","hover","bind","fn","schema","legend","_legendClass","fields","key","default","a","b","value","coerce","v","merge","factory","Circle","label","d","node","parent","children","id","labelConfig","fontResize","opacity","__d3plusOpacity__","base","config","arr","length","_filteredData","call","baseLegend","on","baseShape","callHover","mouseenter","undefined","i","event","ids","_ids","hoverData","h","matches","Object","keys","filter","every","includes","push","__d3plusTooltip__"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;AAOA,GAEA,SAAQA,IAAI,QAAO,eAAe;AAKlC,OAAOC,cAAc,0BAA0B;AAC/C,OAAOC,cAAc,0BAA0B;AAC/C,SAAQC,eAAe,EAAEC,YAAY,EAAEC,YAAY,QAAO,0BAA0B;AAGpF,SAAQC,SAAS,QAAO,6BAA6B;AAGrD,SAAQC,eAAe,QAA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GAAGqB;wBACxB,IAAMI,YAAY7D,iBAAiBoC;wBACnCkB,UAAUQ,SAAAA;4BACR,IAAMC,UAAUC,OAAOC,IAAI,CAACH,GACzBI,MAAM,CAACzC,SAAAA;uCAAOA,QAAQ;+BACtB0C,KAAK,CAAC1C,SAAAA;gCACL,IAAMM,IAAIK,CAAC,CAACX,IAAI;gCAChB,OAAOM,KAAK,QAAQ,AAACA,EAA2BqC,QAAQ,CAACN,CAAC,CAACrC,IAAI;4BACjE;4BACF,IAAIsC,SAASF,UAAUQ,IAAI,CAACP;iCACvB,IAAIH,IAAIS,QAAQ,CAACN,EAAErC,GAAG,GAAa;oCACtCoC;gCAAAA,CAAAA,aAAAA,WAAUQ,IAAI,OAAdR,YAAe,qBAAG7D,iBAAiB8D,GAAG;oCAACA;iCAAE;4BAC3C;4BACA,OAAOD,UAAUO,QAAQ,CAACN;wBAC5B;oBACF;oBACA,mBAAmB,SACjB1B,GAAcqB,GAAWjD,GAAYkD;wBAErC,IAAItB,EAAEkC,iBAAiB,EAAEjB,UAAUjB,GAAGqB,GAAGjD,GAAGkD;wBAC5C,IAAMG,YAAY7D,iBAAiBoC,GAAG;4BAACA;yBAAE;wBACzCkB,UAAUQ,SAAAA;mCAAKD,UAAUO,QAAQ,CAACN;;oBACpC;gBACF;YACF;QACF;KACD;AACH,EAAE;AAEF;;AAEA,GACA,eAAejE,UAAUI,SAAS"}
|
|
@@ -42,8 +42,9 @@ export var pieEmit = function pieEmit(param) {
|
|
|
42
42
|
if (!slices.length) return [];
|
|
43
43
|
var arcMaker = viz.ctx.arcData;
|
|
44
44
|
var sc = (_viz_schema_shapeConfig = viz.schema.shapeConfig) !== null && _viz_schema_shapeConfig !== void 0 ? _viz_schema_shapeConfig : {};
|
|
45
|
-
var
|
|
46
|
-
|
|
45
|
+
var value = viz.schema.value;
|
|
46
|
+
var pathNodes = slices.map(function(d, rank) {
|
|
47
|
+
var _d_i, _d_i1, _d_i2, _d_i3, _d_i4, _d_i5;
|
|
47
48
|
var fill = resolveAccessor(sc.fill, d.data, (_d_i = d.i) !== null && _d_i !== void 0 ? _d_i : 0);
|
|
48
49
|
var stroke = resolveAccessor(sc.stroke, d.data, (_d_i1 = d.i) !== null && _d_i1 !== void 0 ? _d_i1 : 0);
|
|
49
50
|
var strokeWidth = resolveAccessor(sc.strokeWidth, d.data, (_d_i2 = d.i) !== null && _d_i2 !== void 0 ? _d_i2 : 0);
|
|
@@ -56,6 +57,9 @@ export var pieEmit = function pieEmit(param) {
|
|
|
56
57
|
fill: typeof fill === "string" ? fill : undefined,
|
|
57
58
|
stroke: stroke,
|
|
58
59
|
strokeWidth: strokeWidth
|
|
60
|
+
},
|
|
61
|
+
aria: {
|
|
62
|
+
label: "".concat(rank + 1, ". ").concat(viz._drawLabel(d.data, (_d_i4 = d.i) !== null && _d_i4 !== void 0 ? _d_i4 : 0), ", ").concat(value(d.data, (_d_i5 = d.i) !== null && _d_i5 !== void 0 ? _d_i5 : 0), ".")
|
|
59
63
|
}
|
|
60
64
|
};
|
|
61
65
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/charts/Pie/emit.ts"],"sourcesContent":["/**\n `pieEmit` — Path SceneNodes (one per slice) + label TextNodes.\n*/\n\nimport type {PieArcDatum} from \"d3-shape\";\nimport {colorContrast} from \"@d3plus/color\";\nimport {largestRect, path2polygon} from \"@d3plus/math\";\nimport type {DataPoint} from \"@d3plus/data\";\nimport type {SceneNode} from \"@d3plus/render\";\n\nimport constant from \"../../utils/constant.js\";\nimport {emitLabels} from \"../../shapes/emitLabels.js\";\nimport type {ChartEmit} from \"../definition/ChartDefinition.js\";\n\nfunction resolveAccessor<T>(\n val: unknown,\n d: DataPoint,\n i: number,\n): T | undefined {\n if (typeof val === \"function\") {\n return (val as (d: DataPoint, i: number) => T)(d, i);\n }\n return val as T | undefined;\n}\n\ntype Slice = PieArcDatum<DataPoint> & {__d3plus__?: true; i?: number};\n\nexport const pieEmit: ChartEmit = ({viz, shapeData}) => {\n const slices = (shapeData ?? []) as Slice[];\n if (!slices.length) return [];\n\n const arcMaker = viz.ctx.arcData as (d: Slice) => string;\n const sc = (viz.schema.shapeConfig ?? {}) as Record<string, unknown>;\n\n const pathNodes: SceneNode[] = slices.map(d => {\n const fill = resolveAccessor<string>(sc.fill, d.data as DataPoint, d.i ?? 0);\n const stroke = resolveAccessor<string>(sc.stroke, d.data as DataPoint, d.i ?? 0);\n const strokeWidth = resolveAccessor<number>(sc.strokeWidth, d.data as DataPoint, d.i ?? 0);\n return {\n type: \"path\",\n key: `pie-${viz._ids(d.data as DataPoint, d.i ?? 0).join(\"-\")}`,\n d: arcMaker(d),\n datum: d.data,\n paint: {\n fill: typeof fill === \"string\" ? fill : undefined,\n stroke,\n strokeWidth,\n },\n } as SceneNode;\n });\n\n const labelNodes = emitLabels({\n data: slices as unknown as DataPoint[],\n label: (_d, i) => viz._drawLabel((slices[i].data as DataPoint), slices[i].i ?? i),\n // The largest inscribed rectangle is in chart-centered path coordinates,\n // so the anchor is the origin and labelBounds carries the absolute box.\n x: () => 0,\n y: () => 0,\n aes: () => ({}),\n rotate: constant(0),\n id: (_d, i) => `pie-label-${i}`,\n labelBounds: (_d, i) => {\n const r = largestRect(path2polygon(arcMaker(slices[i])), {angle: 0});\n if (!r) return false;\n return {\n angle: r.angle,\n width: r.width,\n height: r.height,\n x: r.cx - r.width / 2,\n y: r.cy - r.height / 2,\n };\n },\n labelConfig: {\n fontColor: (d: {data?: Slice}) => {\n const slice = (d.data ?? d) as Slice;\n const fill = resolveAccessor<string>(\n sc.fill,\n slice.data as DataPoint,\n slice.i ?? 0,\n );\n return colorContrast(typeof fill === \"string\" ? fill : \"rgb(255, 255, 255)\");\n },\n fontResize: true,\n textAnchor: \"middle\",\n verticalAlign: \"middle\",\n },\n });\n\n return [...pathNodes, ...labelNodes];\n};\n"],"names":["colorContrast","largestRect","path2polygon","constant","emitLabels","resolveAccessor","val","d","i","pieEmit","viz","shapeData","slices","length","arcMaker","ctx","arcData","sc","schema","shapeConfig","pathNodes","map","fill","data","stroke","strokeWidth","type","key","_ids","join","datum","paint","undefined","
|
|
1
|
+
{"version":3,"sources":["../../../../src/charts/Pie/emit.ts"],"sourcesContent":["/**\n `pieEmit` — Path SceneNodes (one per slice) + label TextNodes.\n*/\n\nimport type {PieArcDatum} from \"d3-shape\";\nimport {colorContrast} from \"@d3plus/color\";\nimport {largestRect, path2polygon} from \"@d3plus/math\";\nimport type {DataPoint} from \"@d3plus/data\";\nimport type {SceneNode} from \"@d3plus/render\";\n\nimport constant from \"../../utils/constant.js\";\nimport {emitLabels} from \"../../shapes/emitLabels.js\";\nimport type {ChartEmit} from \"../definition/ChartDefinition.js\";\n\nfunction resolveAccessor<T>(\n val: unknown,\n d: DataPoint,\n i: number,\n): T | undefined {\n if (typeof val === \"function\") {\n return (val as (d: DataPoint, i: number) => T)(d, i);\n }\n return val as T | undefined;\n}\n\ntype Slice = PieArcDatum<DataPoint> & {__d3plus__?: true; i?: number};\n\nexport const pieEmit: ChartEmit = ({viz, shapeData}) => {\n const slices = (shapeData ?? []) as Slice[];\n if (!slices.length) return [];\n\n const arcMaker = viz.ctx.arcData as (d: Slice) => string;\n const sc = (viz.schema.shapeConfig ?? {}) as Record<string, unknown>;\n\n const value = viz.schema.value as (d: DataPoint, i: number) => number;\n const pathNodes: SceneNode[] = slices.map((d, rank) => {\n const fill = resolveAccessor<string>(sc.fill, d.data as DataPoint, d.i ?? 0);\n const stroke = resolveAccessor<string>(sc.stroke, d.data as DataPoint, d.i ?? 0);\n const strokeWidth = resolveAccessor<number>(sc.strokeWidth, d.data as DataPoint, d.i ?? 0);\n return {\n type: \"path\",\n key: `pie-${viz._ids(d.data as DataPoint, d.i ?? 0).join(\"-\")}`,\n d: arcMaker(d),\n datum: d.data,\n paint: {\n fill: typeof fill === \"string\" ? fill : undefined,\n stroke,\n strokeWidth,\n },\n aria: {\n label: `${rank + 1}. ${viz._drawLabel(d.data as DataPoint, d.i ?? 0)}, ${value(d.data as DataPoint, d.i ?? 0)}.`,\n },\n } as SceneNode;\n });\n\n const labelNodes = emitLabels({\n data: slices as unknown as DataPoint[],\n label: (_d, i) => viz._drawLabel((slices[i].data as DataPoint), slices[i].i ?? i),\n // The largest inscribed rectangle is in chart-centered path coordinates,\n // so the anchor is the origin and labelBounds carries the absolute box.\n x: () => 0,\n y: () => 0,\n aes: () => ({}),\n rotate: constant(0),\n id: (_d, i) => `pie-label-${i}`,\n labelBounds: (_d, i) => {\n const r = largestRect(path2polygon(arcMaker(slices[i])), {angle: 0});\n if (!r) return false;\n return {\n angle: r.angle,\n width: r.width,\n height: r.height,\n x: r.cx - r.width / 2,\n y: r.cy - r.height / 2,\n };\n },\n labelConfig: {\n fontColor: (d: {data?: Slice}) => {\n const slice = (d.data ?? d) as Slice;\n const fill = resolveAccessor<string>(\n sc.fill,\n slice.data as DataPoint,\n slice.i ?? 0,\n );\n return colorContrast(typeof fill === \"string\" ? fill : \"rgb(255, 255, 255)\");\n },\n fontResize: true,\n textAnchor: \"middle\",\n verticalAlign: \"middle\",\n },\n });\n\n return [...pathNodes, ...labelNodes];\n};\n"],"names":["colorContrast","largestRect","path2polygon","constant","emitLabels","resolveAccessor","val","d","i","pieEmit","viz","shapeData","slices","length","arcMaker","ctx","arcData","sc","schema","shapeConfig","value","pathNodes","map","rank","fill","data","stroke","strokeWidth","type","key","_ids","join","datum","paint","undefined","aria","label","_drawLabel","labelNodes","_d","x","y","aes","rotate","id","labelBounds","r","angle","width","height","cx","cy","labelConfig","fontColor","slice","fontResize","textAnchor","verticalAlign"],"mappings":"AAAA;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,SAAQA,aAAa,QAAO,gBAAgB;AAC5C,SAAQC,WAAW,EAAEC,YAAY,QAAO,eAAe;AAIvD,OAAOC,cAAc,0BAA0B;AAC/C,SAAQC,UAAU,QAAO,6BAA6B;AAGtD,SAASC,gBACPC,GAAY,EACZC,CAAY,EACZC,CAAS;IAET,IAAI,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,WAAAA,MAAM9C,CAAC,cAAP8C,sBAAAA,WAAW;gBAEb,OAAOtD,cAAc,OAAOwB,SAAS,WAAWA,OAAO;YACzD;YACA+B,YAAY;YACZC,YAAY;YACZC,eAAe;QACjB;IACF;IAEA,OAAO,AAAC,qBAAGpC,kBAAW,qBAAGiB;AAC3B,EAAE"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { formatAbbreviate } from "@d3plus/format";
|
|
9
9
|
import accessor from "../../utils/accessor.js";
|
|
10
10
|
import { centerChartTransform } from "../features/chartGeometry.js";
|
|
11
|
-
import {
|
|
11
|
+
import { subtitleFeature, titleFeature, totalFeature } from "../features/features.js";
|
|
12
12
|
import { colorScaleBucketShare } from "../features/colorScaleBucket.js";
|
|
13
13
|
import { makeChart } from "../definition/makeChart.js";
|
|
14
14
|
import { applyPieLayout } from "./applyLayout.js";
|
|
@@ -16,7 +16,6 @@ import { pieEmit } from "./emit.js";
|
|
|
16
16
|
export var pieDef = {
|
|
17
17
|
name: "Pie",
|
|
18
18
|
features: [
|
|
19
|
-
backFeature,
|
|
20
19
|
titleFeature,
|
|
21
20
|
subtitleFeature,
|
|
22
21
|
totalFeature
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/charts/Pie/index.ts"],"sourcesContent":["/**\n Pie — d3-shape pie layout, one path per slice.\n\n Implementation files in this folder:\n - `applyLayout.ts` — chart-specific `TransformStage`.\n - `emit.ts` — Path + label scene nodes from the laid-out slices.\n*/\n\nimport {pie as d3Pie} from \"d3-shape\";\nimport {formatAbbreviate} from \"@d3plus/format\";\nimport type {DataPoint} from \"@d3plus/data\";\n\nimport accessor from \"../../utils/accessor.js\";\nimport {centerChartTransform} from \"../features/chartGeometry.js\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/charts/Pie/index.ts"],"sourcesContent":["/**\n Pie — d3-shape pie layout, one path per slice.\n\n Implementation files in this folder:\n - `applyLayout.ts` — chart-specific `TransformStage`.\n - `emit.ts` — Path + label scene nodes from the laid-out slices.\n*/\n\nimport {pie as d3Pie} from \"d3-shape\";\nimport {formatAbbreviate} from \"@d3plus/format\";\nimport type {DataPoint} from \"@d3plus/data\";\n\nimport accessor from \"../../utils/accessor.js\";\nimport {centerChartTransform} from \"../features/chartGeometry.js\";\nimport {subtitleFeature, titleFeature, totalFeature} from \"../features/features.js\";\nimport {colorScaleBucketShare} from \"../features/colorScaleBucket.js\";\nimport type {DataDrivenChartDefinition} from \"../definition/ChartDefinition.js\";\nimport type {D3plusConfig} from \"../../utils/D3plusConfig.js\";\nimport {makeChart} from \"../definition/makeChart.js\";\nimport type {VizInstance} from \"../viz/vizTypes.js\";\n\nimport {applyPieLayout} from \"./applyLayout.js\";\nimport {pieEmit} from \"./emit.js\";\n\nexport const pieDef: DataDrivenChartDefinition = {\n name: \"Pie\",\n\n features: [titleFeature, subtitleFeature, totalFeature],\n layoutStage: applyPieLayout,\n emit: pieEmit,\n\n chartTransform: (viz: VizInstance) =>\n centerChartTransform(\n viz,\n viz.ctx.pieWidth as number,\n viz.ctx.pieHeight as number,\n ),\n\n ctx: {\n pie: d3Pie(),\n },\n\n fields: [\n {key: \"innerRadius\", default: 0},\n {key: \"padAngle\"},\n {key: \"padPixel\", default: 0},\n {\n key: \"value\",\n default: accessor(\"value\"),\n coerce: v => (typeof v === \"function\" ? v : accessor(v as string)),\n },\n {\n key: \"sort\",\n factory: (viz: VizInstance) => {\n const valueFn = viz.schema.value as (d: DataPoint) => number;\n return (a: DataPoint, b: DataPoint) => valueFn(b) - valueFn(a);\n },\n },\n {\n key: \"legendSort\",\n factory: (viz: VizInstance) => {\n const valueFn = viz.schema.value as (d: DataPoint) => number;\n return (a: DataPoint, b: DataPoint) => valueFn(b) - valueFn(a);\n },\n },\n {\n key: \"shapeConfig\",\n merge: true,\n factory: (viz: VizInstance) => ({\n ariaLabel: (d: DataPoint, i: number) => {\n const pieData = viz.ctx.pieData as {index: number}[] | undefined;\n if (!pieData) return \"\";\n return `${++pieData[i].index}. ${viz._drawLabel(d, i)}, ${(viz.schema.value as (d: DataPoint, i: number) => number)(d, i)}.`;\n },\n Path: {labelConfig: {fontResize: true}},\n }),\n },\n {\n key: \"tooltipConfig\",\n merge: true,\n factory: (viz: VizInstance) => ({\n tbody: [\n [\n () => viz.schema.translate(\"Share\"),\n (_d: DataPoint, _i: number, x: Record<string, unknown>) => {\n // A ColorScale range swatch carries no per-row share, so sum the\n // share of every datum that falls in its color range.\n if (x._isColorScaleBucket) {\n const s = colorScaleBucketShare(\n viz,\n x.color,\n viz.schema.value as (d: DataPoint, i: number) => number,\n );\n return s == null\n ? \"\"\n : `${formatAbbreviate(s * 100, viz.schema.locale)}%`;\n }\n // A Legend bucket aggregates multiple rows, so `share` arrives\n // as an array of the members' shares — sum it; a single cell's\n // share is a plain number.\n const share = Array.isArray(x.share)\n ? (x.share as number[]).reduce((a, b) => a + b, 0)\n : (x.share as number);\n if (!Number.isFinite(share)) return \"\";\n return `${formatAbbreviate(share * 100, viz.schema.locale)}%`;\n },\n ],\n ],\n }),\n },\n {\n key: \"legend\",\n coerce: \"const\",\n factory: (viz: VizInstance) => {\n const base = viz.schema.legend as (config: D3plusConfig, arr: DataPoint[]) => unknown;\n return (config: D3plusConfig, arr: DataPoint[]) => {\n if (arr.length === viz._filteredData.length) return false;\n return base.call(viz, config, arr);\n };\n },\n },\n ],\n};\n\n/**\n Uses the d3 pie layout to create SVG arcs based on an array of data.\n*/\nexport default makeChart(pieDef);\n"],"names":["pie","d3Pie","formatAbbreviate","accessor","centerChartTransform","subtitleFeature","titleFeature","totalFeature","colorScaleBucketShare","makeChart","applyPieLayout","pieEmit","pieDef","name","features","layoutStage","emit","chartTransform","viz","ctx","pieWidth","pieHeight","fields","key","default","coerce","v","factory","valueFn","schema","value","a","b","merge","ariaLabel","d","i","pieData","index","_drawLabel","Path","labelConfig","fontResize","tbody","translate","_d","_i","x","_isColorScaleBucket","s","color","locale","share","Array","isArray","reduce","Number","isFinite","base","leg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H;;QACF;QACA;YACE5B,KAAK;YACLE,QAAQ;YACRE,SAAS,SAATA,QAAUT;gBACR,IAAMwC,OAAOxC,IAAIW,MAAM,CAAC8B,MAAM;gBAC9B,OAAO,SAACC,QAAsBC;oBAC5B,IAAIA,IAAIC,MAAM,KAAK5C,IAAI6C,aAAa,CAACD,MAAM,EAAE,OAAO;oBACpD,OAAOJ,KAAKM,IAAI,CAAC9C,KAAK0C,QAAQC;gBAChC;YACF;QACF;KACD;AACH,EAAE;AAEF;;AAEA,GACA,eAAepD,UAAUG,QAAQ"}
|
|
@@ -129,6 +129,7 @@ function _is_native_reflect_construct() {
|
|
|
129
129
|
}
|
|
130
130
|
/* eslint no-cond-assign: 0*/ // @ts-ignore
|
|
131
131
|
import pkg from "open-color/open-color.js";
|
|
132
|
+
import { zoomTransform } from "d3-zoom";
|
|
132
133
|
var openColor = pkg.theme;
|
|
133
134
|
import { colorAssign, colorContrast, colorDefaults } from "@d3plus/color";
|
|
134
135
|
import { assign, backgroundColor } from "@d3plus/dom";
|
|
@@ -217,7 +218,7 @@ import { plotDef } from "./pipeline.js";
|
|
|
217
218
|
import { drawPlot } from "./draw.js";
|
|
218
219
|
import { plotShapeDefaults } from "./shapeDefaults.js";
|
|
219
220
|
import { resolveStackOffset, resolveStackOrder, stackOffsetDiverging, stackOrderTotalDescending } from "./stackHelpers.js";
|
|
220
|
-
import {
|
|
221
|
+
import { paintZoomablePlot, zoomPlot } from "./plotZoom.js";
|
|
221
222
|
import Viz from "../viz/Viz.js";
|
|
222
223
|
import { default as BarBuffer } from "../plotBuffers/Bar.js";
|
|
223
224
|
import { default as BoxBuffer } from "../plotBuffers/Box.js";
|
|
@@ -256,9 +257,14 @@ var Plot = /*#__PURE__*/ function(Viz1) {
|
|
|
256
257
|
Line: false
|
|
257
258
|
});
|
|
258
259
|
_this._confidenceConfig = {
|
|
260
|
+
// A line's colour is its stroke, so the confidence band fills with that
|
|
261
|
+
// same colour (at the reduced opacity below). Prefer a per-Line stroke
|
|
262
|
+
// override, else the shared stroke accessor (the Line config itself sets
|
|
263
|
+
// no `stroke` — the colour comes from the top-level `shapeConfig.stroke`).
|
|
259
264
|
fill: function fill(d, i) {
|
|
260
|
-
var
|
|
261
|
-
|
|
265
|
+
var _this_schema_shapeConfig = _this.schema.shapeConfig, Line = _this_schema_shapeConfig.Line, stroke = _this_schema_shapeConfig.stroke;
|
|
266
|
+
var s = Line && Line.stroke !== undefined ? Line.stroke : stroke;
|
|
267
|
+
return typeof s === "function" ? s(d, i) : s;
|
|
262
268
|
},
|
|
263
269
|
fillOpacity: constant(0.5)
|
|
264
270
|
};
|
|
@@ -530,6 +536,78 @@ var Plot = /*#__PURE__*/ function(Viz1) {
|
|
|
530
536
|
},
|
|
531
537
|
{
|
|
532
538
|
/**
|
|
539
|
+
For a multi-point shape (Line/Area) reports the point nearest the cursor
|
|
540
|
+
along the discrete axis, so every mouse event (tooltip, click, user
|
|
541
|
+
handlers) reflects the hovered x rather than the whole-series aggregate.
|
|
542
|
+
Non-nested shapes and legend swatches fall through to the base (aggregate)
|
|
543
|
+
behavior.
|
|
544
|
+
@private
|
|
545
|
+
*/ key: "_interactionDatum",
|
|
546
|
+
value: function _interactionDatum(pick, event) {
|
|
547
|
+
var node = pick.node;
|
|
548
|
+
var points = node && node.interactionPoints;
|
|
549
|
+
if (node && node.interactionGroup !== "legend" && Array.isArray(points) && points.length && event && Array.isArray(event.point)) {
|
|
550
|
+
var nearest = this._nearestInteractionPoint(points, event.point);
|
|
551
|
+
if (nearest) {
|
|
552
|
+
var wrapped = nearest.datum;
|
|
553
|
+
return {
|
|
554
|
+
d: wrapped && wrapped.data ? wrapped.data : wrapped,
|
|
555
|
+
i: typeof wrapped.i === "number" ? wrapped.i : nearest.index,
|
|
556
|
+
x: wrapped
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
return _get(_get_prototype_of(Plot.prototype), "_interactionDatum", this).call(this, pick, event);
|
|
561
|
+
}
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
/**
|
|
565
|
+
Picks the interaction point closest to a surface-local cursor position
|
|
566
|
+
along the discrete axis. `event.point` is post-zoom surface space while the
|
|
567
|
+
points are in chart content space (under the `viz-zoom` group and then
|
|
568
|
+
the chart's own `viz-chart-body` transform), so the cursor is un-zoomed
|
|
569
|
+
by `_zoomTransform` and offset by `_chartTransform` before comparing.
|
|
570
|
+
@private
|
|
571
|
+
*/ key: "_nearestInteractionPoint",
|
|
572
|
+
value: function _nearestInteractionPoint(points, point) {
|
|
573
|
+
var t = this._zoomTransform;
|
|
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);
|
|
578
|
+
var axis = this.schema.discrete === "y" ? "y" : "x";
|
|
579
|
+
var target = axis === "y" ? cy : cx;
|
|
580
|
+
var best = null;
|
|
581
|
+
var bestDist = Infinity;
|
|
582
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
583
|
+
try {
|
|
584
|
+
for(var _iterator = points[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
585
|
+
var p = _step.value;
|
|
586
|
+
var dist = Math.abs(p[axis] - target);
|
|
587
|
+
if (dist < bestDist) {
|
|
588
|
+
bestDist = dist;
|
|
589
|
+
best = p;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
} catch (err) {
|
|
593
|
+
_didIteratorError = true;
|
|
594
|
+
_iteratorError = err;
|
|
595
|
+
} finally{
|
|
596
|
+
try {
|
|
597
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
598
|
+
_iterator.return();
|
|
599
|
+
}
|
|
600
|
+
} finally{
|
|
601
|
+
if (_didIteratorError) {
|
|
602
|
+
throw _iteratorError;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
return best;
|
|
607
|
+
}
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
/**
|
|
533
611
|
Extends the draw behavior of the abstract Viz class.
|
|
534
612
|
@private
|
|
535
613
|
*/ key: "_draw",
|
|
@@ -550,12 +628,29 @@ var Plot = /*#__PURE__*/ function(Viz1) {
|
|
|
550
628
|
// function of its inputs. `super._draw` resets `_chartScene` to []
|
|
551
629
|
// before the paint phase, so the emit output IS the scene. Viz.toScene
|
|
552
630
|
// wraps the collection in viz-chart-cells + zoom transform.
|
|
553
|
-
|
|
631
|
+
var viz = this;
|
|
632
|
+
var target = viz._zoomEventTarget || viz._container;
|
|
633
|
+
this._chartScene = paintZoomablePlot(viz, pCtx, target && target.node() ? zoomTransform(target.node()) : undefined);
|
|
554
634
|
return this;
|
|
555
635
|
}
|
|
556
636
|
},
|
|
557
637
|
{
|
|
558
638
|
/**
|
|
639
|
+
Zooms by rescaling the plot's linear axes instead of scaling the
|
|
640
|
+
rendered picture (see `Plot/plotZoom.ts`). Returns false when no axis
|
|
641
|
+
is linear, so the plot falls back to picture zoom.
|
|
642
|
+
@private
|
|
643
|
+
*/ key: "_zoomRescale",
|
|
644
|
+
value: function _zoomRescale(t) {
|
|
645
|
+
var duration = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
|
646
|
+
var nodes = zoomPlot(this, t, duration);
|
|
647
|
+
if (!nodes) return false;
|
|
648
|
+
this._chartScene = nodes;
|
|
649
|
+
return true;
|
|
650
|
+
}
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
/**
|
|
559
654
|
Allows drawing custom shapes to be used as annotations in the provided x/y plot. This method accepts custom config objects for the [Shape](http://d3plus.org/docs/#Shape) class, either a single config object or an array of config objects. Each config object requires an additional parameter, the "shape", which denotes which [Shape](http://d3plus.org/docs/#Shape) sub-class to use ([Rect](http://d3plus.org/docs/#Rect), [Line](http://d3plus.org/docs/#Line), etc).
|
|
560
655
|
|
|
561
656
|
Additionally, each config object can also contain an optional "layer" key, which defines whether the annotations will be displayed in "front" or in "back" of the primary visualization shapes. This value defaults to "back" if not present.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/charts/Plot/index.ts"],"sourcesContent":["/* eslint no-cond-assign: 0*/\n\n// @ts-ignore\nimport pkg from \"open-color/open-color.js\";\nconst {theme: openColor} = pkg;\n\nimport {\n colorAssign,\n colorContrast,\n colorDefaults,\n} from \"@d3plus/color\";\nimport {assign, backgroundColor} from \"@d3plus/dom\";\n\nimport {\n AxisBottom,\n AxisLeft,\n AxisRight,\n AxisTop,\n} from \"../../components/index.js\";\nimport {accessor, constant} from \"../../utils/index.js\";\nimport {installFluent} from \"../../fluent.js\";\n\n// E4: Plot's identity-coerce accessor schema (18 keys). installFluent's\n// per-key idempotence lets this co-exist with vizSchema on the parent\n// Viz.prototype — installFluent walks the actual prototype (Plot.prototype\n// here) and skips keys already present.\nconst plotSchema = [\n {key: \"barPadding\", coerce: \"identity\" as const},\n {key: \"baseline\", coerce: \"identity\" as const},\n {key: \"lineLabels\", coerce: \"identity\" as const},\n {key: \"shapeSort\", coerce: \"identity\" as const},\n {key: \"sizeMax\", coerce: \"identity\" as const},\n {key: \"sizeMin\", coerce: \"identity\" as const},\n {key: \"sizeScale\", coerce: \"identity\" as const},\n {key: \"stacked\", coerce: \"identity\" as const},\n {key: \"xCutoff\", coerce: \"identity\" as const},\n {key: \"xDomain\", coerce: \"identity\" as const},\n {key: \"x2Domain\", coerce: \"identity\" as const},\n {key: \"xSort\", coerce: \"identity\" as const},\n {key: \"x2Sort\", coerce: \"identity\" as const},\n {key: \"yCutoff\", coerce: \"identity\" as const},\n {key: \"yDomain\", coerce: \"identity\" as const},\n {key: \"y2Domain\", coerce: \"identity\" as const},\n {key: \"ySort\", coerce: \"identity\" as const},\n {key: \"y2Sort\", coerce: \"identity\" as const},\n];\n\nimport {plotDef} from \"./pipeline.js\";\nimport {drawPlot} from \"./draw.js\";\nimport {plotShapeDefaults} from \"./shapeDefaults.js\";\nimport {\n resolveStackOffset,\n resolveStackOrder,\n stackOffsetDiverging,\n stackOrderTotalDescending,\n type StackOffsetFn,\n type StackOrderFn,\n type StackOrderInput,\n} from \"./stackHelpers.js\";\nimport {plotPaint, type PlotPaintContext} from \"../features/plotPaint.js\";\nimport Viz from \"../viz/Viz.js\";\n\nimport type {Scene, SceneNode} from \"@d3plus/render\";\nimport type {DataPoint} from \"@d3plus/data\";\nimport type {VizInstance} from \"../viz/vizTypes.js\";\n\n/** Accessor function or string key for a plotted value. */\ntype PlotAccessor = (d: DataPoint, i: number) => number | Date | string;\n/** Function-or-string-key value accepted by accessor setters. */\ntype PlotAccessorArg = string | PlotAccessor;\n\nimport {default as BarBuffer} from \"../plotBuffers/Bar.js\";\nimport {default as BoxBuffer} from \"../plotBuffers/Box.js\";\nimport {default as CircleBuffer} from \"../plotBuffers/Circle.js\";\nimport {default as LineBuffer} from \"../plotBuffers/Line.js\";\nimport {default as RectBuffer} from \"../plotBuffers/Rect.js\";\nconst defaultBuffers = {\n Bar: BarBuffer,\n Box: BoxBuffer,\n Circle: CircleBuffer,\n Line: LineBuffer,\n Rect: RectBuffer,\n};\n\n/**\n Creates an x/y plot based on an array of data.\n*/\nexport default class Plot extends Viz {\n\n /**\n Invoked when creating a new class instance, and sets any default parameters.\n @private\n*/\n constructor() {\n super();\n // E4: install identity-coerce accessors on Plot.prototype. Defaults\n // are still applied below imperatively from plotDef; installFluent\n // skips slots that are already set, so the constructor wins.\n installFluent(this, plotSchema);\n // E3: scalar defaults sourced from plotDef.\n const defaults = plotDef.defaults!;\n this._axisPersist = defaults.axisPersist as boolean;\n this._annotations = defaults.annotations as unknown[];\n this._backgroundConfig = {\n duration: 0,\n fill: \"transparent\",\n };\n this.schema.barPadding = defaults.barPadding as number;\n this._buffer = assign({}, defaultBuffers, {Bar: false, Line: false});\n this._confidenceConfig = {\n fill: (d: DataPoint, i: number) => {\n const c =\n typeof this.schema.shapeConfig.Line.stroke === \"function\"\n ? this.schema.shapeConfig.Line.stroke(d, i)\n : this.schema.shapeConfig.Line.stroke;\n return c;\n },\n fillOpacity: constant(0.5),\n };\n this._discreteCutoff = defaults.discreteCutoff as number;\n this._groupPadding = defaults.groupPadding as number;\n this._labelConnectorConfig = {\n strokeDasharray: \"1 1\",\n };\n this._labelPosition = constant(\"auto\");\n this._lineMarkerConfig = {\n fill: (d: DataPoint, i: number) => colorAssign(this._id(d, i)),\n r: constant(3),\n };\n this._lineMarkers = defaults.lineMarkers as boolean;\n this._previousAnnotations = {back: [], front: []};\n this._previousShapes = [];\n this.schema.shape = defaults.shape;\n this.schema.shapeConfig = assign(this.schema.shapeConfig, plotShapeDefaults.call(this as unknown as VizInstance));\n this._shapeOrder = [\"Area\", \"Path\", \"Bar\", \"Box\", \"Line\", \"Rect\", \"Circle\"];\n this.schema.shapeSort = (a: string, b: string) =>\n this._shapeOrder.indexOf(a) - this._shapeOrder.indexOf(b);\n this.schema.sizeMax = 20;\n this.schema.sizeMin = 5;\n this.schema.sizeScale = \"sqrt\";\n this._stackOffset = stackOffsetDiverging;\n this._stackOrder = stackOrderTotalDescending;\n this.schema.timelineConfig = assign(this.schema.timelineConfig, {\n brushMin: () =>\n this._xTime || this._yTime || this._x2Time || this._y2Time ? 2 : 1,\n });\n\n this._x = accessor(\"x\");\n this._xKey = \"x\";\n this._xAxis = new AxisBottom().align(\"end\");\n // _xTest/_yTest/_x2Test/_y2Test are NOT persistent fields anymore. The\n // measure-only test axes are allocated as locals inside `_draw` and\n // garbage-collected after each draw — proving Plot doesn't need to\n // own a long-lived Axis instance just for layout. See measureAxis()\n // in axisLayout.ts for the standalone shape.\n this._xConfig = {\n gridConfig: {\n stroke: (d: {id: string}) => {\n if (this.schema.discrete && this.schema.discrete.charAt(0) === \"x\")\n return \"transparent\";\n const range = this._xAxis.range();\n const position = this._xAxis._getPosition.bind(this._xAxis)(d.id);\n if (range[0] === position) return \"transparent\";\n const bg = this._select ? backgroundColor(this._select.node()) : \"rgb(255, 255, 255)\";\n const contrast = colorContrast(bg);\n return contrast === colorDefaults.dark ? openColor.colors.gray[200] : openColor.colors.gray[600];\n },\n },\n };\n this.schema.xCutoff = 150;\n\n this._x2 = accessor(\"x2\");\n this._x2Key = \"x2\";\n this._x2Axis = new AxisTop().align(\"start\");\n this._x2Config = {};\n\n this._y = accessor(\"y\");\n this._yKey = \"y\";\n this._yAxis = new AxisLeft().align(\"start\");\n this._yKey = \"y\";\n this._yConfig = {\n gridConfig: {\n stroke: (d: {id: string}) => {\n if (this.schema.discrete && this.schema.discrete.charAt(0) === \"y\")\n return \"transparent\";\n const range = this._yAxis.range();\n const position = this._yAxis._getPosition.bind(this._yAxis)(d.id);\n if (range[range.length - 1] === position) return \"transparent\";\n const bg = this._select ? backgroundColor(this._select.node()) : \"rgb(255, 255, 255)\";\n const contrast = colorContrast(bg);\n return contrast === colorDefaults.dark ? openColor.colors.gray[200] : openColor.colors.gray[600];\n },\n },\n };\n this.schema.yCutoff = 150;\n\n this._y2 = accessor(\"y2\");\n this._y2Key = \"y2\";\n this._y2Axis = new AxisRight().align(\"end\");\n this._y2Config = {};\n }\n\n /**\n Extends the preDraw behavior of the abstract Viz class.\n @private\n*/\n _preDraw() {\n // logic repeated for each axis\n [\"x\", \"y\", \"x2\", \"y2\"].forEach(k => {\n // if user has supplied a String key as the main method value\n if (this[`_${k}Key`]) {\n const str = this[`_${k}Key`];\n\n // if axis is discrete and numerical, do not sum values\n if (!this.schema.aggs[str] && this.schema.discrete === k) {\n this.schema.aggs[str] = (a: DataPoint[], c: (d: DataPoint) => unknown) => {\n const v = Array.from(new Set(a.map(c)));\n return v.length === 1 ? v[0] : v;\n };\n }\n\n // set axis title if not discrete\n if (\n str !== k &&\n this[`_${k}Title`] === this[`_${k}Config`].title &&\n this.schema.discrete !== k\n ) {\n this[`_${k}Title`] = str;\n this[`_${k}Config`].title = str;\n }\n }\n });\n\n super._preDraw();\n }\n\n /**\n Composes the chart's scene graph: the native shape scenes from Viz.toScene\n (bars/lines/areas + labels) plus snapshots of the rendered axes, so a Plot\n renders fully — geometry and axes — through the @d3plus/render backends.\n*/\n toScene(): Scene {\n const scene = (Viz.prototype.toScene as () => Scene).call(this);\n // Skip the axis walk when an explicit empty-data render just\n // happened. Axes are constructor-allocated and never reset between\n // renders, so a previous-render's axis._select.node() still exists\n // after `.data([]).render()` — emitting its toScene snapshot\n // would leak stale tick marks + grid lines under the no-data\n // overlay. We test `length === 0` explicitly so test fixtures that\n // construct viz without ever calling .render() (and leave\n // _filteredData undefined) don't trip the early-return.\n if (\n Array.isArray(this._filteredData) &&\n this._filteredData.length === 0 &&\n (!this._annotations || this._annotations.length === 0)\n )\n return scene;\n const axisNodes: SceneNode[] = [];\n for (const name of [\"_xAxis\", \"_x2Axis\", \"_yAxis\", \"_y2Axis\"]) {\n const axis = this[name];\n if (\n axis &&\n typeof axis.toScene === \"function\" &&\n axis._select &&\n typeof axis._select.node === \"function\" &&\n axis._select.node()\n ) {\n // Wrap in a uniquely-keyed group so sibling axes never collide (axis\n // snapshots reuse a per-call key counter).\n axisNodes.push({type: \"group\", key: `plot-${name}`, children: [axis.toScene()]});\n }\n }\n // Axes are drawn behind the shapes.\n scene.root.children.unshift(...axisNodes);\n return scene;\n }\n\n /**\n Wires user-registered `on()` event handlers onto a freshly-configured\n shape instance. Splits the registered events into three buckets:\n global (`\"click\"`), shape-scoped (`\"click.shape\"`), and\n shape-class-scoped (`\"click.Bar\"` etc.). All three forward into\n `this.schema.on[event](d.data, d.i, x, event)`. Extracted from\n Plot._paint so the chart-level event wiring is in one place.\n\n On the scene path (SvgRenderer/CanvasRenderer) these d3-selection\n bindings don't fire — compute-mode shapes mount no per-shape DOM.\n Pointer events are instead routed by `Viz._drawSceneToTarget`'s\n renderer bridge: it hit-tests via `Renderer.pick`, reads the picked\n node's stamped `shapeType`, and dispatches the matching global,\n `.shape`, and shape-class-scoped (`.Bar`) handlers — the same three\n buckets this method wires, so SVG and Canvas behave identically.\n */\n _wirePlotShapeEvents(\n shape: {on(event: string, handler: unknown): unknown},\n shapeKey: string,\n events: string[],\n ) {\n const classEvents = events.filter(e => e.includes(`.${shapeKey}`));\n const globalEvents = events.filter(e => !e.includes(\".\"));\n const shapeEvents = events.filter(e => e.includes(\".shape\"));\n const forward =\n (evt: string) =>\n (d: {data: DataPoint; i: number}, i: number, x: unknown, event: unknown) =>\n this.schema.on[evt](d.data, d.i, x, event);\n for (const evt of globalEvents) shape.on(evt, forward(evt));\n for (const evt of shapeEvents) shape.on(evt, forward(evt));\n for (const evt of classEvents) shape.on(evt, forward(evt));\n }\n\n /**\n Extends the draw behavior of the abstract Viz class.\n @private\n*/\n _draw(callback?: () => void) {\n return drawPlot(this as unknown as VizInstance, callback);\n }\n\n /**\n Paint phase: production axis rendering, shape buffer setup, and shape\n emission with event handlers. Receives all cross-phase locals from\n _draw via `pCtx` (so this method has zero coupling to _draw's local\n scope beyond the explicit context).\n */\n _paint(pCtx: PlotPaintContext) {\n // plotPaint builds the chart scene as a fresh array from the paint\n // context (data, scales, axis measurements) — emission is a pure\n // function of its inputs. `super._draw` resets `_chartScene` to []\n // before the paint phase, so the emit output IS the scene. Viz.toScene\n // wraps the collection in viz-chart-cells + zoom transform.\n this._chartScene = plotPaint(this as unknown as VizInstance, pCtx);\n return this;\n }\n\n /**\n Allows drawing custom shapes to be used as annotations in the provided x/y plot. This method accepts custom config objects for the [Shape](http://d3plus.org/docs/#Shape) class, either a single config object or an array of config objects. Each config object requires an additional parameter, the \"shape\", which denotes which [Shape](http://d3plus.org/docs/#Shape) sub-class to use ([Rect](http://d3plus.org/docs/#Rect), [Line](http://d3plus.org/docs/#Line), etc).\n\nAdditionally, each config object can also contain an optional \"layer\" key, which defines whether the annotations will be displayed in \"front\" or in \"back\" of the primary visualization shapes. This value defaults to \"back\" if not present.\n*/\n annotations(_?: unknown): this | unknown[] {\n return arguments.length\n ? ((this._annotations = _ instanceof Array ? _ : [_]), this)\n : this._annotations;\n }\n\n /**\n Determines whether the x and y axes should have their scales persist while users filter the data, the timeline being the prime example (set this to `true` to make the axes stay consistent when the timeline changes).\n*/\n axisPersist(_?: boolean): this | boolean {\n return arguments.length\n ? ((this._axisPersist = _), this)\n : this._axisPersist;\n }\n\n /**\n A d3plus-shape configuration Object used for styling the background rectangle of the inner x/y plot (behind all of the shapes and gridlines).\n*/\n backgroundConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._backgroundConfig = assign(this._backgroundConfig, _!)), this)\n : this._backgroundConfig;\n }\n\n /**\n Determines whether or not to add additional padding at the ends of x or y scales. The most commone use for this is in Scatter Plots, so that the shapes do not appear directly on the axis itself. The value provided can either be `true` or `false` to toggle the behavior for all shape types, or a keyed Object for each shape type (ie. `{Bar: false, Circle: true, Line: false}`).\n*/\n buffer(_?: boolean | Record<string, boolean>): this | Record<string, unknown> {\n if (arguments.length) {\n if (!_) this._buffer = {};\n else if (_ === true) this._buffer = defaultBuffers;\n else {\n this._buffer = assign({}, this._buffer, _);\n for (const key in this._buffer) {\n const buf = this._buffer as Record<string, unknown>;\n if (buf[key] === true) buf[key] = (defaultBuffers as Record<string, unknown>)[key];\n }\n }\n return this;\n }\n return this._buffer;\n }\n\n /**\n The confidence interval as an array of [lower, upper] bounds.\n\n@example <caption>Can be called with accessor functions or static keys:</caption>\n var data = {id: \"alpha\", value: 10, lci: 9, hci: 11};\n ...\n // Accessor functions\n .confidence([function(d) { return d.lci }, function(d) { return d.hci }])\n\n // Or static keys\n .confidence([\"lci\", \"hci\"])\n*/\n confidence(_?: unknown): this | [number, number] | false {\n if (arguments.length && _ instanceof Array) {\n this._confidence = [];\n const lower = _[0];\n this._confidence[0] =\n typeof lower === \"function\" || !lower ? lower : accessor(lower);\n const upper = _[1];\n this._confidence[1] =\n typeof upper === \"function\" || !upper ? upper : accessor(upper);\n\n return this;\n } else return this._confidence;\n }\n\n /**\n Configuration object for shapes rendered as confidence intervals.\n*/\n confidenceConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._confidenceConfig = assign(this._confidenceConfig, _!)), this)\n : this._confidenceConfig;\n }\n\n /**\n When the width or height of the chart is less than or equal to this pixel value, the discrete axis will not be shown. This helps produce slick sparklines. Set this value to `0` to disable the behavior entirely.\n*/\n discreteCutoff(_?: number): this | number {\n return arguments.length\n ? ((this._discreteCutoff = _), this)\n : this._discreteCutoff;\n }\n\n /**\n The pixel space between groups of bars.\n*/\n groupPadding(_?: number): this | number {\n return arguments.length\n ? ((this._groupPadding = _), this)\n : this._groupPadding;\n }\n\n /**\n The d3plus-shape config used on the Line shapes created to connect lineLabels to the end of their associated Line path.\n*/\n labelConnectorConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._labelConnectorConfig = assign(this._labelConnectorConfig, _!)),\n this)\n : this._labelConnectorConfig;\n }\n\n /**\n The behavior to be used when calculating the position and size of each shape's label(s). The value passed can either be the _String_ name of the behavior to be used for all shapes, or an accessor _Function_ that will be provided each data point and will be expected to return the behavior to be used for that data point. The availability and options for this method depend on the default logic for each Shape. As an example, the values \"outside\" or \"inside\" can be set for Bar shapes, whose \"auto\" default will calculate the best position dynamically based on the available space.\n*/\n labelPosition(\n _?: string | ((d: DataPoint, i: number) => string),\n ): this | ((d: DataPoint, i: number) => string) {\n return arguments.length\n ? ((this._labelPosition = typeof _ === \"function\" ? _ : constant(_)),\n this)\n : this._labelPosition;\n }\n\n /**\n Shape config for the Circle shapes drawn by the lineMarkers method.\n*/\n lineMarkerConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._lineMarkerConfig = assign(this._lineMarkerConfig, _!)), this)\n : this._lineMarkerConfig;\n }\n\n /**\n Draws circle markers on each vertex of a Line.\n*/\n lineMarkers(_?: boolean): this | boolean {\n return arguments.length\n ? ((this._lineMarkers = _), this)\n : this._lineMarkers;\n }\n\n /**\n Sets the size of bubbles to the given Number, data key, or function.\n*/\n size(_?: PlotAccessorArg | false): this | PlotAccessor {\n return arguments.length\n ? ((this._size = typeof _ === \"function\" || !_ ? _ : accessor(_ as string)), this)\n : this._size;\n }\n\n /**\n Sets the vertical offset applied to stacked series. Accepts a named\n offset — `\"diverging\"` (default), `\"none\"`, `\"expand\"`, `\"silhouette\"`,\n or `\"wiggle\"` — or a custom offset function. Unknown names warn and fall\n back to `\"diverging\"`. If *value* is not specified, returns the current\n stack offset function.\n*/\n stackOffset(_?: string | StackOffsetFn): this | StackOffsetFn {\n return arguments.length\n ? ((this._stackOffset = resolveStackOffset(_!)), this)\n : (this._stackOffset as StackOffsetFn);\n }\n\n /**\n Sets the order of stacked series, from the bottom of the stack upward.\n Accepts:\n - a named order: `\"descending\"` (default) / `\"ascending\"` by summed\n value, `\"key\"` / `\"keyReverse\"` alphabetically by series key,\n `\"none\"` / `\"data\"` for input order, or d3's `\"insideOut\"`,\n `\"appearance\"`, `\"reverse\"`;\n - an Array of series keys for an explicit order;\n - a value accessor, or a `{value, order}` config, to rank series by an\n aggregate of any data field.\n\n Unknown named strings warn and fall back to `\"descending\"`. If *value*\n is not specified, returns the current stack order.\n*/\n stackOrder(_?: StackOrderInput): this | StackOrderFn | string[] {\n return arguments.length\n ? ((this._stackOrder = resolveStackOrder(_!)), this)\n : (this._stackOrder as StackOrderFn | string[]);\n }\n\n /**\n Accessor function or string key for the x-axis value of each data point.\n*/\n x(_?: PlotAccessorArg): this | PlotAccessor {\n if (arguments.length) {\n if (typeof _ === \"function\") this._x = _;\n else {\n this._x = accessor(_ as string);\n this._xKey = _;\n }\n return this;\n } else return this._x;\n }\n\n /**\n Accessor function or string key for the secondary x-axis value of each data point.\n*/\n x2(_?: PlotAccessorArg): this | PlotAccessor {\n if (arguments.length) {\n if (typeof _ === \"function\") this._x2 = _;\n else {\n this._x2 = accessor(_ as string);\n this._x2Key = _;\n }\n return this;\n } else return this._x2;\n }\n\n /**\n A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the x-axis. Includes additional functionality where passing \"auto\" as the value for the [scale](http://d3plus.org/docs/#Axis.scale) method will determine if the scale should be \"linear\" or \"log\" based on the provided data.\n*/\n xConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._xConfig = assign(this._xConfig, _!)), this)\n : this._xConfig;\n }\n\n /**\n A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the secondary x-axis. Includes additional functionality where passing \"auto\" as the value for the [scale](http://d3plus.org/docs/#Axis.scale) method will determine if the scale should be \"linear\" or \"log\" based on the provided data.\n*/\n x2Config(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._x2Config = assign(this._x2Config, _!)), this)\n : this._x2Config;\n }\n\n /**\n Accessor function or string key for the y-axis value of each data point.\n*/\n y(_?: PlotAccessorArg): this | PlotAccessor {\n if (arguments.length) {\n if (typeof _ === \"function\") this._y = _;\n else {\n this._y = accessor(_ as string);\n this._yKey = _;\n }\n return this;\n } else return this._y;\n }\n\n /**\n Accessor function or string key for the secondary y-axis value of each data point.\n*/\n y2(_?: PlotAccessorArg): this | PlotAccessor {\n if (arguments.length) {\n if (typeof _ === \"function\") this._y2 = _;\n else {\n this._y2 = accessor(_ as string);\n this._y2Key = _;\n }\n return this;\n } else return this._y2;\n }\n\n /**\n A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the y-axis. Includes additional functionality where passing \"auto\" as the value for the [scale](http://d3plus.org/docs/#Axis.scale) method will determine if the scale should be \"linear\" or \"log\" based on the provided data.\n\n*Note:* If a \"domain\" array is passed to the y-axis config, it will be reversed.\n*/\n yConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n if (arguments.length) {\n const cfg = _ as {domain?: unknown[]};\n if (cfg.domain) cfg.domain = cfg.domain.slice().reverse();\n this._yConfig = assign(this._yConfig, _!);\n return this;\n }\n return this._yConfig;\n }\n\n /**\n A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the secondary y-axis. Includes additional functionality where passing \"auto\" as the value for the [scale](http://d3plus.org/docs/#Axis.scale) method will determine if the scale should be \"linear\" or \"log\" based on the provided data.\n*/\n y2Config(_?: Record<string, unknown>): this | Record<string, unknown> {\n if (arguments.length) {\n const cfg = _ as {domain?: unknown[]};\n if (cfg.domain) cfg.domain = cfg.domain.slice().reverse();\n this._y2Config = assign(this._y2Config, _!);\n return this;\n }\n return this._y2Config;\n }\n\n}\n"],"names":["pkg","theme","openColor","colorAssign","colorContrast","colorDefaults","assign","backgroundColor","AxisBottom","AxisLeft","AxisRight","AxisTop","accessor","constant","installFluent","plotSchema","key","coerce","plotDef","drawPlot","plotShapeDefaults","resolveStackOffset","resolveStackOrder","stackOffsetDiverging","stackOrderTotalDescending","plotPaint","Viz","default","BarBuffer","BoxBuffer","CircleBuffer","LineBuffer","RectBuffer","defaultBuffers","Bar","Box","Circle","Line","Rect","Plot","defaults","_axisPersist","axisPersist","_annotations","annotations","_backgroundConfig","duration","fill","schema","barPadding","_buffer","_confidenceConfig","d","i","c","shapeConfig","stroke","fillOpacity","_discreteCutoff","discreteCutoff","_groupPadding","groupPadding","_labelConnectorConfig","strokeDasharray","_labelPosition","_lineMarkerConfig","_id","r","_lineMarkers","lineMarkers","_previousAnnotations","back","front","_previousShapes","shape","call","_shapeOrder","shapeSort","a","b","indexOf","sizeMax","sizeMin","sizeScale","_stackOffset","_stackOrder","timelineConfig","brushMin","_xTime","_yTime","_x2Time","_y2Time","_x","_xKey","_xAxis","align","_xConfig","gridConfig","discrete","charAt","range","position","_getPosition","bind","id","bg","_select","node","contrast","dark","colors","gray","xCutoff","_x2","_x2Key","_x2Axis","_x2Config","_y","_yKey","_yAxis","_yConfig","length","yCutoff","_y2","_y2Key","_y2Axis","_y2Config","_preDraw","forEach","k","str","aggs","v","Array","from","Set","map","title","toScene","scene","prototype","isArray","_filteredData","axisNodes","name","axis","push","type","children","root","unshift","_wirePlotShapeEvents","shapeKey","events","classEvents","filter","e","includes","globalEvents","shapeEvents","forward","evt","x","event","on","data","_draw","callback","_paint","pCtx","_chartScene","_","arguments","backgroundConfig","buffer","buf","confidence","_confidence","lower","upper","confidenceConfig","labelConnectorConfig","labelPosition","lineMarkerConfig","size","_size","stackOffset","stackOrder","x2","xConfig","x2Config","y","y2","yConfig","cfg","domain","slice","reverse","y2Config"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAA2B,GAE3B,aAAa;AACb,OAAOA,SAAS,2BAA2B;AAC3C,IAAOC,AAAOC,YAAaF,IAApBC;AAEP,SACEE,WAAW,EACXC,aAAa,EACbC,aAAa,QACR,gBAAgB;AACvB,SAAQC,MAAM,EAAEC,eAAe,QAAO,cAAc;AAEpD,SACEC,UAAU,EACVC,QAAQ,EACRC,SAAS,EACTC,OAAO,QACF,4BAA4B;AACnC,SAAQC,QAAQ,EAAEC,QAAQ,QAAO,uBAAuB;AACxD,SAAQC,aAAa,QAAO,kBAAkB;AAE9C,wEAAwE;AACxE,sEAAsE;AACtE,2EAA2E;AAC3E,wCAAwC;AACxC,IAAMC,aAAa;IACjB;QAACC,KAAK;QAAcC,QAAQ;IAAmB;IAC/C;QAACD,KAAK;QAAYC,QAAQ;IAAmB;IAC7C;QAACD,KAAK;QAAcC,QAAQ;IAAmB;IAC/C;QAACD,KAAK;QAAaC,QAAQ;IAAmB;IAC9C;QAACD,KAAK;QAAWC,QAAQ;IAAmB;IAC5C;QAACD,KAAK;QAAWC,QAAQ;IAAmB;IAC5C;QAACD,KAAK;QAAaC,QAAQ;IAAmB;IAC9C;QAACD,KAAK;QAAWC,QAAQ;IAAmB;IAC5C;QAACD,KAAK;QAAWC,QAAQ;IAAmB;IAC5C;QAACD,KAAK;QAAWC,QAAQ;IAAmB;IAC5C;QAACD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/Plot/index.ts"],"sourcesContent":["/* eslint no-cond-assign: 0*/\n\n// @ts-ignore\nimport pkg from \"open-color/open-color.js\";\nimport {zoomTransform} from \"d3-zoom\";\nconst {theme: openColor} = pkg;\n\nimport {\n colorAssign,\n colorContrast,\n colorDefaults,\n} from \"@d3plus/color\";\nimport {assign, backgroundColor} from \"@d3plus/dom\";\n\nimport {\n AxisBottom,\n AxisLeft,\n AxisRight,\n AxisTop,\n} from \"../../components/index.js\";\nimport {accessor, constant} from \"../../utils/index.js\";\nimport {installFluent} from \"../../fluent.js\";\n\n// E4: Plot's identity-coerce accessor schema (18 keys). installFluent's\n// per-key idempotence lets this co-exist with vizSchema on the parent\n// Viz.prototype — installFluent walks the actual prototype (Plot.prototype\n// here) and skips keys already present.\nconst plotSchema = [\n {key: \"barPadding\", coerce: \"identity\" as const},\n {key: \"baseline\", coerce: \"identity\" as const},\n {key: \"lineLabels\", coerce: \"identity\" as const},\n {key: \"shapeSort\", coerce: \"identity\" as const},\n {key: \"sizeMax\", coerce: \"identity\" as const},\n {key: \"sizeMin\", coerce: \"identity\" as const},\n {key: \"sizeScale\", coerce: \"identity\" as const},\n {key: \"stacked\", coerce: \"identity\" as const},\n {key: \"xCutoff\", coerce: \"identity\" as const},\n {key: \"xDomain\", coerce: \"identity\" as const},\n {key: \"x2Domain\", coerce: \"identity\" as const},\n {key: \"xSort\", coerce: \"identity\" as const},\n {key: \"x2Sort\", coerce: \"identity\" as const},\n {key: \"yCutoff\", coerce: \"identity\" as const},\n {key: \"yDomain\", coerce: \"identity\" as const},\n {key: \"y2Domain\", coerce: \"identity\" as const},\n {key: \"ySort\", coerce: \"identity\" as const},\n {key: \"y2Sort\", coerce: \"identity\" as const},\n];\n\nimport {plotDef} from \"./pipeline.js\";\nimport {drawPlot} from \"./draw.js\";\nimport {plotShapeDefaults} from \"./shapeDefaults.js\";\nimport {\n resolveStackOffset,\n resolveStackOrder,\n stackOffsetDiverging,\n stackOrderTotalDescending,\n type StackOffsetFn,\n type StackOrderFn,\n type StackOrderInput,\n} from \"./stackHelpers.js\";\nimport type {PlotPaintContext} from \"../features/plotPaint.js\";\nimport {paintZoomablePlot, zoomPlot, type ZoomState} from \"./plotZoom.js\";\nimport Viz from \"../viz/Viz.js\";\n\nimport type {InteractionPoint, PickResult, Scene, SceneEvent, SceneNode} from \"@d3plus/render\";\nimport type {DataPoint} from \"@d3plus/data\";\nimport type {VizInstance} from \"../viz/vizTypes.js\";\n\n/** Accessor function or string key for a plotted value. */\ntype PlotAccessor = (d: DataPoint, i: number) => number | Date | string;\n/** Function-or-string-key value accepted by accessor setters. */\ntype PlotAccessorArg = string | PlotAccessor;\n\nimport {default as BarBuffer} from \"../plotBuffers/Bar.js\";\nimport {default as BoxBuffer} from \"../plotBuffers/Box.js\";\nimport {default as CircleBuffer} from \"../plotBuffers/Circle.js\";\nimport {default as LineBuffer} from \"../plotBuffers/Line.js\";\nimport {default as RectBuffer} from \"../plotBuffers/Rect.js\";\nconst defaultBuffers = {\n Bar: BarBuffer,\n Box: BoxBuffer,\n Circle: CircleBuffer,\n Line: LineBuffer,\n Rect: RectBuffer,\n};\n\n/**\n Creates an x/y plot based on an array of data.\n*/\nexport default class Plot extends Viz {\n\n /**\n Invoked when creating a new class instance, and sets any default parameters.\n @private\n*/\n constructor() {\n super();\n // E4: install identity-coerce accessors on Plot.prototype. Defaults\n // are still applied below imperatively from plotDef; installFluent\n // skips slots that are already set, so the constructor wins.\n installFluent(this, plotSchema);\n // E3: scalar defaults sourced from plotDef.\n const defaults = plotDef.defaults!;\n this._axisPersist = defaults.axisPersist as boolean;\n this._annotations = defaults.annotations as unknown[];\n this._backgroundConfig = {\n duration: 0,\n fill: \"transparent\",\n };\n this.schema.barPadding = defaults.barPadding as number;\n this._buffer = assign({}, defaultBuffers, {Bar: false, Line: false});\n this._confidenceConfig = {\n // A line's colour is its stroke, so the confidence band fills with that\n // same colour (at the reduced opacity below). Prefer a per-Line stroke\n // override, else the shared stroke accessor (the Line config itself sets\n // no `stroke` — the colour comes from the top-level `shapeConfig.stroke`).\n fill: (d: DataPoint, i: number) => {\n const {Line, stroke} = this.schema.shapeConfig;\n const s = Line && Line.stroke !== undefined ? Line.stroke : stroke;\n return typeof s === \"function\" ? s(d, i) : s;\n },\n fillOpacity: constant(0.5),\n };\n this._discreteCutoff = defaults.discreteCutoff as number;\n this._groupPadding = defaults.groupPadding as number;\n this._labelConnectorConfig = {\n strokeDasharray: \"1 1\",\n };\n this._labelPosition = constant(\"auto\");\n this._lineMarkerConfig = {\n fill: (d: DataPoint, i: number) => colorAssign(this._id(d, i)),\n r: constant(3),\n };\n this._lineMarkers = defaults.lineMarkers as boolean;\n this._previousAnnotations = {back: [], front: []};\n this._previousShapes = [];\n this.schema.shape = defaults.shape;\n this.schema.shapeConfig = assign(this.schema.shapeConfig, plotShapeDefaults.call(this as unknown as VizInstance));\n this._shapeOrder = [\"Area\", \"Path\", \"Bar\", \"Box\", \"Line\", \"Rect\", \"Circle\"];\n this.schema.shapeSort = (a: string, b: string) =>\n this._shapeOrder.indexOf(a) - this._shapeOrder.indexOf(b);\n this.schema.sizeMax = 20;\n this.schema.sizeMin = 5;\n this.schema.sizeScale = \"sqrt\";\n this._stackOffset = stackOffsetDiverging;\n this._stackOrder = stackOrderTotalDescending;\n this.schema.timelineConfig = assign(this.schema.timelineConfig, {\n brushMin: () =>\n this._xTime || this._yTime || this._x2Time || this._y2Time ? 2 : 1,\n });\n\n this._x = accessor(\"x\");\n this._xKey = \"x\";\n this._xAxis = new AxisBottom().align(\"end\");\n // _xTest/_yTest/_x2Test/_y2Test are NOT persistent fields anymore. The\n // measure-only test axes are allocated as locals inside `_draw` and\n // garbage-collected after each draw — proving Plot doesn't need to\n // own a long-lived Axis instance just for layout. See measureAxis()\n // in axisLayout.ts for the standalone shape.\n this._xConfig = {\n gridConfig: {\n stroke: (d: {id: string}) => {\n if (this.schema.discrete && this.schema.discrete.charAt(0) === \"x\")\n return \"transparent\";\n const range = this._xAxis.range();\n const position = this._xAxis._getPosition.bind(this._xAxis)(d.id);\n if (range[0] === position) return \"transparent\";\n const bg = this._select ? backgroundColor(this._select.node()) : \"rgb(255, 255, 255)\";\n const contrast = colorContrast(bg);\n return contrast === colorDefaults.dark ? openColor.colors.gray[200] : openColor.colors.gray[600];\n },\n },\n };\n this.schema.xCutoff = 150;\n\n this._x2 = accessor(\"x2\");\n this._x2Key = \"x2\";\n this._x2Axis = new AxisTop().align(\"start\");\n this._x2Config = {};\n\n this._y = accessor(\"y\");\n this._yKey = \"y\";\n this._yAxis = new AxisLeft().align(\"start\");\n this._yKey = \"y\";\n this._yConfig = {\n gridConfig: {\n stroke: (d: {id: string}) => {\n if (this.schema.discrete && this.schema.discrete.charAt(0) === \"y\")\n return \"transparent\";\n const range = this._yAxis.range();\n const position = this._yAxis._getPosition.bind(this._yAxis)(d.id);\n if (range[range.length - 1] === position) return \"transparent\";\n const bg = this._select ? backgroundColor(this._select.node()) : \"rgb(255, 255, 255)\";\n const contrast = colorContrast(bg);\n return contrast === colorDefaults.dark ? openColor.colors.gray[200] : openColor.colors.gray[600];\n },\n },\n };\n this.schema.yCutoff = 150;\n\n this._y2 = accessor(\"y2\");\n this._y2Key = \"y2\";\n this._y2Axis = new AxisRight().align(\"end\");\n this._y2Config = {};\n }\n\n /**\n Extends the preDraw behavior of the abstract Viz class.\n @private\n*/\n _preDraw() {\n // logic repeated for each axis\n [\"x\", \"y\", \"x2\", \"y2\"].forEach(k => {\n // if user has supplied a String key as the main method value\n if (this[`_${k}Key`]) {\n const str = this[`_${k}Key`];\n\n // if axis is discrete and numerical, do not sum values\n if (!this.schema.aggs[str] && this.schema.discrete === k) {\n this.schema.aggs[str] = (a: DataPoint[], c: (d: DataPoint) => unknown) => {\n const v = Array.from(new Set(a.map(c)));\n return v.length === 1 ? v[0] : v;\n };\n }\n\n // set axis title if not discrete\n if (\n str !== k &&\n this[`_${k}Title`] === this[`_${k}Config`].title &&\n this.schema.discrete !== k\n ) {\n this[`_${k}Title`] = str;\n this[`_${k}Config`].title = str;\n }\n }\n });\n\n super._preDraw();\n }\n\n /**\n Composes the chart's scene graph: the native shape scenes from Viz.toScene\n (bars/lines/areas + labels) plus snapshots of the rendered axes, so a Plot\n renders fully — geometry and axes — through the @d3plus/render backends.\n*/\n toScene(): Scene {\n const scene = (Viz.prototype.toScene as () => Scene).call(this);\n // Skip the axis walk when an explicit empty-data render just\n // happened. Axes are constructor-allocated and never reset between\n // renders, so a previous-render's axis._select.node() still exists\n // after `.data([]).render()` — emitting its toScene snapshot\n // would leak stale tick marks + grid lines under the no-data\n // overlay. We test `length === 0` explicitly so test fixtures that\n // construct viz without ever calling .render() (and leave\n // _filteredData undefined) don't trip the early-return.\n if (\n Array.isArray(this._filteredData) &&\n this._filteredData.length === 0 &&\n (!this._annotations || this._annotations.length === 0)\n )\n return scene;\n const axisNodes: SceneNode[] = [];\n for (const name of [\"_xAxis\", \"_x2Axis\", \"_yAxis\", \"_y2Axis\"]) {\n const axis = this[name];\n if (\n axis &&\n typeof axis.toScene === \"function\" &&\n axis._select &&\n typeof axis._select.node === \"function\" &&\n axis._select.node()\n ) {\n // Wrap in a uniquely-keyed group so sibling axes never collide (axis\n // snapshots reuse a per-call key counter).\n axisNodes.push({type: \"group\", key: `plot-${name}`, children: [axis.toScene()]});\n }\n }\n // Axes are drawn behind the shapes.\n scene.root.children.unshift(...axisNodes);\n return scene;\n }\n\n /**\n Wires user-registered `on()` event handlers onto a freshly-configured\n shape instance. Splits the registered events into three buckets:\n global (`\"click\"`), shape-scoped (`\"click.shape\"`), and\n shape-class-scoped (`\"click.Bar\"` etc.). All three forward into\n `this.schema.on[event](d.data, d.i, x, event)`. Extracted from\n Plot._paint so the chart-level event wiring is in one place.\n\n On the scene path (SvgRenderer/CanvasRenderer) these d3-selection\n bindings don't fire — compute-mode shapes mount no per-shape DOM.\n Pointer events are instead routed by `Viz._drawSceneToTarget`'s\n renderer bridge: it hit-tests via `Renderer.pick`, reads the picked\n node's stamped `shapeType`, and dispatches the matching global,\n `.shape`, and shape-class-scoped (`.Bar`) handlers — the same three\n buckets this method wires, so SVG and Canvas behave identically.\n */\n _wirePlotShapeEvents(\n shape: {on(event: string, handler: unknown): unknown},\n shapeKey: string,\n events: string[],\n ) {\n const classEvents = events.filter(e => e.includes(`.${shapeKey}`));\n const globalEvents = events.filter(e => !e.includes(\".\"));\n const shapeEvents = events.filter(e => e.includes(\".shape\"));\n const forward =\n (evt: string) =>\n (d: {data: DataPoint; i: number}, i: number, x: unknown, event: unknown) =>\n this.schema.on[evt](d.data, d.i, x, event);\n for (const evt of globalEvents) shape.on(evt, forward(evt));\n for (const evt of shapeEvents) shape.on(evt, forward(evt));\n for (const evt of classEvents) shape.on(evt, forward(evt));\n }\n\n /**\n For a multi-point shape (Line/Area) reports the point nearest the cursor\n along the discrete axis, so every mouse event (tooltip, click, user\n handlers) reflects the hovered x rather than the whole-series aggregate.\n Non-nested shapes and legend swatches fall through to the base (aggregate)\n behavior.\n @private\n*/\n _interactionDatum(\n pick: PickResult,\n event: SceneEvent,\n ): {d: unknown; i: number; x: unknown} {\n const node = pick.node as SceneNode & {\n interactionPoints?: InteractionPoint[];\n interactionGroup?: string;\n };\n const points = node && node.interactionPoints;\n if (\n node &&\n node.interactionGroup !== \"legend\" &&\n Array.isArray(points) &&\n points.length &&\n event &&\n Array.isArray(event.point)\n ) {\n const nearest = this._nearestInteractionPoint(points, event.point);\n if (nearest) {\n const wrapped = nearest.datum as {data?: unknown; i?: number};\n return {\n d: wrapped && wrapped.data ? wrapped.data : wrapped,\n i: typeof wrapped.i === \"number\" ? wrapped.i : nearest.index,\n x: wrapped,\n };\n }\n }\n return super._interactionDatum(pick, event);\n }\n\n /**\n Picks the interaction point closest to a surface-local cursor position\n along the discrete axis. `event.point` is post-zoom surface space while the\n points are in chart content space (under the `viz-zoom` group and then\n the chart's own `viz-chart-body` transform), so the cursor is un-zoomed\n by `_zoomTransform` and offset by `_chartTransform` before comparing.\n @private\n*/\n _nearestInteractionPoint(\n points: InteractionPoint[],\n point: [number, number],\n ): InteractionPoint | null {\n const t = this._zoomTransform;\n const scale = t && t.scale ? t.scale : 1;\n const c = this._chartTransform;\n const cx = (point[0] - (t ? t.x : 0)) / scale - (c ? c.x : 0);\n const cy = (point[1] - (t ? t.y : 0)) / scale - (c ? c.y : 0);\n const axis = this.schema.discrete === \"y\" ? \"y\" : \"x\";\n const target = axis === \"y\" ? cy : cx;\n let best: InteractionPoint | null = null;\n let bestDist = Infinity;\n for (const p of points) {\n const dist = Math.abs(p[axis] - target);\n if (dist < bestDist) {\n bestDist = dist;\n best = p;\n }\n }\n return best;\n }\n\n /**\n Extends the draw behavior of the abstract Viz class.\n @private\n*/\n _draw(callback?: () => void) {\n return drawPlot(this as unknown as VizInstance, callback);\n }\n\n /**\n Paint phase: production axis rendering, shape buffer setup, and shape\n emission with event handlers. Receives all cross-phase locals from\n _draw via `pCtx` (so this method has zero coupling to _draw's local\n scope beyond the explicit context).\n */\n _paint(pCtx: PlotPaintContext) {\n // plotPaint builds the chart scene as a fresh array from the paint\n // context (data, scales, axis measurements) — emission is a pure\n // function of its inputs. `super._draw` resets `_chartScene` to []\n // before the paint phase, so the emit output IS the scene. Viz.toScene\n // wraps the collection in viz-chart-cells + zoom transform.\n const viz = this as unknown as VizInstance;\n const target = viz._zoomEventTarget || viz._container;\n this._chartScene = paintZoomablePlot(\n viz,\n pCtx,\n target && target.node() ? zoomTransform(target.node()) : undefined,\n );\n return this;\n }\n\n /**\n Zooms by rescaling the plot's linear axes instead of scaling the\n rendered picture (see `Plot/plotZoom.ts`). Returns false when no axis\n is linear, so the plot falls back to picture zoom.\n @private\n*/\n _zoomRescale(t: ZoomState, duration = 0): boolean {\n const nodes = zoomPlot(this as unknown as VizInstance, t, duration);\n if (!nodes) return false;\n this._chartScene = nodes;\n return true;\n }\n\n /**\n Allows drawing custom shapes to be used as annotations in the provided x/y plot. This method accepts custom config objects for the [Shape](http://d3plus.org/docs/#Shape) class, either a single config object or an array of config objects. Each config object requires an additional parameter, the \"shape\", which denotes which [Shape](http://d3plus.org/docs/#Shape) sub-class to use ([Rect](http://d3plus.org/docs/#Rect), [Line](http://d3plus.org/docs/#Line), etc).\n\nAdditionally, each config object can also contain an optional \"layer\" key, which defines whether the annotations will be displayed in \"front\" or in \"back\" of the primary visualization shapes. This value defaults to \"back\" if not present.\n*/\n annotations(_?: unknown): this | unknown[] {\n return arguments.length\n ? ((this._annotations = _ instanceof Array ? _ : [_]), this)\n : this._annotations;\n }\n\n /**\n Determines whether the x and y axes should have their scales persist while users filter the data, the timeline being the prime example (set this to `true` to make the axes stay consistent when the timeline changes).\n*/\n axisPersist(_?: boolean): this | boolean {\n return arguments.length\n ? ((this._axisPersist = _), this)\n : this._axisPersist;\n }\n\n /**\n A d3plus-shape configuration Object used for styling the background rectangle of the inner x/y plot (behind all of the shapes and gridlines).\n*/\n backgroundConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._backgroundConfig = assign(this._backgroundConfig, _!)), this)\n : this._backgroundConfig;\n }\n\n /**\n Determines whether or not to add additional padding at the ends of x or y scales. The most commone use for this is in Scatter Plots, so that the shapes do not appear directly on the axis itself. The value provided can either be `true` or `false` to toggle the behavior for all shape types, or a keyed Object for each shape type (ie. `{Bar: false, Circle: true, Line: false}`).\n*/\n buffer(_?: boolean | Record<string, boolean>): this | Record<string, unknown> {\n if (arguments.length) {\n if (!_) this._buffer = {};\n else if (_ === true) this._buffer = defaultBuffers;\n else {\n this._buffer = assign({}, this._buffer, _);\n for (const key in this._buffer) {\n const buf = this._buffer as Record<string, unknown>;\n if (buf[key] === true) buf[key] = (defaultBuffers as Record<string, unknown>)[key];\n }\n }\n return this;\n }\n return this._buffer;\n }\n\n /**\n The confidence interval as an array of [lower, upper] bounds.\n\n@example <caption>Can be called with accessor functions or static keys:</caption>\n var data = {id: \"alpha\", value: 10, lci: 9, hci: 11};\n ...\n // Accessor functions\n .confidence([function(d) { return d.lci }, function(d) { return d.hci }])\n\n // Or static keys\n .confidence([\"lci\", \"hci\"])\n*/\n confidence(_?: unknown): this | [number, number] | false {\n if (arguments.length && _ instanceof Array) {\n this._confidence = [];\n const lower = _[0];\n this._confidence[0] =\n typeof lower === \"function\" || !lower ? lower : accessor(lower);\n const upper = _[1];\n this._confidence[1] =\n typeof upper === \"function\" || !upper ? upper : accessor(upper);\n\n return this;\n } else return this._confidence;\n }\n\n /**\n Configuration object for shapes rendered as confidence intervals.\n*/\n confidenceConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._confidenceConfig = assign(this._confidenceConfig, _!)), this)\n : this._confidenceConfig;\n }\n\n /**\n When the width or height of the chart is less than or equal to this pixel value, the discrete axis will not be shown. This helps produce slick sparklines. Set this value to `0` to disable the behavior entirely.\n*/\n discreteCutoff(_?: number): this | number {\n return arguments.length\n ? ((this._discreteCutoff = _), this)\n : this._discreteCutoff;\n }\n\n /**\n The pixel space between groups of bars.\n*/\n groupPadding(_?: number): this | number {\n return arguments.length\n ? ((this._groupPadding = _), this)\n : this._groupPadding;\n }\n\n /**\n The d3plus-shape config used on the Line shapes created to connect lineLabels to the end of their associated Line path.\n*/\n labelConnectorConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._labelConnectorConfig = assign(this._labelConnectorConfig, _!)),\n this)\n : this._labelConnectorConfig;\n }\n\n /**\n The behavior to be used when calculating the position and size of each shape's label(s). The value passed can either be the _String_ name of the behavior to be used for all shapes, or an accessor _Function_ that will be provided each data point and will be expected to return the behavior to be used for that data point. The availability and options for this method depend on the default logic for each Shape. As an example, the values \"outside\" or \"inside\" can be set for Bar shapes, whose \"auto\" default will calculate the best position dynamically based on the available space.\n*/\n labelPosition(\n _?: string | ((d: DataPoint, i: number) => string),\n ): this | ((d: DataPoint, i: number) => string) {\n return arguments.length\n ? ((this._labelPosition = typeof _ === \"function\" ? _ : constant(_)),\n this)\n : this._labelPosition;\n }\n\n /**\n Shape config for the Circle shapes drawn by the lineMarkers method.\n*/\n lineMarkerConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._lineMarkerConfig = assign(this._lineMarkerConfig, _!)), this)\n : this._lineMarkerConfig;\n }\n\n /**\n Draws circle markers on each vertex of a Line.\n*/\n lineMarkers(_?: boolean): this | boolean {\n return arguments.length\n ? ((this._lineMarkers = _), this)\n : this._lineMarkers;\n }\n\n /**\n Sets the size of bubbles to the given Number, data key, or function.\n*/\n size(_?: PlotAccessorArg | false): this | PlotAccessor {\n return arguments.length\n ? ((this._size = typeof _ === \"function\" || !_ ? _ : accessor(_ as string)), this)\n : this._size;\n }\n\n /**\n Sets the vertical offset applied to stacked series. Accepts a named\n offset — `\"diverging\"` (default), `\"none\"`, `\"expand\"`, `\"silhouette\"`,\n or `\"wiggle\"` — or a custom offset function. Unknown names warn and fall\n back to `\"diverging\"`. If *value* is not specified, returns the current\n stack offset function.\n*/\n stackOffset(_?: string | StackOffsetFn): this | StackOffsetFn {\n return arguments.length\n ? ((this._stackOffset = resolveStackOffset(_!)), this)\n : (this._stackOffset as StackOffsetFn);\n }\n\n /**\n Sets the order of stacked series, from the bottom of the stack upward.\n Accepts:\n - a named order: `\"descending\"` (default) / `\"ascending\"` by summed\n value, `\"key\"` / `\"keyReverse\"` alphabetically by series key,\n `\"none\"` / `\"data\"` for input order, or d3's `\"insideOut\"`,\n `\"appearance\"`, `\"reverse\"`;\n - an Array of series keys for an explicit order;\n - a value accessor, or a `{value, order}` config, to rank series by an\n aggregate of any data field.\n\n Unknown named strings warn and fall back to `\"descending\"`. If *value*\n is not specified, returns the current stack order.\n*/\n stackOrder(_?: StackOrderInput): this | StackOrderFn | string[] {\n return arguments.length\n ? ((this._stackOrder = resolveStackOrder(_!)), this)\n : (this._stackOrder as StackOrderFn | string[]);\n }\n\n /**\n Accessor function or string key for the x-axis value of each data point.\n*/\n x(_?: PlotAccessorArg): this | PlotAccessor {\n if (arguments.length) {\n if (typeof _ === \"function\") this._x = _;\n else {\n this._x = accessor(_ as string);\n this._xKey = _;\n }\n return this;\n } else return this._x;\n }\n\n /**\n Accessor function or string key for the secondary x-axis value of each data point.\n*/\n x2(_?: PlotAccessorArg): this | PlotAccessor {\n if (arguments.length) {\n if (typeof _ === \"function\") this._x2 = _;\n else {\n this._x2 = accessor(_ as string);\n this._x2Key = _;\n }\n return this;\n } else return this._x2;\n }\n\n /**\n A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the x-axis. Includes additional functionality where passing \"auto\" as the value for the [scale](http://d3plus.org/docs/#Axis.scale) method will determine if the scale should be \"linear\" or \"log\" based on the provided data.\n*/\n xConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._xConfig = assign(this._xConfig, _!)), this)\n : this._xConfig;\n }\n\n /**\n A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the secondary x-axis. Includes additional functionality where passing \"auto\" as the value for the [scale](http://d3plus.org/docs/#Axis.scale) method will determine if the scale should be \"linear\" or \"log\" based on the provided data.\n*/\n x2Config(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._x2Config = assign(this._x2Config, _!)), this)\n : this._x2Config;\n }\n\n /**\n Accessor function or string key for the y-axis value of each data point.\n*/\n y(_?: PlotAccessorArg): this | PlotAccessor {\n if (arguments.length) {\n if (typeof _ === \"function\") this._y = _;\n else {\n this._y = accessor(_ as string);\n this._yKey = _;\n }\n return this;\n } else return this._y;\n }\n\n /**\n Accessor function or string key for the secondary y-axis value of each data point.\n*/\n y2(_?: PlotAccessorArg): this | PlotAccessor {\n if (arguments.length) {\n if (typeof _ === \"function\") this._y2 = _;\n else {\n this._y2 = accessor(_ as string);\n this._y2Key = _;\n }\n return this;\n } else return this._y2;\n }\n\n /**\n A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the y-axis. Includes additional functionality where passing \"auto\" as the value for the [scale](http://d3plus.org/docs/#Axis.scale) method will determine if the scale should be \"linear\" or \"log\" based on the provided data.\n\n*Note:* If a \"domain\" array is passed to the y-axis config, it will be reversed.\n*/\n yConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n if (arguments.length) {\n const cfg = _ as {domain?: unknown[]};\n if (cfg.domain) cfg.domain = cfg.domain.slice().reverse();\n this._yConfig = assign(this._yConfig, _!);\n return this;\n }\n return this._yConfig;\n }\n\n /**\n A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the secondary y-axis. Includes additional functionality where passing \"auto\" as the value for the [scale](http://d3plus.org/docs/#Axis.scale) method will determine if the scale should be \"linear\" or \"log\" based on the provided data.\n*/\n y2Config(_?: Record<string, unknown>): this | Record<string, unknown> {\n if (arguments.length) {\n const cfg = _ as {domain?: unknown[]};\n if (cfg.domain) cfg.domain = cfg.domain.slice().reverse();\n this._y2Config = assign(this._y2Config, _!);\n return this;\n }\n return this._y2Config;\n }\n\n}\n"],"names":["pkg","zoomTransform","theme","openColor","colorAssign","colorContrast","colorDefaults","assign","backgroundColor","AxisBottom","AxisLeft","AxisRight","AxisTop","accessor","constant","installFluent","plotSchema","key","coerce","plotDef","drawPlot","plotShapeDefaults","resolveStackOffset","resolveStackOrder","stackOffsetDiverging","stackOrderTotalDescending","paintZoomablePlot","zoomPlot","Viz","default","BarBuffer","BoxBuffer","CircleBuffer","LineBuffer","RectBuffer","defaultBuffers","Bar","Box","Circle","Line","Rect","Plot","defaults","_axisPersist","axisPersist","_annotations","annotations","_backgroundConfig","duration","fill","schema","barPadding","_buffer","_confidenceConfig","d","i","shapeConfig","stroke","s","undefined","fillOpacity","_discreteCutoff","discreteCutoff","_groupPadding","groupPadding","_labelConnectorConfig","strokeDasharray","_labelPosition","_lineMarkerConfig","_id","r","_lineMarkers","lineMarkers","_previousAnnotations","back","front","_previousShapes","shape","call","_shapeOrder","shapeSort","a","b","indexOf","sizeMax","sizeMin","sizeScale","_stackOffset","_stackOrder","timelineConfig","brushMin","_xTime","_yTime","_x2Time","_y2Time","_x","_xKey","_xAxis","align","_xConfig","gridConfig","discrete","charAt","range","position","_getPosition","bind","id","bg","_select","node","contrast","dark","colors","gray","xCutoff","_x2","_x2Key","_x2Axis","_x2Config","_y","_yKey","_yAxis","_yConfig","length","yCutoff","_y2","_y2Key","_y2Axis","_y2Config","_preDraw","forEach","k","str","aggs","c","v","Array","from","Set","map","title","toScene","scene","prototype","isArray","_filteredData","axisNodes","name","axis","push","type","children","root","unshift","_wirePlotShapeEvents","shapeKey","events","classEvents","filter","e","includes","globalEvents","shapeEvents","forward","evt","x","event","on","data","_interactionDatum","pick","points","interactionPoints","interactionGroup","point","nearest","_nearestInteractionPoint","wrapped","datum","index","t","_zoomTransform","scale","_chartTransform","cx","cy","y","target","best","bestDist","Infinity","p","dist","Math","abs","_draw","callback","_paint","pCtx","viz","_zoomEventTarget","_container","_chartScene","_zoomRescale","nodes","_","arguments","backgroundConfig","buffer","buf","confidence","_confidence","lower","upper","confidenceConfig","labelConnectorConfig","labelPosition","lineMarkerConfig","size","_size","stackOffset","stackOrder","x2","xConfig","x2Config","y2","yConfig","cfg","domain","slice","reverse","y2Config"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAA2B,GAE3B,aAAa;AACb,OAAOA,SAAS,2BAA2B;AAC3C,SAAQC,aAAa,QAAO,UAAU;AACtC,IAAOC,AAAOC,YAAaH,IAApBE;AAEP,SACEE,WAAW,EACXC,aAAa,EACbC,aAAa,QACR,gBAAgB;AACvB,SAAQC,MAAM,EAAEC,eAAe,QAAO,cAAc;AAEpD,SACEC,UAAU,EACVC,QAAQ,EACRC,SAAS,EACTC,OAAO,QACF,4BAA4B;AACnC,SAAQC,QAAQ,EAAEC,QAAQ,QAAO,uBAAuB;AACxD,SAAQC,aAAa,QAAO,kBAAkB;AAE9C,wEAA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oBACvD,IAAI,CAACtG,SAAS,GAAG1H,OAAO,IAAI,CAAC0H,SAAS,EAAE6E;oBACxC,OAAO,IAAI;gBACb;gBACA,OAAO,IAAI,CAAC7E,SAAS;YACvB;;;WA5mBmBxF;EAAab;AAHlC;;AAEA,GACA,SAAqBa,kBA8mBpB"}
|
|
@@ -113,21 +113,41 @@ import { deviation, extent, groups, max, mean, min, range, rollups } from "d3-ar
|
|
|
113
113
|
import discreteBufferFn from "../plotBuffers/discreteBuffer.js";
|
|
114
114
|
import constant from "../../utils/constant.js";
|
|
115
115
|
import { shapeConfigFor } from "../features/emitHelpers.js";
|
|
116
|
-
import {
|
|
116
|
+
import { subtitleFeature, titleFeature, totalFeature } from "../features/features.js";
|
|
117
117
|
/** d3-scale's scale constructors, indexed by the dynamic `scale<Type>` name. */ var scaleConstructors = scales;
|
|
118
118
|
export { computePlotInitialDomains } from "./pipelineDomains.js";
|
|
119
119
|
export { measurePlotLineLabels } from "./pipelineLineLabels.js";
|
|
120
120
|
var defaultChartFeatures = [
|
|
121
|
-
backFeature,
|
|
122
121
|
titleFeature,
|
|
123
122
|
subtitleFeature,
|
|
124
123
|
totalFeature
|
|
125
124
|
];
|
|
125
|
+
/**
|
|
126
|
+
A plotted axis value that can't be turned into a pixel coordinate: a
|
|
127
|
+
non-finite number (`NaN`/`±Infinity`), `null`, or the empty-array sentinel
|
|
128
|
+
`merge` yields when a numeric column aggregates to no usable value. Any of
|
|
129
|
+
these poisons the shape's transform or path `d` downstream — e.g.
|
|
130
|
+
`translate(NaN,…)` or `…L268.75,NaN` — which the browser rejects. A bare
|
|
131
|
+
`undefined` is NOT bad: it's how an unused secondary axis (x2/y2) reports
|
|
132
|
+
"no value on this row".
|
|
133
|
+
*/ var isBadAxisValue = function isBadAxisValue(v) {
|
|
134
|
+
return v === null || typeof v === "number" && !Number.isFinite(v) || Array.isArray(v) && v.length === 0;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
A formatted row is plottable when its x/y — and any *defined* x2/y2 — are
|
|
138
|
+
real coordinates. Rows failing this are dropped in `formatPlotData` before
|
|
139
|
+
domains, stacking, and paint ever read `_formattedData`, so a NaN measure
|
|
140
|
+
no longer widens a domain, stacks as 0, or emits a broken coordinate.
|
|
141
|
+
Resolves d3plus/d3plus#776.
|
|
142
|
+
*/ var isPlottableRow = function isPlottableRow(d) {
|
|
143
|
+
return !isBadAxisValue(d.x) && !isBadAxisValue(d.y) && (d.x2 === undefined || !isBadAxisValue(d.x2)) && (d.y2 === undefined || !isBadAxisValue(d.y2));
|
|
144
|
+
};
|
|
126
145
|
/**
|
|
127
146
|
`formatPlotData` — first stage of Plot's chart-specific pipeline. Detects
|
|
128
147
|
time axes (sets viz._xTime / _x2Time / _yTime / _y2Time), maps the
|
|
129
148
|
filtered data through `prepData` to produce the per-row PlotDatum shape
|
|
130
|
-
(x/y/x2/y2 + id + group + shape + lci/hci + discrete),
|
|
149
|
+
(x/y/x2/y2 + id + group + shape + lci/hci + discrete), drops rows whose
|
|
150
|
+
axis values can't be plotted (`isPlottableRow` — see #776), and constructs
|
|
131
151
|
the `_sizeScaleD3` if `_size` is set.
|
|
132
152
|
|
|
133
153
|
Pure compute. Returns `{formattedData, axisData, x2Exists, y2Exists}`
|
|
@@ -171,8 +191,8 @@ var defaultChartFeatures = [
|
|
|
171
191
|
newD.id = newD.shape === "Bar" ? "".concat(newD.id, "_").concat(newD[viz.schema.discrete]) : newD.id;
|
|
172
192
|
return newD;
|
|
173
193
|
};
|
|
174
|
-
var formattedData = viz._formattedData = viz._filteredData.map(prepData);
|
|
175
|
-
var axisData = viz._axisPersist ? viz._data.map(prepData) : formattedData;
|
|
194
|
+
var formattedData = viz._formattedData = viz._filteredData.map(prepData).filter(isPlottableRow);
|
|
195
|
+
var axisData = viz._axisPersist ? viz._data.map(prepData).filter(isPlottableRow) : formattedData;
|
|
176
196
|
if (viz._size) {
|
|
177
197
|
var rExtent = extent(axisData, function(d) {
|
|
178
198
|
return viz._size(d.data);
|