@pioneer-code/pioneer-charts 22.2.22 → 22.2.24

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.
@@ -1 +1 @@
1
- {"version":3,"file":"pioneer-code-pioneer-charts.mjs","sources":["../../../projects/pioneer-charts/src/lib/core/chart.model.ts","../../../projects/pioneer-charts/src/lib/core/tick-format.ts","../../../projects/pioneer-charts/src/lib/core/axis.builder.ts","../../../projects/pioneer-charts/src/lib/core/grid.builder.ts","../../../projects/pioneer-charts/src/lib/core/color.service.ts","../../../projects/pioneer-charts/src/lib/core/transition.service.ts","../../../projects/pioneer-charts/src/lib/core/marks.ts","../../../projects/pioneer-charts/src/lib/core/tooltip.builder.ts","../../../projects/pioneer-charts/src/lib/core/chart.ts","../../../projects/pioneer-charts/src/lib/core/stack.ts","../../../projects/pioneer-charts/src/lib/bar-chart/bar-thresholds.ts","../../../projects/pioneer-charts/src/lib/bar-chart/bar-series.ts","../../../projects/pioneer-charts/src/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.builder.ts","../../../projects/pioneer-charts/src/lib/core/resize.service.ts","../../../projects/pioneer-charts/src/lib/core/tooltip.directive.ts","../../../projects/pioneer-charts/src/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.component.ts","../../../projects/pioneer-charts/src/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.component.html","../../../projects/pioneer-charts/src/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.model.ts","../../../projects/pioneer-charts/src/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.builder.ts","../../../projects/pioneer-charts/src/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.component.ts","../../../projects/pioneer-charts/src/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.component.html","../../../projects/pioneer-charts/src/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.model.ts","../../../projects/pioneer-charts/src/lib/core/public-api.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/plot-line-area-chart.model.ts","../../../projects/pioneer-charts/src/lib/dot-plot-chart/dot-plot-chart.model.ts","../../../projects/pioneer-charts/src/lib/dot-plot-chart/dot-plot-layout.ts","../../../projects/pioneer-charts/src/lib/dot-plot-chart/dot-plot-chart.builder.ts","../../../projects/pioneer-charts/src/lib/dot-plot-chart/dot-plot-chart.component.ts","../../../projects/pioneer-charts/src/lib/dot-plot-chart/dot-plot-chart.component.html","../../../projects/pioneer-charts/src/lib/legend/legend.component.ts","../../../projects/pioneer-charts/src/lib/legend/legend.component.html","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/core/x-format.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/core/builders/has-value.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/core/builders/effects.builders.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/plot/plot.model.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/core/builders/scales.builder.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/core/builders/line-generator.builder.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/core/builders/area-generator.builder.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/core/builders/zoom-behavior.builder.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/core/builders/point-range.builder.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/core/builders/point-gauge.builder.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/core/builders/reference-lines.builder.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/core/builders/fan-out.builder.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/core/builders/chart.builder.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/plot-line-area-chart.component.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/plot-line-area-chart.component.html","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/plot/plot.component.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/plot/plot.component.html","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/line/line.component.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/line/line.component.html","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/line/line.model.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/area/area.component.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/area/area.component.html","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/area/area.model.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/public-api.ts","../../../projects/pioneer-charts/src/lib/proximity-chart/proximity-chart.model.ts","../../../projects/pioneer-charts/src/lib/proximity-chart/proximity-layout.ts","../../../projects/pioneer-charts/src/lib/proximity-chart/proximity-chart.builder.ts","../../../projects/pioneer-charts/src/lib/proximity-chart/proximity-chart.component.ts","../../../projects/pioneer-charts/src/lib/proximity-chart/proximity-chart.component.html","../../../projects/pioneer-charts/src/lib/pie-donut-chart/pie-donut-chart.model.ts","../../../projects/pioneer-charts/src/lib/pie-donut-chart/donut/donut.model.ts","../../../projects/pioneer-charts/src/lib/pie-donut-chart/pie-donut-chart.builder.ts","../../../projects/pioneer-charts/src/lib/pie-donut-chart/pie-donut-chart.component.ts","../../../projects/pioneer-charts/src/lib/pie-donut-chart/pie-donut-chart.component.html","../../../projects/pioneer-charts/src/lib/pie-donut-chart/pie/pie.component.ts","../../../projects/pioneer-charts/src/lib/pie-donut-chart/pie/pie.component.html","../../../projects/pioneer-charts/src/lib/pie-donut-chart/pie/pie.model.ts","../../../projects/pioneer-charts/src/lib/pie-donut-chart/donut/donut.component.ts","../../../projects/pioneer-charts/src/lib/pie-donut-chart/donut/donut.component.html","../../../projects/pioneer-charts/src/lib/pie-donut-chart/public-api.ts","../../../projects/pioneer-charts/src/public-api.ts","../../../projects/pioneer-charts/src/pioneer-code-pioneer-charts.ts"],"sourcesContent":["/**\n * Base configuration for all charts.\n * INewChart extends IChart\n */\nexport class PcacChartConfig {\n data: PcacData[] = []\n\n /**\n * Height in pixels\n */\n height: number = 200\n\n /**\n * When true, `height` becomes a *minimum* height: if the container the chart is placed in is\n * taller than `height`, the chart grows to fill it instead.\n *\n * The chart fills its own host element (`<pcac-bar-vertical-chart>` etc.), which it stretches\n * to `height: 100%` while this is on - so the consumer just needs to give the element wrapping\n * the chart a definite height (an explicit height, or a flex/grid track that resolves to one).\n * If that wrapper turns out to be auto-height, there's nothing definite to fill and the chart\n * falls back to `height`.\n *\n * Optional (rather than defaulted like the properties above) so that adding it doesn't force\n * every existing consumer that builds a config as an object literal to declare it; the `= false`\n * initializer still applies to anything constructed via `new`.\n */\n heightFull?: boolean = false\n\n /**\n * What the chart shows, for screen readers - e.g. `'Sales by month, 2026'`. The chart's `<svg>` is\n * announced as one image with this name; when it isn't set, the chart's type is used (`'Bar\n * chart'`, `'Pie chart'`, ...). Optional for the same reason as `heightFull`.\n */\n ariaLabel?: string\n}\n\n/**\n * Up to three short labels placed along an axis by position rather than by value: `min` at its\n * start, `mid` at its center, `max` at its end. Any subset can be given.\n */\nexport class PcacAxisSubLabels {\n min?: string\n mid?: string\n max?: string\n}\n\n/**\n * Everything configurable about one axis. Used twice per chart, as `xAxis` and `yAxis` on\n * `PcacAxisChartConfig`, so the two never drift apart and a new per-axis option lands in one place.\n *\n * Every field is optional so an object-literal / JSON config can give just the ones it cares\n * about (or omit the axis entirely); the initializers apply to anything built with `new`, and\n * `resolveAxisConfig()` fills the rest in for builders.\n *\n * The `*Color` fields each color one part of this axis, with any CSS color. Unset, the part keeps\n * the theme's color. A color never turns a part on - it only shows once the part is drawn. Each\n * is applied to the axis as the CSS custom property named on the field, so a stylesheet can set\n * the same property on any ancestor instead; a config value wins.\n */\nexport class PcacAxisConfig {\n /**\n * Don't draw this axis at all (labels, tick marks, line), and give the margins it would have\n * occupied back to the plot area. Hiding the y axis reclaims the left and top margins; hiding\n * the x axis reclaims the bottom and right. The chart's total footprint doesn't change.\n */\n hide?: boolean = false\n\n /**\n * Draw grid lines from this axis's ticks (or, on a category axis, from each category) across\n * the plot: horizontal lines for the y axis, vertical for the x. Left unset, each chart keeps\n * the grid it has always drawn - the y axis's on vertical bar and line/area/plot charts, the\n * x axis's on the horizontal bar chart - and no other; set it to turn either grid on or off\n * explicitly. Deliberately has no initializer, since \"unset\" is what carries the per-chart\n * default.\n */\n showGrid?: boolean\n\n /**\n * Grid line color (`--pcac-grid-color`), shown while this axis's grid is drawn - see `showGrid`.\n * Theme default `$gray-200`.\n */\n gridColor?: string\n\n /**\n * Requested number of ticks (D3's `ticks()` hint, so the actual count can differ slightly) -\n * also the number of grid lines for this axis. Ignored by a category (band) axis, which has one\n * tick per category. Default 5.\n */\n ticks?: number = 5\n\n /**\n * Length in pixels of the small tick marks. Tick marks are not drawn at all unless this is set\n * (the theme hides them, as it always has), so setting a size is also what turns them on; D3's\n * default 6px is a sensible first value. `0` keeps them off but still pulls the labels in to\n * the axis. Labels follow the marks (D3 places them at tick length + 3px), and the chart's\n * margins grow or shrink by the same amount so the plot area makes room for them - a longer\n * tick means a slightly smaller plot, never labels pushed off the edge. Only the per-tick marks\n * change; the axis line's two end-caps keep their default length. Colored by `tickColor`, the\n * theme's `$gray-900` (like the axis line) by default. Ignored while `autoTickSize` is on.\n */\n tickSize?: number\n\n /**\n * Size the tick marks from the chart's points instead of `tickSize`: half the largest mark\n * toward this axis, so a point sitting on the axis ends where its tick does and never covers a\n * tick label (D3's 3px tick padding is the gap left between them). This **overrides**\n * `tickSize` - with it on, any `tickSize` given is ignored - and turns the marks on the same\n * way a `tickSize` does. The largest mark is measured as drawn: a hovered dot, an image's box\n * (its height for the x axis, its width for the y axis), and a gauge ring around either,\n * after any shrinking to fit (dot plot). Honored by the charts that draw points - line, area,\n * plot and dot plot; ignored elsewhere. On the dot plot the marks never reach the axis (its\n * bottom row sits a `gap` above it), so there it only spaces the labels to the marks' size.\n * Default false.\n */\n autoTickSize?: boolean = false\n\n /**\n * Tick mark color (`--pcac-axis-tick-color`), shown once `tickSize` has turned the marks on.\n * Theme default `$gray-900`.\n */\n tickColor?: string\n\n /**\n * Tick label color (`--pcac-axis-tick-label-color`) - the values along the axis. Default is the\n * page's text color (`currentColor`), as d3-axis has always drawn them.\n */\n tickLabelColor?: string\n\n /**\n * Draw a solid line along the axis itself (the full length of the axis, with D3's short\n * end-caps). Off by default, as the theme has always hidden it. Colored by `lineColor`, the\n * theme's `$gray-900` by default.\n */\n showLine?: boolean = false\n\n /**\n * Axis line color (`--pcac-axis-line-color`), shown with `showLine` on. Theme default `$gray-900`.\n */\n lineColor?: string\n\n /**\n * A title for the whole axis (e.g. \"Revenue ($)\"), drawn centered along it just inside the\n * chart's edge: below the tick labels for the x axis, rotated to read bottom-to-top left of\n * them for the y axis. The chart's margin grows by `PcacChart.AXIS_LABEL_SPACE` to make room,\n * shrinking the plot area the same way a longer tick does. Not drawn on a hidden axis. Styled\n * by the theme's `.pcac-axis-label` rule.\n */\n label?: string\n\n /** `label` color (`--pcac-axis-label-color`). Theme default `$gray-700`. */\n labelColor?: string\n\n /**\n * Min / mid / max sub labels (e.g. \"Low\" / \"Medium\" / \"High\") in their own row just outside the\n * tick labels, and inside the `label` if there is one: `min` left-aligned at the axis's start,\n * `mid` centered, `max` right-aligned at its end, so they never spill past the axis. On the\n * y axis they run bottom-to-top like the label, `min` at the bottom. The margin grows by\n * `PcacChart.AXIS_SUB_LABEL_SPACE` when any is set, shrinking the plot area. Not drawn on a\n * hidden axis. Styled by the theme's `.pcac-axis-sub-label` rule.\n */\n subLabels?: PcacAxisSubLabels\n\n /** `subLabels` color, all three (`--pcac-axis-sub-label-color`). Theme default `$gray-600`. */\n subLabelColor?: string\n\n /**\n * How the values along this axis are interpreted and shown - the tick labels, and the value\n * (`yAxis`) or key (`xAxis`) in the default tooltip. On the line/area/plot charts the x axis's\n * format is also what decides how a point's `key` maps to an x position (by index for the\n * default, `Decimal` and `DateTime` by the key's own value on a linear/time scale - see\n * `PcacLineAreaChartConfig`); on a bar chart's category axis it only formats keys that are\n * numbers, and shows any other key as it is. Default `None`, which\n * on those charts behaves as `DatasetLength`.\n */\n format?: PcacFormatEnum = PcacFormatEnum.None\n\n /**\n * The value axis's domain: it runs from `domainMin` to `domainMax`, ignoring the data. Defaults\n * 0 and 100. Only the type of axis that has a domain to set reads them - a bar chart's category\n * axis ignores both, its value axis reads `domainMax` only (bars always grow from 0), and a\n * line/area/plot chart's x axis reads them only under the `Decimal` (numbers) and `DateTime`\n * (anything `new Date()` accepts, and required) formats - the index-based formats size the\n * axis from the data.\n */\n domainMin?: number | string = 0\n domainMax?: number | string = 100\n}\n\n/**\n * The `PcacChartMargin` type lives here rather than in chart.ts so the axis builder can take\n * one without importing the class module that imports it back.\n */\nexport interface PcacChartMargin {\n top: number;\n right: number;\n bottom: number;\n left: number;\n}\n\n/**\n * `PcacAxisConfig` with every default applied - what builders work with, so they never have to\n * null-check. `tickSize`, `label`, `subLabels` and the `*Color` fields stay optional: \"not set\"\n * is itself the meaningful default (no marks, no labels, the theme's colors). The color fields\n * are picked up by name, so a new one needs only its declaration on the class.\n */\ntype PcacOptionalAxisFields = 'tickSize' | 'label' | 'subLabels' | Extract<keyof PcacAxisConfig, `${string}Color`>;\nexport type PcacResolvedAxisConfig = Required<Omit<PcacAxisConfig, PcacOptionalAxisFields>> & Pick<PcacAxisConfig, PcacOptionalAxisFields>;\n\n/** True if `axis` has at least one sub label to draw (an empty `subLabels` object counts as none). */\nexport function hasAxisSubLabels(axis: PcacAxisConfig | undefined): boolean {\n const sub = axis?.subLabels;\n return !!sub && (!!sub.min || !!sub.mid || !!sub.max);\n}\n\n/**\n * Room reserved in a margin for an axis `label`: the theme's 12px label plus a gap from the tick\n * labels. Reserved on the side the label sits on (`bottom` for x, `left` for y), and taken out\n * of the plot area, the same way a longer tick is. Change together with `.pcac-axis-label`.\n */\nexport const PCAC_AXIS_LABEL_SPACE = 18;\n\n/** Likewise for a row of `subLabels`: the theme's 11px text plus a gap (`.pcac-axis-sub-label`). */\nexport const PCAC_AXIS_SUB_LABEL_SPACE = 16;\n\n/**\n * Total margin an axis's `label` and `subLabels` take on its side. `PcacChart` reserves it and\n * the axis builder places the text by it, so the two stay in step.\n */\nexport function axisLabelSpace(axis: PcacAxisConfig | undefined): number {\n return (axis?.label ? PCAC_AXIS_LABEL_SPACE : 0) + (hasAxisSubLabels(axis) ? PCAC_AXIS_SUB_LABEL_SPACE : 0);\n}\n\n/**\n * @param showGridDefault what `showGrid` resolves to when the consumer left it unset - each chart\n * passes `true` for the axis whose grid it has always drawn and `false` for the other.\n */\nexport function resolveAxisConfig(axis?: PcacAxisConfig, showGridDefault = false): PcacResolvedAxisConfig {\n const defaults = new PcacAxisConfig();\n // The optional fields (see `PcacOptionalAxisFields`) pass through as given; only the ones with\n // a default are spelled out.\n return {\n ...axis,\n hide: axis?.hide ?? defaults.hide!,\n showGrid: axis?.showGrid ?? showGridDefault,\n ticks: axis?.ticks ?? defaults.ticks!,\n showLine: axis?.showLine ?? defaults.showLine!,\n autoTickSize: axis?.autoTickSize ?? defaults.autoTickSize!,\n format: axis?.format ?? defaults.format!,\n domainMin: axis?.domainMin ?? defaults.domainMin!,\n domainMax: axis?.domainMax ?? defaults.domainMax!,\n };\n}\n\n/**\n * Base configuration for every chart that has an x and y axis (bar, line, area, plot - not pie).\n */\nexport class PcacAxisChartConfig extends PcacChartConfig {\n xAxis?: PcacAxisConfig = new PcacAxisConfig()\n yAxis?: PcacAxisConfig = new PcacAxisConfig()\n}\n\nexport class PcacData {\n key: string | number | null = null\n value: string | number| null = null\n\n /**\n * Hides the item while keeping its place in the color order, so a `<pcac-legend>` can toggle it\n * without the other items changing color. A line/area/plot series draws no line, area, points or\n * hover effects; a bar (or every bar of a group) is drawn at zero size, keeping its slot; a pie\n * slice takes no angle.\n */\n hide: boolean = false\n data: PcacData[] = []\n\n /**\n * URL (or data URI) of an image to draw at this point *in place of* its dot. Currently honored\n * by the line/area/plot charts only, on the innermost (point-level) `PcacData`; sized by the\n * chart config's `pointImage` (see `PcacLineAreaChartConfig.pointImage`). Points without one\n * keep their regular dot, so the two can be mixed within a single series.\n *\n * Optional (rather than defaulted) for the same reason as `PcacChartConfig.heightFull`: so\n * existing object-literal / JSON data doesn't have to declare it.\n */\n image?: string\n\n /**\n * The span this point's `key` / `value` stands for, when the point is really the middle of a\n * range: `x` for the key, `y` for the value, either or both. Currently honored by the\n * line/area/plot charts only, on the innermost (point-level) `PcacData`, and only drawn when\n * the chart config turns `pointRange` on (see `PcacPointRangeConfig`). Nothing is labeled on\n * the chart; a custom tooltip can read it off the point.\n *\n * Optional for the same reason as `image`.\n */\n range?: PcacDataRange\n\n /**\n * A third number for this point, shown as how full a ring around its mark is - on a scatter of\n * two measures, say, a third one per point. Out of the chart config's `pointGauge.max`: at `max`\n * or above the ring is full, at `0` or below it's empty. Currently honored by the line/area/plot\n * charts only, on the innermost (point-level) `PcacData`, and only drawn when the chart config\n * turns `pointGauge` on (see `PcacPointGaugeConfig`). A point without one gets no ring at all,\n * which can itself say something (\"doesn't apply\").\n *\n * Optional for the same reason as `image`.\n */\n gauge?: number\n\n /**\n * The consumer's own identifier for this item - a record's primary key, say. Nothing draws or\n * labels it; it's carried through untouched so a click output (`dotClicked`, `barClicked`,\n * `sliceClicked`, `itemClicked`) can be traced back to the record it came from. Click outputs\n * emit a copy of the item (the chart works on a copy of its config), so matching by object\n * identity doesn't work, and matching by `key` or `image` breaks as soon as two items share one.\n *\n * Optional for the same reason as `image`.\n */\n id?: string | number\n}\n\n/**\n * One side of a `PcacDataRange`. `min` above `max` is read as the other way round; `min` equal to\n * `max` (or either missing) as no range on that axis.\n */\nexport class PcacRangeBounds<T> {\n min!: T\n max!: T\n}\n\n/**\n * `PcacData.range`. `x` is read the way the point's `key` is, per the chart's `xAxis.format`: a\n * number for `Decimal`, anything `new Date()` accepts for `DateTime`, and for every index-based\n * format a (possibly fractional) index - `{ min: 2.5, max: 3.5 }` is half a slot either side of\n * the fourth point. `y` is on the value axis.\n */\nexport class PcacDataRange {\n x?: PcacRangeBounds<number | string>\n y?: PcacRangeBounds<number>\n}\n\nexport enum PcacFormatEnum {\n None = 'none',\n Decimal = 'decimal',\n DatasetLength = 'datasetLength',\n Percentage = 'percentage',\n Minutes = 'minutes',\n DateTime = 'dateTime',\n Fahrenheit = 'fahrenheit',\n\n /**\n * Hours of the day, 0-24, labelled on a 12 hour clock: 0 = 12am, 1 = 1am, 13 = 1pm, 24 = 12am.\n * A value between hours shows its minutes (2.5 = 2:30am).\n */\n OneDayHours = 'oneDayHours'\n}\n\n","import { AxisDomain, AxisScale } from 'd3-axis';\nimport { format } from 'd3-format';\nimport { PcacFormatEnum } from './chart.model';\n\n/** A continuous scale's own `tickFormat`, which picks its precision from the tick step. */\ntype WithTickFormat<Domain> = AxisScale<Domain> & {\n tickFormat?: (count?: number, specifier?: string) => (d: Domain) => string;\n};\n\n/**\n * `Percentage` values are fractions - `0.25` is 25% - on the axis and in the tooltip alike.\n * `~` trims trailing zeros, so 0.07 reads `7%` rather than `7.000000%`.\n */\nexport const formatPercent = format('~%');\n\n/**\n * An hour of the day, 0-24, on a 12-hour clock: 0 and 24 are `12am`, 13 is `1pm`, and a\n * fractional hour gets its minutes (`2.5` is `2:30am`) rather than reading `2.5am`.\n */\nexport function formatHourOfDay(value: number): string {\n let totalMinutes = Math.round(value * 60);\n totalMinutes = ((totalMinutes % 1440) + 1440) % 1440;\n const hour24 = Math.floor(totalMinutes / 60);\n const minutes = totalMinutes % 60;\n const hour = hour24 % 12 === 0 ? 12 : hour24 % 12;\n const period = hour24 < 12 ? 'am' : 'pm';\n return minutes === 0 ? `${hour}${period}` : `${hour}:${String(minutes).padStart(2, '0')}${period}`;\n}\n\n/** Plain numbers with thousands separators - `1,500`, `0.05` - for the `Decimal` format. */\nconst formatDecimal = format(',~f');\n\n/**\n * A single value (not a tick) in `pcacFormat`, the way an axis in that format labels it - so a\n * tooltip reads like the axis it's measured against. Returns null for the formats that have no\n * formatting of their own, and for a value the format can't read as a number, which callers show\n * as it is.\n */\nexport function formatValue(pcacFormat: PcacFormatEnum | undefined, value: unknown): string | null {\n const numeric = typeof value === 'number' || (typeof value === 'string' && value.trim() !== '')\n ? Number(value)\n : NaN;\n switch (pcacFormat) {\n case PcacFormatEnum.Percentage:\n return Number.isFinite(numeric) ? formatPercent(numeric) : null;\n case PcacFormatEnum.Decimal:\n return Number.isFinite(numeric) ? formatDecimal(numeric) : null;\n case PcacFormatEnum.OneDayHours:\n return Number.isFinite(numeric) ? formatHourOfDay(numeric) : null;\n case PcacFormatEnum.Minutes:\n return Number.isFinite(numeric) ? value + 'm' : null;\n case PcacFormatEnum.Fahrenheit:\n return Number.isFinite(numeric) ? value + ' F' : null;\n default:\n return null;\n }\n}\n\n/**\n * The tick label format for an axis in `format`, shared by both axes (so a format means the same\n * thing on x and y) and by anything that labels a value on that axis, like the line/area hover\n * crosshair. Returns null for the formats that keep D3's default labels.\n *\n * Numeric formats take their precision from the scale's tick step where the scale has one: a\n * fixed precision is fine for a whole domain but breaks down once zoom narrows it to a few units.\n *\n * On a category axis (a band scale - a bar chart's groups) only keys that are numbers are formatted\n * - `'0.25'` reads `25%` - and any other key is shown as it is: a format there, easy to set by\n * mistake on the horizontal chart (where y is the category axis), turned every label into `NaN%`\n * or `Chipsm`.\n */\nexport function axisTickFormat<Domain extends AxisDomain>(\n pcacFormat: PcacFormatEnum | undefined,\n scale: AxisScale<Domain>,\n ticks: number | undefined,\n): ((d: Domain) => string) | null {\n const format = valueTickFormat(pcacFormat, scale, ticks);\n if (!format || !('bandwidth' in scale)) {\n return format;\n }\n return (d: Domain) => isNumericKey(d) ? format(d) : String(d);\n}\n\n/** A category key that reads as a number - `0.25`, `'1500'` - rather than text like `'Chips'`. */\nfunction isNumericKey(key: unknown): boolean {\n return (typeof key === 'number' || (typeof key === 'string' && key.trim() !== '')) && Number.isFinite(Number(key));\n}\n\nfunction valueTickFormat<Domain extends AxisDomain>(\n pcacFormat: PcacFormatEnum | undefined,\n scale: AxisScale<Domain>,\n ticks: number | undefined,\n): ((d: Domain) => string) | null {\n const withTicks = scale as WithTickFormat<Domain>;\n switch (pcacFormat) {\n case PcacFormatEnum.Percentage:\n return withTicks.tickFormat ? withTicks.tickFormat(ticks, '~%') : (d) => formatPercent(Number(d));\n case PcacFormatEnum.Decimal:\n // Plain numbers with thousands separators - `1,500`, `0.05` - rather than SI prefixes, which\n // turned a differential of 0.05 into `50m` (reading as minutes, like the Minutes format).\n return withTicks.tickFormat ? withTicks.tickFormat(ticks, ',~f') : (d) => formatDecimal(Number(d));\n case PcacFormatEnum.Minutes:\n return (d) => d + 'm';\n case PcacFormatEnum.Fahrenheit:\n return (d) => d + ' F';\n case PcacFormatEnum.OneDayHours:\n return (d) => formatHourOfDay(Number(d));\n default:\n return null;\n }\n}\n","import { Injectable } from '@angular/core';\nimport { axisBottom, axisLeft, AxisScale, AxisDomain } from 'd3-axis';\nimport { BaseType, Selection } from 'd3-selection';\nimport { PCAC_AXIS_LABEL_SPACE, PcacChartMargin, PcacResolvedAxisConfig } from './chart.model';\nimport { axisTickFormat } from './tick-format';\n\n/**\n * Generic over each axis's own domain type (e.g. `number` for a value axis's `ScaleLinear`,\n * `string` for a category axis's `ScaleBand`) rather than `any`, since the two axes on a chart\n * routinely have different domain types and each real D3 scale already satisfies `AxisScale`\n * structurally - no widening needed at the type level.\n */\nexport interface IPcacAxisBuilderConfig<XDomain extends AxisDomain = AxisDomain, YDomain extends AxisDomain = AxisDomain> {\n svg: Selection<SVGGElement, unknown, BaseType, unknown>;\n /** Plot area size - the axes' own lengths - and the chart's margins, which position a `label`. */\n width: number;\n height: number;\n margin: PcacChartMargin;\n xScale: AxisScale<XDomain>;\n yScale: AxisScale<YDomain>;\n /**\n * The chart's per-axis settings, defaults already applied (`resolveAxisConfig()`). `hide` skips\n * the axis entirely. `tickSize` is D3's `tickSizeInner`; left undefined, D3's default of 6\n * applies to the geometry - but the theme hides tick marks unless the axis group carries\n * `pcac-axis-tick-marks`, which is added exactly when a size is given, so an undefined size\n * means \"no visible marks, labels where they've always been\". `0` is a legitimate value (no\n * marks, labels hugging the axis), hence the `!== undefined` checks below. `showLine` adds\n * `pcac-axis-line`, which un-hides D3's `.domain` path the same way. The domain path keeps\n * D3's default 6px outer end-caps (`tickSizeOuter`), so it reads as a bracket rather than a\n * bare rule; that's D3's standard look and is left as-is. `label` and `subLabels` are drawn\n * inside the axis group (so they're raised and non-interactive along with it) - see `drawLabels`.\n * `format` picks the tick label format; `None` leaves D3's default. The `*Color` fields are\n * applied by `applyColors`.\n */\n xAxis: PcacResolvedAxisConfig;\n yAxis: PcacResolvedAxisConfig;\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class PcacAxisBuilder {\n drawAxis<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacAxisBuilderConfig<XDomain, YDomain>): void {\n this.drawXAxis(config);\n this.drawYAxis(config);\n }\n\n /**\n * Moves both axis groups to the end of the chart's `<g>`, so they paint over everything drawn\n * since `drawAxis()`. Axes are drawn first (so scales and margins are settled before content),\n * which leaves anything sitting at x = 0 - a line chart's first segment and dot, an area's fill,\n * a horizontal bar chart's bars - painting over the y axis line. Builders call this after the\n * content that should sit *under* the axes, and draw anything that should stay on top (the\n * line/area/plot charts' dots) afterwards. Safe to sit above the hover/zoom overlay rects too,\n * because the groups are `pointer-events: none` (set where each group is appended).\n */\n raiseAxes(svg: Selection<SVGGElement, unknown, BaseType, unknown>): void {\n svg.selectAll('.pcac-x-axis, .pcac-y-axis').raise();\n }\n\n drawYAxis<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacAxisBuilderConfig<XDomain, YDomain>) {\n if (config.yAxis.hide) return;\n config.svg.selectAll('.pcac-y-axis').remove();\n\n const yAxis = axisLeft(config.yScale).ticks(config.yAxis.ticks);\n if (config.yAxis.tickSize !== undefined) {\n yAxis.tickSizeInner(config.yAxis.tickSize);\n }\n\n const yFormat = axisTickFormat(config.yAxis.format, config.yScale, config.yAxis.ticks);\n if (yFormat) {\n yAxis.tickFormat(yFormat);\n }\n\n\n const group = config.svg.append('g')\n .attr('class', 'pcac-y-axis')\n // Axes are raised above the interactive overlays (see raiseAxes) and take no mouse events\n .attr('pointer-events', 'none')\n // Nor are they read out: the marks' own names carry each key and value (see marks.ts), and\n // every tick label as well would only bury them.\n .attr('aria-hidden', 'true')\n .classed('pcac-axis-tick-marks', config.yAxis.tickSize !== undefined)\n .classed('pcac-axis-line', config.yAxis.showLine)\n .call(yAxis)\n .call(applyColors, config.yAxis);\n\n this.drawLabels(group, config.yAxis, { length: config.height, outer: config.margin.left, vertical: true });\n }\n\n drawXAxis<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacAxisBuilderConfig<XDomain, YDomain>) {\n if (config.xAxis.hide) return;\n config.svg.selectAll('.pcac-x-axis').remove();\n\n const xAxis = axisBottom(config.xScale).ticks(config.xAxis.ticks);\n if (config.xAxis.tickSize !== undefined) {\n xAxis.tickSizeInner(config.xAxis.tickSize);\n }\n\n const xFormat = axisTickFormat(config.xAxis.format, config.xScale, config.xAxis.ticks);\n if (xFormat) {\n xAxis.tickFormat(xFormat);\n }\n\n\n const group = config.svg.append('g')\n .attr('class', 'pcac-x-axis')\n .attr('pointer-events', 'none')\n .attr('aria-hidden', 'true')\n .classed('pcac-axis-tick-marks', config.xAxis.tickSize !== undefined)\n .classed('pcac-axis-line', config.xAxis.showLine)\n .attr('transform', 'translate(0,' + config.height + ')')\n .call(xAxis)\n .call(applyColors, config.xAxis);\n\n this.drawLabels(group, config.xAxis, { length: config.width, outer: config.margin.bottom, vertical: false });\n }\n\n /**\n * The axis `label` and `subLabels`. Both are placed by two distances: along the axis (0 at its\n * start, `length` at its end - for the y axis, 0 is the bottom) and out from it, toward the\n * chart's edge. The label goes at the very edge (`outer`, i.e. the margin), the sub-label row\n * `PCAC_AXIS_LABEL_SPACE` inside that when there's a label. For the y axis the text is rotated\n * to read bottom-to-top, which swaps the two: after `rotate(-90)` x runs up the axis (so the\n * bottom is x = -length) and y runs left. `fill` is set explicitly because d3-axis puts\n * `fill=\"none\"` on the group; its own tick text does the same.\n */\n private drawLabels(\n group: Selection<SVGGElement, unknown, BaseType, unknown>,\n axis: PcacResolvedAxisConfig,\n layout: { length: number; outer: number; vertical: boolean }\n ): void {\n const text = (cls: string, along: number, out: number, anchor: string, content: string) => {\n group.append('text')\n .attr('class', cls)\n .attr('fill', 'currentColor')\n .attr('text-anchor', anchor)\n .attr('transform', layout.vertical ? 'rotate(-90)' : null)\n .attr('x', layout.vertical ? along - layout.length : along)\n .attr('y', layout.vertical ? -out : out)\n .attr('dy', layout.vertical ? '1em' : '-0.35em')\n .text(content);\n };\n\n if (axis.label) {\n text('pcac-axis-label', layout.length / 2, layout.outer, 'middle', axis.label);\n }\n const sub = axis.subLabels;\n if (sub) {\n const edge = layout.outer - (axis.label ? PCAC_AXIS_LABEL_SPACE : 0);\n if (sub.min) text('pcac-axis-sub-label', 0, edge, 'start', sub.min);\n if (sub.mid) text('pcac-axis-sub-label', layout.length / 2, edge, 'middle', sub.mid);\n if (sub.max) text('pcac-axis-sub-label', layout.length, edge, 'end', sub.max);\n }\n }\n}\n\n/**\n * Sets the axis's `*Color` fields on its group as CSS custom properties, which the theme reads\n * with its own color as the fallback (`var(--pcac-axis-tick-color, ...)`). Custom properties\n * rather than inline `stroke`/`fill` on the elements: the theme still decides what is drawn (a\n * color never un-hides marks or the line), the property reaches everything d3-axis draws in the\n * group, and a stylesheet can set the same property on any ancestor. An unset field sets nothing.\n */\nfunction applyColors(group: Selection<SVGGElement, unknown, BaseType, unknown>, axis: PcacResolvedAxisConfig): void {\n group\n .style('--pcac-axis-tick-color', () => axis.tickColor ?? null)\n .style('--pcac-axis-tick-label-color', () => axis.tickLabelColor ?? null)\n .style('--pcac-axis-line-color', () => axis.lineColor ?? null)\n .style('--pcac-axis-label-color', () => axis.labelColor ?? null)\n .style('--pcac-axis-sub-label-color', () => axis.subLabelColor ?? null);\n}\n","import { Injectable } from '@angular/core';\nimport { BaseType, Selection } from 'd3-selection';\nimport { AxisScale, AxisDomain } from 'd3-axis';\n\n/**\n * Generic over each axis's own domain type, same rationale as `IPcacAxisBuilderConfig`.\n */\nexport interface IPcacGridBuilderConfig<XDomain extends AxisDomain = AxisDomain, YDomain extends AxisDomain = AxisDomain> {\n svg: Selection<SVGGElement, unknown, BaseType, unknown>;\n /**\n * Required for horizontal grid\n */\n width: number;\n /**\n * Required for vertical grid\n */\n height: number;\n xScale: AxisScale<XDomain>;\n yScale: AxisScale<YDomain>;\n /**\n * Tick count hint for a continuous scale (D3's `ticks(n)`); a category (band) scale ignores it\n * and gets one line per category.\n */\n numberOfTicks: number;\n /**\n * Line color (`PcacAxisConfig.gridColor`), set on the grid group as `--pcac-grid-color` for the\n * theme's `.pcac-grid-rule line` rule to read; unset means the theme's color. See the axis\n * builder's `applyColors` for why a custom property.\n */\n color?: string;\n}\n\n/**\n * `AxisScale` (the shape shared by every D3 scale usable here) doesn't declare `.ticks()` -\n * band scales don't have one - nor `.bandwidth()`, which only band scales have. Either kind can\n * drive a grid: a continuous scale puts a line at each tick, a band scale one through the middle\n * of each category, so `gridLines()` sniffs for `.ticks` and handles both.\n */\ntype TickableAxisScale<Domain extends AxisDomain> = AxisScale<Domain> & { ticks(count?: number): Domain[] };\ntype BandAxisScale<Domain extends AxisDomain> = AxisScale<Domain> & { bandwidth(): number };\n\n/** Where along its axis each grid line sits, in pixels. */\nfunction gridLines<Domain extends AxisDomain>(scale: AxisScale<Domain>, numberOfTicks: number): number[] {\n if (typeof (scale as TickableAxisScale<Domain>).ticks === 'function') {\n return (scale as TickableAxisScale<Domain>).ticks(numberOfTicks).map(d => scale(d) ?? 0);\n }\n const band = scale as BandAxisScale<Domain>;\n const half = typeof band.bandwidth === 'function' ? band.bandwidth() / 2 : 0;\n return scale.domain().map(d => (scale(d) ?? 0) + half);\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class PcacGridBuilder {\n /**\n * Vertical lines, one per x-axis tick (or category), running the plot's full height. The group\n * is classed `pcac-grid-vertical` (the horizontal one `pcac-grid-horizontal`) so a chart can\n * find and redraw just one grid - the line/area/plot charts do on zoom, when an axis's ticks move.\n */\n drawVerticalGrid<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacGridBuilderConfig<XDomain, YDomain>): void {\n config.svg.append('g')\n .attr('class', 'pcac-grid pcac-grid-vertical')\n .attr('aria-hidden', 'true')\n .style('--pcac-grid-color', () => config.color ?? null)\n .selectAll('g.rule')\n .data(gridLines(config.xScale, config.numberOfTicks))\n .enter().append('svg:g')\n .attr('class', 'pcac-grid-rule')\n .attr('transform', (x): string => (`translate(${x}, 0)`))\n .append('svg:line')\n .attr('y1', 0)\n .attr('y2', config.height);\n }\n\n /**\n * Horizontal lines, one per y-axis tick (or category), running the plot's full width.\n */\n drawHorizontalGrid<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacGridBuilderConfig<XDomain, YDomain>): void {\n config.svg.append('g')\n .attr('class', 'pcac-grid pcac-grid-horizontal')\n .attr('aria-hidden', 'true')\n .style('--pcac-grid-color', () => config.color ?? null)\n .selectAll('g.pcac-grid-rule')\n .data(gridLines(config.yScale, config.numberOfTicks))\n .enter().append('svg:g')\n .attr('class', 'pcac-grid-rule')\n .append('svg:line')\n .attr('y1', (y) => y)\n .attr('y2', (y) => y)\n .attr('x1', 0)\n .attr('x2', config.width);\n }\n}\n","import { Injectable, signal, untracked } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class PcacColorService {\n private primaryLight = '#a3a1fb';\n private success = '#5ee2a0';\n private danger = '#ff6565';\n private warning = '#fec163';\n private orange = '#ffa177';\n private blue = '#55d8fe';\n private alert = 'red';\n\n /**\n * Bumped by every setter, and read by the getters, so anything reading colors inside a reactive\n * context tracks palette changes: the legend's `colorScale` computed recomputes, and every chart\n * (whose build runs in an `effect`) redraws - together, rather than the legend keeping the old\n * swatches while newly built charts took the new palette.\n */\n private readonly version = signal(0);\n\n /**\n * Bumps `version` from a setter. `untracked`, because Angular forbids writing a signal inside a\n * `computed` - and a consumer deriving its theme reactively (`computed(() => { setScale(...);\n * ... })`) called these setters there without error before they were reactive.\n */\n private changed(): void {\n untracked(() => this.version.update((v) => v + 1));\n }\n\n /** A consumer's own scale from `setScale()`; replaces the default palette while set. */\n private customScale: string[] | null = null;\n\n /**\n * The palette charts cycle through: the `setScale()` one when given, else the default colors\n * built from the current fields - so a setter like `setSuccess()` changes the charts drawn after\n * it, rather than a copy of the colors taken when the service was created.\n */\n private get scale(): string[] {\n return this.customScale ?? [\n this.primaryLight,\n this.success,\n this.danger,\n this.warning,\n this.orange,\n this.blue,\n ];\n }\n\n /**\n * Get a scale of colors dynamically\n * @param numberOfNodes Number of items in dynamically build collection of colors\n */\n getColorScale(numberOfNodes: number): string[] {\n this.version();\n const palette = [] as string[];\n for (let i = 0; i < numberOfNodes; i++) {\n const mark = i % this.scale.length;\n palette.push(this.scale[mark]);\n }\n return palette;\n }\n\n getAlert(): string {\n this.version();\n return this.alert;\n }\n\n /**\n * Set the scale that charts use to set colors of data[x] on the UI, in place of the default\n * palette (and of the individual color setters below, which only shape the default). An empty\n * array goes back to the default palette rather than leaving charts with no colors.\n * @param colors A collection of hex values\n */\n setScale(colors: string[]): void {\n this.customScale = colors.length ? [...colors] : null;\n this.changed();\n }\n\n setPrimaryLight(color: string): void {\n this.primaryLight = color;\n this.changed();\n }\n\n setSuccess(color: string): void {\n this.success = color;\n this.changed();\n }\n\n setDanger(color: string): void {\n this.danger = color;\n this.changed();\n }\n\n setWarning(color: string): void {\n this.warning = color;\n this.changed();\n }\n\n setOrange(color: string): void {\n this.orange = color;\n this.changed();\n }\n\n setBlue(color: string): void {\n this.blue = color;\n this.changed();\n }\n\n setAlert(color: string): void {\n this.alert = color;\n this.changed();\n }\n}\n","import { DOCUMENT, Injectable, inject } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class PcacTransitionService {\n private transitionDuration = 750;\n private document = inject(DOCUMENT);\n\n /**\n * How long the charts animate - bars growing, lines drawing in, hover fades - or 0 when the user\n * has asked their system to reduce motion, so every chart is drawn in its final state at once.\n * Read on every call rather than once, so changing the setting applies from the next draw on.\n */\n getTransitionDuration(): number {\n return this.prefersReducedMotion() ? 0 : this.transitionDuration;\n }\n\n /** `false` where there's no `matchMedia` to ask - server-side rendering, a test environment. */\n private prefersReducedMotion(): boolean {\n return this.document.defaultView?.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false;\n }\n}\n","import { Selection } from 'd3-selection';\n\n/** Marks the elements `makeMarksAccessible` set up, so navigation can find a chart's marks. */\nconst MARK_ATTR = 'data-pcac-mark';\n\n/**\n * How a chart's marks - its bars, slices or points - take part in keyboard and screen reader use.\n * See `makeMarksAccessible`.\n */\nexport interface PcacMarkAccess<E extends Element, D> {\n /** The mark's accessible name, e.g. `\"Chips, 2024: 680\"`. */\n label: (d: D, element: E) => string;\n /** Leaves a mark out of navigation and the accessibility tree: a hidden bar, series or slice. */\n skip?: (d: D) => boolean;\n /** Enter or Space on a mark: what a click does. */\n activate: (d: D) => void;\n /** Keyboard focus arrived on a mark: what hovering it does - highlight it and show its tooltip. */\n focus: (element: E, d: D) => void;\n /** Keyboard focus left a mark, or Escape was pressed on it: what the pointer leaving does. */\n blur: (element: E, d: D) => void;\n}\n\n/**\n * Makes a chart's marks usable from the keyboard and readable by a screen reader, alongside the\n * pointer handlers they already have.\n *\n * Every mark gets a role and a name, but only one of them - the chart's \"tab stop\" - is in the Tab\n * order (see `refreshTabStop`): Tab reaches the chart once, and the arrow keys move between its\n * marks, Home and End to the first and last. A chart of a thousand bars isn't a thousand Tab\n * presses to get past. Focus does what hovering does (`focus`), and Enter or Space what a click\n * does (`activate`); Escape hides the tooltip, as moving the pointer away would - and goes no\n * further while it has one to hide, so it doesn't also close a dialog the chart is in. Keys pressed\n * with Alt, Ctrl or Cmd are left to the browser (Alt+Left is Back).\n *\n * A mark takes focus from the keyboard only: pressing the pointer on one is kept from focusing it,\n * so a click doesn't leave a keyboard-style tooltip and focus ring behind on the clicked mark. It\n * does let go of a mark in the same chart that has focus, which would otherwise stay highlighted,\n * its tooltip gone, while the pointer is at work elsewhere in the chart.\n */\nexport function makeMarksAccessible<E extends Element, D>(\n marks: Selection<E, D, any, any>,\n access: PcacMarkAccess<E, D>,\n): void {\n const skipped = (d: D) => access.skip?.(d) ?? false;\n // The marks showing what focus shows (their tooltip, highlighted), until blur or Escape.\n const open = new WeakSet<Element>();\n marks\n .attr(MARK_ATTR, (d: D) => (skipped(d) ? null : ''))\n .attr('aria-hidden', (d: D) => (skipped(d) ? 'true' : null))\n // An image, with a name, rather than a button: whether the chart's click output has a listener\n // can't be told from here (the pie, donut, line, area and plot charts' own wrappers always\n // listen, to pass it on), and a button that does nothing would be a lie. Enter and Space still\n // do what a click does, and the click listener has browsers report the mark as clickable.\n .attr('role', (d: D) => (skipped(d) ? null : 'img'))\n .attr('aria-label', function (this: E, d: D) {\n return skipped(d) ? null : access.label(d, this);\n })\n .attr('tabindex', (d: D) => (skipped(d) ? null : -1))\n // The events are typed plainly as `Event`: with the element type generic here, d3's typings\n // (@types/d3-selection 3.0.12 on) can't narrow them to `MouseEvent`/`KeyboardEvent`.\n .on('mousedown.pcac-mark', function (this: E, event: Event) {\n event.preventDefault();\n const focused = this.ownerDocument.activeElement;\n if (focused !== this && focused?.hasAttribute(MARK_ATTR) && sameChart(focused, this)) {\n (focused as SVGElement).blur();\n }\n })\n .on('focus.pcac-mark', function (this: E, _event: Event, d: D) {\n open.add(this);\n access.focus(this, d);\n })\n .on('blur.pcac-mark', function (this: E, _event: Event, d: D) {\n open.delete(this);\n access.blur(this, d);\n })\n .on('keydown.pcac-mark', function (this: E, event: Event, d: D) {\n const { key, altKey, ctrlKey, metaKey } = event as KeyboardEvent;\n if (altKey || ctrlKey || metaKey) {\n return;\n }\n switch (key) {\n case 'Enter':\n case ' ':\n event.preventDefault();\n access.activate(d);\n return;\n case 'Escape':\n // Only while there's a tooltip to hide; a second Escape carries on to whatever the\n // chart is in (a dialog closes, as it would have).\n if (open.delete(this)) {\n event.preventDefault();\n event.stopPropagation();\n access.blur(this, d);\n }\n return;\n }\n const target = neighbor(this, key);\n if (target) {\n event.preventDefault();\n moveFocus(this, target);\n }\n });\n}\n\n/** Where a chart's Tab stop was, and whether it had focus: what a redraw puts back. */\nexport interface PcacMarkFocus {\n /** The Tab stop's place among the marks that could take focus. */\n index: number;\n focused: boolean;\n}\n\n/**\n * Notes the chart's Tab stop - and whether it has focus - before a redraw removes every mark, so\n * `refreshTabStop` can put both back: a keyboard user who pressed Enter on a bar, with a click\n * handler that updates the data, stays on that bar rather than being dropped at the top of the\n * page. `null` when the chart has no Tab stop.\n */\nexport function captureMarkFocus(root: Element | null): PcacMarkFocus | null {\n if (!root) {\n return null;\n }\n const marks = navigableMarks(root);\n const index = marks.findIndex((mark) => mark.getAttribute('tabindex') === '0');\n if (index < 0) {\n return null;\n }\n return { index, focused: root.ownerDocument.activeElement === marks[index] };\n}\n\n/**\n * Puts the chart's one Tab stop (`tabindex=\"0\"`) on a mark that can take focus; every other mark\n * is `-1` already (`makeMarksAccessible`). Call once a chart's marks are drawn, and again whenever\n * marks can have been hidden - by zoom, say - so Tab doesn't land on one that can't be focused and\n * skip the chart.\n *\n * Leaves the Tab stop where it is while that mark can still take focus, so coming back to the chart\n * returns to the mark last visited. After a redraw, given what `captureMarkFocus` noted, it goes\n * back to the same place - the last mark, if there are fewer now - and takes focus back if it had\n * it. Touches only the old and new stops, as it runs on every zoom frame.\n */\nexport function refreshTabStop(root: Element | null, previous: PcacMarkFocus | null = null): void {\n if (!root) {\n return;\n }\n const current = root.querySelector(`[${MARK_ATTR}][tabindex=\"0\"]`);\n if (current && !previous && !isNotDisplayed(current, root)) {\n return;\n }\n const marks = navigableMarks(root);\n const stop = previous ? marks[Math.min(previous.index, marks.length - 1)] : marks[0];\n if (current && current !== stop) {\n current.setAttribute('tabindex', '-1');\n }\n if (!stop) {\n return;\n }\n stop.setAttribute('tabindex', '0');\n if (previous?.focused) {\n (stop as SVGElement).focus({ preventScroll: true });\n }\n}\n\n/** Whether two marks are in the same chart (the same `<svg>`). */\nfunction sameChart(a: Element, b: Element): boolean {\n return ((a as SVGElement).ownerSVGElement ?? a.parentElement) === ((b as SVGElement).ownerSVGElement ?? b.parentElement);\n}\n\n/** The chart's marks that can take focus now, in drawing order. */\nfunction navigableMarks(root: Element): Element[] {\n return Array.from(root.querySelectorAll(`[${MARK_ATTR}]`)).filter((mark) => !isNotDisplayed(mark, root));\n}\n\n/**\n * Whether the mark, or a group it's in, isn't displayed: a hidden series, or a point zoomed out of\n * the plot. Read from the `display` attribute and inline style the builders set, rather than from\n * layout, which a browser without one (a test environment) doesn't have.\n */\nfunction isNotDisplayed(mark: Element, root: Element): boolean {\n for (let node: Element | null = mark; node && node !== root; node = node.parentElement) {\n if (node.getAttribute('display') === 'none' || (node as SVGElement).style?.display === 'none') {\n return true;\n }\n }\n return false;\n}\n\n/** The mark an arrow, Home or End key moves to from `mark`, or `null` for any other key. */\nfunction neighbor(mark: Element, key: string): Element | null {\n const root = (mark as SVGElement).ownerSVGElement ?? mark.parentElement;\n if (!root) {\n return null;\n }\n const marks = navigableMarks(root);\n const at = marks.indexOf(mark);\n switch (key) {\n case 'ArrowRight':\n case 'ArrowDown':\n return marks[Math.min(at + 1, marks.length - 1)] ?? null;\n case 'ArrowLeft':\n case 'ArrowUp':\n return marks[Math.max(at - 1, 0)] ?? null;\n case 'Home':\n return marks[0] ?? null;\n case 'End':\n return marks[marks.length - 1] ?? null;\n default:\n return null;\n }\n}\n\n/** Moves focus, and the chart's Tab stop with it, from one mark to another. */\nfunction moveFocus(from: Element, to: Element): void {\n if (from === to) {\n return;\n }\n from.setAttribute('tabindex', '-1');\n to.setAttribute('tabindex', '0');\n (to as SVGElement).focus();\n}\n\n","import { ApplicationRef, DOCUMENT, EmbeddedViewRef, Injectable, OnDestroy, TemplateRef, inject } from '@angular/core';\nimport { PcacData, PcacFormatEnum } from './chart.model';\nimport { PcacTooltipContext } from './tooltip.directive';\nimport { Selection, select } from 'd3-selection';\nimport { formatValue } from './tick-format';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class PcacTooltipBuilder implements OnDestroy {\n private appRef = inject(ApplicationRef);\n private document = inject(DOCUMENT);\n\n private shell: Selection<HTMLDivElement, unknown, null, undefined> | null = null;\n\n /**\n * One tooltip element shared by every chart on the page, appended to `<body>` so it can float\n * over anything. It's only ever a positioning shell: the default look (`.pcac-d3-tooltip-default`)\n * is toggled on when the library renders its own key/value content and off when a consumer's\n * `<ng-template pcacTooltip>` is rendered into it instead, so a custom template owns the whole box.\n *\n * Created on first use rather than with the service, which every chart builder injects: that\n * way nothing touches the DOM until a chart actually shows a tooltip, so building a chart\n * where there's no browser `document` (server-side rendering) doesn't throw. Removed again in\n * `ngOnDestroy()`, when the app that owns this root service is destroyed. The touch listener\n * (see `onPointerDown`) is added and removed with it.\n */\n get tooltip(): Selection<HTMLDivElement, unknown, null, undefined> {\n if (!this.shell) {\n this.shell = select(this.document.body)\n .append('div')\n .attr('class', 'pcac-d3-tooltip')\n .attr('id', PcacTooltipBuilder.ID)\n .attr('role', 'tooltip');\n this.document.addEventListener('pointerdown', this.onPointerDown, { capture: true, passive: true });\n }\n return this.shell;\n }\n\n /**\n * A touch (or pen) coming down anywhere closes the tooltip. A tap shows it by way of the mouse\n * events the browser makes up for the tap, but nothing then moves off the mark to hide it again:\n * without this it stayed up after a tap until the next one happened to land on another mark,\n * scrolled away with the page, and covered whatever opened in response. A tap on another mark\n * still shows its tooltip - this runs first, on the way down, and the made-up mouse events that\n * show the new one come after. A mouse is left alone; it hides the tooltip by leaving the mark.\n */\n private readonly onPointerDown = (event: PointerEvent): void => {\n if (event.pointerType !== 'mouse') {\n this.hideTooltip();\n }\n };\n\n /**\n * The consumer template currently rendered into the shell, if any. Created on the first show\n * of a hover and torn down in `hideTooltip()` - not kept around between hovers - so a view is\n * never left holding onto a declaring component that has since been destroyed (e.g. after a\n * route change). While it lives, repeated `mousemove`s just update its context in place.\n */\n private view: EmbeddedViewRef<PcacTooltipContext> | null = null;\n private viewTemplate: TemplateRef<PcacTooltipContext> | null = null;\n\n /**\n * Whatever showed the tooltip last (a chart passes itself), so `hideTooltip(owner)` from any\n * other chart leaves it alone. The element is shared by every chart on the page: without this, a\n * chart rebuilding or being destroyed would close the tooltip another chart is showing.\n */\n private owner: object | null = null;\n\n /**\n * The tooltip element's id, for a focused mark's `aria-describedby` (see `PcacChart.showMarkTooltip`).\n * One per page, like the element.\n */\n static readonly ID = 'pcac-tooltip';\n\n /** Space left between the tooltip and whatever it's placed next to (the cursor or an anchor). */\n static readonly GAP = 8;\n\n /**\n * Shows the tooltip for a hovered datum. Renders `template` when the chart has one projected;\n * otherwise falls back to the default key/value content, formatted per `valueFormat`/`keyFormat`.\n * Placed beside `anchor` when one is given (see `positionBeside`), else above the event's position.\n * `event` can be `null` only with an `anchor`: a tooltip shown for keyboard focus has no pointer.\n * `owner` is what's showing it (see `hideTooltip`).\n */\n showTooltip(\n event: MouseEvent | null,\n template: TemplateRef<PcacTooltipContext> | undefined,\n context: PcacTooltipContext,\n valueFormat?: PcacFormatEnum,\n keyFormat?: PcacFormatEnum,\n anchor?: Element | null,\n owner?: object\n ): void {\n this.owner = owner ?? null;\n if (template) {\n this.renderTemplate(template, context);\n } else {\n this.renderDefault(context.$implicit, valueFormat, keyFormat);\n }\n const shell = this.measurable();\n if (anchor) {\n this.positionBeside(shell, anchor);\n } else if (event) {\n this.positionAbove(shell, event);\n }\n }\n\n /**\n * Hides the tooltip. Given an `owner`, only if that owner is the one showing it - so a chart can\n * release the tooltip on rebuild or destroy without closing one another chart has open. Without\n * an owner it always hides.\n */\n hideTooltip(owner?: object): void {\n if (owner !== undefined && owner !== this.owner) {\n return;\n }\n this.owner = null;\n if (!this.shell) {\n // Never shown, so there's nothing to hide - and no reason to create the element just to.\n return;\n }\n this.shell.style('display', 'none');\n this.destroyView();\n }\n\n ngOnDestroy(): void {\n this.destroyView();\n if (this.shell) {\n this.document.removeEventListener('pointerdown', this.onPointerDown, { capture: true });\n }\n this.shell?.remove();\n this.shell = null;\n }\n\n /**\n * The library's own key/value content. Built from text nodes, never parsed as HTML: `key` and\n * `value` are consumer data, and markup in them must show as text rather than run.\n */\n private renderDefault(data: PcacData, valueFormat?: PcacFormatEnum, keyFormat?: PcacFormatEnum): void {\n this.destroyView();\n const { key, value } = tooltipText(data, valueFormat, keyFormat);\n const shell = this.tooltip\n .classed('pcac-d3-tooltip-default', true)\n .html(null)\n .node() as HTMLDivElement;\n if (key !== null) {\n shell.append(key, this.document.createElement('br'));\n }\n shell.append(value);\n }\n\n private renderTemplate(template: TemplateRef<PcacTooltipContext>, context: PcacTooltipContext): void {\n if (this.view && this.viewTemplate === template) {\n // Same hover, new mouse position/datum: keep the view and just refresh what it's bound to.\n Object.assign(this.view.context, context);\n } else {\n this.destroyView();\n this.tooltip.classed('pcac-d3-tooltip-default', false).html(null);\n\n // Same technique as the CDK's DomPortalOutlet: create the view off-tree, attach it to the\n // app so it takes part in change detection (a template reading a signal keeps updating\n // while shown), then physically move its nodes into the shell. The view's own injector is\n // the declaring component's, so pipes/DI in the template resolve as they would in place.\n this.view = template.createEmbeddedView(context);\n this.viewTemplate = template;\n this.appRef.attachView(this.view);\n const shell = this.tooltip.node() as HTMLDivElement;\n for (const node of this.view.rootNodes) {\n shell.appendChild(node);\n }\n }\n // The trigger is a D3-native mouse listener, which nothing in Angular observes under zoneless\n // change detection, so the view has to be checked explicitly for the new context to render\n // before it's measured for positioning.\n this.view.detectChanges();\n }\n\n private destroyView(): void {\n if (!this.view) {\n return;\n }\n // `destroy()` also detaches the view from the ApplicationRef it was attached to, but it\n // doesn't pull the nodes we moved into the shell back out of the DOM - that's what a\n // ViewContainerRef would normally do on removal - so the shell is emptied here explicitly.\n this.view.destroy();\n this.view = null;\n this.viewTemplate = null;\n this.shell?.html(null);\n }\n\n /**\n * Shows the (already rendered) shell at the page's top-left so it can be measured. Left where the\n * last hover put it, a shell near the right edge would be squeezed by its containing block and\n * measure narrower (wrapped) than the content really is once it's moved somewhere with room.\n */\n private measurable(): HTMLDivElement {\n return this.tooltip\n .style('left', '0px')\n .style('top', '0px')\n .style('display', 'inline-block')\n .node() as HTMLDivElement;\n }\n\n /**\n * Centers the tooltip horizontally on the cursor and sits it just above. Measured from the real\n * box rather than fixed offsets so it works for content of any size. Kept on screen like\n * `positionBeside`: slid in from whichever side edge it would cross (the left one winning if it's\n * wider than the viewport), and dropped below the cursor when there's no room above - hovering\n * a bar at the page's edge used to cut the tooltip off.\n */\n private positionAbove(shell: HTMLDivElement, event: MouseEvent): void {\n const gap = PcacTooltipBuilder.GAP;\n const width = shell.offsetWidth;\n const height = shell.offsetHeight;\n const viewport = this.document.documentElement;\n const scrollX = this.document.defaultView?.scrollX ?? 0;\n const scrollY = this.document.defaultView?.scrollY ?? 0;\n\n const centered = event.pageX - width / 2;\n const left = Math.max(scrollX, Math.min(centered, scrollX + viewport.clientWidth - width));\n const above = event.pageY - height - gap;\n const top = above >= scrollY ? above : event.pageY + gap;\n\n this.tooltip\n .style('left', left + 'px')\n .style('top', top + 'px');\n }\n\n /**\n * Places the tooltip diagonally off one corner of `anchor`'s rendered box, so it never covers\n * the anchor itself (e.g. a point's image). Prefers above-right - the tooltip's bottom-left\n * corner at the anchor's top-right - and flips each axis independently when the tooltip wouldn't\n * fit in the viewport that way: to the left when there's no room on the right, below when there's\n * no room above. When neither side of an axis fits, it takes whichever side has more room.\n */\n private positionBeside(shell: HTMLDivElement, anchor: Element): void {\n const gap = PcacTooltipBuilder.GAP;\n const box = anchor.getBoundingClientRect();\n const width = shell.offsetWidth;\n const height = shell.offsetHeight;\n // `clientWidth`/`clientHeight` of the root, unlike `innerWidth`/`innerHeight`, exclude scrollbars.\n const viewport = this.document.documentElement;\n const view = this.document.defaultView;\n\n const right = viewport.clientWidth - box.right - gap;\n const left = box.left - gap;\n const above = box.top - gap;\n const below = viewport.clientHeight - box.bottom - gap;\n\n const toRight = width <= right || (width > left && right >= left);\n const toTop = height <= above || (height > below && above >= below);\n\n const x = toRight ? box.right + gap : box.left - gap - width;\n const y = toTop ? box.top - gap - height : box.bottom + gap;\n\n // The rect is in viewport coordinates; the shell is absolutely positioned against the page.\n this.tooltip\n .style('left', x + (view?.scrollX ?? 0) + 'px')\n .style('top', y + (view?.scrollY ?? 0) + 'px');\n }\n}\n\n/**\n * The default tooltip's two lines as plain text; `key` is null when the datum has none. Also what a\n * mark's accessible name is made of (see `PcacChart.markLabel`), so the two read the same.\n */\nexport function tooltipText(\n data: PcacData,\n valueFormat?: PcacFormatEnum,\n keyFormat?: PcacFormatEnum,\n): { key: string | null; value: string } {\n let value = data.value;\n let key = data.key\n\n // Formatted the way the value's axis labels it (see `formatValue`), so the tooltip for a\n // point reads like the axis it sits against - `1:30pm`, not `13.5`, on a OneDayHours axis.\n // A missing value stays blank rather than being formatted as `0%` / `null F`.\n if (value !== null && value !== undefined) {\n value = formatValue(valueFormat, value) ?? value;\n }\n\n if (key !== null && key !== undefined && key !== '') {\n // A key that doesn't parse as a date is shown as it is, rather than as \"Invalid Date\".\n if (keyFormat === PcacFormatEnum.DateTime && !Number.isNaN(new Date(key).getTime())) {\n key = new Date(key).toLocaleDateString('en-US', {\n day: '2-digit',\n month: '2-digit',\n year: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit'\n })\n } else if (keyFormat === PcacFormatEnum.Decimal) {\n // Only where the key *is* the x value. Every other x format positions points by index,\n // so its axis labels the index, not the key - formatting the key would only make it\n // disagree with the axis (and tag text keys with a unit: `Mon` read `Monm` on Minutes).\n key = formatValue(keyFormat, key) ?? key;\n }\n }\n\n // A key of 0 (e.g. hour 0) is a real key; only a missing or empty one leaves the line out.\n return {\n key: key === null || key === undefined || key === '' ? null : String(key),\n value: value === null || value === undefined ? '' : String(value),\n };\n}\n","import { axisLeft, AxisDomain, AxisScale } from 'd3-axis';\nimport { BaseType, Selection } from 'd3-selection';\nimport { IPcacAxisBuilderConfig, PcacAxisBuilder } from './axis.builder';\nimport { PcacGridBuilder } from './grid.builder';\nimport { PcacColorService } from './color.service';\nimport { select } from 'd3-selection';\nimport { ElementRef, Injectable, OnDestroy, TemplateRef, inject } from '@angular/core';\nimport { PCAC_AXIS_LABEL_SPACE, PCAC_AXIS_SUB_LABEL_SPACE, PcacAxisChartConfig, PcacChartConfig, PcacChartMargin, PcacData, PcacFormatEnum, PcacResolvedAxisConfig, axisLabelSpace, resolveAxisConfig } from './chart.model';\nimport { PcacTransitionService } from './transition.service';\nimport { axisTickFormat } from './tick-format';\nimport { PcacMarkFocus, captureMarkFocus, refreshTabStop } from './marks';\nimport { PcacTooltipBuilder, tooltipText } from './tooltip.builder';\nimport { PcacTooltipCoincident, PcacTooltipContext } from './tooltip.directive';\n\n/** The most of its container's width a chart's measured left (label) margin may take. */\nconst MAX_LABEL_MARGIN_SHARE = 0.5;\n\n/** D3's gap between a tick and its label (`axis.tickPadding()`), which the builders never change. */\nconst TICK_PADDING = 3;\n\n/** D3's default tick length (`axis.tickSizeInner()`), used while an axis's `tickSize` isn't set. */\nconst DEFAULT_TICK_SIZE = 6;\n\n/**\n * Everything `showTooltip()` needs beyond the hovered datum itself. `parent`/`isThreshold` feed\n * the consumer template's context; the formats only apply to the default (no template) content.\n */\nexport interface PcacTooltipOptions {\n /** See `PcacTooltipContext.index`. Required so no hover site can forget to supply it. */\n index: number;\n parent?: PcacData | null;\n /** See `PcacTooltipContext.parentIndex`. Defaults to `null`, matching `parent`'s default. */\n parentIndex?: number | null;\n isThreshold?: boolean;\n /** See `PcacTooltipContext.coincident`. Defaults to none. */\n coincident?: PcacTooltipCoincident[];\n valueFormat?: PcacFormatEnum;\n keyFormat?: PcacFormatEnum;\n /**\n * The element the tooltip is placed beside instead of above the cursor: off one of its corners,\n * whichever fits in the viewport (see `PcacTooltipBuilder.positionBeside`), so it never covers it.\n */\n anchor?: Element | null;\n}\n\n\n// Decorated only so Angular accepts its `ngOnDestroy` hook, which the builders extending it inherit;\n// never provided itself - each builder is provided by its own chart component.\n@Injectable()\nexport class PcacChart implements OnDestroy {\n axisBuilder = inject(PcacAxisBuilder);\n gridBuilder = inject(PcacGridBuilder);\n transitionService = inject(PcacTransitionService);\n tooltipBuilder = inject(PcacTooltipBuilder);\n colorService = inject(PcacColorService);\n\n /** D3's own `tickSizeInner` default, which the default `margin` below is sized around. */\n static readonly DEFAULT_TICK_SIZE = 6;\n\n /** See `PCAC_AXIS_LABEL_SPACE` / `PCAC_AXIS_SUB_LABEL_SPACE` in chart.model.ts. */\n static readonly AXIS_LABEL_SPACE = PCAC_AXIS_LABEL_SPACE;\n static readonly AXIS_SUB_LABEL_SPACE = PCAC_AXIS_SUB_LABEL_SPACE;\n\n margin: PcacChartMargin = { top: 8, right: 16, bottom: 20, left: 40 };\n private readonly defaultMargin: PcacChartMargin = { ...this.margin };\n\n /**\n * The current build's per-axis settings with defaults applied, set by `initializeAxisState()`.\n * Builders read these (not the raw `config.xAxis`) everywhere: drawing the axes, choosing\n * whether to draw a grid, how many grid lines, and so on. Pie has no axes and never sets them.\n */\n xAxis: PcacResolvedAxisConfig = resolveAxisConfig();\n yAxis: PcacResolvedAxisConfig = resolveAxisConfig();\n svg!: Selection<SVGGElement, unknown, BaseType, unknown>;\n width = 400;\n height = 400;\n colors = [] as string[];\n /**\n * How wide a y-axis tick label may be once `setHorizontalMarginsBasedOnContent` has capped the\n * margin, or `null` while the labels fit as they are. See `truncateYTickLabels`.\n */\n protected yTickLabelMaxWidth: number | null = null;\n startData: PcacData[] = [];\n\n /** The chart's accessible name when its config gives no `ariaLabel`; each builder names its type. */\n protected chartTypeLabel = 'Chart';\n\n /** Grows the palette to at least `count` colors, repeating it as `getColorScale` does. */\n protected ensureColorCount(count: number): void {\n if (this.colors.length < count) {\n this.colors = this.colorService.getColorScale(count);\n }\n }\n\n /**\n * Swaps a consumer's `colorOverride` in for the theme palette `initializeChartState` set, in\n * order. Checks `length` rather than truthiness: every config class defaults its override to\n * `[]`, and an empty array is truthy - taken as an override, it would leave every mark with no\n * color. Cycled out to at least as many entries as the theme palette, the same way that palette\n * cycles its own colors, so an override shorter than the data repeats rather than leaving the\n * marks past its end with an `undefined` color. Call after `initializeChartState()`.\n */\n protected applyColorOverride(override: readonly string[] | undefined): void {\n if (!override?.length) {\n return;\n }\n this.colors = Array.from(\n { length: Math.max(this.colors.length, override.length) },\n (_, i) => override[i % override.length],\n );\n }\n\n /**\n * Raw, unadjusted container width measured by the last successful `initializeChartState()`\n * call, or `null` if none has succeeded yet. Deliberately tracked separately from `width`:\n * some builders (e.g. bar-horizontal-chart's `setHorizontalMarginsBasedOnContent`) recompute\n * `width`/`margin.left` mid-build from measured axis-label sizes, so `width` alone isn't a\n * stable basis for \"did the container itself resize\" — the raw container measurement is.\n */\n private lastContainerWidth: number | null = null;\n\n /**\n * Raw container height measured by the last successful `initializeChartState()` call, and\n * whether that build was running with `heightFull` on. Only consulted by `containerSizeChanged`\n * when it was: without `heightFull` the container's height is driven *by* the chart's own SVG\n * height, so comparing it would report \"changed\" every time the chart itself grew or shrank.\n */\n private lastContainerHeight: number | null = null;\n private lastHeightFull = false;\n\n /**\n * How much the vertical margins have grown this build beyond their defaults - for tick marks\n * and axis labels (`initializeAxisState()`; negative when a short tick took some away) and for\n * content that hangs past the plot's edge (`reserveEdgeSpace()`). `resolveHeight()` subtracts\n * it from the plot height so the SVG's total height doesn't change with any of them. Reset\n * alongside the margins.\n */\n private reservedHeight = 0;\n\n /**\n * Resolves the consumer's projected `<ng-template pcacTooltip>`, if any. Each chart component\n * points this at its own `contentChild(PcacTooltipDirective)` query. It's a getter rather than\n * a captured value so it's read lazily, at hover time, from inside a D3 listener: reading the\n * query signal in the component's build effect instead would make the effect depend on it and\n * rebuild the whole chart (restarting its entry animation) whenever the query resolves.\n */\n tooltipTemplate: () => TemplateRef<PcacTooltipContext> | undefined = () => undefined;\n\n /**\n * Puts `margin` back to its defaults. `initializeAxisState()` calls this first thing, before any\n * per-build adjustment (hidden axes giving sides back, tick sizes growing them, label widths\n * measured into `margin.left`): `margin` lives on this per-chart instance and so persists\n * between builds, and without a reset an adjustment made for one config silently carries into\n * the next - e.g. axes drawn with no room after `hide` flips back to false.\n */\n resetMargin(): void {\n this.margin = { ...this.defaultMargin };\n this.reservedHeight = 0;\n }\n\n /**\n * Resolves the config's `xAxis`/`yAxis` onto this chart and sets the margins up for them. Axis\n * charts call this at the top of `buildChart()`, on their own copy of the config (it rewrites\n * `config.height` for hidden axes), before `initializeChartState()` measures the plot area.\n * In order:\n *\n * 1. `resetMargin()`.\n * 2. Tick marks: an axis with `autoTickSize` takes its `tickSize` from `autoTickSize` (see below).\n * Then room for a non-default `tickSize` is reserved on each axis that will actually\n * be drawn (`reserveTickSizeMargins`).\n * 3. Labels: `AXIS_LABEL_SPACE` is added to `bottom` / `left` for an axis with a `label`, and\n * `AXIS_SUB_LABEL_SPACE` for one with any `subLabels` (see `axisLabelSpace`), again only if\n * the axis will be drawn.\n * 4. Hidden axes: an axis with `hide` gives its margins back to the plot. The y axis owns\n * `left` and `top` (the top margin is only there so the topmost y label isn't clipped), the\n * x axis `bottom` and `right` (likewise for the rightmost x label). Each reclaimed vertical\n * margin is added onto `config.height` so the SVG's total height stays what the consumer\n * configured; horizontally `initializeChartState()` picks the change up on its own.\n *\n * @param defaultGrid the axis whose grid this chart draws when the consumer hasn't said\n * (`PcacAxisConfig.showGrid`): `'y'` for horizontal lines, `'x'` for vertical.\n * @param hiddenAxisMargin what a hidden axis's sides shrink to, rather than 0. The\n * line/area/plot charts keep 8px so a dot on the edge of the plot isn't clipped by the SVG.\n * @param autoTickSize for the charts that draw points: half their largest mark toward each axis\n * (`x`: its vertical half, `y`: its horizontal half), which an axis with `autoTickSize` takes,\n * rounded up, as its `tickSize` - in place of any `tickSize` the consumer gave. Left out, as by\n * the charts without points, `autoTickSize` does nothing.\n */\n initializeAxisState(\n config: PcacAxisChartConfig, defaultGrid: 'x' | 'y', hiddenAxisMargin = 0, autoTickSize?: { x: number; y: number }\n ): void {\n this.xAxis = resolveAxisConfig(config.xAxis, defaultGrid === 'x');\n this.yAxis = resolveAxisConfig(config.yAxis, defaultGrid === 'y');\n if (autoTickSize && this.xAxis.autoTickSize) {\n this.xAxis.tickSize = Math.ceil(autoTickSize.x);\n }\n if (autoTickSize && this.yAxis.autoTickSize) {\n this.yAxis.tickSize = Math.ceil(autoTickSize.y);\n }\n this.resetMargin();\n this.reserveTickSizeMargins(\n this.xAxis.hide ? undefined : this.xAxis.tickSize,\n this.yAxis.hide ? undefined : this.yAxis.tickSize\n );\n if (!this.xAxis.hide) {\n const space = axisLabelSpace(this.xAxis);\n this.margin.bottom += space;\n this.reservedHeight += space;\n }\n if (!this.yAxis.hide) {\n this.margin.left += axisLabelSpace(this.yAxis);\n }\n if (this.yAxis.hide) {\n config.height = config.height + this.margin.top - hiddenAxisMargin;\n this.margin.top = hiddenAxisMargin;\n this.margin.left = hiddenAxisMargin;\n }\n if (this.xAxis.hide) {\n config.height = config.height + this.margin.bottom - hiddenAxisMargin;\n this.margin.bottom = hiddenAxisMargin;\n this.margin.right = hiddenAxisMargin;\n }\n }\n\n /**\n * The `PcacAxisBuilder` config for this chart's current state - everything but the scales is\n * already on the instance. Builders pass the result to `drawAxis()` (or `drawXAxis()` with a\n * rescaled x, on zoom).\n */\n axisBuilderConfig<XDomain extends AxisDomain, YDomain extends AxisDomain>(\n xScale: AxisScale<XDomain>, yScale: AxisScale<YDomain>\n ): IPcacAxisBuilderConfig<XDomain, YDomain> {\n return {\n svg: this.svg,\n width: this.width,\n height: this.height,\n margin: this.margin,\n xScale,\n yScale,\n xAxis: this.xAxis,\n yAxis: this.yAxis\n };\n }\n\n /**\n * Draws whichever grids the resolved axes ask for: vertical lines from the x axis's ticks,\n * horizontal from the y's (`PcacAxisConfig.showGrid`). `which` restricts it to one axis - the\n * line/area/plot charts redraw just a zoomed axis's grid against its rescaled scale on zoom.\n */\n drawGrids<XDomain extends AxisDomain, YDomain extends AxisDomain>(\n xScale: AxisScale<XDomain>, yScale: AxisScale<YDomain>, which: 'x' | 'y' | 'both' = 'both'\n ): void {\n const base = { svg: this.svg, width: this.width, height: this.height, xScale, yScale };\n if (which !== 'y' && this.xAxis.showGrid) {\n this.gridBuilder.drawVerticalGrid({ ...base, numberOfTicks: this.xAxis.ticks, color: this.xAxis.gridColor });\n }\n if (which !== 'x' && this.yAxis.showGrid) {\n this.gridBuilder.drawHorizontalGrid({ ...base, numberOfTicks: this.yAxis.ticks, color: this.yAxis.gridColor });\n }\n }\n\n /**\n * Makes room in the margins for tick marks longer (or shorter) than D3's default. The default\n * margins are sized around that default (`DEFAULT_TICK_SIZE`), and D3 places each tick label at\n * tick length + padding, so a longer tick pushes its labels outward by exactly the difference -\n * into space the margin doesn't have unless it grows by the same amount. Growing the margin here,\n * *before* `initializeChartState()` measures the plot area, is what makes the chart shrink to fit\n * its labels rather than pushing them off the edge of the SVG. A shorter tick hands the\n * difference back to the plot area the same way.\n *\n * Horizontally that happens on its own: `initializeChartState()` derives `width` from the\n * container minus the margins. Vertically it doesn't - `config.height` is the plot area, and\n * the SVG is that plus the margins - so a taller bottom margin would grow the SVG instead. The\n * delta is therefore also remembered in `reservedHeight` and taken back out of the plot\n * height by `resolveHeight()`, keeping the chart's total footprint where the consumer put it.\n *\n * Called by `initializeAxisState()` right after `resetMargin()`, for the axes that will be\n * drawn. Only the axis a tick size is given for is affected; `undefined` leaves that margin\n * alone.\n * @param xTickSize `tickSizeInner` for the bottom (x) axis, which lives in `margin.bottom`\n * @param yTickSize `tickSizeInner` for the left (y) axis, which lives in `margin.left`\n */\n reserveTickSizeMargins(xTickSize?: number, yTickSize?: number): void {\n if (xTickSize !== undefined) {\n const bottom = Math.max(0, this.margin.bottom + xTickSize - PcacChart.DEFAULT_TICK_SIZE);\n this.reservedHeight = bottom - this.margin.bottom;\n this.margin.bottom = bottom;\n }\n if (yTickSize !== undefined) {\n this.margin.left = Math.max(0, this.margin.left + yTickSize - PcacChart.DEFAULT_TICK_SIZE);\n }\n }\n\n /**\n * Makes sure each given margin is at least that big, for content drawn at the very edge of the\n * plot area that reaches past it - a point image on the line/area/plot charts, say, whose box\n * is centered on a point at the top of the y domain and so hangs half of itself above the plot.\n * Those charts already widen their clip-path to let such a point through; this is what stops\n * the `<svg>` itself from cutting it off, the SVG being only the plot area plus the margins.\n *\n * \"At least\", not \"add\": the default margins, and any tick / label room already reserved in\n * them, may well cover it already (`margin.left` is 40 by default), and adding on top of that\n * would give up plot area for nothing. Vertical growth is taken out of the plot height the same\n * way `reserveTickSizeMargins()`'s is, so the SVG's total height stays what the consumer\n * configured; horizontally `initializeChartState()` picks the change up on its own. A side\n * left `undefined` is untouched.\n *\n * Call after `initializeAxisState()` (which resets the margins) and before\n * `initializeChartState()` (which measures the plot area against them).\n */\n reserveEdgeSpace(space: Partial<PcacChartMargin>): void {\n for (const side of ['top', 'right', 'bottom', 'left'] as const) {\n const wanted = space[side];\n if (wanted === undefined || wanted <= this.margin[side]) {\n continue;\n }\n if (side === 'top' || side === 'bottom') {\n this.reservedHeight += wanted - this.margin[side];\n }\n this.margin[side] = wanted;\n }\n }\n\n /**\n * Shows the tooltip for a hovered datum, through the chart's `pcacTooltip` template when one is\n * projected and the default key/value content otherwise. Every builder's hover handler should\n * go through here rather than `tooltipBuilder` directly so the template is honored everywhere.\n */\n showTooltip(event: MouseEvent | null, data: PcacData, options: PcacTooltipOptions): void {\n this.tooltipBuilder.showTooltip(\n event,\n this.tooltipTemplate(),\n {\n $implicit: data,\n parent: options.parent ?? null,\n isThreshold: options.isThreshold ?? false,\n index: options.index,\n parentIndex: options.parentIndex ?? null,\n coincident: options.coincident ?? [],\n },\n options.valueFormat,\n options.keyFormat,\n options.anchor,\n this\n );\n }\n\n /** Hides the tooltip if this chart is the one showing it; another chart's is left alone. */\n hideTooltip(): void {\n this.tooltipBuilder.hideTooltip(this);\n }\n\n /**\n * A mark's accessible name: its parent's key (the bar's group, the point's series), its own key\n * and its value, formatted as the tooltip formats them - `\"Chips, 2024: 680\"`.\n */\n protected markLabel(\n data: PcacData,\n options: { parent?: PcacData | null; valueFormat?: PcacFormatEnum; keyFormat?: PcacFormatEnum } = {},\n ): string {\n const { key, value } = tooltipText(data, options.valueFormat, options.keyFormat);\n const parentKey = options.parent?.key;\n const names = [parentKey === null || parentKey === undefined || parentKey === '' ? null : String(parentKey), key]\n .filter((name): name is string => name !== null);\n return `${names.join(', ')}${names.length ? ': ' : ''}${value === '' ? 'no value' : value}`;\n }\n\n /**\n * Keyboard focus on a mark: its tooltip, beside it (there's no pointer to put it above). With a\n * consumer `pcacTooltip` template, the mark is also described by the tooltip, so a screen reader\n * reads whatever the template adds to the mark's own name; the default tooltip only repeats it.\n */\n protected showMarkTooltip(element: Element, data: PcacData, options: PcacTooltipOptions): void {\n this.showTooltip(null, data, { ...options, anchor: options.anchor ?? element });\n if (this.tooltipTemplate()) {\n element.setAttribute('aria-describedby', PcacTooltipBuilder.ID);\n }\n }\n\n /**\n * Where the chart's Tab stop was before the last redraw removed its marks, and whether it had\n * focus; put back by `restoreTabStop`. Kept until then - across a build that couldn't draw (no\n * width yet) - and not overwritten by a second clear in the same build, which finds no marks.\n */\n private markFocus: PcacMarkFocus | null = null;\n\n private noteMarkFocus(chartElm: ElementRef): void {\n this.markFocus = captureMarkFocus(chartElm.nativeElement) ?? this.markFocus;\n }\n\n /**\n * Puts the chart's Tab stop on its new marks - where it was before the redraw, with focus if it\n * had it (see marks.ts). Every builder calls this once its marks are drawn.\n */\n protected restoreTabStop(chartElm: ElementRef): void {\n refreshTabStop(chartElm.nativeElement, this.markFocus);\n this.markFocus = null;\n }\n\n /**\n * The chart's accessible name when its config gives no `ariaLabel`: its type, and the titles of\n * the axes it shows - \"Bar chart - x axis: Product, y axis: Units sold\". The titles are drawn\n * inside the axis groups, which are hidden from screen readers (the marks' own names carry each\n * key and value), so this is the only place they're read out.\n */\n private defaultChartName(): string {\n const axes: [string, PcacResolvedAxisConfig][] = [['x', this.xAxis], ['y', this.yAxis]];\n const titles = axes\n .filter(([, axis]) => !axis.hide && !!axis.label)\n .map(([name, axis]) => `${name} axis: ${axis.label}`);\n return titles.length ? `${this.chartTypeLabel} - ${titles.join(', ')}` : this.chartTypeLabel;\n }\n\n /** Keyboard focus leaving a mark: the undoing of `showMarkTooltip`. */\n protected hideMarkTooltip(element: Element): void {\n this.hideTooltip();\n element.removeAttribute('aria-describedby');\n }\n\n /**\n * Builders are provided per chart component, so Angular calls this when the component is\n * destroyed. A chart removed while hovered (an `@if` flip, a route change) gets no `mouseout`,\n * so without this its tooltip - and any consumer template view in it - would stay on screen.\n */\n ngOnDestroy(): void {\n this.hideTooltip();\n }\n\n /**\n * Removes whatever the chart last drew, for a build with no data to draw. Builders call it\n * rather than just returning, which left the previous data on screen when a consumer emptied\n * the chart (e.g. a filter that now matches nothing).\n */\n clearChart(chartElm: ElementRef): void {\n this.hideTooltip();\n this.noteMarkFocus(chartElm);\n select(chartElm.nativeElement).select('g').remove();\n }\n\n /**\n * Prior to building a chart, we need to initialize the state of the chart.\n *\n * Returns `false` (and leaves `width`/`height`/`colors` untouched) if the container hasn't\n * been laid out yet, so its `clientWidth` measures 0 — this happens when a chart mounts\n * already holding data (e.g. behind a loading gate) and its first build `effect` run fires\n * before the browser has committed layout for its own just-created DOM node. Callers should\n * bail out of their build on `false` rather than proceeding with a degenerate width;\n * `PcacChartResizeService` (wired up by every chart component) retries the build once the\n * container has a real size.\n * @param chartElm Reference to SVG on dom\n * @param config Chart specific configuration\n */\n initializeChartState(chartElm: ElementRef, config: PcacChartConfig): boolean {\n // The rebuild removes the hovered element, which gets no mouseout to close its tooltip.\n this.hideTooltip();\n this.noteMarkFocus(chartElm);\n select(chartElm.nativeElement).select('g').remove();\n // One color per group or per series within a group, whichever needs more. Bar charts, which\n // color by series across groups, top this up with `ensureColorCount()`. Read before the width\n // check below, even though a build that fails it draws nothing: this runs inside each chart\n // component's build `effect`, and reading the palette is what makes that effect redraw the\n // chart when the palette changes (see `PcacColorService`) - including a chart whose first\n // build found its container not laid out yet. (A loop rather than `Math.max(...)` over the\n // groups: spreading one argument per group overflows the call stack at a few hundred thousand.)\n const colors = this.colorService.getColorScale(\n config.data.reduce((max, d) => Math.max(max, d.data?.length ?? 0), config.data.length),\n );\n const container = chartElm.nativeElement.parentNode as HTMLElement;\n const containerWidth = container.clientWidth;\n const measuredWidth = containerWidth - this.margin.left - this.margin.right;\n // `!(> 0)` rather than `<= 0`, so a width that can't be measured at all - `NaN`, as when a page\n // is rendered on the server, where there's no layout and `clientWidth` is undefined - also\n // draws nothing, rather than drawing a chart `NaN` pixels wide.\n if (!(measuredWidth > 0)) {\n // The previous drawing was just removed above, so nothing is on screen any more. Forget the\n // size it was drawn at, or a container that comes back at that same width (a hidden tab\n // shown again) would read as unchanged to `containerSizeChanged()` and never be redrawn.\n this.lastContainerWidth = null;\n return false;\n }\n this.width = measuredWidth;\n // A named group of marks, each with its own name and role (see marks.ts), rather than a pile of\n // unlabelled shapes. (A `role=\"img\"`, which this used to be, would hide the marks inside it from\n // a screen reader, and keyboard focus on them would announce nothing.)\n select(chartElm.nativeElement)\n .attr('role', 'group')\n .attr('aria-label', config.ariaLabel || this.defaultChartName());\n this.height = this.resolveHeight(container, config);\n this.colors = colors;\n this.lastContainerWidth = containerWidth;\n this.lastContainerHeight = container.clientHeight;\n this.lastHeightFull = config.heightFull === true;\n return true;\n }\n\n /**\n * `config.height` normally *is* the height of the drawing area. With `config.heightFull` on it\n * becomes a floor instead: the chart fills its container, and only falls back to `config.height`\n * when the container is shorter than that (or has no definite height of its own to fill - see\n * `PcacChartConfig.heightFull`, where an auto-height container measures ~0 here and the\n * `Math.max` keeps the configured height).\n *\n * Note this deliberately subtracts the margins, so it's the *total* SVG that ends up matching\n * the container: `buildContainer()` adds `margin.top`/`margin.bottom` back on top of `height`\n * when sizing the `<svg>`, so filling without this would overflow the container by exactly the\n * vertical margins.\n * @param container The chart's container element (the `<svg>`'s parent)\n * @param config Chart specific configuration\n */\n private resolveHeight(container: HTMLElement, config: PcacChartConfig): number {\n // See `reserveTickSizeMargins()` / `reserveEdgeSpace()`: room made in the vertical margins\n // comes out of the plot area, not added on to the SVG. Applies to the floor in the `heightFull`\n // case too, for the same reason.\n const height = Math.max(0, config.height - this.reservedHeight);\n if (!config.heightFull) {\n return height;\n }\n return Math.max(height, container.clientHeight - this.margin.top - this.margin.bottom);\n }\n\n /**\n * True if the container's current raw layout width differs from the one measured by the last\n * successful build, or if no successful build has happened yet. For a `heightFull` chart, a\n * change in the container's height counts too - that's the whole size the chart is tracking.\n *\n * `PcacChartResizeService`'s `ResizeObserver` is guaranteed to fire once as soon as it starts\n * observing — that's what lets a chart recover from the 0-width race described on\n * `initializeChartState`, but it also means that \"routine\" first callback usually lands\n * moments after the component's build `effect` already built successfully at the same width.\n * Without this check, that redundant callback would restart the chart's enter transition\n * mid-animation for no visual change. Only that effect (which reacts to config, not size) should\n * skip this check.\n * @param chartElm Reference to SVG on dom\n */\n containerSizeChanged(chartElm: ElementRef): boolean {\n if (this.lastContainerWidth === null) {\n return true;\n }\n const container = chartElm.nativeElement.parentNode as HTMLElement;\n const containerWidth = container.clientWidth;\n if (containerWidth > 0 && containerWidth !== this.lastContainerWidth) {\n return true;\n }\n if (!this.lastHeightFull) {\n return false;\n }\n // Height only matters for a `heightFull` chart, and only there is it safe to compare: the\n // container's height is definite (see `resolveHeight`), so it changes when the *layout*\n // changes, not in response to the height this chart just drew itself at.\n const containerHeight = container.clientHeight;\n return containerHeight > 0 && containerHeight !== this.lastContainerHeight;\n }\n\n /**\n * 1) Set the width and height of the SVG\n * 2) Add a group and translate it to state of {{center}} option\n * @param chartElm Reference to SVG on dom\n * @param center Are we pinning x,y to the top,left, or are we centering our drawing group inside the SVG.\n */\n buildContainer(chartElm: ElementRef, center = false): void {\n const combinedHeight = this.height + this.margin.top + this.margin.bottom;\n const combinedWidth = this.width + this.margin.left + this.margin.right;\n this.svg = select(chartElm.nativeElement)\n .attr('width', combinedWidth)\n .attr('height', combinedHeight);\n if (center) {\n this.svg = this.svg\n .append('g')\n .attr('transform', 'translate(' + combinedWidth / 2 + ',' + combinedHeight / 2 + ')');\n return;\n }\n this.svg = this.svg\n .append('g')\n .attr('transform', 'translate(' + this.margin.left + ',' + this.margin.top + ')');\n }\n\n /**\n * Most charts share a default margin(s) state.\n * In some cases, that state needs to be calculated based on the content that resides in that margin.\n * For example, labels on a horizontal bar chart are dynamic and such the margin needs to be calculated ahead of\n * chart axis construction.\n *\n * Measures with the y axis's own `tickSize` (the measured box spans the tick line as well as\n * the label, so measuring at a different length would put the labels off by the difference)\n * and adds its `axisLabelSpace()` back on top, since the measurement replaces whatever\n * `initializeAxisState()` reserved for the label / sub labels.\n *\n * The margin never takes more than `MAX_LABEL_MARGIN_SHARE` of the container: labels wider than\n * that are cut off at the chart's left edge rather than squeezing the plot to nothing (it used\n * to go to a negative width, and no bars drew at all). Returns `false`, like\n * `initializeChartState()`, if there is still no room left to draw in.\n * @param chartElm Reference to SVG on dom\n * @param yScale D3 scale transformation object (d3.ScaleBand)\n */\n setHorizontalMarginsBasedOnContent<Domain extends AxisDomain>(chartElm: ElementRef, yScale: AxisScale<Domain>): boolean {\n this.yTickLabelMaxWidth = null;\n const axisY = axisLeft(yScale).ticks(5);\n if (this.yAxis.tickSize !== undefined) {\n axisY.tickSizeInner(this.yAxis.tickSize);\n }\n // Labelled as the axis will label them, or a unit suffix went unmeasured and ran off the edge.\n const format = axisTickFormat(this.yAxis.format, yScale, this.yAxis.ticks);\n if (format) {\n axisY.tickFormat(format);\n }\n let max = 0;\n select(chartElm.nativeElement).append('g')\n .call(axisY)\n .each((d, i, n) => {\n const width = (n[i] as SVGGraphicsElement).getBBox().width;\n if (width > max) {\n max = width;\n }\n })\n .remove();\n // `width` was already computed net of the current `margin.left` by initializeChartState(),\n // so only the *change* in margin comes out of it. Subtracting the whole measured margin\n // double-counted it, and since `margin` persists on the builder between builds, the amount\n // double-counted grew on the next rebuild - the plot area came out narrower than the\n // container allowed and then shrank further after the first resize.\n const containerWidth = this.width + this.margin.left + this.margin.right;\n const labelSpace = axisLabelSpace(this.yAxis);\n const left = Math.min(max + labelSpace, containerWidth * MAX_LABEL_MARGIN_SHARE);\n this.width = this.width + this.margin.left - left;\n this.margin.left = left;\n if (left < max + labelSpace) {\n // Capped: the labels are shortened to what's left between the axis title's band and the\n // ticks (see `truncateYTickLabels`), rather than running on past the chart's edge - and\n // over the title.\n const tickOverhead = Math.max(this.yAxis.tickSize ?? DEFAULT_TICK_SIZE, 0) + TICK_PADDING;\n this.yTickLabelMaxWidth = Math.max(0, left - labelSpace - tickOverhead);\n }\n return this.width > 0;\n }\n\n /**\n * Shortens every y-axis tick label wider than the room `setHorizontalMarginsBasedOnContent` left\n * for it, ending it in \"…\". Call after the axis is drawn. Does nothing when the labels fit.\n */\n protected truncateYTickLabels(): void {\n const maxWidth = this.yTickLabelMaxWidth;\n if (maxWidth === null) {\n return;\n }\n this.svg.selectAll<SVGTextElement, unknown>('.pcac-y-axis .tick text').each(function () {\n fitText(this, maxWidth);\n });\n }\n}\n\n/**\n * Shortens `text` to the longest prefix that, with \"…\" appended, fits in `maxWidth` - just \"…\"\n * if nothing does. Measured with `getComputedTextLength()`, so the text must be rendered; left\n * alone where that isn't available (a DOM without layout).\n */\nfunction fitText(text: SVGTextElement, maxWidth: number): void {\n if (typeof text.getComputedTextLength !== 'function' || text.getComputedTextLength() <= maxWidth) {\n return;\n }\n const full = text.textContent ?? '';\n const withEllipsis = (length: number) => full.slice(0, length).trimEnd() + '…';\n let fits = 0;\n let tooLong = full.length;\n while (tooLong - fits > 1) {\n const mid = Math.floor((fits + tooLong) / 2);\n text.textContent = withEllipsis(mid);\n if (text.getComputedTextLength() <= maxWidth) {\n fits = mid;\n } else {\n tooLong = mid;\n }\n }\n text.textContent = withEllipsis(fits);\n}\n","import { PcacData } from './chart.model';\n\n/**\n * How long each bar is drawn: its value, or 0 when it can't be drawn - a null or non-numeric\n * value, or `hide` set on the bar or on its whole group. A hidden bar keeps its slot (and so its\n * color) and just draws nothing, the same way a hidden line/area/plot series keeps its place.\n * A negative value is drawn as 0 too: the bar charts only draw upward from a 0 baseline, and a\n * negative size was an invalid SVG `height`/`width` (the bar vanished with a console error) that\n * also pulled the rest of a stack down over the bars before it.\n *\n * Keyed by the bar's own `PcacData` object so D3 callbacks (which only get the datum) can look\n * their size up directly.\n */\nexport function barSizes(groups: PcacData[]): Map<PcacData, number> {\n const sizes = new Map<PcacData, number>();\n for (const group of groups) {\n for (const bar of group.data ?? []) {\n const value = Number(bar.value ?? 0);\n sizes.set(bar, group.hide || bar.hide || !Number.isFinite(value) ? 0 : Math.max(0, value));\n }\n }\n return sizes;\n}\n\n/**\n * Where each bar of a stacked group starts: the running total of the bars before it, in data\n * order, so the first bar sits on the baseline and each later one on top of the previous. Sizes\n * are the bar's *own* (segment), not a pre-accumulated total, taken from `barSizes` - so a null,\n * non-numeric or hidden bar adds nothing to the stack.\n */\nexport function stackStarts(groups: PcacData[], sizes = barSizes(groups)): Map<PcacData, number> {\n const starts = new Map<PcacData, number>();\n for (const group of groups) {\n let total = 0;\n for (const bar of group.data ?? []) {\n starts.set(bar, total);\n total += sizes.get(bar) ?? 0;\n }\n }\n return starts;\n}\n","import { PcacData } from '../core/chart.model';\n\n/** How a bar chart's `thresholds` are laid out; see `barThresholdLayout`. */\nexport type BarThresholdLayout = 'none' | 'chart' | 'group' | 'bar';\n\n/** Whether a threshold entry carries per-bar values in its `data`. */\nfunction hasBars(entry: PcacData): boolean {\n return (entry.data?.length ?? 0) > 0;\n}\n\n/** A threshold is only drawn when its value is a finite number. */\nfunction drawable(threshold: PcacData | undefined): PcacData | null {\n if (!threshold || threshold.value === null || threshold.value === undefined) {\n return null;\n }\n return Number.isFinite(Number(threshold.value)) ? threshold : null;\n}\n\n/**\n * Reads the shape of `thresholds` the way the docs describe it:\n * - one entry with an empty (or no) `data` - a single threshold across the whole chart;\n * - one entry per group, each with an empty `data` - a threshold per group;\n * - one entry per group, each with an entry per bar in its `data` - a threshold per bar.\n *\n * A stacked group is drawn as one bar, so on a stacked chart per-bar entries give per-group\n * thresholds, each group's taken from its entry's first `data` item. Checks `data.length` rather\n * than `data`'s truthiness: `PcacData.data` defaults to `[]`, which is truthy.\n */\nexport function barThresholdLayout(\n thresholds: PcacData[] | undefined,\n isStacked: boolean,\n): BarThresholdLayout {\n if (!thresholds?.length) {\n return 'none';\n }\n if (!thresholds.some(hasBars)) {\n return thresholds.length === 1 ? 'chart' : 'group';\n }\n return isStacked ? 'group' : 'bar';\n}\n\n/**\n * The threshold drawn across the group at `groupIndex` (or across the chart, for index 0 of a\n * `'chart'` layout): the entry itself, or its first `data` item when it has per-bar values. Null\n * when there's no entry for that group or no numeric value to draw.\n */\nexport function groupThreshold(thresholds: PcacData[], groupIndex: number): PcacData | null {\n const entry = thresholds[groupIndex];\n if (!entry) {\n return null;\n }\n return drawable(hasBars(entry) ? entry.data[0] : entry);\n}\n\n/** The threshold drawn across one bar, or null when that bar has none (or no numeric value). */\nexport function barThreshold(\n thresholds: PcacData[],\n groupIndex: number,\n barIndex: number,\n): PcacData | null {\n return drawable(thresholds[groupIndex]?.data?.[barIndex]);\n}\n","import { PcacData } from '../core/chart.model';\n\n/**\n * Every series key across all groups, in first-seen order: the domain of a grouped bar chart's\n * inner band, so each series has its own slot in every group. Taken from the first group alone,\n * a series that only later groups have fell outside the band and was drawn over the first slot.\n */\nexport function seriesKeys(groups: PcacData[]): string[] {\n const keys = new Set<string>();\n for (const group of groups) {\n for (const bar of group.data ?? []) {\n keys.add(bar.key as string);\n }\n }\n return [...keys];\n}\n\n/**\n * The slots a grouped (not stacked) chart places each group's bars in, and which slot a bar takes:\n * its series key - so a series sits in the same place in every group - when the keys tell the\n * series apart (see `hasDistinctSeriesKeys`), and its position in its group otherwise. Placed by\n * key regardless, bars with no key (`PcacData`'s default `null`) or a repeated one all fell into\n * one slot and were drawn on top of each other, only the last visible - though they were already\n * colored by position in that case.\n */\nexport function seriesSlots(groups: PcacData[]): { domain: string[]; slotOf: (bar: PcacData, index: number) => string } {\n if (hasDistinctSeriesKeys(groups)) {\n return { domain: seriesKeys(groups), slotOf: (bar) => bar.key as string };\n }\n const size = groups.reduce((max, group) => Math.max(max, group.data?.length ?? 0), 0);\n return {\n domain: Array.from({ length: size }, (_, i) => String(i)),\n slotOf: (_bar, index) => String(index),\n };\n}\n\n/**\n * Whether every bar has a key that is unique within its own group - what coloring bars by series\n * key needs. Without that (keys left `null`, as `PcacData` defaults them, or repeated within a\n * group, as stacked data often has), coloring by key would paint every bar sharing a key the\n * same color, so the bars fall back to being colored by their position in the group.\n */\nexport function hasDistinctSeriesKeys(groups: PcacData[]): boolean {\n return groups.every((group) => {\n const keys = (group.data ?? []).map((bar) => bar.key);\n return keys.every((key) => key !== null && key !== undefined && key !== '')\n && new Set(keys).size === keys.length;\n });\n}\n\n/**\n * Whether a band scale spanning `length` pixels across `count` bands can round them to whole\n * pixels. Rounding gives crisp bar edges, but it floors the step - so with more bands than pixels\n * every band collapses to 0 and nothing draws. Only rounded while each band gets at least 2px.\n */\nexport function canRoundBands(length: number, count: number): boolean {\n return count > 0 && length / count >= 2;\n}\n\n/**\n * A bar config's `colorOverride` as the plain list of colors every chart now takes. Up to 22.2 the\n * bar charts wrapped it as `{ colors: [...] }`; a config still shaped that way - which TypeScript\n * misses when it's spread together or loaded as JSON - is still read, and `warn` is called (see\n * `colorOverrideWarning`). Only for colors actually set: before 22.2.17 every bar config defaulted\n * to `{ colors: [] }`, so one saved as JSON back then would warn about an override its author\n * never chose.\n */\nexport function barColorOverride(\n override: readonly string[] | { colors?: readonly string[] } | undefined,\n warn: () => void = () => undefined,\n): readonly string[] | undefined {\n if (!override || Array.isArray(override)) {\n return override as readonly string[] | undefined;\n }\n const colors = (override as { colors?: readonly string[] }).colors;\n if (colors?.length) {\n warn();\n }\n return colors;\n}\n\n/**\n * The development-mode warning about the old `colorOverride` shape, for one chart: each bar builder\n * keeps its own, so it warns once per chart - like the pie's leftover-`donut` warning - rather than\n * once per page, which also made it depend on which chart happened to build first.\n */\nexport function colorOverrideWarning(): () => void {\n let warned = false;\n return () => {\n if (warned || typeof ngDevMode === 'undefined' || !ngDevMode) {\n return;\n }\n warned = true;\n console.warn(\n 'Pioneer Charts: a bar chart\\'s `colorOverride` is now a plain array of colors, like the other ' +\n 'charts\\' - use `colorOverride: [...]` rather than `colorOverride: { colors: [...] }`.',\n );\n };\n}\n","import { Injectable, ElementRef } from '@angular/core';\nimport { color } from 'd3-color';\nimport { scaleBand, ScaleBand, scaleLinear, ScaleLinear } from 'd3-scale';\nimport { select, Selection } from 'd3-selection';\nimport { BaseType } from 'd3-selection';\n// Side effect only: adds .transition() to d3-selection's Selection, which the bar animations use.\nimport 'd3-transition';\nimport { Subject } from 'rxjs';\n\n/**\n * Lib\n */\nimport { PcacBarHorizontalChartConfig } from './bar-horizontal-chart.model';\nimport { PcacChart, PcacTooltipOptions } from '../../core/chart';\nimport { makeMarksAccessible } from '../../core/marks';\nimport { PcacData } from '../../core/chart.model';\nimport { barSizes, stackStarts } from '../../core/stack';\nimport { barThreshold, barThresholdLayout, groupThreshold } from '../bar-thresholds';\nimport { barColorOverride, canRoundBands, colorOverrideWarning, hasDistinctSeriesKeys, seriesKeys, seriesSlots } from '../bar-series';\n\n// `BaseType` (not the hand-rolled union this used to be, which omitted `null` and never\n// actually matched what `.selectAll()`'s default generics resolve to).\ntype GroupType = Selection<BaseType, PcacData, BaseType, PcacData>;\n\n/**\n * Provided per-component (see PcacBarHorizontalChart's `providers`), not root-scoped:\n * this builder extends PcacChart, which holds mutable per-chart-instance state (margin, width,\n * height, colors, svg). A root singleton would be shared and clobbered by every\n * <pcac-bar-horizontal-chart> rendered at once.\n */\n@Injectable()\nexport class BarHorizontalChartBuilder extends PcacChart {\n private xScale!: ScaleLinear<number, number>;\n private yScaleStacked!: ScaleBand<string>;\n private yScaleGrouped!: ScaleBand<string>;\n /** Warns, once for this chart, about a `colorOverride` in its old `{ colors }` shape. */\n private readonly warnOfColorOverride = colorOverrideWarning();\n /** A bar's slot in `yScaleGrouped`, from its datum and its index in its group (see `seriesSlots`). */\n private slotOf: (bar: PcacData, index: number) => string = (bar) => bar.key as string;\n private barClickedSource = new Subject<PcacData>();\n barClicked$ = this.barClickedSource.asObservable();\n\n protected override chartTypeLabel = 'Bar chart';\n\n buildChart(chartElm: ElementRef, config: PcacBarHorizontalChartConfig): void {\n if (!config?.data?.length) {\n this.clearChart(chartElm);\n return;\n }\n\n // Shallow copy, as the vertical chart does: initializeAxisState() rewrites `height`, which\n // must not land on the consumer's config - but the data stays the consumer's own objects, so\n // `barClicked` and the tooltip hand back the very `PcacData` they passed in. (A JSON deep copy\n // used to hand back clones, which never matched the consumer's data by identity.)\n config = { ...config };\n this.initializeAxisState(config, 'x');\n if (!this.initializeChartState(chartElm, config)) {\n return;\n }\n\n this.ensureColorCount(seriesKeys(config.data).length);\n this.applyColorOverride(barColorOverride(config.colorOverride, this.warnOfColorOverride));\n if (!this.buildScales(chartElm, config)) {\n return;\n }\n this.drawChart(chartElm, config);\n }\n\n /** Returns `false` if the container leaves no room to draw in once the labels are measured. */\n private buildScales(chartElm: ElementRef, config: PcacBarHorizontalChartConfig): boolean {\n // Bars grow from 0, so only `domainMax` is read; `xAxis.domainMin` is ignored.\n this.xScale = scaleLinear()\n .domain([0, this.xAxis.domainMax as number]);\n\n\n this.yScaleStacked = scaleBand()\n .domain(config.data.map((d) => d.key as string))\n .range([this.height, 0])\n // Rounded to whole pixels for crisp bar edges, while there's room to (see canRoundBands).\n .round(canRoundBands(this.height, config.data.length))\n .padding(0.1);\n\n const slots = seriesSlots(config.data);\n this.slotOf = slots.slotOf;\n this.yScaleGrouped = scaleBand()\n .padding(0.05)\n .range([0, this.yScaleStacked.bandwidth()])\n .round(canRoundBands(this.yScaleStacked.bandwidth(), slots.domain.length))\n .domain(slots.domain);\n\n // The left margin is sized to the y axis's labels - unless there is no y axis to size it to\n if (!this.yAxis.hide && !this.setHorizontalMarginsBasedOnContent(chartElm, this.yScaleStacked)) {\n return false;\n }\n\n this.xScale.range([0, this.width]);\n return true;\n }\n\n private drawChart(chartElm: ElementRef, config: PcacBarHorizontalChartConfig): void {\n this.buildContainer(chartElm);\n this.axisBuilder.drawAxis(this.axisBuilderConfig(this.xScale, this.yScaleStacked));\n this.truncateYTickLabels();\n this.drawGrids(this.xScale, this.yScaleStacked);\n this.addGroups(config);\n this.axisBuilder.raiseAxes(this.svg);\n this.restoreTabStop(chartElm);\n }\n\n private addGroups(config: PcacBarHorizontalChartConfig) {\n const groupsContainer = this.svg.append('g')\n .attr('class', 'pcac-bars')\n .selectAll('g')\n .data(config.data)\n .enter().append('g')\n .attr('class', 'pcac-bar-group')\n .attr('data-group-id', (d: PcacData, i: number) => {\n return i;\n })\n .attr('transform', (d: PcacData) => 'translate(0,' + this.yScaleStacked(d.key as string) + ')');\n\n const group = groupsContainer.selectAll('rect')\n .data((d: PcacData) => {\n return d.data ?? [];\n });\n\n this.drawBarsPerGroup(group, config);\n\n switch (barThresholdLayout(config.thresholds, config.isStacked)) {\n case 'chart':\n this.drawThresholdAcrossChart(config);\n break;\n case 'group':\n this.drawThresholdsPerGroup(config);\n break;\n case 'bar':\n this.drawThresholdsPerBarInGroup(group, config);\n break;\n }\n }\n\n private drawBarsPerGroup(groups: GroupType, config: PcacBarHorizontalChartConfig) {\n const self = this;\n // Stacked bars start where the previous bar in their group ends; every other layout draws\n // from the baseline (start 0).\n // Sizes honor `hide` (and treat a null or non-numeric value as 0), so a hidden bar keeps its\n // slot and color but draws nothing - see `barSizes`.\n const sizes = barSizes(config.data);\n const starts = config.isStacked ? stackStarts(config.data, sizes) : new Map<PcacData, number>();\n const startOf = (d: PcacData) => starts.get(d) ?? 0;\n const endOf = (d: PcacData) => startOf(d) + (sizes.get(d) ?? 0);\n // Colored by series - the bar's key's place among every group's keys, the same slot it's drawn\n // in - rather than by its position in its own group, which differs when groups hold different\n // series. By position after all when the keys can't tell series apart (see\n // `hasDistinctSeriesKeys`), and with `spreadColorsPerGroup`, by group instead.\n const keys = seriesKeys(config.data);\n const byKey = hasDistinctSeriesKeys(config.data);\n const fillOf = (d: PcacData, bar: SVGRectElement) => {\n if (config.spreadColorsPerGroup) {\n return this.colors[Number((bar.parentNode as Element).getAttribute('data-group-id'))];\n }\n return this.colors[byKey ? keys.indexOf(d.key as string) : Number(bar.getAttribute('data-group-bar-id'))];\n };\n // The hover fades run as their own named transition: an unnamed one would cancel the enter\n // transition still growing the bar, leaving it part-grown until the next rebuild. Shared by\n // the pointer and keyboard focus (see makeMarksAccessible).\n const highlight = (bar: SVGRectElement, d: PcacData) => {\n const fill = fillOf(d, bar);\n select(bar)\n .transition('hover')\n .duration(this.transitionService.getTransitionDuration() / 5)\n .style('fill', color(fill)?.darker(1).toString() ?? fill);\n };\n const rest = (bar: SVGRectElement, d: PcacData) => {\n select(bar)\n .transition('hover')\n .duration(this.transitionService.getTransitionDuration() / 5)\n .style('fill', fillOf(d, bar));\n };\n const tooltipOptions = (bar: SVGRectElement): PcacTooltipOptions => {\n const groupIndex = Number((bar.parentNode as Element).getAttribute('data-group-id'));\n const index = Number(bar.getAttribute('data-group-bar-id'));\n return { index, parent: config.data[groupIndex], parentIndex: groupIndex, valueFormat: this.xAxis.format };\n };\n const bars = groups.enter().append('rect')\n .attr('class', 'pcac-bar')\n .attr('x', (d: PcacData) => this.xScale(startOf(d)))\n // A stacked bar spans its whole group, which is already translated into place; looking its\n // series key up in the group band put it off in another group's slot whenever the key\n // matched a group key.\n .attr('y', (d: PcacData, i: number) => config.isStacked ? 0 : this.yScaleGrouped(this.slotOf(d, i)) ?? 0)\n .attr('data-group-bar-id', (_: PcacData, i: number) => {\n return i;\n })\n .attr('height', !config.isStacked ? this.yScaleGrouped.bandwidth() : this.yScaleStacked.bandwidth())\n .style('fill', function (this: SVGRectElement, d: PcacData) {\n return fillOf(d, this);\n })\n .attr('width', 0)\n .on('mouseover', function (this: SVGRectElement, _event: MouseEvent, d: PcacData) {\n highlight(this, d);\n })\n .on('mousemove', function (this: SVGRectElement, event: MouseEvent, d: PcacData) {\n self.showTooltip(event, d, tooltipOptions(this));\n })\n .on('mouseout', function (this: SVGRectElement, _event: MouseEvent, d: PcacData) {\n self.hideTooltip();\n rest(this, d);\n })\n .on('click', (_event: MouseEvent, d: PcacData) => {\n this.barClickedSource.next(d);\n });\n makeMarksAccessible(bars, {\n label: (d, bar) => this.markLabel(d, { parent: tooltipOptions(bar).parent, valueFormat: this.xAxis.format }),\n skip: (d) => !!d.hide,\n activate: (d) => this.barClickedSource.next(d),\n focus: (bar, d) => {\n highlight(bar, d);\n this.showMarkTooltip(bar, d, tooltipOptions(bar));\n },\n blur: (bar, d) => {\n this.hideMarkTooltip(bar);\n rest(bar, d);\n },\n });\n bars\n .transition()\n .duration(this.transitionService.getTransitionDuration())\n .attr('width', (d: PcacData) => {\n return this.xScale(endOf(d)) - this.xScale(startOf(d));\n });\n }\n\n private drawThresholdAcrossChart(config: PcacBarHorizontalChartConfig) {\n const threshold = groupThreshold(config.thresholds, 0);\n if (!threshold) {\n return;\n }\n this.applyPreTransitionThresholdStyles(this.svg.select('.pcac-bars').append('rect'))\n .attr('height', this.height)\n .attr('data-group-threshold-id', 0)\n .on('mousemove', (event: MouseEvent) => {\n this.showTooltip(event, threshold, { index: 0, isThreshold: true, valueFormat: this.xAxis.format });\n })\n .transition()\n .duration(this.transitionService.getTransitionDuration())\n .attr('x', this.xScale(Number(threshold.value)));\n }\n\n /** One threshold across each group that has one; groups without an entry are skipped. */\n private drawThresholdsPerGroup(config: PcacBarHorizontalChartConfig) {\n const self = this;\n const groupIndexOf = (rect: Element) => Number((rect.parentElement as HTMLElement).dataset['groupId']);\n const groups = this.svg.selectAll<SVGGElement, PcacData>('.pcac-bar-group')\n .filter((_: PcacData, i: number) => groupThreshold(config.thresholds, i) !== null);\n this.applyPreTransitionThresholdStyles(groups.append('rect'))\n .attr('height', this.yScaleStacked.bandwidth())\n .attr('data-group-threshold-id', function (this: SVGRectElement) {\n return groupIndexOf(this);\n })\n .on('mousemove', function (this: SVGRectElement, event: MouseEvent) {\n const index = groupIndexOf(this);\n // A threshold's own PcacData is typically just a value, so its parent is the *data* group\n // it's drawn against (which has the key) rather than the threshold entry it came from.\n self.showTooltip(\n event,\n groupThreshold(config.thresholds, index) as PcacData,\n { index, parent: config.data[index], parentIndex: index, isThreshold: true, valueFormat: self.xAxis.format }\n );\n })\n .transition()\n .duration(this.transitionService.getTransitionDuration())\n .attr('x', (_: unknown, i: number, nodes: ArrayLike<Element>) => {\n return this.xScale(Number(groupThreshold(config.thresholds, groupIndexOf(nodes[i]))?.value));\n });\n }\n\n /** One threshold across each bar that has one; bars without an entry are skipped. */\n private drawThresholdsPerBarInGroup(group: GroupType, config: PcacBarHorizontalChartConfig) {\n const self = this;\n const thresholdOf = (rect: Element) => barThreshold(\n config.thresholds,\n Number((rect.parentElement as HTMLElement).dataset['groupId']),\n Number(rect.getAttribute('data-group-threshold-id')),\n );\n const rects = this.applyPreTransitionThresholdStyles(group.enter().append('rect'))\n .attr('data-group-threshold-id', (_: PcacData, i: number) => {\n return i;\n })\n // Placed in its bar's slot up front - only its value (`x`) animates. Set on the transition,\n // it slid in from the top of the group, where the vertical chart's appear in place.\n // ScaleBand can return undefined for a key outside its domain; `.attr()` needs null, not undefined.\n .attr('y', (d: PcacData, i: number) => this.yScaleGrouped(this.slotOf(d, i)) ?? null)\n .attr('height', this.yScaleGrouped.bandwidth());\n rects.filter(function (this: SVGRectElement) {\n return thresholdOf(this) === null;\n }).remove();\n rects.filter(function (this: SVGRectElement) {\n return thresholdOf(this) !== null;\n })\n .on('mousemove', function (this: SVGRectElement, event: MouseEvent) {\n const index = Number(this.getAttribute('data-group-threshold-id'));\n const groupIndex = Number((this.parentElement as HTMLElement).dataset['groupId']);\n // Parent is the data group (see drawThresholdsPerGroup), not the threshold entry itself.\n self.showTooltip(\n event,\n thresholdOf(this) as PcacData,\n { index, parent: config.data[groupIndex], parentIndex: groupIndex, isThreshold: true, valueFormat: self.xAxis.format }\n );\n })\n .transition()\n .duration(this.transitionService.getTransitionDuration())\n .attr('x', (_: PcacData, i: number, nodes: ArrayLike<Element>) => {\n return this.xScale(Number(thresholdOf(nodes[i])?.value));\n });\n }\n\n private applyPreTransitionThresholdStyles<S extends Selection<any, any, any, any>>(elm: S): S {\n return elm.attr('class', 'pcac-threshold')\n .style('fill', () => {\n return this.colorService.getAlert();\n })\n .style('stroke', () => {\n return this.colorService.getAlert();\n })\n .style('stroke-width', () => {\n return 2;\n })\n .attr('width', '3px')\n .on('mouseout', () => {\n this.hideTooltip();\n });\n }\n}\n","import { DestroyRef, ElementRef, Injectable, Signal, afterNextRender, inject } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { Subject } from 'rxjs';\nimport { debounceTime } from 'rxjs/operators';\n\n/**\n * Rebuilds a chart whenever its container's real, laid-out size changes.\n *\n * A plain `window:resize` listener (the previous approach) misses any layout-driven size change\n * that isn't a viewport resize — a sidebar collapsing, a tab becoming active, a flex/grid reflow.\n * It also can't help a chart that mounts already holding data (e.g. behind a loading gate): that\n * chart's first build `effect` run can fire before the browser has committed layout for its own\n * just-created DOM node, so `PcacChart.initializeChartState()` measures a 0-width container and\n * bails out with nothing drawn — and with no resize ever firing, nothing retries it.\n *\n * `ResizeObserver`'s callback contract guarantees real, laid-out dimensions on every firing,\n * including its first, so observing the container naturally retries that exact case.\n */\n@Injectable({ providedIn: 'root' })\nexport class PcacChartResizeService {\n /**\n * Call once from a chart component's constructor (an injection context).\n * @param chartElm Signal resolving to the chart's `<svg>` element ref, e.g. a `viewChild.required` query.\n * @param rebuild Invoked whenever the chart's container size changes: immediately for the\n * observer's first (guaranteed-initial) callback, debounced for every one after that.\n */\n observe(chartElm: Signal<ElementRef>, rebuild: () => void): void {\n const destroyRef = inject(DestroyRef);\n const trigger$ = new Subject<void>();\n trigger$.pipe(\n debounceTime(300),\n takeUntilDestroyed(destroyRef)\n ).subscribe(rebuild);\n\n // chartElm() is a required viewChild query: unreadable until this component's own view has\n // been created, so we defer the observe() call itself rather than reading it eagerly here.\n afterNextRender(() => {\n const container = chartElm().nativeElement.parentNode as HTMLElement;\n // The observer's first callback is its guaranteed initial one (see the class doc comment) -\n // it's correcting an already-wrong first paint (e.g. a host layout, like a Material sidenav,\n // that hasn't finished settling its width yet when this chart's very first build ran), not\n // responding to live resize churn, so it shouldn't sit behind the same 300ms debounce meant\n // for that. Left debounced, that correction could land while the wrong-width build's own\n // enter transition is still visibly mid-animation, restarting it partway through - firing it\n // immediately instead means the correction lands within a frame or two, before there's\n // anything to visibly interrupt. Every callback after the first is still debounced normally.\n let firstCallback = true;\n const observer = new ResizeObserver(() => {\n if (firstCallback) {\n firstCallback = false;\n rebuild();\n return;\n }\n trigger$.next();\n });\n observer.observe(container);\n destroyRef.onDestroy(() => observer.disconnect());\n });\n }\n}\n","import { Directive, TemplateRef, inject } from '@angular/core';\nimport { PcacData } from './chart.model';\n\n/**\n * A datum drawn at the same coordinate as the hovered one (see `PcacTooltipContext.coincident`),\n * located the same way the context locates `$implicit`: `parent` is the series it belongs to,\n * `index` its position in `parent.data`, `parentIndex` the series' position in the chart's `data`.\n */\nexport interface PcacTooltipCoincident {\n data: PcacData;\n parent: PcacData;\n index: number;\n parentIndex: number;\n}\n\n/**\n * Template context handed to a consumer's `<ng-template pcacTooltip>` each time a tooltip is shown.\n */\nexport interface PcacTooltipContext {\n /**\n * The hovered datum: a bar, a line/area/plot point, a pie slice, or a threshold. Bound with a\n * bare `let-point` (or any name) in the template.\n */\n $implicit: PcacData;\n\n /**\n * The `PcacData` the hovered datum sits inside - the group a bar belongs to, or the series a\n * point belongs to. For a threshold, the data group it's drawn against (a threshold's own\n * `PcacData` usually carries only a value, so this is where its label lives). `null` when there\n * is no enclosing level (pie slices, a chart-wide threshold).\n */\n parent: PcacData | null;\n\n /**\n * True when the hovered element is a threshold marker on a bar chart rather than a data point.\n * In that case `$implicit` is the threshold's own `PcacData`.\n */\n isThreshold: boolean;\n\n /**\n * Position of `$implicit` in the array it was taken from: `parent.data` when there is a parent\n * (a bar within its group, a point within its series), or the chart's top-level `data` when\n * there isn't (a pie slice). For a threshold it's the position in `config.thresholds`, or in\n * `config.thresholds[parentIndex].data` for a per-bar threshold.\n *\n * Together with `parentIndex` this lets a template reach back into whatever collection the\n * `PcacData` was built from, as long as that collection is parallel to `data` (same order, no\n * filtering): `items[parentIndex][index]` for a two-level chart, `items[index]` for a pie.\n * Charts never reorder `data`, so the correspondence is stable across builds and resizes.\n */\n index: number;\n\n /**\n * Position of `parent` in the chart's top-level `data`; `null` whenever `parent` is.\n */\n parentIndex: number | null;\n\n /**\n * Every *other* datum drawn at exactly the same coordinate as `$implicit`, in data order, so a\n * template can list who else is at the hovered point. Set by the line, area and plot charts,\n * whether or not the plot chart's `pointFanOut` has spread the points apart (without it, the\n * hovered point is the only one of them visible, which makes this list all the more useful).\n * Empty on the other charts and whenever nothing shares the point.\n */\n coincident: PcacTooltipCoincident[];\n}\n\n/**\n * Marks an `<ng-template>` projected into any chart component as that chart's tooltip. When\n * present it replaces the default key/value tooltip *entirely* - the library only positions the\n * rendered template; it applies no background, padding or text styling of its own, so the template\n * owns the whole box.\n *\n * ```html\n * <pcac-bar-vertical-chart [config]=\"config\">\n * <ng-template pcacTooltip let-point let-group=\"parent\">\n * <div class=\"my-tooltip\">{{ group?.key }} / {{ point.key }}: {{ point.value | number }}</div>\n * </ng-template>\n * </pcac-bar-vertical-chart>\n * ```\n *\n * The template is rendered with full Angular semantics (pipes, directives, components, DI from\n * the declaring component), so anything a normal template can do works here too. `index` and\n * `parentIndex` locate the hovered datum within `data`, so a template can pull extra fields from\n * the consumer's own source collection when that collection is parallel to `data`:\n *\n * ```html\n * <ng-template pcacTooltip let-point let-i=\"index\" let-g=\"parentIndex\">\n * <div class=\"my-tooltip\">{{ orders[g!][i].customer }}: {{ point.value | number }}</div>\n * </ng-template>\n * ```\n *\n * `coincident` lists the other points at the hovered coordinate, each located the same way:\n *\n * ```html\n * <ng-template pcacTooltip let-point let-others=\"coincident\">\n * <div class=\"my-tooltip\">\n * {{ point.key }}, {{ point.value }}\n * @for (other of others; track other.parentIndex) { <div>Also here: {{ other.parent.key }}</div> }\n * </div>\n * </ng-template>\n * ```\n */\n@Directive({\n selector: 'ng-template[pcacTooltip]'\n})\nexport class PcacTooltipDirective {\n readonly templateRef = inject<TemplateRef<PcacTooltipContext>>(TemplateRef);\n\n /**\n * Lets the template type-checker know the shape of `let-` variables declared on the\n * `<ng-template>`, so `point.value` etc. are checked against `PcacData` under strictTemplates.\n */\n static ngTemplateContextGuard(_dir: PcacTooltipDirective, _ctx: unknown): _ctx is PcacTooltipContext {\n return true;\n }\n}\n","import { Component, ElementRef, ViewEncapsulation, contentChild, effect, inject, viewChild, input } from '@angular/core';\nimport { outputFromObservable } from '@angular/core/rxjs-interop';\nimport { BarHorizontalChartBuilder } from './bar-horizontal-chart.builder';\nimport { PcacBarHorizontalChartConfig } from './bar-horizontal-chart.model';\nimport { PcacChartResizeService } from '../../core/resize.service';\nimport { PcacTooltipDirective } from '../../core/tooltip.directive';\n\n@Component({\n selector: 'pcac-bar-horizontal-chart',\n // While `config().heightFull` is on, the chart fills its container instead of using a fixed\n // height (see PcacChartConfig.heightFull). That only works if this host element itself has a\n // height to hand down, so the class stretches it to `height: 100%`; the styling lives in CSS\n // rather than being measured/set in JS so the browser resolves it as part of normal layout.\n host: { '[class.pcac-height-full]': 'config().heightFull' },\n templateUrl: './bar-horizontal-chart.component.html',\n styleUrl: './bar-horizontal-chart.component.scss',\n encapsulation: ViewEncapsulation.None,\n providers: [BarHorizontalChartBuilder]\n})\nexport class PcacBarHorizontalChart {\n private chartBuilder = inject(BarHorizontalChartBuilder);\n\n readonly config = input.required<PcacBarHorizontalChartConfig>();\n private readonly chartElm = viewChild.required<ElementRef>('chart');\n readonly barClicked = outputFromObservable(this.chartBuilder.barClicked$);\n\n /**\n * Optional consumer `<ng-template pcacTooltip>` projected into this element; replaces the\n * default tooltip when present (see PcacTooltipDirective).\n */\n readonly tooltipTemplate = contentChild(PcacTooltipDirective);\n\n constructor() {\n // Reacts to config() the same way ngOnChanges used to — reading it here (rather than a\n // lifecycle hook) is what makes this an effect: it tracks config() as its dependency and\n // reruns whenever a new value comes in, signal-input-changes-drive-behavior all the way down.\n effect(() => this.buildChart());\n\n // Handed over as a getter so the builder reads the query at hover time, not in the effect\n // above (see PcacChart.tooltipTemplate).\n this.chartBuilder.tooltipTemplate = () => this.tooltipTemplate()?.templateRef;\n\n inject(PcacChartResizeService).observe(this.chartElm, () => {\n // Skip the ResizeObserver's routine initial callback when it lands after the effect above\n // already built successfully at this same width — only a real size change (or a build\n // that never happened, e.g. the 0-width mount race) should trigger a rebuild here.\n if (this.chartBuilder.containerSizeChanged(this.chartElm())) {\n this.buildChart();\n }\n });\n }\n\n private buildChart(): void {\n const config = this.config();\n // Handed over even when empty: the builder clears what it last drew rather than leaving it.\n if (config) {\n this.chartBuilder.buildChart(this.chartElm(), config);\n }\n }\n}\n","<section class=\"pcac-bar-horizontal-chart\">\n <svg #chart></svg>\n</section>\n","import { PcacAxisChartConfig, PcacData } from '../../core/chart.model';\n\nexport class PcacBarHorizontalChartConfig extends PcacAxisChartConfig {\n isStacked: boolean = false;\n thresholds: PcacData[] = [];\n spreadColorsPerGroup: boolean = false\n /**\n * Bar colors, any CSS color, in place of the theme palette - by series, or by group with\n * `spreadColorsPerGroup`. Repeated when there are more series (or groups) than colors. Omitted\n * or empty, the theme palette is used - optional, as on every chart's config.\n */\n colorOverride?: string[]\n}\n","import { Injectable, ElementRef } from '@angular/core';\n\nimport { select, Selection, BaseType } from 'd3-selection';\nimport { scaleBand, ScaleBand, scaleLinear, ScaleLinear } from 'd3-scale';\nimport { color } from 'd3-color';\n// Imported for its side effect only: this is what adds .transition() to d3-selection's\n// Selection prototype, which this builder leans on throughout.\nimport 'd3-transition';\n\n/**\n * Lib\n */\nimport { PcacBarVerticalChartConfig } from './bar-vertical-chart.model';\nimport { PcacChart, PcacTooltipOptions } from '../../core/chart';\nimport { makeMarksAccessible } from '../../core/marks';\nimport { PcacData } from '../../core/chart.model';\nimport { barSizes, stackStarts } from '../../core/stack';\nimport { barThreshold, barThresholdLayout, groupThreshold } from '../bar-thresholds';\nimport { barColorOverride, canRoundBands, colorOverrideWarning, hasDistinctSeriesKeys, seriesKeys, seriesSlots } from '../bar-series';\n\nimport { Subject } from 'rxjs';\n\n// `BaseType` (not the hand-rolled union this used to be, which omitted `null` and never\n// actually matched what `.selectAll()`'s default generics resolve to).\ntype GroupType = Selection<BaseType, PcacData, BaseType, PcacData>;\n\n/**\n * Provided per-component (see PcacBarVerticalChart's `providers`), not root-scoped:\n * this builder extends PcacChart, which holds mutable per-chart-instance state (margin, width,\n * height, colors, svg). A root singleton would be shared and clobbered by every\n * <pcac-bar-vertical-chart> rendered at once.\n */\n@Injectable()\nexport class BarVerticalChartBuilder extends PcacChart {\n private xScaleStacked!: ScaleBand<string>;\n private xScaleGrouped!: ScaleBand<string>;\n /** Warns, once for this chart, about a `colorOverride` in its old `{ colors }` shape. */\n private readonly warnOfColorOverride = colorOverrideWarning();\n /** A bar's slot in `xScaleGrouped`, from its datum and its index in its group (see `seriesSlots`). */\n private slotOf: (bar: PcacData, index: number) => string = (bar) => bar.key as string;\n private yScale!: ScaleLinear<number, number>;\n private barClickedSource = new Subject<PcacData>();\n barClicked$ = this.barClickedSource.asObservable();\n\n\n\n protected override chartTypeLabel = 'Bar chart';\n\n buildChart(chartElm: ElementRef, config: PcacBarVerticalChartConfig): void {\n if (!config?.data?.length) {\n this.clearChart(chartElm);\n return;\n }\n\n // Shallow copy: initializeAxisState() rewrites `height` for hidden axes, and that must not\n // land on the consumer's own config object (it previously did, growing it by the margins on\n // first build).\n config = { ...config };\n this.initializeAxisState(config, 'y');\n if (!this.initializeChartState(chartElm, config)) {\n return;\n }\n\n this.ensureColorCount(seriesKeys(config.data).length);\n this.applyColorOverride(barColorOverride(config.colorOverride, this.warnOfColorOverride));\n this.buildScales(config);\n this.drawChart(chartElm, config);\n }\n\n private buildScales(config: PcacBarVerticalChartConfig) {\n // `this.height`, not `config.height`: with `heightFull` on they differ (see\n // PcacChart.resolveHeight), and the axis, grid and bar baselines all use the resolved one.\n // Bars grow from 0, so only `domainMax` is read; `yAxis.domainMin` is ignored.\n this.yScale = scaleLinear()\n .rangeRound([0, this.height])\n .domain([this.yAxis.domainMax as number, 0]);\n\n this.xScaleStacked = scaleBand()\n .domain(config.data.map((d) => d.key as string))\n .range([0, this.width])\n // Rounded to whole pixels for crisp bar edges, while there's room to (see canRoundBands).\n .round(canRoundBands(this.width, config.data.length))\n .padding(0.1);\n\n const slots = seriesSlots(config.data);\n this.slotOf = slots.slotOf;\n this.xScaleGrouped = scaleBand()\n .padding(0.2)\n .range([0, this.xScaleStacked.bandwidth()])\n .round(canRoundBands(this.xScaleStacked.bandwidth(), slots.domain.length))\n .domain(slots.domain);\n }\n\n private drawChart(chartElm: ElementRef, config: PcacBarVerticalChartConfig): void {\n this.buildContainer(chartElm);\n this.axisBuilder.drawAxis(this.axisBuilderConfig(this.xScaleStacked, this.yScale));\n this.drawGrids(this.xScaleStacked, this.yScale);\n this.addGroups(config);\n this.axisBuilder.raiseAxes(this.svg);\n this.restoreTabStop(chartElm);\n }\n\n private addGroups(config: PcacBarVerticalChartConfig) {\n const groupsContainer = this.svg.append('g')\n .attr('class', 'pcac-bars')\n .selectAll('g')\n .data(config.data)\n .enter().append('g')\n .attr('class', 'pcac-bar-group')\n .attr('data-group-id', (d: PcacData, i: number) => {\n return i;\n })\n .attr('transform', (d: PcacData) => {\n return 'translate(' + this.xScaleStacked(d.key as string) + ',0)';\n });\n\n const group = groupsContainer.selectAll('rect')\n .data((d: PcacData) => {\n return d.data ?? [];\n });\n\n this.drawBarsPerGroup(group, config);\n\n switch (barThresholdLayout(config.thresholds, config.isStacked)) {\n case 'chart':\n this.drawThresholdAcrossChart(config);\n break;\n case 'group':\n this.drawThresholdsPerGroup(config);\n break;\n case 'bar':\n this.drawThresholdsPerBarInGroup(group, config);\n break;\n }\n }\n\n private drawBarsPerGroup(group: GroupType, config: PcacBarVerticalChartConfig) {\n const self = this;\n // Stacked bars sit on top of the ones before them in their group; every other layout draws\n // from the baseline (start 0).\n // Sizes honor `hide` (and treat a null or non-numeric value as 0), so a hidden bar keeps its\n // slot and color but draws nothing - see `barSizes`.\n const sizes = barSizes(config.data);\n const starts = config.isStacked ? stackStarts(config.data, sizes) : new Map<PcacData, number>();\n const startOf = (d: PcacData) => starts.get(d) ?? 0;\n const endOf = (d: PcacData) => startOf(d) + (sizes.get(d) ?? 0);\n // Colored by series - the bar's key's place among every group's keys, the same slot it's drawn\n // in - rather than by its position in its own group, which differs when groups hold different\n // series. By position after all when the keys can't tell series apart (see\n // `hasDistinctSeriesKeys`), and with `spreadColorsPerGroup`, by group instead.\n const keys = seriesKeys(config.data);\n const byKey = hasDistinctSeriesKeys(config.data);\n const fillOf = (d: PcacData, bar: SVGRectElement) => {\n if (config.spreadColorsPerGroup) {\n return this.colors[Number((bar.parentNode as Element).getAttribute('data-group-id'))];\n }\n return this.colors[byKey ? keys.indexOf(d.key as string) : Number(bar.getAttribute('data-group-bar-id'))];\n };\n // The hover fades run as their own named transition: an unnamed one would cancel the enter\n // transition still growing the bar, leaving it part-grown until the next rebuild. Shared by\n // the pointer and keyboard focus (see makeMarksAccessible).\n const highlight = (bar: SVGRectElement, d: PcacData) => {\n const fill = fillOf(d, bar);\n select(bar)\n .transition('hover')\n .duration(this.transitionService.getTransitionDuration() / 5)\n .style('fill', color(fill)?.darker(1).toString() ?? fill);\n };\n const rest = (bar: SVGRectElement, d: PcacData) => {\n select(bar)\n .transition('hover')\n .duration(this.transitionService.getTransitionDuration() / 5)\n .style('fill', fillOf(d, bar));\n };\n const tooltipOptions = (bar: SVGRectElement): PcacTooltipOptions => {\n const groupIndex = Number((bar.parentNode as Element).getAttribute('data-group-id'));\n const index = Number(bar.getAttribute('data-group-bar-id'));\n return { index, parent: config.data[groupIndex], parentIndex: groupIndex, valueFormat: this.yAxis.format };\n };\n const bars = group.enter().append('rect')\n .attr('class', 'pcac-bar')\n // A stacked bar spans its whole group, which is already translated into place; looking its\n // series key up in the group band put it off in another group's slot whenever the key\n // matched a group key.\n .attr('x', (d: PcacData, i: number) => config.isStacked ? 0 : this.xScaleGrouped(this.slotOf(d, i)) ?? 0)\n .attr('data-group-bar-id', (_: PcacData, i: number) => {\n return i;\n })\n .style('fill', function (this: SVGRectElement, d: PcacData) {\n return fillOf(d, this);\n })\n .attr('y', () => {\n return this.height;\n })\n .attr('height', 0)\n .on('mouseover', function (this: SVGRectElement, _event: MouseEvent, d: PcacData) {\n highlight(this, d);\n })\n .on('mousemove', function (this: SVGRectElement, event: MouseEvent, d: PcacData) {\n self.showTooltip(event, d, tooltipOptions(this));\n })\n .on('mouseout', function (this: SVGRectElement, _event: MouseEvent, d: PcacData) {\n self.hideTooltip();\n rest(this, d);\n })\n .on('click', (_, d: PcacData) => {\n this.barClickedSource.next(d);\n });\n makeMarksAccessible(bars, {\n label: (d, bar) => this.markLabel(d, { parent: tooltipOptions(bar).parent, valueFormat: this.yAxis.format }),\n skip: (d) => !!d.hide,\n activate: (d) => this.barClickedSource.next(d),\n focus: (bar, d) => {\n highlight(bar, d);\n this.showMarkTooltip(bar, d, tooltipOptions(bar));\n },\n blur: (bar, d) => {\n this.hideMarkTooltip(bar);\n rest(bar, d);\n },\n });\n bars\n .transition()\n .duration(this.transitionService.getTransitionDuration())\n .attr('width', !config.isStacked ? this.xScaleGrouped.bandwidth() : this.xScaleStacked.bandwidth())\n .attr('y', (d: PcacData) => {\n return this.yScale(endOf(d));\n })\n .attr('height', (d: PcacData) => {\n return this.yScale(startOf(d)) - this.yScale(endOf(d));\n });\n }\n\n private drawThresholdAcrossChart(config: PcacBarVerticalChartConfig) {\n const threshold = groupThreshold(config.thresholds, 0);\n if (!threshold) {\n return;\n }\n this.applyPreTransitionThresholdStyles(this.svg.select('.pcac-bars').append('rect'))\n .attr('width', this.width)\n .attr('data-group-threshold-id', 0)\n .on('mousemove', (event: MouseEvent) => {\n this.showTooltip(event, threshold, { index: 0, isThreshold: true, valueFormat: this.yAxis.format });\n })\n .transition()\n .duration(this.transitionService.getTransitionDuration())\n .attr('y', this.yScale(Number(threshold.value)));\n }\n\n /** One threshold across each group that has one; groups without an entry are skipped. */\n private drawThresholdsPerGroup(config: PcacBarVerticalChartConfig) {\n const self = this;\n const groupIndexOf = (rect: Element) => Number((rect.parentElement as HTMLElement).dataset['groupId']);\n const groups = this.svg.selectAll<SVGGElement, PcacData>('.pcac-bar-group')\n .filter((_: PcacData, i: number) => groupThreshold(config.thresholds, i) !== null);\n this.applyPreTransitionThresholdStyles(groups.append('rect'))\n // Spans its whole group: the pre-transition styles place a rect by bar key, which a group\n // key can collide with.\n .attr('x', 0)\n .attr('width', this.xScaleStacked.bandwidth())\n .attr('data-group-threshold-id', function (this: SVGRectElement) {\n return groupIndexOf(this);\n })\n .on('mousemove', function (this: SVGRectElement, event: MouseEvent) {\n const index = groupIndexOf(this);\n // A threshold's own PcacData is typically just a value, so its parent is the *data* group\n // it's drawn against (which has the key) rather than the threshold entry it came from.\n self.showTooltip(\n event,\n groupThreshold(config.thresholds, index) as PcacData,\n { index, parent: config.data[index], parentIndex: index, isThreshold: true, valueFormat: self.yAxis.format }\n );\n })\n .transition()\n .duration(this.transitionService.getTransitionDuration())\n .attr('y', (_: unknown, i: number, nodes: ArrayLike<Element>) => {\n return this.yScale(Number(groupThreshold(config.thresholds, groupIndexOf(nodes[i]))?.value));\n });\n }\n\n /** One threshold across each bar that has one; bars without an entry are skipped. */\n private drawThresholdsPerBarInGroup(group: GroupType, config: PcacBarVerticalChartConfig) {\n const self = this;\n const thresholdOf = (rect: Element) => barThreshold(\n config.thresholds,\n Number((rect.parentElement as HTMLElement).dataset['groupId']),\n Number(rect.getAttribute('data-group-threshold-id')),\n );\n const rects = this.applyPreTransitionThresholdStyles(group.enter().append('rect'))\n .attr('data-group-threshold-id', (_: PcacData, i: number) => {\n return i;\n })\n .attr('width', this.xScaleGrouped.bandwidth());\n rects.filter(function (this: SVGRectElement) {\n return thresholdOf(this) === null;\n }).remove();\n rects.filter(function (this: SVGRectElement) {\n return thresholdOf(this) !== null;\n })\n .on('mousemove', function (this: SVGRectElement, event: MouseEvent) {\n const index = Number(this.getAttribute('data-group-threshold-id'));\n const groupIndex = Number((this.parentElement as HTMLElement).dataset['groupId']);\n // Parent is the data group (see drawThresholdsPerGroup), not the threshold entry itself.\n self.showTooltip(\n event,\n thresholdOf(this) as PcacData,\n { index, parent: config.data[groupIndex], parentIndex: groupIndex, isThreshold: true, valueFormat: self.yAxis.format }\n );\n })\n .transition()\n .duration(this.transitionService.getTransitionDuration())\n .attr('y', (_: PcacData, i: number, nodes: ArrayLike<Element>) => {\n return this.yScale(Number(thresholdOf(nodes[i])?.value));\n });\n }\n\n private applyPreTransitionThresholdStyles<S extends Selection<any, any, any, any>>(elm: S): S {\n return elm.attr('class', 'pcac-threshold')\n .attr('x', (d: any, i: number) => {\n // Not every caller's selection has a per-item PcacData bound (the whole-chart threshold\n // rect has none), hence the defensive fallback rather than assuming `d` is always present.\n const datum = d as PcacData | undefined;\n // ScaleBand can return undefined for a key outside its domain; `.attr()` needs null, not undefined.\n return this.xScaleGrouped(datum ? this.slotOf(datum, i) : '') ?? null;\n })\n .attr('y', () => {\n return this.height;\n })\n .attr('height', 0)\n .style('fill', () => {\n return this.colorService.getAlert();\n })\n .style('stroke', () => {\n return this.colorService.getAlert();\n })\n .style('stroke-width', () => {\n return 2;\n })\n .on('mouseout', () => {\n this.hideTooltip();\n })\n .attr('height', () => {\n return '3px';\n });\n }\n}\n","import { Component, ElementRef, ViewEncapsulation, contentChild, effect, inject, viewChild, input } from '@angular/core';\nimport { outputFromObservable } from '@angular/core/rxjs-interop';\nimport { BarVerticalChartBuilder } from './bar-vertical-chart.builder';\nimport { PcacBarVerticalChartConfig } from './bar-vertical-chart.model';\nimport { PcacChartResizeService } from '../../core/resize.service';\nimport { PcacTooltipDirective } from '../../core/tooltip.directive';\n\n@Component({\n selector: 'pcac-bar-vertical-chart',\n // While `config().heightFull` is on, the chart fills its container instead of using a fixed\n // height (see PcacChartConfig.heightFull). That only works if this host element itself has a\n // height to hand down, so the class stretches it to `height: 100%`; the styling lives in CSS\n // rather than being measured/set in JS so the browser resolves it as part of normal layout.\n host: { '[class.pcac-height-full]': 'config().heightFull' },\n templateUrl: './bar-vertical-chart.component.html',\n styleUrl: './bar-vertical-chart.component.scss',\n encapsulation: ViewEncapsulation.None,\n providers: [BarVerticalChartBuilder]\n})\nexport class PcacBarVerticalChart {\n private chartBuilder = inject(BarVerticalChartBuilder);\n\n readonly config = input.required<PcacBarVerticalChartConfig>();\n private readonly chartElm = viewChild.required<ElementRef>('chart');\n readonly barClicked = outputFromObservable(this.chartBuilder.barClicked$);\n\n /**\n * Optional consumer `<ng-template pcacTooltip>` projected into this element; replaces the\n * default tooltip when present (see PcacTooltipDirective).\n */\n readonly tooltipTemplate = contentChild(PcacTooltipDirective);\n\n constructor() {\n // Reacts to config() the same way ngOnChanges used to — reading it here (rather than a\n // lifecycle hook) is what makes this an effect: it tracks config() as its dependency and\n // reruns whenever a new value comes in, signal-input-changes-drive-behavior all the way down.\n effect(() => this.buildChart());\n\n // Handed over as a getter so the builder reads the query at hover time, not in the effect\n // above (see PcacChart.tooltipTemplate).\n this.chartBuilder.tooltipTemplate = () => this.tooltipTemplate()?.templateRef;\n\n inject(PcacChartResizeService).observe(this.chartElm, () => {\n // Skip the ResizeObserver's routine initial callback when it lands after the effect above\n // already built successfully at this same width — only a real size change (or a build\n // that never happened, e.g. the 0-width mount race) should trigger a rebuild here.\n if (this.chartBuilder.containerSizeChanged(this.chartElm())) {\n this.buildChart();\n }\n });\n }\n\n private buildChart(): void {\n const config = this.config();\n // Handed over even when empty: the builder clears what it last drew rather than leaving it.\n if (config) {\n this.chartBuilder.buildChart(this.chartElm(), config);\n }\n }\n}\n","<section class=\"pcac-bar-vertical-chart\">\n <svg #chart></svg>\n</section>\n","import { PcacAxisChartConfig, PcacData } from '../../core/chart.model';\n\nexport class PcacBarVerticalChartConfig extends PcacAxisChartConfig {\n isStacked: boolean = false;\n thresholds: PcacData[] = [];\n spreadColorsPerGroup: boolean = false\n /**\n * Bar colors, any CSS color, in place of the theme palette - by series, or by group with\n * `spreadColorsPerGroup`. Repeated when there are more series (or groups) than colors. Omitted\n * or empty, the theme palette is used - optional, as on every chart's config.\n */\n colorOverride?: string[]\n}\n","// Only what a consumer configures, binds or styles with. The chart plumbing - the `PcacChart`\n// base class and the builders, the axis/grid/tooltip/transition/resize services, and the\n// resolved-config helpers - is internal, so it can change without breaking anyone.\nexport {\n PcacAxisChartConfig,\n PcacAxisConfig,\n PcacAxisSubLabels,\n PcacChartConfig,\n PcacData,\n PcacDataRange,\n PcacFormatEnum,\n PcacRangeBounds,\n} from './chart.model';\nexport * from './color.service';\nexport * from './tooltip.directive';\n","import { PcacAxisChartConfig } from '../core/chart.model';\n\nexport enum PcacLineAreaPlotChartConfigType {\n Line = 'line',\n Area = 'area',\n Plot = 'plot'\n}\n\n/**\n * Sizing for the images drawn in place of a point's dot (see `PcacData.image`). An image is\n * scaled uniformly (up or down) to fit inside a `maxWidth` x `maxHeight` box, preserving its\n * aspect ratio, and is centered on the data point exactly where the dot would have been.\n */\nexport class PcacPointImageConfig {\n maxWidth: number = 16\n maxHeight: number = 16\n}\n\n/** How a point's `range` is drawn (see `PcacPointRangeConfig.style`). */\nexport enum PcacPointRangeStyle {\n /** Error bars: a line across each range, capped at both ends. */\n Whiskers = 'whiskers',\n /** A rectangle spanning the x range by the y range; a thin strip when only one is set. */\n Box = 'box',\n /**\n * A fill strongest at the point's value and fading out to the range's edges: an oval glow\n * with both ranges (brightest on the value, even off-center), a fading bar with one.\n */\n Fade = 'fade'\n}\n\n/** When a point's `range` shows (see `PcacPointRangeConfig.show`). */\nexport enum PcacPointRangeShow {\n /** Only the hovered point's range. */\n Hover = 'hover',\n /** Every range at `faintOpacity`, the hovered point's at full strength. */\n Faint = 'faint',\n /** Every range at full strength; the others dim while a point is hovered. */\n Always = 'always'\n}\n\n/**\n * Drawing for `PcacData.range` on the line/area/plot charts. Ranges sit above the lines/areas and\n * below the points, on the point's true coordinate (a fanned-out point's range stays on its\n * anchor), clipped to the plot area and following zoom. The chart draws no numbers for them; a\n * custom tooltip gets the point, `range` included.\n */\nexport class PcacPointRangeConfig {\n style: PcacPointRangeStyle = PcacPointRangeStyle.Whiskers\n show: PcacPointRangeShow = PcacPointRangeShow.Faint\n\n /** Opacity of the ranges at rest under `show: Faint`, 0 - 1. */\n faintOpacity: number = 0.2\n\n /**\n * Any CSS color for every range on the chart. Unset, each takes its series' color. Applied as\n * `--pcac-point-range-color` on the chart's `.point-ranges` group, so a stylesheet can set it\n * on an ancestor instead (a config value wins).\n */\n color?: string\n}\n\n/**\n * Drawing for `PcacData.gauge` on the line/area/plot charts: a ring around each point's mark (its\n * dot, or its image) whose arc fills clockwise from 12 o'clock in proportion to `gauge / max`,\n * over a faint full-circle track. Drawn with the mark, so it moves with zoom and fan-out; fan-out\n * spacing and the chart's edge space grow to fit it. Points without a `gauge` get no ring.\n */\nexport class PcacPointGaugeConfig {\n /** The `gauge` value of a full ring. Default 1, for values that are already a fraction. */\n max: number = 1\n\n /** Ring thickness in px. */\n width: number = 2.5\n\n /** Space between the mark (the image box, or a hovered dot) and the ring, in px. */\n gap: number = 3\n\n /** Draw the unfilled rest of the ring, so an arc reads as a share of a whole. */\n showTrack: boolean = true\n\n /**\n * What the gauge measures, e.g. `'PSA'`. When set, each point's screen reader name ends with it\n * and the point's value - \"…, PSA 0.018\" - since the ring itself is only visual. Unset, the\n * ring isn't read at all; say what it means in the chart's `ariaLabel`, or a custom tooltip.\n */\n name?: string\n\n /**\n * Any CSS color for the filled arc. Unset, each takes its series' color. Applied as\n * `--pcac-point-gauge-color` on the chart's `.dots` groups, so a stylesheet can set it on an\n * ancestor instead (a config value wins).\n */\n color?: string\n\n /** Any CSS color for the track (`--pcac-point-gauge-track-color`). Theme default `$gray-200`. */\n trackColor?: string\n}\n\n/**\n * A line across the plot at one value on an axis (see `PcacLineAreaChartConfig.referenceLines`):\n * a target, a threshold, a median. Drawn dashed, over the grid and under the series, clipped to\n * the plot area, and moved with zoom like the data.\n */\nexport class PcacReferenceLine {\n /** Which axis `value` is on: `'y'` draws a horizontal line, `'x'` a vertical one. */\n axis: 'x' | 'y' = 'y'\n\n /**\n * Where the line sits, in the axis's own terms: a number on the y axis; on the x axis, whatever\n * a point's `key` would be under `xAxis.format` - a number for `Decimal`, a date (or anything\n * `new Date()` reads) for `DateTime`, a series index otherwise.\n */\n value: number | string = 0\n\n /**\n * A few words drawn at one end of the line, inside the plot (see `labelPosition`). Styled by the\n * theme's `.reference-line-label` rule.\n */\n label?: string\n\n /**\n * Which end of the line `label` sits at. `'end'`, the default, is above the right end of a\n * horizontal line and beside the top of a vertical one; `'start'` is above its left end and beside\n * its bottom - for when the far end is crowded, say by a corner label.\n */\n labelPosition: 'start' | 'end' = 'end'\n\n /**\n * Any CSS color for the line and its label. Theme default `$gray-500`. Applied as\n * `--pcac-reference-line-color` on the line's group, so a stylesheet can set it on an ancestor\n * instead (a config value wins).\n */\n color?: string\n}\n\n/**\n * Text pinned to the plot area's corners (see `PcacLineAreaChartConfig.cornerLabels`) - names for\n * the regions the plot divides into, such as the quadrants between two reference lines. Pinned to\n * the plot's frame rather than to data, so they stay put when the chart is zoomed. Drawn under the\n * series, so a point in the corner covers its label rather than the other way round, unless the\n * chart sets `labelsOnTop`. Any corner left unset is left empty.\n */\nexport class PcacCornerLabels {\n topLeft?: string\n topRight?: string\n bottomLeft?: string\n bottomRight?: string\n\n /**\n * Any CSS color for all four. Theme default `$gray-600`. Applied as `--pcac-corner-label-color`\n * on their group, so a stylesheet can set it on an ancestor instead (a config value wins).\n */\n color?: string\n}\n\n/**\n * The axes' `format` and `domainMin`/`domainMax` (`PcacAxisConfig`) do more here than on the bar\n * charts. `yAxis.domainMin`/`domainMax` are the y scale's domain (default 0..100). `xAxis.format`\n * decides how each point's `key` becomes an x position: `Decimal` reads it as a number on a\n * linear scale from `xAxis.domainMin` to `domainMax`, `DateTime` parses it with `new Date()` on\n * a time scale between the two (both required), and every other format - including the default -\n * places points by their index within their series, sizing the axis from the first series'\n * length and ignoring the domain fields.\n */\nexport class PcacLineAreaChartConfig extends PcacAxisChartConfig {\n enableEffects: boolean = true\n /**\n * Zoom and pan along the x / y axis (scroll / pinch to zoom 1x-10x, drag to pan, never leaving\n * the original domain). Either, or both, can be on. A gesture is always two-dimensional, so with\n * only one enabled the other axis simply stays put. Both off by default. The zoom is kept when\n * the chart redraws - a new config, a series toggled in a legend, a resize (which keeps the same\n * part of the domain in view) - and dropped when zoom is turned off or the zoomable axes change.\n */\n enableZoomX: boolean = false\n enableZoomY: boolean = false\n\n /**\n * Series colors, any CSS color, in place of the theme palette, one per series in order. Repeats\n * from the start when there are more series than colors, as the default palette does. Omitted or\n * empty, the theme palette is used - optional, as on every chart's config.\n */\n colorOverride?: string[]\n\n /**\n * Bounding box for any point images (`PcacData.image`) on this chart. Optional; each field falls\n * back to the `PcacPointImageConfig` default when not given, so a consumer only setting `image`\n * on their data still gets a sensibly-sized result.\n */\n pointImage?: Partial<PcacPointImageConfig>\n\n /**\n * Draw each point's `range` (see `PcacData.range`). Off when not set; `{}` turns it on with\n * every `PcacPointRangeConfig` default. Points without a `range` draw nothing extra.\n */\n pointRange?: Partial<PcacPointRangeConfig>\n\n /**\n * Dashed lines at chosen values on either axis (see `PcacReferenceLine`). None when not set.\n * They are decoration for sighted readers - hidden from screen readers like the grid - so when\n * one carries meaning, say so in the chart's `ariaLabel`.\n */\n referenceLines?: Partial<PcacReferenceLine>[]\n\n /**\n * Draw each point's `gauge` as a ring around its mark (see `PcacData.gauge`). Off when not set;\n * `{}` turns it on with every `PcacPointGaugeConfig` default. Points without a `gauge` draw\n * nothing extra.\n */\n pointGauge?: Partial<PcacPointGaugeConfig>\n\n /**\n * Labels in the plot's four corners (see `PcacCornerLabels`). None when not set. Hidden from\n * screen readers like the grid, so when they carry meaning, say so in the chart's `ariaLabel`.\n */\n cornerLabels?: PcacCornerLabels\n\n /**\n * Draw the corner labels and reference-line labels over the series instead of under it, each\n * outlined in a halo so it stays readable on whatever it crosses - for a chart whose points crowd\n * the corners or the lines' ends, where they'd otherwise hide the labels. Default false. The halo\n * is `--pcac-label-halo-color`, the theme's `$white` by default: set it to the chart's background\n * (a dark one, say) on the chart or any ancestor. The labels never take the pointer, so a point\n * under one can still be hovered and clicked. The reference lines themselves stay under the series.\n */\n labelsOnTop?: boolean\n}\n","import { PcacAxisChartConfig } from '../core/chart.model';\nimport { PcacPointImageConfig } from '../plot-line-area-chart/plot-line-area-chart.model';\n\n/**\n * A dot plot: every point placed along one value axis (x), and points that share a value - or,\n * with `binWidth`, fall in the same bin - stacked into a column above it, one mark per point. It\n * shows how values are distributed while keeping every item visible and hoverable, which suits\n * items with their own identity (and their own `image`) better than a histogram's bars.\n *\n * `data` is series, each holding its points - the same shape as the plot chart - so points can be\n * colored by group. A point's `value` is its position on the axis and its `key` its name (in the\n * tooltip and to screen readers). A point whose `value` isn't a number is left out, as is a series\n * or point with `hide`.\n *\n * The axes: `xAxis` is the value axis - `domainMin` / `domainMax` fix its span (by default it\n * spans the data, rounded out to nice ticks), `format` formats its ticks and the tooltip's value,\n * and every label, sub label, tick and grid setting applies. There is no y scale - a column's\n * height is a count of marks, not a value - so the y axis is never drawn; `yAxis` is ignored.\n */\nexport class PcacDotPlotChartConfig extends PcacAxisChartConfig {\n /**\n * Group values into bins this wide, in the axis's units, and stack each bin at its center: with\n * values 7, 7.5 and 8 and a `binWidth` of 1, the 7 and 7.5 share a column. Unset (the default),\n * only equal values stack. Bins start at `xAxis.domainMin`, or 0 without one.\n */\n binWidth?: number\n\n /**\n * Radius of a point's dot, in px; default 6. Points with an `image` are sized by `pointImage`\n * instead. Optional, as `colorOverride` is on every chart, so an object literal needn't spell it out.\n */\n dotRadius?: number = 6\n\n /** Space between marks stacked in a column, in px; default 2. Optional, likewise. */\n gap?: number = 2\n\n /**\n * Bounding box for points' images (`PcacData.image`), drawn in place of their dots, as on the\n * plot chart. Each field falls back to its `PcacPointImageConfig` default.\n *\n * A column too tall for the chart's height shrinks every mark on the chart evenly until it fits,\n * so no point is ever cut off; give the chart more `height` to keep marks at full size.\n */\n pointImage?: Partial<PcacPointImageConfig>\n\n /**\n * Series colors, any CSS color, in place of the theme palette, one per series in order. Repeats\n * when there are more series than colors. Omitted or empty, the theme palette is used.\n */\n colorOverride?: string[]\n}\n","import { PcacData } from '../core/chart.model';\n\n/** Where one point sits in a dot plot, before it's scaled to pixels. */\nexport interface PcacDotPlacement {\n /** The point itself (the element from its series' `data`). */\n data: PcacData;\n /** Its series, and that series' index in `config.data` - which color it takes. */\n series: PcacData;\n seriesIndex: number;\n /** Its index within its series' `data`. */\n index: number;\n /** Where its column sits on the value axis: its value, or its bin's center. */\n position: number;\n /** Its place in the column, 0 at the bottom. */\n level: number;\n}\n\n/** A point's value as a number to place it by, or `null` when it has none. */\nexport function dotValue(d: PcacData): number | null {\n const value = typeof d.value === 'number' ? d.value : typeof d.value === 'string' && d.value.trim() !== '' ? Number(d.value) : NaN;\n return Number.isFinite(value) ? value : null;\n}\n\n/**\n * Stacks every drawable point into columns: points with an equal value share a column or, with a\n * positive `binWidth`, points in the same bin (bins run from `origin`, each `binWidth` wide) share\n * one at the bin's center. Within a column, points take levels in data order - series order, then\n * each series' own order - so the first is at the bottom. Hidden series and points, and points\n * with no numeric value, are left out.\n */\nexport function stackDots(series: PcacData[], binWidth?: number, origin = 0): PcacDotPlacement[] {\n const binned = !!binWidth && binWidth > 0;\n const levels = new Map<number, number>();\n const placements: PcacDotPlacement[] = [];\n series.forEach((s, seriesIndex) => {\n if (s.hide) {\n return;\n }\n (s.data ?? []).forEach((d, index) => {\n const value = dotValue(d);\n if (d.hide || value === null) {\n return;\n }\n const position = binned\n ? origin + (Math.floor((value - origin) / binWidth!) + 0.5) * binWidth!\n : value;\n const level = levels.get(position) ?? 0;\n levels.set(position, level + 1);\n placements.push({ data: d, series: s, seriesIndex, index, position, level });\n });\n });\n return placements;\n}\n\n/** How many marks the tallest column holds; 0 with none. */\nexport function tallestColumn(placements: PcacDotPlacement[]): number {\n return placements.reduce((tallest, p) => Math.max(tallest, p.level + 1), 0);\n}\n","import { ElementRef, Injectable } from '@angular/core';\nimport { select } from 'd3-selection';\nimport { extent } from 'd3-array';\nimport { scaleLinear, ScaleLinear } from 'd3-scale';\n// Imported for its side effect only: adds .transition() to d3-selection's Selection.\nimport 'd3-transition';\nimport { Subject } from 'rxjs';\n\nimport { PcacChart, PcacTooltipOptions } from '../core/chart';\nimport { PcacData } from '../core/chart.model';\nimport { makeMarksAccessible } from '../core/marks';\nimport { PcacPointImageConfig } from '../plot-line-area-chart/plot-line-area-chart.model';\nimport { PcacDotPlotChartConfig } from './dot-plot-chart.model';\nimport { PcacDotPlacement, stackDots, tallestColumn } from './dot-plot-layout';\n\n/** How much a hovered dot grows, in px of radius - also room kept for it at the plot's edges. */\nconst DOT_HOVER_GROWTH = 2;\n\n/**\n * Provided per-component (see PcacDotPlotChart's `providers`), like every builder that extends\n * PcacChart: it holds per-chart-instance state, which a root singleton would share between charts.\n */\n@Injectable()\nexport class DotPlotChartBuilder extends PcacChart {\n private dotClickedSource = new Subject<PcacData>();\n dotClicked$ = this.dotClickedSource.asObservable();\n\n protected override chartTypeLabel = 'Dot plot';\n\n private xScale!: ScaleLinear<number, number>;\n private placements: PcacDotPlacement[] = [];\n private pointImage!: PcacPointImageConfig;\n /** A mark's size and the gap between stacked marks this build, after any shrinking to fit. */\n private markSize = 0;\n private markGap = 0;\n private dotRadius = 0;\n\n buildChart(chartElm: ElementRef, config: PcacDotPlotChartConfig): void {\n if (!config?.data?.length) {\n this.hideTooltip();\n this.clearChart(chartElm);\n return;\n }\n this.hideTooltip();\n\n // A column's height is a count of marks, not a value, so there's no y axis to draw.\n const rawXAxis = config.xAxis;\n config = { ...config, yAxis: { ...config.yAxis, hide: true } };\n\n const defaults = new PcacDotPlotChartConfig();\n const dotRadius = config.dotRadius ?? defaults.dotRadius!;\n const gap = config.gap ?? defaults.gap!;\n this.pointImage = { ...new PcacPointImageConfig(), ...config.pointImage };\n const origin = rawXAxis?.domainMin !== undefined ? Number(rawXAxis.domainMin) : 0;\n this.placements = stackDots(config.data, config.binWidth, origin);\n const hasImages = this.placements.some((p) => !!p.data.image);\n const hasDots = this.placements.some((p) => !p.data.image);\n const fullSize = hasImages\n ? Math.max(this.pointImage.maxWidth, this.pointImage.maxHeight)\n : 2 * (dotRadius + DOT_HOVER_GROWTH);\n const tallest = tallestColumn(this.placements);\n // `autoTickSize`: half the tallest mark at a given fit - a hovered dot (its growth isn't\n // scaled) or an image's box - toward the x axis.\n const markHalf = (fit: number) => Math.max(\n hasDots ? dotRadius * fit + DOT_HOVER_GROWTH : 0,\n hasImages ? this.pointImage.maxHeight * fit / 2 : 0,\n );\n\n // The fit shrinks marks to the plot's height, which an auto tick takes its length out of, so\n // with `autoTickSize` the layout is settled in up to three passes: at full size; at the size\n // that fit, if smaller; and - should the height that handed back have grown the marks past\n // that, rounding up a pixel - at the length they now need, which is still no longer than the\n // first, so the marks can only shrink again and never outgrow the tick.\n let tick = markHalf(1);\n for (let pass = 0; ; pass++) {\n if (!this.layout(chartElm, config, tick, fullSize)) {\n return;\n }\n const fit = tallest ? Math.min(1, this.height / (tallest * (fullSize + gap))) : 1;\n this.markSize = fullSize * fit;\n this.markGap = gap * fit;\n this.dotRadius = dotRadius * fit;\n const needed = Math.ceil(markHalf(fit));\n if (!this.xAxis.autoTickSize || this.xAxis.hide || needed === this.xAxis.tickSize || pass === 2) {\n break;\n }\n tick = needed;\n }\n this.ensureColorCount(config.data.length);\n this.applyColorOverride(config.colorOverride);\n\n this.xScale = this.buildXScale(rawXAxis?.domainMin, rawXAxis?.domainMax);\n this.drawChart(chartElm);\n }\n\n /**\n * Sets the axes and margins up and measures the plot area, with `tick` as the x axis's length\n * under `autoTickSize`. Returns `initializeChartState`'s result. On a copy of the config each\n * time: initializeAxisState() rewrites `height`, which mustn't reach the consumer's object or\n * build up over passes.\n */\n private layout(chartElm: ElementRef, config: PcacDotPlotChartConfig, tick: number, fullSize: number): boolean {\n config = { ...config };\n this.initializeAxisState(config, 'x', 0, { x: tick, y: 0 });\n // A mark at the domain's edge is centered on it, so half of it hangs past the plot area.\n const half = Math.ceil(fullSize / 2);\n this.reserveEdgeSpace({ left: half, right: half });\n return this.initializeChartState(chartElm, config);\n }\n\n /**\n * The value axis: `xAxis.domainMin` / `domainMax` where given, otherwise the data's extent\n * rounded out to nice ticks - checked on the consumer's own axis config, since the resolved one\n * fills in 0 - 100 for anything unset.\n */\n private buildXScale(domainMin: number | string | undefined, domainMax: number | string | undefined): ScaleLinear<number, number> {\n const [lo, hi] = extent(this.placements, (p) => p.position) as [number | undefined, number | undefined];\n const min = domainMin !== undefined ? Number(domainMin) : lo ?? 0;\n const max = domainMax !== undefined ? Number(domainMax) : hi ?? 1;\n const scale = scaleLinear().domain(min === max ? [min - 1, max + 1] : [min, max]).range([0, this.width]);\n return domainMin === undefined || domainMax === undefined ? scale.nice(this.xAxis.ticks) : scale;\n }\n\n private drawChart(chartElm: ElementRef): void {\n this.buildContainer(chartElm);\n const yScale = scaleLinear().domain([0, 1]).range([this.height, 0]);\n this.axisBuilder.drawAxis(this.axisBuilderConfig(this.xScale, yScale));\n this.drawGrids(this.xScale, yScale);\n this.axisBuilder.raiseAxes(this.svg);\n this.drawDots();\n this.restoreTabStop(chartElm);\n }\n\n /** The center of a placed point's mark, in plot pixels: its column's x, its level's y. */\n private center(p: PcacDotPlacement): { x: number; y: number } {\n const step = this.markSize + this.markGap;\n return {\n x: this.xScale(p.position),\n y: this.height - this.markGap - this.markSize / 2 - p.level * step,\n };\n }\n\n private drawDots(): void {\n const self = this;\n const duration = this.transitionService.getTransitionDuration();\n const { maxWidth, maxHeight } = this.pointImage;\n const fit = this.markSize / (this.placements.some((p) => !!p.data.image) ? Math.max(maxWidth, maxHeight) : 1);\n const imageWidth = maxWidth * fit;\n const imageHeight = maxHeight * fit;\n const color = (p: PcacDotPlacement) => this.colors[p.seriesIndex];\n const tooltipOptions = (p: PcacDotPlacement, anchor: Element | null = null): PcacTooltipOptions => ({\n index: p.index,\n parent: p.series,\n parentIndex: p.seriesIndex,\n valueFormat: this.xAxis.format,\n anchor,\n });\n const grow = (mark: SVGGElement, p: PcacDotPlacement, hovered: boolean) => {\n select(mark).select('.pcac-dot')\n .interrupt('hover')\n .transition('hover')\n .duration(duration / 3)\n .attr('r', hovered ? this.dotRadius + DOT_HOVER_GROWTH : this.dotRadius)\n .attr('fill', hovered ? color(p) : 'var(--pcac-dot-fill, #fff)');\n };\n\n const marks = this.svg.append('g')\n .attr('class', 'pcac-dots')\n .selectAll<SVGGElement, PcacDotPlacement>('.pcac-dot-mark')\n .data(this.placements)\n .enter().append('g')\n .attr('class', 'pcac-dot-mark')\n .attr('transform', (p) => `translate(${this.center(p).x}, ${this.center(p).y})`)\n .on('mouseover', function (this: SVGGElement, event: MouseEvent, p: PcacDotPlacement) {\n grow(this, p, true);\n self.showTooltip(event, p.data, tooltipOptions(p, select(this).select('.pcac-dot, .pcac-dot-image').node() as Element | null));\n })\n .on('mouseout', function (this: SVGGElement, _event: MouseEvent, p: PcacDotPlacement) {\n grow(this, p, false);\n self.hideTooltip();\n })\n .on('click', (_event: MouseEvent, p: PcacDotPlacement) => this.dotClickedSource.next(p.data));\n\n makeMarksAccessible(marks, {\n label: (p) => this.markLabel(p.data, { parent: p.series, valueFormat: this.xAxis.format }),\n activate: (p) => this.dotClickedSource.next(p.data),\n focus: (mark, p) => {\n grow(mark, p, true);\n this.showMarkTooltip(mark, p.data, tooltipOptions(p, select(mark).select('.pcac-dot, .pcac-dot-image').node() as Element | null));\n },\n blur: (mark, p) => {\n grow(mark, p, false);\n this.hideMarkTooltip(mark);\n },\n });\n\n // Each column builds up from the axis: a mark fades in a beat after the one below it.\n const delay = (p: PcacDotPlacement) => Math.min(p.level * 40, duration);\n marks.filter((p) => !p.data.image)\n .append('circle')\n .attr('class', 'pcac-dot')\n .attr('r', this.dotRadius)\n .attr('stroke', color)\n .attr('fill', 'var(--pcac-dot-fill, #fff)')\n .attr('opacity', 0)\n .transition()\n .delay(delay)\n .duration(duration / 2)\n .attr('opacity', 1);\n\n marks.filter((p) => !!p.data.image)\n .append('image')\n .attr('class', 'pcac-dot-image')\n .attr('href', (p) => p.data.image as string)\n .attr('width', imageWidth)\n .attr('height', imageHeight)\n .attr('x', -imageWidth / 2)\n .attr('y', -imageHeight / 2)\n .attr('preserveAspectRatio', 'xMidYMid meet')\n .attr('opacity', 0)\n .transition()\n .delay(delay)\n .duration(duration / 2)\n .attr('opacity', 1);\n }\n}\n","import { Component, ElementRef, ViewEncapsulation, contentChild, effect, inject, input, viewChild } from '@angular/core';\nimport { outputFromObservable } from '@angular/core/rxjs-interop';\nimport { DotPlotChartBuilder } from './dot-plot-chart.builder';\nimport { PcacDotPlotChartConfig } from './dot-plot-chart.model';\nimport { PcacChartResizeService } from '../core/resize.service';\nimport { PcacTooltipDirective } from '../core/tooltip.directive';\n\n/** A dot plot: points along one value axis, stacked into columns where they share a value (see PcacDotPlotChartConfig). */\n@Component({\n selector: 'pcac-dot-plot-chart',\n // See PcacBarVerticalChart: `heightFull` needs the host to hand a height down.\n host: { '[class.pcac-height-full]': 'config().heightFull' },\n templateUrl: './dot-plot-chart.component.html',\n styleUrl: './dot-plot-chart.component.scss',\n encapsulation: ViewEncapsulation.None,\n providers: [DotPlotChartBuilder]\n})\nexport class PcacDotPlotChart {\n private chartBuilder = inject(DotPlotChartBuilder);\n\n readonly config = input.required<PcacDotPlotChartConfig>();\n private readonly chartElm = viewChild.required<ElementRef>('chart');\n readonly dotClicked = outputFromObservable(this.chartBuilder.dotClicked$);\n\n /** Optional consumer `<ng-template pcacTooltip>`, replacing the default tooltip (see PcacTooltipDirective). */\n readonly tooltipTemplate = contentChild(PcacTooltipDirective);\n\n constructor() {\n effect(() => this.buildChart());\n // A getter, so the builder reads the query at hover time rather than in the effect above.\n this.chartBuilder.tooltipTemplate = () => this.tooltipTemplate()?.templateRef;\n inject(PcacChartResizeService).observe(this.chartElm, () => {\n if (this.chartBuilder.containerSizeChanged(this.chartElm())) {\n this.buildChart();\n }\n });\n }\n\n private buildChart(): void {\n const config = this.config();\n // Handed over even when empty: the builder clears what it last drew rather than leaving it.\n if (config) {\n this.chartBuilder.buildChart(this.chartElm(), config);\n }\n }\n}\n","<section class=\"pcac-dot-plot-chart\">\n <svg #chart></svg>\n</section>\n","import { Component, computed, inject, model, output } from '@angular/core';\nimport { PcacColorService } from '../core';\n\nexport class PcacLegendConfigItem {\n label!: string;\n checked: boolean = true;\n colorOverride: string | null = null;\n}\n\nexport class PcacLegendConfig {\n heading: string | null = null;\n items: PcacLegendConfigItem[] = [];\n}\n\nlet nextLegendId = 0;\n\n@Component({\n selector: 'pcac-legend',\n templateUrl: './legend.component.html',\n styleUrl: './legend.component.scss',\n // One named group of switches, so a screen reader announces the heading (\"Series\") on entering\n // the legend, and each switch as part of it, rather than a heading and some unrelated switches.\n host: {\n role: 'group',\n '[attr.aria-labelledby]': 'config().heading ? headingId : null',\n },\n})\nexport class PcacLegend {\n readonly headingId = `pcac-legend-heading-${nextLegendId++}`;\n private readonly colorService = inject(PcacColorService);\n config = model.required<PcacLegendConfig>();\n itemClicked = output<PcacLegendConfigItem[]>();\n\n colorScale = computed(() => \n this.colorService.getColorScale(this.config().items.length)\n );\n\n onItemClicked(index: number) {\n const items = this.config().items.map((item, i) =>\n i === index ? { ...item, checked: !item.checked } : item\n );\n this.config.set({ ...this.config(), items });\n this.itemClicked.emit(items);\n }\n}\n","@if (config().heading) {\n<div class=\"pcac-legend-label\" [id]=\"headingId\"><small>{{config().heading}}</small></div>\n}\n@for(item of config().items; track $index; let i = $index) {\n<div class=\"pcac-legend-item\" [class.pcac-legend-unchecked]=\"!item.checked\"\n role=\"switch\" [attr.aria-checked]=\"item.checked\" tabindex=\"0\" (click)=\"onItemClicked(i)\"\n (keydown.enter)=\"onItemClicked(i)\" (keydown.space)=\"onItemClicked(i); $event.preventDefault()\">\n @let color = item.colorOverride ? item.colorOverride : colorScale()[i];\n <div class=\"pcac-legend-circle\" [style.backgroundColor]=\"color\"></div>\n <small>{{ item.label }}</small>\n</div>\n}\n","import { ScaleLinear, ScaleTime } from \"d3-scale\";\nimport { PcacData, PcacFormatEnum } from \"../../core\";\n\n/**\n * Whether a point has an x key to position by. An explicit emptiness check, not truthiness: a\n * Decimal key of `0` is a perfectly good coordinate (the left edge of a `domainMin: 0` axis) and\n * used to be read as \"no key\" - drawn at pixel 0 whatever the domain, and pinned there under zoom.\n */\nexport function hasKey(data: PcacData): boolean {\n return data.key !== null && data.key !== undefined && data.key !== '';\n}\n\nexport function getXFormat(type: PcacFormatEnum, data: PcacData, index: number, xScale: ScaleLinear<number, number> | ScaleTime<number, number, never>) {\n switch (type) {\n case PcacFormatEnum.DateTime:\n if (hasKey(data)) {\n return xScale(new Date(data.key as string | number));\n }\n return 0\n case PcacFormatEnum.Decimal:\n if (hasKey(data)) {\n return xScale(Number(data.key));\n }\n return 0\n default:\n return xScale(index)\n }\n}\n","import { PcacData } from '../../../core';\n\n/** Whether a point has a numeric value to draw at. */\nexport function hasValue(d: PcacData): boolean {\n return d.value !== null && d.value !== undefined && d.value !== '' && Number.isFinite(Number(d.value));\n}\n","import { Selection, BaseType } from 'd3-selection';\nimport { ScaleLinear, ScaleTime } from 'd3-scale';\nimport { PcacData, PcacFormatEnum } from '../../../core';\nimport { axisTickFormat } from '../../../core/tick-format';\nimport { Injectable } from '@angular/core';\nimport { select } from 'd3-selection';\nimport { getXFormat } from '../x-format';\nimport { hasValue } from './has-value';\n\nexport interface IPlaChartEffectsBuilderConfig {\n colors: string[];\n data: PcacData[];\n width: number;\n height: number;\n svg: Selection<SVGGElement, unknown, BaseType, unknown>;\n x: ScaleLinear<number, number> | ScaleTime<number, number, never>;\n y: ScaleLinear<number, number> | ScaleTime<number, number, never>;\n /** The x axis's format, so the crosshair positions points the way the lines do (`getXFormat`). */\n xFormat: PcacFormatEnum;\n /** The y axis's format and tick count, so the crosshair's value reads like the axis labels. */\n yFormat?: PcacFormatEnum;\n yTicks?: number;\n}\n\n/**\n * Provided per-component (see PcacLineAreaChartComponent's `providers`), not root-scoped: this\n * holds mutable per-chart-instance state (`config`, `series`) despite looking like a stateless\n * helper. A root singleton would be shared and clobbered by every `<pcac-line-area-chart>`\n * rendered at once — each instance's hover effects would end up reading/writing whichever\n * chart's `buildEffects()` ran last, not their own.\n */\n@Injectable()\nexport class PlaChartEffectsBuilder {\n private config!: IPlaChartEffectsBuilderConfig;\n // The series that get an effect group, each with its index in `config.data` (which is what its\n // line's color is picked by, so a skipped empty series doesn't shift the colors after it).\n private series: { data: PcacData; index: number }[] = [];\n /** Where the cursor last was over the plot, while the crosshair is showing; null otherwise. */\n private lastMousePos: [number, number] | null = null;\n\n buildEffects(config: IPlaChartEffectsBuilderConfig): void {\n this.config = config;\n this.lastMousePos = null;\n this.series = config.data\n .map((data, index) => ({ data, index }))\n .filter(({ data }) => data.data.length > 0);\n this.buildCollection();\n this.buildCanvas();\n }\n\n /**\n * Swaps in the scales a zoom has rescaled. The crosshair positions and labels its points\n * against the scales, so a zoom has to hand them over here or it would track the unzoomed\n * lines.\n */\n updateScales(x: IPlaChartEffectsBuilderConfig['x'], y: IPlaChartEffectsBuilderConfig['y']): void {\n this.config.x = x;\n this.config.y = y;\n // A wheel zoom moves the lines under a cursor that stays put, and sends no mousemove - so the\n // crosshair is re-read at the same spot, or it would sit on the pre-zoom values until the\n // mouse next moved.\n if (this.lastMousePos) {\n this.onMouseMove(this.lastMousePos);\n }\n }\n\n private buildCollection() {\n const collection = this.config.svg.append('g')\n .attr('class', 'effects')\n // The hover crosshair repeats, for the pointer, what the points' own names say.\n .attr('aria-hidden', 'true');\n\n collection.append('path')\n .attr('class', 'effect-line');\n\n const mousePerLine = collection.selectAll('.effect-group')\n .data(this.series)\n .enter().append('g')\n .attr('class', 'effect-group')\n .attr('style', ({ data }) => data.hide ? 'display: none' : null);\n\n mousePerLine.append('circle')\n .attr('r', 7)\n .attr('class', 'effect-circle')\n .style('stroke', ({ index }) => this.config.colors[index]);\n\n mousePerLine.append('text')\n .attr('class', 'effect-text')\n .attr('y', 1.5)\n .attr('transform', 'translate(10,3)');\n }\n\n private buildCanvas(): void {\n this.config.svg.append('rect')\n .attr('class', 'effects-canvas')\n .attr('width', this.config.width)\n .attr('height', this.config.height)\n .attr('pointer-events', 'all')\n .on('mouseout', () => {\n this.hideEffects();\n })\n .on('mouseover', () => {\n this.showEffects();\n })\n .on('mousemove', (event: MouseEvent) => {\n const current = event.currentTarget as Element\n const parent = current.parentElement\n const xForms = parent?.getAttribute('transform')\n if(!xForms) \n return this.onMouseMove([event.offsetX, event.offsetY]);\n \n const parts = /translate\\(\\s*([^\\s,)]+)[ ,]([^\\s,)]+)/.exec(xForms);\n if(!parts) \n return this.onMouseMove([event.offsetX, event.offsetY]);\n const x = Number(parts[1])\n this.onMouseMove([event.offsetX - x, event.offsetY]);\n });\n }\n\n private showEffects() {\n this.config.svg.select('.effect-line')\n .style('opacity', '1');\n this.config.svg.selectAll('.effect-group circle')\n .style('opacity', '1');\n this.config.svg.selectAll('.effect-group text')\n .style('opacity', '1');\n }\n\n private hideEffects() {\n this.lastMousePos = null;\n this.config.svg.select('.effect-line')\n .style('opacity', '0');\n this.config.svg.selectAll('.effect-group circle')\n .style('opacity', '0');\n this.config.svg.selectAll('.effect-group text')\n .style('opacity', '0');\n }\n\n private onMouseMove(mousePos: [number, number]) {\n this.lastMousePos = mousePos;\n this.updateLine(mousePos);\n this.updateEffects(mousePos);\n }\n\n private updateLine(mousePos: [number, number]) {\n this.config.svg.select('.effect-line')\n .attr('d', () => 'M' + mousePos[0] + ',' + this.config.height + ' ' + mousePos[0] + ',' + 0);\n }\n\n private updateEffects(mousePos: [number, number]) {\n this.config.svg.selectAll<SVGGElement, { data: PcacData }>('.effect-group')\n .each((series, index, nodes) => {\n const group = select(nodes[index]);\n const value = this.valueAt(series.data.data, mousePos[0]);\n // No value under the cursor (a gap in the series): nothing to mark, so the group is\n // hidden rather than left at its last position.\n group.attr('visibility', value === null ? 'hidden' : null);\n if (value === null) {\n return;\n }\n group.attr('transform', 'translate(' + mousePos[0] + ',' + this.config.y(value) + ')');\n group.select('text').text(this.formatValue(value));\n });\n }\n\n /**\n * The series' value at plot x `mouseX`, interpolated along the segment of the line that spans it\n * - the same (linear) join the line/area draws between two consecutive points - or null if it\n * falls in a gap, where the line isn't drawn. Beyond the line's leftmost/rightmost point it holds\n * that point's value.\n *\n * Works on the segments in data order and never assumes x increases along them: DateTime or\n * Decimal data can come newest-first (or in any order), and the line still joins consecutive\n * points - reading \"the first point\" as the leftmost one showed the newest value everywhere.\n *\n * Worked out from the data rather than by walking the drawn path: an area's outline doubles\n * back along its baseline, so a search over the path's geometry could land on the bottom edge\n * and read the wrong value.\n */\n private valueAt(points: PcacData[], mouseX: number): number | null {\n const xAt = (i: number) => getXFormat(this.config.xFormat, points[i], i, this.config.x);\n const valueOf = (i: number) => Number(points[i].value);\n const drawn = points.map((_, i) => i).filter((i) => hasValue(points[i]));\n if (!drawn.length) {\n return null;\n }\n\n // A segment joins two points next to each other in the data, both with a value - a point\n // without one between them breaks the line (`defined(hasValue)`).\n for (let i = 1; i < points.length; i++) {\n if (!hasValue(points[i - 1]) || !hasValue(points[i])) {\n continue;\n }\n const [xa, xb] = [xAt(i - 1), xAt(i)];\n if (mouseX < Math.min(xa, xb) || mouseX > Math.max(xa, xb)) {\n continue;\n }\n const [va, vb] = [valueOf(i - 1), valueOf(i)];\n return xb === xa ? vb : va + (vb - va) * (mouseX - xa) / (xb - xa);\n }\n\n const leftmost = drawn.reduce((min, i) => (xAt(i) < xAt(min) ? i : min));\n const rightmost = drawn.reduce((max, i) => (xAt(i) > xAt(max) ? i : max));\n if (mouseX <= xAt(leftmost)) {\n return valueOf(leftmost);\n }\n if (mouseX >= xAt(rightmost)) {\n return valueOf(rightmost);\n }\n return null;\n }\n\n /**\n * The crosshair's value, formatted the way the y axis labels its ticks - same format, same\n * step-based precision - rather than rounded to a whole number, which read a 0-1 axis as 0 or 1.\n */\n private formatValue(value: number): string {\n const y = this.config.y as ScaleLinear<number, number>;\n const formatter = axisTickFormat(this.config.yFormat, y, this.config.yTicks)\n ?? y.tickFormat(this.config.yTicks);\n return formatter(value);\n }\n}\n","import { PcacLineAreaChartConfig } from \"../plot-line-area-chart.model\";\n\n/**\n * How the plot chart spreads out points that share a coordinate (see\n * `PcacPlotChartConfig.pointFanOut`). Each group of coincident points is placed evenly around\n * a ring centered on the shared coordinate, starting at 12 o'clock and going clockwise in data\n * order (series order, then point order), so every point stays visible and hoverable. A ring at\n * the edge of the domain is moved back inside the plot area as one, so no member hangs over an\n * axis by more than half its mark - the same as a lone point there; the anchor stays put.\n */\nexport class PcacPointFanOutConfig {\n /**\n * Ring radius in px, the same for every group. When not set, each group gets the smallest\n * radius at which its neighbors sit `gap` px apart - so a pair barely moves while a group of\n * five spreads as far as it has to.\n */\n radius?: number\n\n /**\n * Space between neighboring points on the ring, in px, when `radius` is not set. Measured\n * between their image boxes (or hovered dots), not their centers.\n */\n gap: number = 4\n\n /**\n * Draw a dot at the shared coordinate - the value the group's points actually have - with a\n * spoke out to each of them. Styled by the theme's `.fan-out-anchor` / `.fan-out-spoke` rules,\n * whose colors `anchorColor` / `spokeColor` override.\n */\n showAnchor: boolean = true\n\n /**\n * Spoke color, any CSS color; theme default `$gray-400`. Applied as `--pcac-fan-out-spoke-color`\n * on the chart's `.fan-outs` group, so a stylesheet can set it on an ancestor instead (a config\n * value wins). Needs `showAnchor`.\n */\n spokeColor?: string\n\n /** Anchor dot color, likewise (`--pcac-fan-out-anchor-color`); theme default `$gray-600`. */\n anchorColor?: string\n}\n\nexport class PcacPlotChartConfig extends PcacLineAreaChartConfig {\n /**\n * Spread points that share a coordinate around it instead of drawing them on top of one\n * another (where only the last series' point shows, and only it can be hovered). Off when not\n * set; `{}` turns it on with every `PcacPointFanOutConfig` default. The fanned points keep\n * their true value in the tooltip, and the hovered point's tooltip context lists the others at\n * its coordinate in `coincident` (see `PcacTooltipContext`).\n *\n * Plot chart only: a line or area chart's points are joined in series order, so moving one\n * would kink the line.\n */\n pointFanOut?: Partial<PcacPointFanOutConfig>\n}\n","\nimport { scaleTime } from 'd3-scale';\nimport { ScaleLinear, scaleLinear, ScaleTime } from 'd3-scale';\n\n\nimport { PcacData, PcacFormatEnum, PcacResolvedAxisConfig } from '../../../core/chart.model';\n\nexport class PlaChartScales {\n x!: ScaleLinear<number, number> | ScaleTime<number, number, never>;\n y!: ScaleLinear<number, number>;\n}\n\n/**\n * Takes the chart's *resolved* axes (`PcacChart.xAxis`/`yAxis`), not the raw config, so the\n * `format`/`domainMin`/`domainMax` defaults are already applied - see `PcacLineAreaChartConfig`\n * for what each format does with them.\n */\n/** The number of points in the longest series. */\nexport function longestSeriesLength(data: PcacData[]): number {\n return data.reduce((max, series) => Math.max(max, series.data.length), 0);\n}\n\nexport class PlaChartScalesBuilder {\n build(\n xAxis: PcacResolvedAxisConfig, yAxis: PcacResolvedAxisConfig, data: PcacData[], chartWidth: number, chartHeight: number\n ): PlaChartScales {\n const resp = new PlaChartScales();\n resp.x = this.buildXScale(xAxis, data, chartWidth);\n resp.y = this.buildYScale(yAxis, chartHeight);\n return resp;\n }\n\n private buildXScale(\n xAxis: PcacResolvedAxisConfig, data: PcacData[], chartWidth: number\n ): ScaleLinear<number, number> | ScaleTime<number, number, never> {\n switch (xAxis.format) {\n case PcacFormatEnum.DateTime:\n return scaleTime()\n .domain([new Date(xAxis.domainMin), new Date(xAxis.domainMax)])\n .range([0, chartWidth]);\n case PcacFormatEnum.Decimal:\n return scaleLinear()\n .domain([xAxis.domainMin as number, xAxis.domainMax as number])\n .range([0, chartWidth]);\n default:\n // DatasetLength and every other format position points by index - across the longest\n // series, not the first, which may be shorter or empty (an empty one gave [0, -1], an\n // inverted scale that pushed every point off the plot).\n return scaleLinear()\n .domain([0, Math.max(0, longestSeriesLength(data) - 1)])\n .range([0, chartWidth]);\n }\n }\n\n private buildYScale(yAxis: PcacResolvedAxisConfig, chartHeight: number): ScaleLinear<number, number> {\n return scaleLinear()\n .domain([yAxis.domainMin as number, yAxis.domainMax as number])\n .range([chartHeight, 0]);\n }\n}\n","import { line, Line } from 'd3-shape';\nimport { getXFormat } from '../x-format';\nimport { PcacData, PcacFormatEnum } from '../../../core';\nimport { PlaChartScales } from './scales.builder';\nimport { hasValue } from './has-value';\n\nexport function buildLineGenerator(format: PcacFormatEnum, scales: PlaChartScales): Line<PcacData> {\n return line<PcacData>()\n // A point with no numeric value leaves a gap rather than a NaN in the path, which browsers stop\n // drawing at - hiding the rest of the line.\n .defined(hasValue)\n .x((d: PcacData, i) => {\n return getXFormat(format, d, i, scales.x)\n })\n .y((d: PcacData) => {\n return scales.y(d.value as number);\n });\n}","import { Area, area } from 'd3-shape';\nimport { getXFormat } from '../x-format';\nimport { PcacData, PcacFormatEnum } from '../../../core';\nimport { PlaChartScales } from './scales.builder';\nimport { hasValue } from './has-value';\n\nexport function buildAreaGenerator(format: PcacFormatEnum, scales: PlaChartScales, chartHeight: number): Area<PcacData> {\n return area<PcacData>()\n // A point with no numeric value leaves a gap rather than a NaN in the path, which browsers stop\n // drawing at - hiding the rest of the area.\n .defined(hasValue)\n .x((d: PcacData, i) => {\n return getXFormat(format, d, i, scales.x);\n })\n .y0(chartHeight)\n .y1((d: PcacData) => {\n return scales.y(d.value as number);\n });\n}","import { D3ZoomEvent, ZoomBehavior, zoom } from \"d3-zoom\";\n\n/**\n * `extent` (the viewport the gesture happens in) is set to the plot area explicitly rather than\n * left to d3's default, which reads the *owning `<svg>`'s* size - plot plus margins. With the\n * viewport wider than `translateExtent`, d3's constraint centers the plot within it instead of\n * pinning the two together, so the first gesture (even one that zooms straight back out to k = 1)\n * left the chart shifted right/down by half the margins: x domain min detached from the y axis,\n * domain max pushed off the right edge.\n */\nexport function buildZoomBehavior(width: number, height: number, zoomedFn: (event: D3ZoomEvent<Element, unknown>) => void): ZoomBehavior<Element, unknown> {\n return zoom()\n .scaleExtent([1, 10])\n .extent([[0, 0], [width, height]])\n .translateExtent([[0, 0], [width, height]])\n .on(\"zoom\", zoomedFn);\n}\n","import { BaseType, Selection } from 'd3-selection';\nimport { PcacData, PcacFormatEnum } from '../../../core/chart.model';\nimport { PcacPointRangeStyle } from '../../plot-line-area-chart.model';\nimport { PlaChartScales } from './scales.builder';\n\n/**\n * A point's `range` in pixels, alongside the point's own position. `x0 < x1` and `y0 < y1` (so\n * `y0` is the range's *max* - the y scale runs top-down); an axis without a usable range has\n * neither of its pair.\n */\nexport interface PlaRangeExtent {\n cx: number;\n cy: number;\n x0?: number;\n x1?: number;\n y0?: number;\n y1?: number;\n}\n\n/** Half the length of a whisker's end cap, in px. */\nexport const RANGE_CAP = 5;\n/** How thick a box is drawn along an axis the point has no range on, in px. */\nexport const RANGE_STRIP = 4;\n/** How thick a fade is drawn along an axis the point has no range on, in px. */\nexport const RANGE_FADE_BAR = 10;\n\n/**\n * Where an x range bound lands, read the way `getXFormat` reads a key: a date for `DateTime`, a\n * number for `Decimal`, and a (possibly fractional) index for every index-based format. `NaN`\n * for anything that doesn't parse.\n */\nfunction xBound(value: number | string, format: PcacFormatEnum, scales: PlaChartScales): number {\n if (value === null || value === undefined || value === '') {\n return NaN;\n }\n if (format === PcacFormatEnum.DateTime) {\n return scales.x(new Date(value)) as number;\n }\n return scales.x(Number(value)) as number;\n}\n\n/**\n * Sorts a pair of pixel bounds, or returns nothing if either isn't a real number - or if they're\n * the same, since a range that doesn't span anything has nothing to draw (whiskers would be a\n * stray pair of caps, a box or fade zero-sized).\n */\nfunction span(a: number, b: number): [number, number] | undefined {\n if (!Number.isFinite(a) || !Number.isFinite(b) || a === b) {\n return undefined;\n }\n return a <= b ? [a, b] : [b, a];\n}\n\n/**\n * `d`'s range at these scales, drawn around `(cx, cy)` - the point's true coordinate - or `null`\n * when it has no range on either axis that can be placed.\n */\nexport function rangeExtent(\n d: PcacData, cx: number, cy: number, format: PcacFormatEnum, scales: PlaChartScales\n): PlaRangeExtent | null {\n const range = d.range;\n if (!range) {\n return null;\n }\n const xs = range.x ? span(xBound(range.x.min, format, scales), xBound(range.x.max, format, scales)) : undefined;\n const ys = range.y ? span(scales.y(Number(range.y.min)), scales.y(Number(range.y.max))) : undefined;\n if (!xs && !ys) {\n return null;\n }\n const extent: PlaRangeExtent = { cx, cy };\n if (xs) {\n [extent.x0, extent.x1] = xs;\n }\n if (ys) {\n [extent.y0, extent.y1] = ys;\n }\n return extent;\n}\n\n/**\n * Where the point sits within its range's box, as 0 - 1 fractions: the fade's brightest spot.\n * An axis without a range has the point in the middle.\n */\nexport function rangeFocus(extent: PlaRangeExtent): { fx: number; fy: number } {\n const fraction = (v: number, lo?: number, hi?: number) =>\n lo === undefined || hi === undefined || hi === lo ? 0.5 : Math.min(1, Math.max(0, (v - lo) / (hi - lo)));\n return { fx: fraction(extent.cx, extent.x0, extent.x1), fy: fraction(extent.cy, extent.y0, extent.y1) };\n}\n\n/**\n * (Re)draws one point's range into `group`, in plot coordinates, replacing whatever was there -\n * the same call serves the first draw and every zoom. `gradientId` must be unique in the page;\n * only the fade uses it. Colors, stroke widths and opacity all come from the theme (see\n * plot-line-area-chart.component.scss), so nothing here depends on the series.\n */\nexport function drawRange(\n group: Selection<SVGGElement, unknown, BaseType, unknown>,\n extent: PlaRangeExtent,\n style: PcacPointRangeStyle,\n gradientId: string\n): void {\n group.selectAll('*').remove();\n const { cx, cy, x0, x1, y0, y1 } = extent;\n\n switch (style) {\n case PcacPointRangeStyle.Box: {\n const left = x0 ?? cx - RANGE_STRIP / 2;\n const right = x1 ?? cx + RANGE_STRIP / 2;\n const top = y0 ?? cy - RANGE_STRIP / 2;\n const bottom = y1 ?? cy + RANGE_STRIP / 2;\n group.append('rect')\n .attr('class', 'point-range-box')\n .attr('x', left)\n .attr('y', top)\n .attr('width', right - left)\n .attr('height', bottom - top)\n .attr('rx', 2);\n return;\n }\n\n case PcacPointRangeStyle.Fade: {\n const { fx, fy } = rangeFocus(extent);\n const stops = (gradient: Selection<any, unknown, BaseType, unknown>, offsets: [number, number][]) => {\n for (const [offset, opacity] of offsets) {\n gradient.append('stop')\n .attr('class', 'point-range-stop')\n .attr('offset', offset)\n .attr('stop-opacity', opacity);\n }\n };\n // The gradient lives inside the point's own group, not the chart's <defs>, so its stops\n // inherit the color custom properties set on the series group above it. Sized in\n // objectBoundingBox units, so the brightest spot stays on the point as zoom stretches it.\n const defs = group.append('defs');\n if (x0 !== undefined && x1 !== undefined && y0 !== undefined && y1 !== undefined) {\n const gradient = defs.append('radialGradient')\n .attr('id', gradientId)\n .attr('cx', 0.5).attr('cy', 0.5).attr('r', 0.5)\n .attr('fx', fx).attr('fy', fy);\n stops(gradient, [[0, 0.8], [0.5, 0.35], [1, 0]]);\n group.append('ellipse')\n .attr('class', 'point-range-fade')\n .attr('cx', (x0 + x1) / 2)\n .attr('cy', (y0 + y1) / 2)\n .attr('rx', (x1 - x0) / 2)\n .attr('ry', (y1 - y0) / 2)\n .attr('fill', `url(#${gradientId})`);\n return;\n }\n const vertical = y0 !== undefined && y1 !== undefined;\n const gradient = defs.append('linearGradient')\n .attr('id', gradientId)\n .attr('x1', 0).attr('y1', 0)\n .attr('x2', vertical ? 0 : 1).attr('y2', vertical ? 1 : 0);\n stops(gradient, [[0, 0.05], [vertical ? fy : fx, 0.8], [1, 0.05]]);\n const left = x0 ?? cx - RANGE_FADE_BAR / 2;\n const right = x1 ?? cx + RANGE_FADE_BAR / 2;\n const top = y0 ?? cy - RANGE_FADE_BAR / 2;\n const bottom = y1 ?? cy + RANGE_FADE_BAR / 2;\n group.append('rect')\n .attr('class', 'point-range-fade')\n .attr('x', left)\n .attr('y', top)\n .attr('width', right - left)\n .attr('height', bottom - top)\n .attr('rx', RANGE_FADE_BAR / 2)\n .attr('fill', `url(#${gradientId})`);\n return;\n }\n\n default: {\n // Whiskers\n const line = (xa: number, ya: number, xb: number, yb: number, cls: string) =>\n group.append('line')\n .attr('class', cls)\n .attr('x1', xa).attr('y1', ya)\n .attr('x2', xb).attr('y2', yb);\n if (y0 !== undefined && y1 !== undefined) {\n line(cx, y0, cx, y1, 'point-range-whisker');\n line(cx - RANGE_CAP, y0, cx + RANGE_CAP, y0, 'point-range-cap');\n line(cx - RANGE_CAP, y1, cx + RANGE_CAP, y1, 'point-range-cap');\n }\n if (x0 !== undefined && x1 !== undefined) {\n line(x0, cy, x1, cy, 'point-range-whisker');\n line(x0, cy - RANGE_CAP, x0, cy + RANGE_CAP, 'point-range-cap');\n line(x1, cy - RANGE_CAP, x1, cy + RANGE_CAP, 'point-range-cap');\n }\n }\n }\n}\n","import { Selection } from 'd3-selection';\nimport { arc } from 'd3-shape';\nimport { PcacData } from '../../../core/chart.model';\nimport { PcacPointGaugeConfig } from '../../plot-line-area-chart.model';\n\n/** A hovered dot's radius - the largest a dot gets, so a ring around it never touches it. */\nexport const GAUGE_DOT_RADIUS = 6;\n\n/** Whether a point has a gauge value to draw. */\nexport function hasGauge(d: PcacData): boolean {\n return typeof d.gauge === 'number' && Number.isFinite(d.gauge);\n}\n\n/** How far a ring reaches past the mark it surrounds: its gap plus its full width. */\nexport function gaugeExtent(config: PcacPointGaugeConfig): number {\n return config.gap + config.width;\n}\n\n/** The share of the ring a value fills, clamped to 0 - 1. A `max` of 0 or less fills nothing. */\nexport function gaugeFraction(value: number, max: number): number {\n return max > 0 ? Math.min(1, Math.max(0, value / max)) : 0;\n}\n\n/**\n * Appends a `.point-gauge` ring to each point in `points` that has a `gauge`: a `.point-gauge-track`\n * circle (unless `showTrack` is off) and a `.point-gauge-arc` path filling clockwise from 12\n * o'clock. `markRadius` is half of what the ring surrounds - the image box, or a hovered dot - so\n * the ring's centerline sits `gap + width / 2` beyond it. Returned so the caller can place the\n * rings (see `drawDots`, which moves them with each point's fan-out offset and enter rise).\n */\nexport function drawPointGauges(\n points: Selection<SVGGElement, PcacData, SVGGElement, unknown>,\n config: PcacPointGaugeConfig,\n markRadius: (d: PcacData) => number,\n): Selection<SVGGElement, PcacData, SVGGElement, unknown> {\n const radius = (d: PcacData) => markRadius(d) + config.gap + config.width / 2;\n const gauges = points.filter(hasGauge)\n .append('g')\n .attr('class', 'point-gauge')\n .attr('aria-hidden', 'true');\n if (config.showTrack) {\n gauges.append('circle')\n .attr('class', 'point-gauge-track')\n .attr('r', radius)\n .attr('stroke-width', config.width);\n }\n gauges.append('path')\n .attr('class', 'point-gauge-arc')\n .attr('d', (d: PcacData) => {\n const fraction = gaugeFraction(d.gauge as number, config.max);\n if (fraction === 0) {\n return null;\n }\n const r = radius(d);\n // Rounded ends read as a gauge; a full ring has no ends to round.\n return arc().cornerRadius(fraction < 1 ? config.width / 2 : 0)({\n innerRadius: r - config.width / 2,\n outerRadius: r + config.width / 2,\n startAngle: 0,\n endAngle: 2 * Math.PI * fraction,\n });\n });\n return gauges;\n}\n","import { BaseType, Selection } from 'd3-selection';\nimport { PcacFormatEnum } from '../../../core/chart.model';\nimport { PcacCornerLabels, PcacReferenceLine } from '../../plot-line-area-chart.model';\nimport { PlaChartScales } from './scales.builder';\n\n/** How far a reference line's label, and a corner label, sits in from what it's attached to, in px. */\nconst LABEL_INSET = 4;\nconst CORNER_INSET = 8;\n\n/** A `PcacReferenceLine` with its defaults filled in. */\ntype PlaReferenceLine = PcacReferenceLine;\n\n/**\n * Where a reference line sits on its axis, in plot pixels, or `null` when its value doesn't place\n * (a date that won't parse, a non-numeric value) - such a line isn't drawn. An x value is read the\n * way a point's `key` is under the axis's format (see `getXFormat`).\n */\nexport function referenceLinePosition(\n line: PlaReferenceLine,\n scales: PlaChartScales,\n xFormat: PcacFormatEnum | undefined,\n): number | null {\n const position = line.axis === 'x'\n ? scales.x(xFormat === PcacFormatEnum.DateTime ? new Date(line.value) : Number(line.value))\n : scales.y(Number(line.value));\n return Number.isFinite(position) ? position : null;\n}\n\n/**\n * Draws `lines` into one `.reference-lines` group, clipped to the plot (`clipPathId`) so a line\n * zoomed past an edge disappears there, each a `.reference-line` group holding the dashed `<line>`.\n * Their labels go in a `.reference-line-labels` group of their own, clipped the same way, so they\n * can be raised over the series (`raiseLabels`) without the lines. Both hidden from screen readers,\n * as the grid is.\n */\nexport function drawReferenceLines(\n svg: Selection<SVGGElement, unknown, BaseType, unknown>,\n lines: Partial<PcacReferenceLine>[] | undefined,\n scales: PlaChartScales,\n xFormat: PcacFormatEnum | undefined,\n width: number,\n height: number,\n clipPathId: string,\n): void {\n if (!lines?.length) {\n return;\n }\n const resolved = lines.map((line): PlaReferenceLine => ({ ...new PcacReferenceLine(), ...line }));\n const groups = svg.append('g')\n .attr('class', 'reference-lines')\n .attr('clip-path', `url(#${clipPathId})`)\n .attr('aria-hidden', 'true')\n .selectAll('.reference-line')\n .data(resolved)\n .enter().append('g')\n .attr('class', (line: PlaReferenceLine) => `reference-line reference-line-${line.axis}`)\n .style('--pcac-reference-line-color', (line: PlaReferenceLine) => line.color ?? null);\n groups.append('line').attr('class', 'reference-line-stroke');\n const labelled = resolved.filter((line) => !!line.label);\n if (labelled.length) {\n svg.append('g')\n .attr('class', 'reference-line-labels')\n .attr('clip-path', `url(#${clipPathId})`)\n .attr('aria-hidden', 'true')\n .selectAll('.reference-line-label')\n .data(labelled)\n .enter().append('text')\n .attr('class', (line: PlaReferenceLine) => `reference-line-label reference-line-label-${line.axis}`)\n .style('--pcac-reference-line-color', (line: PlaReferenceLine) => line.color ?? null)\n .text((line: PlaReferenceLine) => line.label!);\n }\n positionReferenceLines(svg, scales, xFormat, width, height);\n}\n\n/**\n * Places the chart's reference lines, and their labels, against `scales` - on the first draw and\n * again on every zoom. A horizontal line's label sits above its right end, or its left with\n * `labelPosition: 'start'`; a vertical line's beside its top, or its bottom.\n */\nexport function positionReferenceLines(\n svg: Selection<SVGGElement, unknown, BaseType, unknown>,\n scales: PlaChartScales,\n xFormat: PcacFormatEnum | undefined,\n width: number,\n height: number,\n): void {\n const hidden = (line: PlaReferenceLine) => referenceLinePosition(line, scales, xFormat) === null ? 'none' : null;\n const groups = svg.selectAll<SVGGElement, PlaReferenceLine>('.reference-line').attr('display', hidden);\n const at = (line: PlaReferenceLine) => referenceLinePosition(line, scales, xFormat) ?? 0;\n const atStart = (line: PlaReferenceLine) => line.labelPosition === 'start';\n groups.select('.reference-line-stroke')\n .attr('x1', (line: PlaReferenceLine) => line.axis === 'x' ? at(line) : 0)\n .attr('x2', (line: PlaReferenceLine) => line.axis === 'x' ? at(line) : width)\n .attr('y1', (line: PlaReferenceLine) => line.axis === 'x' ? 0 : at(line))\n .attr('y2', (line: PlaReferenceLine) => line.axis === 'x' ? height : at(line));\n svg.selectAll<SVGTextElement, PlaReferenceLine>('.reference-line-label')\n .attr('display', hidden)\n .attr('x', (line: PlaReferenceLine) => line.axis === 'x'\n ? at(line) + LABEL_INSET\n : atStart(line) ? LABEL_INSET : width - LABEL_INSET)\n .attr('y', (line: PlaReferenceLine) => line.axis === 'x'\n ? atStart(line) ? height - LABEL_INSET : LABEL_INSET\n : at(line) - LABEL_INSET)\n .attr('text-anchor', (line: PlaReferenceLine) => line.axis === 'y' && !atStart(line) ? 'end' : 'start')\n .attr('dominant-baseline', (line: PlaReferenceLine) => line.axis === 'x' && !atStart(line) ? 'hanging' : 'auto');\n}\n\n/**\n * Draws `labels` into a `.corner-labels` group, each a `.corner-label` inset from its corner of\n * the plot area. Pinned to the frame, so zoom leaves them alone. Hidden from screen readers, as\n * the grid is.\n */\nexport function drawCornerLabels(\n svg: Selection<SVGGElement, unknown, BaseType, unknown>,\n labels: PcacCornerLabels | undefined,\n width: number,\n height: number,\n): void {\n if (!labels) {\n return;\n }\n const corners = [\n { text: labels.topLeft, x: CORNER_INSET, y: CORNER_INSET, anchor: 'start', baseline: 'hanging', name: 'top-left' },\n { text: labels.topRight, x: width - CORNER_INSET, y: CORNER_INSET, anchor: 'end', baseline: 'hanging', name: 'top-right' },\n { text: labels.bottomLeft, x: CORNER_INSET, y: height - CORNER_INSET, anchor: 'start', baseline: 'auto', name: 'bottom-left' },\n { text: labels.bottomRight, x: width - CORNER_INSET, y: height - CORNER_INSET, anchor: 'end', baseline: 'auto', name: 'bottom-right' },\n ].filter((corner) => !!corner.text);\n if (corners.length === 0) {\n return;\n }\n svg.append('g')\n .attr('class', 'corner-labels')\n .attr('aria-hidden', 'true')\n .style('--pcac-corner-label-color', () => labels.color ?? null)\n .selectAll('.corner-label')\n .data(corners)\n .enter().append('text')\n .attr('class', (corner) => `corner-label corner-label-${corner.name}`)\n .attr('x', (corner) => corner.x)\n .attr('y', (corner) => corner.y)\n .attr('text-anchor', (corner) => corner.anchor)\n .attr('dominant-baseline', (corner) => corner.baseline)\n .text((corner) => corner.text!);\n}\n\n/**\n * With `labelsOnTop`, moves the corner labels and reference-line labels above everything drawn\n * so far - the series included - and marks them for the theme's halo. Called after each draw and\n * each zoom, which re-raises the series over the axes it redraws.\n */\nexport function raiseLabels(svg: Selection<SVGGElement, unknown, BaseType, unknown>): void {\n svg.selectAll('.corner-labels, .reference-line-labels')\n .classed('pcac-labels-on-top', true)\n .raise();\n}\n","import { PcacData, PcacFormatEnum } from '../../../core/chart.model';\nimport { hasKey } from '../x-format';\nimport { hasValue } from './has-value';\n\n/** A point along with where it sits in the chart's `data`, the way a tooltip context reports it. */\nexport interface PlaCoincidentPoint {\n data: PcacData;\n series: PcacData;\n /** Position of `data` within `series.data`. */\n index: number;\n /** Position of `series` within the chart's top-level `data`. */\n seriesIndex: number;\n}\n\n/** Two or more points that would be drawn at exactly the same coordinate, in data order. */\nexport interface PlaCoincidentGroup {\n members: PlaCoincidentPoint[];\n}\n\n/** How far a fanned-out point is drawn from its true coordinate, in px. */\nexport interface PlaPointOffset {\n dx: number;\n dy: number;\n}\n\n/**\n * Finds every set of points that share a coordinate across all of the chart's visible series.\n * Coincidence is decided from the data rather than from scaled pixels, so this can run before\n * the scales exist (the space the fan-out needs has to be reserved before the plot area, and so\n * the scales, is sized): two points coincide when they have the same y `value` and the same x\n * position under `xFormat` - the same numeric `key` (`Decimal`), the same instant (`DateTime`), or\n * the same index within their series (every other format, which positions by index). Mirrors\n * `getXFormat()`, which is what actually places them. Hidden series and points without a value\n * are left out, as they aren't drawn.\n */\nexport function findCoincidentGroups(series: PcacData[], xFormat: PcacFormatEnum): PlaCoincidentGroup[] {\n const byPosition = new Map<string, PlaCoincidentPoint[]>();\n series.forEach((s, seriesIndex) => {\n if (s.hide) {\n return;\n }\n s.data.forEach((data, index) => {\n // Same test as the line/dots use, so a point that isn't drawn (`''`, NaN) never joins a ring.\n if (!hasValue(data)) {\n return;\n }\n // By numeric value, so `5` and `'5'` - drawn at the same spot - are recognized as sharing it.\n const key = `${xPositionKey(xFormat, data, index)}|${Number(data.value)}`;\n let members = byPosition.get(key);\n if (!members) {\n members = [];\n byPosition.set(key, members);\n }\n members.push({ data, series: s, index, seriesIndex });\n });\n });\n return Array.from(byPosition.values())\n .filter((members) => members.length > 1)\n .map((members) => ({ members }));\n}\n\nfunction xPositionKey(xFormat: PcacFormatEnum, data: PcacData, index: number): string | number {\n switch (xFormat) {\n case PcacFormatEnum.DateTime:\n return hasKey(data) ? new Date(data.key as string | number).getTime() : 'none';\n case PcacFormatEnum.Decimal:\n return hasKey(data) ? Number(data.key) : 'none';\n default:\n return index;\n }\n}\n\n/**\n * The smallest ring radius at which `count` marks of `size` px sit `gap` px apart from their\n * neighbors: the chord between adjacent ring positions is `2r sin(π/n)`, so solve it for\n * `size + gap`. A pair (n = 2) lands `size + gap` apart along a diameter, as expected.\n */\nexport function fanOutRadius(count: number, size: number, gap: number): number {\n return (size + gap) / (2 * Math.sin(Math.PI / count));\n}\n\n/**\n * Places each group's members evenly around a ring centered on their shared coordinate, the\n * first member at 12 o'clock and the rest clockwise. `radius` is called per group so it can\n * depend on the group's size (see `fanOutRadius`). Keyed by the point objects themselves,\n * which are the very elements the builder binds to the DOM, so lookups are exact.\n */\nexport function fanOutOffsets(groups: PlaCoincidentGroup[], radius: (group: PlaCoincidentGroup) => number): Map<PcacData, PlaPointOffset> {\n const offsets = new Map<PcacData, PlaPointOffset>();\n for (const group of groups) {\n const r = radius(group);\n const n = group.members.length;\n group.members.forEach((member, i) => {\n const angle = -Math.PI / 2 + (i * 2 * Math.PI) / n;\n offsets.set(member.data, { dx: round(r * Math.cos(angle)), dy: round(r * Math.sin(angle)) });\n });\n }\n return offsets;\n}\n\n/** Two decimal places is plenty for an SVG coordinate and keeps `cos(π/2)` from reading as `6e-17`. */\nfunction round(value: number): number {\n return Math.round(value * 100) / 100;\n}\n\n/** A pixel position within the plot area, the way the scales report one. */\nexport interface PlaPoint {\n x: number;\n y: number;\n}\n\n/**\n * How far to move a whole fanned-out ring so that none of its members' centers leave the plot\n * area - so a member at the edge of the domain hangs over the axis by at most half its mark,\n * exactly as a lone point at that coordinate would, rather than by half its mark plus the ring's\n * radius. The ring moves as one (its members keep their spacing) and the anchor stays put, so the\n * spokes simply get longer on the side that was pushed back. Per axis: if the ring pokes out past\n * 0 it comes back by that much, else if it pokes out past the far edge it comes back by that; a\n * ring too big to fit is kept in at the axis end, where the origin is.\n *\n * `anchor` is clamped to the plot area first, so once zoom carries a group's coordinate out of the\n * domain its members follow it out at the same pace instead of staying pinned to the edge (or\n * snapping the ring's radius the moment the anchor crosses): at the edge the correction is exactly\n * the outermost member's offset, and stays so beyond it.\n */\nexport function fanOutShift(anchor: PlaPoint, offsets: PlaPointOffset[], plot: { width: number; height: number }): PlaPointOffset {\n const dxs = offsets.map((o) => o.dx);\n const dys = offsets.map((o) => o.dy);\n return {\n dx: axisShift(clamp(anchor.x, 0, plot.width), Math.min(...dxs), Math.max(...dxs), plot.width),\n dy: axisShift(clamp(anchor.y, 0, plot.height), Math.min(...dys), Math.max(...dys), plot.height),\n };\n}\n\nfunction axisShift(anchor: number, min: number, max: number, size: number): number {\n if (anchor + min < 0) {\n return round(-(anchor + min));\n }\n if (anchor + max > size) {\n return round(size - (anchor + max));\n }\n return 0;\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n","import { ElementRef, Injectable, inject } from '@angular/core';\nimport { select, Selection } from 'd3-selection';\nimport { Line, Area } from 'd3-shape';\nimport { range } from 'd3-array';\nimport { ZoomBehavior, ZoomTransform, zoomIdentity } from 'd3-zoom';\n// Side effect only: adds .transition() to d3-selection's Selection, which the entry animations use.\nimport 'd3-transition';\nimport { Subject } from 'rxjs';\n\n/**\n * Lib\n */\nimport { PlaChartEffectsBuilder } from './effects.builders';\nimport { PcacLineAreaChartConfig, PcacLineAreaPlotChartConfigType, PcacPointGaugeConfig, PcacPointImageConfig, PcacPointRangeConfig } from '../../plot-line-area-chart.model';\nimport { PcacPlotChartConfig, PcacPointFanOutConfig } from '../../plot/plot.model';\nimport { PcacChart } from '../../../core/chart';\nimport { makeMarksAccessible, refreshTabStop } from '../../../core/marks';\nimport { PcacTooltipBuilder } from '../../../core/tooltip.builder';\nimport { PcacData } from '../../../core/chart.model';\nimport { PcacTooltipCoincident } from '../../../core/tooltip.directive';\nimport { PlaChartScalesBuilder, PlaChartScales, longestSeriesLength } from './scales.builder';\nimport { getXFormat } from '../x-format';\nimport { buildLineGenerator } from './line-generator.builder';\nimport { buildAreaGenerator } from './area-generator.builder';\nimport { buildZoomBehavior } from './zoom-behavior.builder';\nimport { hasValue } from './has-value';\nimport { drawRange, rangeExtent } from './point-range.builder';\nimport { GAUGE_DOT_RADIUS, drawPointGauges, gaugeExtent, hasGauge } from './point-gauge.builder';\nimport { drawCornerLabels, drawReferenceLines, positionReferenceLines, raiseLabels } from './reference-lines.builder';\nimport { PlaCoincidentGroup, PlaCoincidentPoint, PlaPoint, PlaPointOffset, fanOutOffsets, fanOutRadius, fanOutShift, findCoincidentGroups } from './fan-out.builder';\n\n/** Half the theme's 2px line stroke: how far the lines/areas/fan-outs clip-path reaches past the plot. */\nconst PLOT_CLIP_ALLOWANCE = 1;\n\n/**\n * Names for the dot's transitions. d3 lets only one transition *per name* run on an element: a\n * new one cancels the old. The enter rise (`cy`) keeps the default name; the hover grow/shrink\n * and the entry's size-in (`r`) each get their own, so hovering a dot while the chart is still\n * animating in no longer cancels its rise and strands it short of its value. Hover interrupts\n * the size-in explicitly instead, since both tween `r`.\n */\nconst DOT_GROW_TRANSITION = 'pcac-dot-grow';\nconst DOT_HOVER_TRANSITION = 'pcac-dot-hover';\n/** See `revealAfterEntry`. */\nconst REVEAL_TRANSITION = 'pcac-reveal';\n\n/** Each chart type's accessible name when its config gives no `ariaLabel`. */\nconst CHART_TYPE_LABELS: Record<PcacLineAreaPlotChartConfigType, string> = {\n [PcacLineAreaPlotChartConfigType.Line]: 'Line chart',\n [PcacLineAreaPlotChartConfigType.Area]: 'Area chart',\n [PcacLineAreaPlotChartConfigType.Plot]: 'Plot chart',\n};\n\n/**\n * Provided per-component (see PcacLineAreaChartComponent's `providers`), not root-scoped: this\n * builder extends PcacChart, which holds mutable per-chart-instance state (margin, width,\n * height, colors, svg). A root singleton would be shared and clobbered by every\n * <pcac-line-area-chart> rendered at once.\n */\n@Injectable()\nexport class PlaChartBuilder extends PcacChart {\n private effectsBuilder = inject(PlaChartEffectsBuilder);\n /**\n * The scales as drawn: `baseScales` with the zoom this build started at (see `keptZoom`) applied.\n * A zoom gesture rescales from `baseScales`, never from these.\n */\n private scales!: PlaChartScales;\n /** The unzoomed scales, spanning the whole domain. */\n private baseScales!: PlaChartScales;\n /**\n * The zoom a rebuild picks up again, so a new config (a series toggled in the legend, live\n * data) or a resize doesn't throw away where the user had zoomed to. The pan is kept as a share\n * of the plot's size, which is what carries it across a resize: the same part of the domain\n * stays in view. `axes` is which axes were zoomable; a build where that differs starts unzoomed.\n */\n private keptZoom: { k: number; x: number; y: number; axes: string } | null = null;\n /** The zoom this build starts at, if any; applied to the zoom behavior once it's attached. */\n private startZoom: ZoomTransform | null = null;\n /** Set while `startZoom` is handed to the zoom behavior, whose resulting zoom event is skipped. */\n private restoringZoom = false;\n private lineGenerator!: Line<PcacData>;\n private areaGenerator!: Area<PcacData>;\n /** This build's zoom behavior; `null` while zoom is off. */\n private zoomBehavior: ZoomBehavior<Element, unknown> | null = null;\n private dotClickedSource = new Subject<PcacData>();\n private config!: PcacLineAreaChartConfig;\n /**\n * Numbers this chart's clip-path ids (and, through `plotClipPathId`, its range gradients'),\n * which have to be unique in the whole page: `url(#id)` resolves to the first match in the\n * document, so a duplicate would clip one chart with another's rect. A per-instance counter\n * rather than the timestamp-plus-random stamp this used to be, which two charts rebuilding in\n * the same millisecond (every chart on a page reacts to a window resize at once) could share.\n */\n private static nextInstanceId = 0;\n private readonly instanceId = ++PlaChartBuilder.nextInstanceId;\n private clipPathId!: string;\n /**\n * A second clip-path for everything that isn't a point - lines, areas, fan-out anchors and\n * spokes: the plot area plus `PLOT_CLIP_ALLOWANCE`. These have no business past the axes; the\n * points' buffer below used to apply to them too, so a line chart with big point images had\n * its lines run on half an image past the axes once zoomed.\n */\n private plotClipPathId!: string;\n /**\n * How far the points' clip-path rect extends past the drawable [0, width] x [0, height] area on\n * every side, so a point sitting exactly on the domain's edge isn't cut in half. 10px\n * comfortably clears a dot (r = 4, or 6 on hover); a point image or a gauge ring can be much\n * bigger than that, so `reservePointSpace()` widens this to half the largest mark on the chart\n * (and grows the margins to match, since the clip-path only matters up to the edge of the SVG).\n * The buffer is only there for points whose center is inside the plot; one whose center zoom\n * has carried past an edge is hidden outright (see `pointVisible`), rather than left showing up\n * to a whole half-mark beyond the axis.\n */\n private clipBuffer = 10;\n private pointImage!: PcacPointImageConfig;\n /**\n * Points that share a coordinate, found by `resolvePointLayout()`. `coincidentOf` looks a\n * point's group up for its tooltip and for its ring's shift (see `fanOutShift`); `fanOutOffsets`\n * only matters when `fanOut` is on (plot chart with `pointFanOut`) and is where each member sits\n * on its ring relative to the shared coordinate, before that shift.\n */\n private coincidentGroups: PlaCoincidentGroup[] = [];\n private coincidentOf = new Map<PcacData, PlaCoincidentGroup>();\n private fanOut: PcacPointFanOutConfig | null = null;\n private fanOutOffsets = new Map<PcacData, PlaPointOffset>();\n /** The `.point` group under the cursor, between its mouseover and mouseout (see `leavePoint`). */\n private hoveredPoint: SVGGElement | null = null;\n /** `config.pointRange` with its defaults applied, or `null` while ranges are off. */\n private pointRange: PcacPointRangeConfig | null = null;\n /** `pointGauge` with its defaults, or `null` while it's off. */\n private pointGauge: PcacPointGaugeConfig | null = null;\n /** Each drawn range's `.point-range` group, by its point, so hover can find the one to focus. */\n private rangeGroupOf = new Map<PcacData, SVGGElement>();\n /**\n * Whether this build has the hover crosshair: `enableEffects`, on a line or area chart. A plot\n * chart has no line for it to follow, so it gets none - its circles had nowhere to go and sat\n * stacked in the plot's top-left corner.\n */\n private effectsEnabled = false;\n dotClicked$ = this.dotClickedSource.asObservable();\n\n\n buildChart(chartElm: ElementRef, config: PcacLineAreaChartConfig, type: PcacLineAreaPlotChartConfigType): void {\n if (!config?.data?.length) {\n this.leavePoint();\n this.clearChart(chartElm);\n return;\n }\n\n // A rebuild throws the hovered point away with everything else, and a removed element gets\n // no mouseout, so its tooltip is closed here (see `leavePoint`).\n this.leavePoint();\n this.config = JSON.parse(JSON.stringify(config));\n this.startData = range(longestSeriesLength(this.config.data)).map((): PcacData => ({\n key: '',\n value: 0,\n hide: false,\n data: []\n }));\n\n // Before the axes and the layout: the marks' size feeds `autoTickSize`, and a ring widens what\n // fan-out and the edge space have to make room for.\n this.pointImage = { ...new PcacPointImageConfig(), ...this.config.pointImage };\n this.pointGauge = this.config.pointGauge ? { ...new PcacPointGaugeConfig(), ...this.config.pointGauge } : null;\n // A hidden axis keeps 8px rather than 0 so a dot on the edge of the plot isn't clipped\n this.initializeAxisState(this.config, 'y', 8, this.largestMarkHalf());\n this.chartTypeLabel = CHART_TYPE_LABELS[type];\n this.resolvePointLayout(type);\n this.reservePointSpace();\n this.pointRange = this.config.pointRange ? { ...new PcacPointRangeConfig(), ...this.config.pointRange } : null;\n\n if (!this.initializeChartState(chartElm, this.config)) {\n return;\n }\n this.applyColorOverride(this.config.colorOverride);\n\n this.baseScales = new PlaChartScalesBuilder().build(this.xAxis, this.yAxis, this.config.data, this.width, this.height);\n this.startZoom = this.resumeZoom();\n this.scales = this.startZoom ? this.zoomedScales(this.startZoom) : this.baseScales;\n this.lineGenerator = buildLineGenerator(this.xAxis.format, this.scales);\n this.areaGenerator = buildAreaGenerator(this.xAxis.format, this.scales, this.height);\n\n if (this.zoomEnabled) {\n const behavior = buildZoomBehavior(this.width, this.height, (event) => {\n // Zoom moves the points, not the mouse: the hovered one slides out from under a still\n // cursor (or is hidden outright, see `pointDisplay`), and either way the browser never\n // sends it a mouseout - its tooltip would stay up, and its dot stay grown, until the\n // cursor happened to cross it again. So the hover is ended here, on every zoom event.\n // The build's own starting zoom, handed to the behavior: already drawn that way. And a\n // gesture begun on an earlier build - a drag still going when live data or a resize redrew\n // the chart, which d3-zoom carries on through listeners on the window - belongs to a\n // drawing that's gone: left to run, it moved this one and overwrote the kept zoom with its\n // own, and the next gesture snapped back.\n if (this.restoringZoom || behavior !== this.zoomBehavior) {\n return;\n }\n this.leavePoint();\n this.keepZoom(event.transform);\n\n const zoomedScales = this.zoomedScales(event.transform);\n const { x: newX, y: newY } = zoomedScales;\n\n // Update the zoomed axes, each with its grid: the grid hangs off the axis's ticks, so it\n // is redrawn against the rescaled scale and dropped back underneath everything (append\n // puts it on top).\n if (this.config.enableZoomX) {\n this.axisBuilder.drawXAxis(this.axisBuilderConfig(newX, newY));\n this.svg.selectAll('.pcac-grid-vertical').remove();\n this.drawGrids(newX, newY, 'x');\n }\n if (this.config.enableZoomY) {\n this.axisBuilder.drawYAxis(this.axisBuilderConfig(newX, newY));\n this.svg.selectAll('.pcac-grid-horizontal').remove();\n this.drawGrids(newX, newY, 'y');\n }\n this.svg.selectAll('.pcac-grid').lower();\n\n // Update lines/areas. Fresh generators against the rescaled scales, so they go through\n // the same getXFormat() as the dots below - positioning by bare index here (which this\n // used to do, and which also overwrote the original generators' x accessor for good) is\n // only right for the default DatasetLength format; a DateTime/Decimal chart's lines\n // drifted away from its dots as soon as it was zoomed.\n // Interrupted first: a zoom during the enter transition would otherwise have the rest of\n // that transition keep drawing the unzoomed shape over this one.\n const zoomedLine = buildLineGenerator(this.xAxis.format, zoomedScales);\n const zoomedArea = buildAreaGenerator(this.xAxis.format, zoomedScales, this.height);\n this.svg.selectAll<SVGPathElement, PcacData[]>('.line').interrupt().attr('d', (d: PcacData[]) => zoomedLine(d));\n this.svg.selectAll<SVGPathElement, PcacData[]>('.area').interrupt().attr('d', (d: PcacData[]) => zoomedArea(d));\n\n // Update dots / point images. Nested selectAll (not a flat svg.selectAll('.point')) so\n // that `i` is the point's index *within its own series* - the x format default\n // (DatasetLength) positions by index, and a flat selection would number every series'\n // points consecutively, shoving the second series' points off to the right on zoom.\n this.svg.selectAll('.dots').selectAll<SVGGElement, PcacData>('.point')\n .attr('transform', (d: PcacData, i: number) => this.pointTransform(d, i, zoomedScales))\n .attr('display', (d: PcacData, i: number) => this.pointDisplay(d, i, zoomedScales));\n // The chart's Tab stop may just have been zoomed out of the plot, and hidden.\n refreshTabStop(this.svg.node()?.ownerSVGElement ?? null);\n // A fan-out's anchor is positioned like the points it belongs to, so it moves the same way;\n // its spokes are re-aimed because the ring's shift back into the plot (`fanOutShift`)\n // depends on where the anchor now is.\n this.svg.selectAll<SVGGElement, PlaCoincidentGroup>('.fan-out')\n .attr('transform', (g: PlaCoincidentGroup) => this.fanOutTransform(g, zoomedScales))\n .selectAll<SVGLineElement, PlaCoincidentPoint>('.fan-out-spoke')\n .attr('x2', (member: PlaCoincidentPoint) => this.spokeEnd(member, zoomedScales).dx)\n .attr('y2', (member: PlaCoincidentPoint) => this.spokeEnd(member, zoomedScales).dy);\n\n // Reference lines sit at data values, so they move with it; corner labels are pinned to the\n // frame and stay put.\n positionReferenceLines(this.svg, zoomedScales, this.xAxis.format, this.width, this.height);\n\n // The hover crosshair positions and labels against the scales, so it takes the zoomed ones.\n if (this.effectsEnabled) {\n this.effectsBuilder.updateScales(newX, newY);\n }\n\n // Ranges are drawn in plot coordinates rather than hung off a translate, so every one is\n // redrawn against the zoomed scales.\n this.updatePointRanges(zoomedScales);\n\n // Redrawing an axis appends it at the end of the group, above the dots; put them back\n // on top so a point on the baseline isn't covered (see drawChart's draw order).\n this.svg.selectAll('.point-ranges').raise();\n this.svg.selectAll('.fan-outs').raise();\n this.svg.selectAll('.dots').raise();\n if (this.config.labelsOnTop) {\n raiseLabels(this.svg);\n }\n });\n this.zoomBehavior = behavior;\n } else {\n this.zoomBehavior = null;\n }\n\n this.drawChart(chartElm, this.config, type);\n }\n\n private drawChart(chartElm: ElementRef, config: PcacLineAreaChartConfig, type: PcacLineAreaPlotChartConfigType): void {\n this.buildContainer(chartElm);\n this.attachZoomBehavior();\n this.createReusableClipPath(); \n\n this.axisBuilder.drawAxis(this.axisBuilderConfig(this.scales.x, this.scales.y));\n\n this.drawGrids(this.scales.x, this.scales.y);\n\n // Over the grid, under the series: guides, not data.\n drawCornerLabels(this.svg, config.cornerLabels, this.width, this.height);\n drawReferenceLines(this.svg, config.referenceLines, this.scales, this.xAxis.format, this.width, this.height, this.plotClipPathId);\n\n this.drawLineArea(config, type);\n\n this.effectsEnabled = !!config.enableEffects && type !== PcacLineAreaPlotChartConfigType.Plot;\n if (this.effectsEnabled) {\n this.effectsBuilder.buildEffects({\n svg: this.svg,\n height: this.height,\n width: this.width,\n data: config.data,\n colors: this.colors,\n x: this.scales.x,\n y: this.scales.y,\n xFormat: this.xAxis.format,\n yFormat: this.yAxis.format,\n yTicks: this.yAxis.ticks,\n });\n }\n\n // Axes above the lines/areas (so an axis line isn't covered by a series sitting at x = 0),\n // but the dots above the axes: a point on the baseline or the y axis stays whole. Fan-out\n // spokes go between the two so they run underneath the points they lead to, and point\n // ranges under those.\n this.axisBuilder.raiseAxes(this.svg);\n this.drawPointRanges();\n this.drawFanOuts();\n this.drawDots(config);\n // Labels asked to stay readable go over all of it (see `labelsOnTop`).\n if (config.labelsOnTop) {\n raiseLabels(this.svg);\n }\n this.restoreTabStop(chartElm);\n }\n\n /**\n * Finds the points that share a coordinate and, on a plot chart with\n * `pointFanOut`, works out where to draw each of them instead. Coincidence is found from the\n * data (see `findCoincidentGroups`) so this can run before the scales exist. Line and area\n * charts still get the groups, for the tooltip's `coincident` list, but never an offset.\n */\n private resolvePointLayout(type: PcacLineAreaPlotChartConfigType): void {\n this.coincidentGroups = findCoincidentGroups(this.config.data, this.xAxis.format);\n this.coincidentOf = new Map(\n this.coincidentGroups.flatMap((group) => group.members.map((member) => [member.data, group] as const))\n );\n\n const fanOut = type === PcacLineAreaPlotChartConfigType.Plot\n ? (this.config as PcacPlotChartConfig).pointFanOut\n : undefined;\n if (!fanOut) {\n this.fanOut = null;\n this.fanOutOffsets = new Map();\n return;\n }\n this.fanOut = { ...new PcacPointFanOutConfig(), ...fanOut };\n // A group's members are kept apart by the size of what's drawn for them: the image box when\n // any member has an image, else a hovered dot (r = 6) - plus a gauge ring on both sides when\n // any member has one.\n const { maxWidth, maxHeight } = this.pointImage;\n const ring = (group: PlaCoincidentGroup) =>\n this.pointGauge && group.members.some((member) => hasGauge(member.data)) ? 2 * gaugeExtent(this.pointGauge) : 0;\n const markSize = (group: PlaCoincidentGroup) =>\n (group.members.some((member) => !!member.data.image) ? Math.max(maxWidth, maxHeight) : 2 * GAUGE_DOT_RADIUS) + ring(group);\n const radius = (group: PlaCoincidentGroup) =>\n this.fanOut!.radius ?? fanOutRadius(group.members.length, markSize(group), this.fanOut!.gap);\n this.fanOutOffsets = fanOutOffsets(this.coincidentGroups, radius);\n }\n\n /**\n * Half the largest mark on the chart toward each axis, for `autoTickSize` and the edge space\n * (`reservePointSpace`): `x` its vertical half (what reaches down to the x axis), `y` its\n * horizontal half. Measured as drawn - a hovered dot (`GAUGE_DOT_RADIUS`), an image's box, and\n * a gauge ring around either (circular, so the same both ways). Points in a hidden series\n * count, so toggling one in a legend doesn't move the axes; a gap (no value) draws nothing and\n * doesn't. Needs `pointImage` and `pointGauge` resolved.\n */\n private largestMarkHalf(): { x: number; y: number } {\n const { maxWidth, maxHeight } = this.pointImage;\n const half = { x: 0, y: 0 };\n for (const point of this.config.data.flatMap((series) => series.data ?? [])) {\n if (!hasValue(point)) {\n continue;\n }\n let x = point.image ? maxHeight / 2 : GAUGE_DOT_RADIUS;\n let y = point.image ? maxWidth / 2 : GAUGE_DOT_RADIUS;\n if (this.pointGauge && hasGauge(point)) {\n // The ring surrounds the mark's larger side - see `markRadius` in `drawDots`.\n const ring = (point.image ? Math.max(maxWidth, maxHeight) / 2 : GAUGE_DOT_RADIUS) + gaugeExtent(this.pointGauge);\n x = Math.max(x, ring);\n y = Math.max(y, ring);\n }\n half.x = Math.max(half.x, x);\n half.y = Math.max(half.y, y);\n }\n return half;\n }\n\n /**\n * Makes room for the points at the edge of the domain: the clip-path buffer grows to half the\n * largest mark (`largestMarkHalf()` - an image box, a ring, or a hovered dot) so the `.dots`\n * group lets it through, and the margins grow to at least that same amount so the `<svg>`\n * doesn't cut off what the clip-path let through (a mark is centered on its point, so at the top\n * of the y domain half of it sits above the plot area - in `margin.top`, which is only 8px by\n * default). A ring is measured around the image box's larger side, as `drawDots` draws it, on\n * both axes; measured against the box's own side, a ringed wide image at the top of the domain\n * had the top of its ring cut off by the SVG. Half a mark is all a fan-out needs too: a\n * fanned-out ring is shifted back inside the plot area (`fanOutShift`), so no member's center\n * ever sits past the edge either. A plain dot fits the default 10px buffer and every margin\n * already. Must run after `resolvePointLayout()` and between `initializeAxisState()` and\n * `initializeChartState()`, see `reserveEdgeSpace`.\n */\n private reservePointSpace(): void {\n const half = this.largestMarkHalf();\n const halfWidth = Math.ceil(half.y);\n const halfHeight = Math.ceil(half.x);\n this.clipBuffer = Math.max(10, halfWidth, halfHeight);\n this.reserveEdgeSpace({ top: halfHeight, bottom: halfHeight, left: halfWidth, right: halfWidth });\n }\n\n private createReusableClipPath(): void {\n // The previous build's <defs> went with the rest of its drawing (see initializeChartState),\n // so the same ids are free again.\n this.clipPathId = `pcac-clip-${this.instanceId}`;\n this.plotClipPathId = `pcac-clip-plot-${this.instanceId}`;\n const defs = this.svg.append('defs');\n defs.append('clipPath')\n .attr('id', this.clipPathId)\n .append('rect')\n // Extend the clip-path past the drawable area on every side so a dot (or point image) at\n // the x-domain's min/max, or the top/bottom of the y range, isn't cut in half. See clipBuffer.\n .attr('x', -this.clipBuffer)\n .attr('y', -this.clipBuffer)\n .attr('width', this.width + this.clipBuffer * 2)\n .attr('height', this.height + this.clipBuffer * 2);\n // Lines, areas and the fan-out anchors and spokes get the plot area itself, give or take a\n // stroke: a line along the domain's max keeps its full width rather than being halved at\n // the edge, but nothing runs on into the points' buffer - a spoke to a member that zoom has\n // carried out of the plot (and hidden, see `pointVisible`) stops at the axis.\n defs.append('clipPath')\n .attr('id', this.plotClipPathId)\n .append('rect')\n .attr('x', -PLOT_CLIP_ALLOWANCE)\n .attr('y', -PLOT_CLIP_ALLOWANCE)\n .attr('width', this.width + PLOT_CLIP_ALLOWANCE * 2)\n .attr('height', this.height + PLOT_CLIP_ALLOWANCE * 2);\n }\n\n private get zoomEnabled(): boolean {\n return !!(this.config.enableZoomX || this.config.enableZoomY);\n }\n\n /** Which axes zoom, as `keptZoom.axes` records them. */\n private get zoomAxes(): string {\n return `${!!this.config.enableZoomX}${!!this.config.enableZoomY}`;\n }\n\n /**\n * `baseScales` under a zoom transform. A d3 zoom transform is always two-dimensional; only the\n * enabled axes follow it and the other keeps its original scale, so that component of the\n * gesture is simply ignored.\n */\n private zoomedScales(transform: ZoomTransform): PlaChartScales {\n return {\n x: this.config.enableZoomX ? transform.rescaleX(this.baseScales.x) : this.baseScales.x,\n y: this.config.enableZoomY ? transform.rescaleY(this.baseScales.y) : this.baseScales.y,\n };\n }\n\n /** Records a zoom for the next build to resume (see `keptZoom`). */\n private keepZoom(transform: ZoomTransform): void {\n this.keptZoom = {\n k: transform.k,\n x: transform.x / this.width,\n y: transform.y / this.height,\n axes: this.zoomAxes,\n };\n }\n\n /**\n * The zoom this build starts at: the kept one, fitted to this build's plot size, or `null` for\n * none - zoom off, the zoomable axes changed, or never zoomed. Forgets the kept zoom when it\n * can't be resumed, so turning zoom off and on again starts unzoomed.\n */\n private resumeZoom(): ZoomTransform | null {\n const kept = this.keptZoom;\n if (!kept || !this.zoomEnabled || kept.axes !== this.zoomAxes) {\n this.keptZoom = null;\n return null;\n }\n return zoomIdentity.translate(kept.x * this.width, kept.y * this.height).scale(kept.k);\n }\n\n private attachZoomBehavior(): void {\n const zoom = this.zoomBehavior;\n if (!this.zoomEnabled || !zoom) return;\n\n // A transparent rect so the empty plot area is a hit target too: a `<g>` has no area of its\n // own, so wheel/drag only reaches it through something painted. The rect is only ever that -\n // the behavior is attached once, to the group, and the rect's events bubble up to it. It used\n // to be `.call()`ed on both, and d3-zoom keeps its transform per element (`__zoom`): a wheel\n // over a point never passes through the rect (a sibling of the `.dots`, not an ancestor), so\n // only the group's transform advanced, and once the point had slid out from under the cursor\n // the next tick hit the rect - whose handler redrew from its own stale, near-identity\n // transform before the group's redrew from the real one, every tick, flickering the chart\n // between the two.\n //\n // d3's `ZoomBehavior<Element, unknown>` vs. our concretely-typed `Selection<SVGGElement, ...>`\n // is a known D3+TS typings friction point: `.call()` structurally compares nested generic Selection\n // methods (`.merge()`, `.select()`, ...) and those never line up across two different concrete element\n // types, even though a zoom behavior works on any element at runtime. Narrow, local `any` escape hatch.\n this.svg.insert('rect', ':first-child')\n .attr('width', this.width)\n .attr('height', this.height)\n .attr('fill', 'none')\n .attr('pointer-events', 'all');\n\n this.svg.call(zoom as any);\n\n // A resumed zoom is already drawn (`scales`); the behavior is told it too, so the next gesture\n // carries on from there rather than from the whole domain.\n if (this.startZoom) {\n this.restoringZoom = true;\n this.svg.call(zoom.transform as any, this.startZoom);\n this.restoringZoom = false;\n }\n }\n\n private drawLineArea(config: PcacLineAreaChartConfig, type: PcacLineAreaPlotChartConfigType): void {\n for (let i = 0; i < config.data.length; i++) {\n if (type === PcacLineAreaPlotChartConfigType.Area) {\n this.drawArea(config.data[i].data, i, config.data[i].hide);\n } else if (type === PcacLineAreaPlotChartConfigType.Line) {\n this.drawLine(config.data[i].data, i, config.data[i].hide);\n }\n }\n }\n\n private drawLine(lineData: PcacData[], index: number, hide = false): void {\n this.svg.append('g')\n .attr('class', 'lines')\n .attr('clip-path', `url(#${this.plotClipPathId})`)\n .append('path')\n .datum(lineData)\n .attr('class', 'line')\n // Set up front rather than on the transition, so a zoom interrupting it (see the zoom\n // handler) doesn't leave the line uncolored, or a hidden one showing.\n .attr('stroke', this.colors[index])\n .attr('fill', 'none')\n .attr('style', hide ? 'display: none' : null)\n .attr('d', this.lineGenerator(this.startData))\n .transition()\n .duration(this.transitionService.getTransitionDuration())\n .attr('d', this.lineGenerator);\n }\n\n private drawArea(lineData: PcacData[], index: number, hide = false) {\n this.svg.append('g')\n .attr('class', 'areas')\n .attr('clip-path', `url(#${this.plotClipPathId})`)\n .append('path')\n .datum(lineData)\n .attr('class', 'area')\n // Same `hide` handling as drawLine()/drawDots(); the area used to ignore it and paint\n // a hidden series' fill anyway.\n .style('display', () => hide ? 'none' : null)\n .style('opacity', 0.5)\n .style('fill', () => {\n return this.colors[index];\n })\n .attr('d', this.areaGenerator(this.startData))\n .transition()\n .duration(this.transitionService.getTransitionDuration())\n .attr('d', this.areaGenerator);\n }\n\n /**\n * Draws one `<g class=\"point-ranges\">` holding a group per series and, inside it, a\n * `<g class=\"point-range\">` per point that has a `range` - only while `pointRange` is on. Clipped\n * to the plot area and deaf to the pointer, so it never gets in the way of hover or zoom. When\n * each range shows is entirely the theme's business, driven by classes: `pcac-range-<show>` on\n * the outer group sets the resting opacity, and hover (`focusPointRange`) marks the hovered\n * point's range `is-focused` and the outer group `has-focus`. The colors are custom properties\n * - the series' own on its group, `color` (when set) on the outer one, which wins - see\n * plot-line-area-chart.component.scss.\n */\n private drawPointRanges(): void {\n this.rangeGroupOf = new Map();\n if (!this.pointRange) {\n return;\n }\n const { show, faintOpacity, color } = this.pointRange;\n const layer = this.svg.append('g')\n .attr('class', `point-ranges pcac-range-${show}`)\n .attr('clip-path', `url(#${this.plotClipPathId})`)\n .attr('pointer-events', 'none')\n .style('--pcac-point-range-color', () => color ?? null)\n .style('--pcac-point-range-faint-opacity', () => faintOpacity);\n\n this.config.data.forEach((series, seriesIndex) => {\n const seriesGroup = layer.append('g')\n .attr('class', 'point-range-series')\n .style('--pcac-point-range-series-color', () => this.colors[seriesIndex])\n .style('display', () => series.hide ? 'none' : null);\n series.data.forEach((point) => {\n // A point with no value draws no dot (see `pointDisplay`), so it draws no range either -\n // one would stand around a coordinate with nothing on it (on the baseline, for `''`).\n if (point.range && hasValue(point)) {\n this.rangeGroupOf.set(point, seriesGroup.append('g').attr('class', 'point-range').node()!);\n }\n });\n });\n this.updatePointRanges(this.scales);\n this.revealAfterEntry(layer);\n }\n\n /**\n * Draws every range against `scales`, around its point's true coordinate - a fanned-out point's\n * range stays on the anchor, not on the ring. A range with nothing placeable is left empty.\n */\n private updatePointRanges(scales: PlaChartScales): void {\n if (!this.pointRange) {\n return;\n }\n const style = this.pointRange.style;\n this.config.data.forEach((series, seriesIndex) => {\n series.data.forEach((point, index) => {\n const node = this.rangeGroupOf.get(point);\n if (!node) {\n return;\n }\n const group = select(node);\n const { x, y } = this.pointPosition(point, index, scales);\n const extent = rangeExtent(point, x, y, this.xAxis.format, scales);\n if (!extent) {\n group.selectAll('*').remove();\n return;\n }\n drawRange(group, extent, style, `${this.plotClipPathId}-range-${seriesIndex}-${index}`);\n });\n });\n }\n\n /** Brings `d`'s range forward (see `drawPointRanges`), or with `null` puts every range back to rest. */\n private focusPointRange(d: PcacData | null): void {\n if (!this.pointRange || !this.svg) {\n return;\n }\n this.svg.selectAll('.point-range.is-focused').classed('is-focused', false);\n const node = d ? this.rangeGroupOf.get(d) : undefined;\n if (node) {\n select(node).classed('is-focused', true);\n }\n this.svg.select('.point-ranges').classed('has-focus', !!node);\n }\n\n /**\n * Draws one `<g class=\"fan-outs\">` holding a `<g class=\"fan-out\">` per group of coincident\n * points: a spoke from the shared coordinate to where each member is drawn, and an anchor dot\n * on the coordinate itself. Only when the fan-out is on and asks for anchors. The group sits on\n * the true coordinate (unlike a point group, which also carries its ring's shift - see\n * `pointTransform`), so zoom moves it the same way and everything inside is relative to the\n * coordinate; each spoke ends where its member is actually drawn, ring offset plus shift. It\n * fades in over the points' own entry transition. `spokeColor` / `anchorColor` go on the outer\n * group as custom properties for the theme's `.fan-out-spoke` / `.fan-out-anchor` rules (see\n * the axis builder's `applyColors`).\n */\n private drawFanOuts(): void {\n if (!this.fanOut?.showAnchor || this.coincidentGroups.length === 0) {\n return;\n }\n const { spokeColor, anchorColor } = this.fanOut;\n const groups = this.svg.append('g')\n .attr('class', 'fan-outs')\n .attr('clip-path', `url(#${this.plotClipPathId})`)\n .style('--pcac-fan-out-spoke-color', () => spokeColor ?? null)\n .style('--pcac-fan-out-anchor-color', () => anchorColor ?? null)\n .selectAll('.fan-out')\n .data(this.coincidentGroups)\n .enter().append('g')\n .attr('class', 'fan-out')\n .attr('transform', (group: PlaCoincidentGroup) => this.fanOutTransform(group, this.scales));\n\n groups.selectAll('.fan-out-spoke')\n .data((group: PlaCoincidentGroup) => group.members)\n .enter().append('line')\n .attr('class', 'fan-out-spoke')\n .attr('x1', 0)\n .attr('y1', 0)\n .attr('x2', (member: PlaCoincidentPoint) => this.spokeEnd(member, this.scales).dx)\n .attr('y2', (member: PlaCoincidentPoint) => this.spokeEnd(member, this.scales).dy);\n\n groups.append('circle')\n .attr('class', 'fan-out-anchor')\n .attr('r', 3);\n\n this.revealAfterEntry(groups);\n }\n\n /**\n * Keeps `selection` hidden while the points rise in from the baseline, then fades it in. For\n * the guides drawn around the points (fan-out spokes and anchors, point ranges): they're drawn\n * where the points end up, so showing them during the rise has them pointing at empty space.\n * Its own transition name so that nothing else animating the same element cancels it.\n */\n private revealAfterEntry(selection: Selection<any, any, any, any>): void {\n const duration = this.transitionService.getTransitionDuration();\n selection.attr('opacity', 0)\n .transition(REVEAL_TRANSITION)\n .delay(duration)\n .duration(duration / 3)\n .attr('opacity', 1);\n }\n\n /**\n * Draws one `<g class=\"dots\">` per series holding a `<g class=\"point\">` per data point. The\n * point group carries the position (as a translate) so that zoom, on either axis, only has to\n * touch that one attribute regardless of what's inside; the child is either the regular\n * `<circle class=\"dot\">` or, when the point has a `PcacData.image`, an `<image class=\"dot-image\">`\n * in its place, and sits at the group's origin. Both animate in from the baseline the same way\n * - the start is the baseline expressed relative to the point, since the group is already on\n * the point - and the tooltip / click handlers sit on the group so they behave identically for\n * either. A fanned-out point's ring offset is applied to the child, inside the group, so it too\n * is untouched by zoom; only its ring's shift back into the plot area, which depends on where\n * the coordinate is, rides along in the group's translate (see `pointTransform`).\n */\n private drawDots(config: PcacLineAreaChartConfig): void {\n const self = this;\n const duration = this.transitionService.getTransitionDuration();\n const { maxWidth, maxHeight } = this.pointImage;\n const rise = (d: PcacData) => this.scales.y(0) - this.scales.y(d.value as number);\n\n for (let index = 0; index < config.data.length; index++) {\n const series = config.data[index];\n const points = this.svg.append('g')\n .attr('class', 'dots')\n .attr('clip-path', `url(#${this.clipPathId})`)\n .attr('style', series.hide ? 'display: none' : null)\n // After `style`, which replaces the whole attribute.\n .style('--pcac-point-gauge-color', () => this.pointGauge?.color ?? null)\n .style('--pcac-point-gauge-track-color', () => this.pointGauge?.trackColor ?? null)\n .selectAll('.point')\n .data(series.data)\n .enter().append('g')\n .attr('class', 'point')\n .attr('transform', (d: PcacData, i: number) => this.pointTransform(d, i, this.scales))\n .attr('display', (d: PcacData, i: number) => this.pointDisplay(d, i, this.scales))\n .on('mouseover', function (this: SVGGElement, _event: MouseEvent, d: PcacData) {\n self.enterPoint(this, d, series, index);\n })\n .on('mouseout', () => this.leavePoint())\n .on('click', (_event: MouseEvent, d: PcacData) => {\n this.dotClickedSource.next(d);\n });\n makeMarksAccessible(points, {\n label: (d) => this.markLabel(d, { parent: series, valueFormat: this.yAxis.format, keyFormat: this.xAxis.format })\n + this.gaugeLabel(d),\n activate: (d) => this.dotClickedSource.next(d),\n focus: (point, d) => {\n this.enterPoint(point, d, series, index);\n if (this.tooltipTemplate()) {\n point.setAttribute('aria-describedby', PcacTooltipBuilder.ID);\n }\n },\n blur: (point) => {\n this.leavePoint();\n point.removeAttribute('aria-describedby');\n },\n });\n\n points.filter((d: PcacData) => !d.image)\n .append('circle')\n .attr('class', 'dot')\n .attr('stroke', this.colors[index])\n .attr('cx', (d: PcacData) => this.offsetOf(d).dx)\n .attr('cy', rise)\n .attr('fill', '#fff')\n .call((dots) => dots.transition()\n .duration(duration)\n .attr('cy', (d: PcacData) => this.offsetOf(d).dy))\n .transition(DOT_GROW_TRANSITION)\n .duration(duration)\n .attr('r', 4);\n\n // `preserveAspectRatio=\"xMidYMid meet\"` is what does the \"resize to fit\" - the image is\n // scaled uniformly to fit inside the maxWidth x maxHeight box and centered within it, so\n // a non-square image still lands centered on the point. x/y offset by half the box so the\n // box (not its top-left corner) is centered on the point group's origin, matching where a\n // dot sits.\n points.filter((d: PcacData) => !!d.image)\n .append('image')\n .attr('class', 'dot-image')\n .attr('href', (d: PcacData) => d.image as string)\n .attr('width', maxWidth)\n .attr('height', maxHeight)\n .attr('preserveAspectRatio', 'xMidYMid meet')\n .attr('x', (d: PcacData) => -maxWidth / 2 + this.offsetOf(d).dx)\n .attr('y', (d: PcacData) => rise(d) - maxHeight / 2)\n .transition()\n .duration(duration)\n .attr('y', (d: PcacData) => -maxHeight / 2 + this.offsetOf(d).dy);\n\n // Gauge rings around the image box or the dot, rising in with the mark they surround.\n if (this.pointGauge) {\n const markRadius = (d: PcacData) => d.image ? Math.max(maxWidth, maxHeight) / 2 : GAUGE_DOT_RADIUS;\n drawPointGauges(points, this.pointGauge, markRadius)\n .style('--pcac-point-gauge-series-color', () => this.colors[index])\n .attr('transform', (d: PcacData) => `translate(${this.offsetOf(d).dx}, ${rise(d)})`)\n .transition()\n .duration(duration)\n // Tweened as a number rather than `.attr('transform', ...)`: d3's transform interpolation\n // parses through SVG DOM APIs (`transform.baseVal`) that not every environment has.\n .attrTween('transform', (d: PcacData) => {\n const { dx, dy } = this.offsetOf(d);\n const from = rise(d);\n return (t: number) => `translate(${dx}, ${from + (dy - from) * t})`;\n });\n }\n }\n }\n\n /**\n * The end of a point's screen reader name for its gauge - \", PSA 0.018\" - when `pointGauge` has a\n * `name` and the point a `gauge`; otherwise nothing, the ring being only visual.\n */\n private gaugeLabel(d: PcacData): string {\n return this.pointGauge?.name && hasGauge(d) ? `, ${this.pointGauge.name} ${d.gauge}` : '';\n }\n\n /**\n * Starts a hover on a point - its tooltip, beside it; its range brought forward; its dot grown -\n * for the pointer and keyboard focus alike (see makeMarksAccessible). Ended by `leavePoint`.\n */\n private enterPoint(point: SVGGElement, d: PcacData, series: PcacData, index: number): void {\n const duration = this.transitionService.getTransitionDuration();\n this.hoveredPoint = point;\n this.focusPointRange(d);\n // `d` is the very element bound from `series.data`, so identity lookup is exact.\n this.showTooltip(null, d, {\n index: series.data.indexOf(d),\n parent: series,\n parentIndex: index,\n coincident: this.coincidentWith(d),\n valueFormat: this.yAxis.format,\n keyFormat: this.xAxis.format,\n // The dot or image itself rather than the group, so the tooltip clears what's drawn.\n anchor: select(point).select('.dot, .dot-image').node() as Element | null ?? point,\n });\n // No-op for an image point (no circle inside to grow). Its own transition name, so it\n // runs alongside the enter rise rather than cancelling it (see DOT_HOVER_TRANSITION);\n // it only takes over the entry's size tween, which it would otherwise fight over `r`.\n select(point).select('.dot')\n .interrupt(DOT_GROW_TRANSITION)\n .transition(DOT_HOVER_TRANSITION)\n .duration(duration / 3)\n .attr('r', 6)\n .attr('fill', this.colors[index]);\n }\n\n /**\n * Ends the current hover, if there is one: hides the tooltip and shrinks the dot back. Shared by\n * the point's own mouseout and the zoom handler, which has to end a hover the browser won't\n * (the point moves, the cursor doesn't - see `buildChart`'s zoom callback).\n */\n private leavePoint(): void {\n if (!this.hoveredPoint) {\n return;\n }\n const point = this.hoveredPoint;\n this.hoveredPoint = null;\n this.hideTooltip();\n this.focusPointRange(null);\n select(point).select('.dot')\n .interrupt(DOT_GROW_TRANSITION)\n .transition(DOT_HOVER_TRANSITION)\n .duration(this.transitionService.getTransitionDuration() / 3)\n .attr('r', 4)\n .attr('fill', '#fff');\n }\n\n /**\n * Where a point's group goes: its true coordinate, plus - for a fanned-out point - however far\n * its ring had to be shifted to stay inside the plot area at these scales. The shift is on the\n * group rather than the child because it changes as zoom moves the coordinate (the ring offset,\n * on the child, doesn't), and this is the one attribute zoom already updates.\n */\n private pointTransform(d: PcacData, i: number, scales: PlaChartScales): string {\n const { x, y } = this.pointPlacement(d, i, scales);\n return `translate(${x}, ${y})`;\n }\n\n /**\n * The `display` of a point's group at these scales: shown while its center is inside the plot\n * area, `none` once zoom has carried it past an edge. Together with the clip-path's buffer this\n * is what bounds how far a mark may hang over an axis: a point on the edge is drawn whole, half\n * of it outside the plot, and that half is the most that ever shows - the alternative, letting\n * the clip-path's buffer do the work, showed a point up to a whole half-mark beyond the axis\n * with its center already outside. Also takes it out of hover's reach, as a hidden group\n * receives no pointer events.\n *\n * A point with no value to plot isn't drawn at all - the same test the line/area uses to leave\n * a gap (`hasValue`). An empty string used to slip through: the scale reads `''` as 0, so the\n * line left a gap while a dot sat (hoverable) on the baseline.\n */\n private pointDisplay(d: PcacData, i: number, scales: PlaChartScales): string | null {\n return hasValue(d) && this.pointVisible(d, i, scales) ? null : 'none';\n }\n\n private pointVisible(d: PcacData, i: number, scales: PlaChartScales): boolean {\n const { x, y } = this.markCenter(d, i, scales);\n // A hair of slack, so a point on the domain's edge isn't lost to a rescaled scale landing on\n // -0.0000001 instead of 0.\n const slack = 0.5;\n return x >= -slack && x <= this.width + slack && y >= -slack && y <= this.height + slack;\n }\n\n /** Where the point's group is drawn: its coordinate plus its ring's shift, if it's fanned out. */\n private pointPlacement(d: PcacData, i: number, scales: PlaChartScales): PlaPoint {\n const { x, y } = this.pointPosition(d, i, scales);\n const shift = this.shiftOf(d, scales);\n return { x: x + shift.dx, y: y + shift.dy };\n }\n\n /** Where the mark itself is centered: the group's placement plus the ring offset on the child. */\n private markCenter(d: PcacData, i: number, scales: PlaChartScales): PlaPoint {\n const { x, y } = this.pointPlacement(d, i, scales);\n const offset = this.offsetOf(d);\n return { x: x + offset.dx, y: y + offset.dy };\n }\n\n /** A fan-out sits on its members' true coordinate, with no shift applied; any member locates it. */\n private fanOutTransform(group: PlaCoincidentGroup, scales: PlaChartScales): string {\n const { data, index } = group.members[0];\n const { x, y } = this.pointPosition(data, index, scales);\n return `translate(${x}, ${y})`;\n }\n\n private pointPosition(d: PcacData, i: number, scales: PlaChartScales): PlaPoint {\n return { x: getXFormat(this.xAxis.format, d, i, scales.x), y: scales.y(d.value as number) };\n }\n\n /** A member's ring offset from the shared coordinate, `0` for a point that isn't fanned out. */\n private offsetOf(d: PcacData): PlaPointOffset {\n return this.fanOutOffsets.get(d) ?? { dx: 0, dy: 0 };\n }\n\n /** How far `d`'s ring is moved back into the plot area at these scales (see `fanOutShift`). */\n private shiftOf(d: PcacData, scales: PlaChartScales): PlaPointOffset {\n const group = this.coincidentOf.get(d);\n if (!group || !this.fanOutOffsets.has(d)) {\n return { dx: 0, dy: 0 };\n }\n const { data, index } = group.members[0];\n const offsets = group.members.map((member) => this.offsetOf(member.data));\n return fanOutShift(this.pointPosition(data, index, scales), offsets, { width: this.width, height: this.height });\n }\n\n /** Where a spoke ends, relative to its anchor: where the member is drawn, ring offset plus shift. */\n private spokeEnd(member: PlaCoincidentPoint, scales: PlaChartScales): PlaPointOffset {\n const offset = this.offsetOf(member.data);\n const shift = this.shiftOf(member.data, scales);\n return { dx: offset.dx + shift.dx, dy: offset.dy + shift.dy };\n }\n\n /** The other points at `d`'s coordinate, for the tooltip context (see `PcacTooltipContext.coincident`). */\n private coincidentWith(d: PcacData): PcacTooltipCoincident[] {\n const group = this.coincidentOf.get(d);\n if (!group) {\n return [];\n }\n return group.members\n .filter((member) => member.data !== d)\n .map((member) => ({ data: member.data, parent: member.series, index: member.index, parentIndex: member.seriesIndex }));\n }\n}\n","import { Component, ElementRef, TemplateRef, ViewEncapsulation, effect, inject, viewChild, input } from '@angular/core';\nimport { outputFromObservable } from '@angular/core/rxjs-interop';\n\nimport { PcacLineAreaChartConfig, PcacLineAreaPlotChartConfigType } from './plot-line-area-chart.model';\nimport { PlaChartBuilder } from './core/builders/chart.builder';\nimport { PlaChartEffectsBuilder } from './core/builders/effects.builders';\nimport { PcacChartResizeService } from '../core/resize.service';\nimport { PcacTooltipContext } from '../core/tooltip.directive';\n\n@Component({\n selector: 'pcac-line-area-chart',\n // While `config().heightFull` is on, the chart fills its container instead of using a fixed\n // height (see PcacChartConfig.heightFull). That only works if this host element itself has a\n // height to hand down, so the class stretches it to `height: 100%`; the styling lives in CSS\n // rather than being measured/set in JS so the browser resolves it as part of normal layout.\n host: { '[class.pcac-height-full]': 'config().heightFull' },\n templateUrl: './plot-line-area-chart.component.html',\n styleUrl: './plot-line-area-chart.component.scss',\n encapsulation: ViewEncapsulation.None,\n // PlaChartEffectsBuilder must be listed here too, not just PlaChartBuilder: it's injected\n // *inside* PlaChartBuilder, but its own per-instance state (see its class doc) still needs\n // this component's injector to shadow its (default) root scope, or every <pcac-line-area-chart>\n // on the page would share one PlaChartEffectsBuilder instance.\n providers: [PlaChartBuilder, PlaChartEffectsBuilder]\n})\nexport class PcacLineAreaChartComponent {\n private chartBuilder = inject(PlaChartBuilder);\n\n readonly config = input.required<PcacLineAreaChartConfig>();\n readonly type = input.required<PcacLineAreaPlotChartConfigType>();\n\n readonly chartElm = viewChild.required<ElementRef>('chart');\n readonly dotClicked = outputFromObservable(this.chartBuilder.dotClicked$);\n\n /**\n * The consumer's `<ng-template pcacTooltip>`, forwarded by the PcacLineChart/PcacAreaChart/\n * PcacPlotChart wrapper it was projected into. An input rather than a `contentChild()` query\n * of this component's own: content queries only see nodes declared directly inside the\n * element in the consumer's template, not ones the wrapper re-projects through `<ng-content>`,\n * so the wrapper has to run the query and pass the result down.\n */\n readonly tooltipTemplate = input<TemplateRef<PcacTooltipContext>>();\n\n constructor() {\n // Reacts to config()/type() the same way ngOnChanges used to — reading them here (rather\n // than a lifecycle hook) is what makes this an effect: it tracks whichever signals\n // buildChart() reads and reruns whenever either changes. That includes type(), which the old\n // ngOnChanges deliberately ignored (it only compared changes['config']) — in practice type()\n // is always bound to a constant per wrapper (PcacLineChart/PcacAreaChart/PcacPlotChart), so\n // this is unreachable today, but reacting to it is the more correct behavior regardless.\n effect(() => this.buildChart());\n\n // Handed over as a getter so the builder reads the input at hover time, not in the effect\n // above (see PcacChart.tooltipTemplate).\n this.chartBuilder.tooltipTemplate = () => this.tooltipTemplate();\n\n inject(PcacChartResizeService).observe(this.chartElm, () => {\n // Skip the ResizeObserver's routine initial callback when it lands after the effect above\n // already built successfully at this same width — only a real size change (or a build\n // that never happened, e.g. the 0-width mount race) should trigger a rebuild here.\n if (this.chartBuilder.containerSizeChanged(this.chartElm())) {\n this.buildChart();\n }\n });\n }\n\n buildChart(): void {\n const config = this.config();\n // Handed over even when empty: the builder clears what it last drew rather than leaving it.\n if (config) {\n this.chartBuilder.buildChart(this.chartElm(), config, this.type());\n }\n }\n}\n","<section class=\"pcac-line-area-chart\">\n <svg #chart></svg>\n</section>\n\n","import { Component, contentChild, input, output } from \"@angular/core\";\nimport { PcacLineAreaChartComponent } from \"../plot-line-area-chart.component\";\nimport { PcacPlotChartConfig } from \"./plot.model\";\nimport { PcacLineAreaPlotChartConfigType } from \"../plot-line-area-chart.model\";\nimport { PcacData } from \"../../core\";\nimport { PcacTooltipDirective } from \"../../core/tooltip.directive\";\n\n@Component({\n selector: 'pcac-plot-chart',\n // Passes `heightFull` down the wrapper: the inner <pcac-line-area-chart> can only fill a host\n // that has a height itself (see PcacChartConfig.heightFull).\n host: { '[class.pcac-height-full]': 'config().heightFull' },\n templateUrl: './plot.component.html',\n imports: [PcacLineAreaChartComponent]\n})\nexport class PcacPlotChart {\n readonly config = input.required<PcacPlotChartConfig>();\n protected readonly types = PcacLineAreaPlotChartConfigType;\n readonly dotClicked = output<PcacData>();\n\n /**\n * Optional consumer `<ng-template pcacTooltip>` projected into this element, forwarded to the\n * inner chart (see PcacLineAreaChartComponent.tooltipTemplate for why it can't query it itself).\n */\n readonly tooltipTemplate = contentChild(PcacTooltipDirective);\n}\n","<pcac-line-area-chart [config]=\"config()\" [tooltipTemplate]=\"tooltipTemplate()?.templateRef\" [type]=\"types.Plot\" (dotClicked)=\"dotClicked.emit($event)\"/>","import { Component, contentChild, input, output } from \"@angular/core\";\nimport { PcacLineAreaChartComponent } from \"../plot-line-area-chart.component\";\nimport { PcacLineChartConfig } from \"./line.model\";\nimport { PcacLineAreaPlotChartConfigType } from \"../plot-line-area-chart.model\";\nimport { PcacData } from \"../../core\";\nimport { PcacTooltipDirective } from \"../../core/tooltip.directive\";\n\n@Component({\n selector: 'pcac-line-chart',\n // Passes `heightFull` down the wrapper: the inner <pcac-line-area-chart> can only fill a host\n // that has a height itself (see PcacChartConfig.heightFull).\n host: { '[class.pcac-height-full]': 'config().heightFull' },\n templateUrl: \"./line.component.html\",\n imports: [PcacLineAreaChartComponent]\n})\nexport class PcacLineChart {\n readonly config = input.required<PcacLineChartConfig>();\n protected readonly types = PcacLineAreaPlotChartConfigType;\n readonly dotClicked = output<PcacData>()\n\n /**\n * Optional consumer `<ng-template pcacTooltip>` projected into this element, forwarded to the\n * inner chart (see PcacLineAreaChartComponent.tooltipTemplate for why it can't query it itself).\n */\n readonly tooltipTemplate = contentChild(PcacTooltipDirective);\n}\n","<pcac-line-area-chart [config]=\"config()\" [tooltipTemplate]=\"tooltipTemplate()?.templateRef\" [type]=\"types.Line\" (dotClicked)=\"dotClicked.emit($event)\" />","import { PcacLineAreaChartConfig } from \"../plot-line-area-chart.model\";\n\nexport class PcacLineChartConfig extends PcacLineAreaChartConfig {\n\n}","import { Component, contentChild, input, output } from \"@angular/core\";\nimport { PcacAreaChartConfig } from \"./area.model\";\nimport { PcacLineAreaChartComponent } from \"../plot-line-area-chart.component\";\nimport { PcacLineAreaPlotChartConfigType } from \"../plot-line-area-chart.model\";\nimport { PcacData } from \"../../core\";\nimport { PcacTooltipDirective } from \"../../core/tooltip.directive\";\n\n@Component({\n selector: 'pcac-area-chart',\n // Passes `heightFull` down the wrapper: the inner <pcac-line-area-chart> can only fill a host\n // that has a height itself (see PcacChartConfig.heightFull).\n host: { '[class.pcac-height-full]': 'config().heightFull' },\n templateUrl: './area.component.html',\n imports: [PcacLineAreaChartComponent]\n})\nexport class PcacAreaChart {\n readonly config = input.required<PcacAreaChartConfig>();\n protected readonly types = PcacLineAreaPlotChartConfigType;\n readonly dotClicked = output<PcacData>()\n\n /**\n * Optional consumer `<ng-template pcacTooltip>` projected into this element, forwarded to the\n * inner chart (see PcacLineAreaChartComponent.tooltipTemplate for why it can't query it itself).\n */\n readonly tooltipTemplate = contentChild(PcacTooltipDirective);\n}\n","<pcac-line-area-chart [config]=\"config()\" [tooltipTemplate]=\"tooltipTemplate()?.templateRef\" [type]=\"types.Area\" (dotClicked)=\"dotClicked.emit($event)\" />","import { PcacLineAreaChartConfig } from \"../plot-line-area-chart.model\";\n\nexport class PcacAreaChartConfig extends PcacLineAreaChartConfig {\n\n}","// export * from './plot-line-area-chart.builder';\n// export * from './plot-line-area-chart.component';\n// export * from './plot-line-area-chart.model';\n// The rest of that model stays internal (the shared PcacLineAreaChartConfig is reached through\n// the per-chart PcacLineChartConfig/PcacAreaChartConfig/PcacPlotChartConfig subclasses), but\n// the point-image, point-range, point-gauge, reference-line and corner-label types are part of those configs'\n// public shape, so they're exported alone.\nexport {\n PcacCornerLabels,\n PcacPointGaugeConfig,\n PcacPointImageConfig,\n PcacPointRangeConfig,\n PcacPointRangeShow,\n PcacPointRangeStyle,\n PcacReferenceLine,\n} from './plot-line-area-chart.model';\nexport * from './plot/plot.component';\nexport * from './plot/plot.model';\nexport * from './line/line.component';\nexport * from './line/line.model';\nexport * from './area/area.component';\nexport * from './area/area.model';","import { PcacChartConfig, PcacData, PcacFormatEnum } from '../core/chart.model';\n\n/**\n * A proximity chart: one item in the middle (`center`) and others (`data`) around it, each placed\n * closer in or further out by its `value` - how similar it is to the center, say, or how far from\n * it. It answers \"what's nearest to this?\" at a glance: the closest matches sit tight around the\n * center, weaker ones out on the rim.\n *\n * Each item in `data` is one point: `key` is its name (tooltip, screen readers), `value` its\n * closeness in whatever units the chart's `closeValue` / `farValue` use, and `image` optionally\n * drawn in place of its dot. Items go around the center clockwise from `startAngle` in data order,\n * evenly spaced, so put the closest first to have it at the top. An item whose `value` isn't a\n * number, or with `hide`, is left out. Best with a handful to a dozen or so items; past that they\n * crowd one another around the ring.\n */\nexport class PcacProximityChartConfig extends PcacChartConfig {\n /** The item the others are measured against, drawn in the middle. Its `value` isn't used. */\n center: PcacData = new PcacData()\n\n /**\n * The `value` that sits right up against the center, and the one that sits on the outer rim;\n * values in between are placed proportionally, and anything beyond either is held at it.\n * The defaults suit a similarity from 0 to 1 (1 = identical, closest in). For a distance, swap\n * them: `closeValue: 0, farValue: <largest distance>`.\n */\n closeValue?: number = 1\n farValue?: number = 0\n\n /**\n * Values to draw a faint guide ring at, each labelled in `format` - e.g. `[0.95, 0.9, 0.85]` with\n * `Percentage` reads \"95%\", \"90%\", \"85%\". None when not set.\n */\n rings?: number[]\n\n /** How values read on the ring labels, in the tooltip and to screen readers; see `PcacFormatEnum`. */\n format?: PcacFormatEnum\n\n /**\n * Write each item's `key` under it, and the center's under the center. Default false: names are\n * in the tooltip either way. Keep it off for long names or a crowded ring.\n */\n showLabels?: boolean = false\n\n /** Draw a faint line from the center to each item. Default true. */\n showSpokes?: boolean = true\n\n /** Where the first item sits, in degrees clockwise from 12 o'clock. Default 0. */\n startAngle?: number = 0\n\n /** Size of the center item's image (or twice its dot's radius), in px. Default 64. */\n centerSize?: number = 64\n\n /** Size of each surrounding item's image (or twice its dot's radius), in px. Default 40. */\n itemSize?: number = 40\n\n /**\n * Item colors, any CSS color, used in data order for the dots of items without an `image` (the\n * center takes the first). Repeated when there are more items than colors. Omitted or empty, the\n * theme palette is used.\n */\n colorOverride?: string[]\n}\n","import { PcacData } from '../core/chart.model';\n\n/** Where one surrounding item sits, in polar terms around the center. */\nexport interface PcacProximityPlacement {\n data: PcacData;\n /** Its index in `config.data`: which color it takes. */\n index: number;\n /** The item's value, as a number. */\n value: number;\n /** Clockwise from 12 o'clock, in radians. */\n angle: number;\n /** How far out it sits, from 0 (the center) to 1 (the outer rim). */\n distance: number;\n}\n\n/** An item's value as a number, or `null` when it has none. */\nexport function proximityValue(d: PcacData): number | null {\n const value = typeof d.value === 'number' ? d.value : typeof d.value === 'string' && d.value.trim() !== '' ? Number(d.value) : NaN;\n return Number.isFinite(value) ? value : null;\n}\n\n/**\n * Where a value sits between the center and the rim: 0 at `closeValue`, 1 at `farValue`, in\n * proportion between them and held at either end beyond them. Equal ends put everything at 0.\n */\nexport function proximityDistance(value: number, closeValue: number, farValue: number): number {\n if (closeValue === farValue) {\n return 0;\n }\n return Math.min(1, Math.max(0, (value - closeValue) / (farValue - closeValue)));\n}\n\n/**\n * Places every drawable item evenly around the center, clockwise from `startAngle` (degrees from\n * 12 o'clock) in data order, each at its value's distance. Hidden items and items without a\n * numeric value are left out, and don't take up a slot.\n */\nexport function placeProximity(\n data: PcacData[],\n closeValue: number,\n farValue: number,\n startAngle = 0,\n): PcacProximityPlacement[] {\n const drawable = data\n .map((d, index) => ({ d, index, value: proximityValue(d) }))\n .filter((item): item is { d: PcacData; index: number; value: number } => !item.d.hide && item.value !== null);\n const start = (startAngle * Math.PI) / 180;\n return drawable.map(({ d, index, value }, slot) => ({\n data: d,\n index,\n value,\n angle: start + (slot / drawable.length) * 2 * Math.PI,\n distance: proximityDistance(value, closeValue, farValue),\n }));\n}\n","import { ElementRef, Injectable } from '@angular/core';\nimport { select, Selection } from 'd3-selection';\n// Imported for its side effect only: adds .transition() to d3-selection's Selection.\nimport 'd3-transition';\nimport { Subject } from 'rxjs';\n\nimport { PcacChart, PcacTooltipOptions } from '../core/chart';\nimport { PcacData } from '../core/chart.model';\nimport { makeMarksAccessible } from '../core/marks';\nimport { formatValue } from '../core/tick-format';\nimport { PcacProximityChartConfig } from './proximity-chart.model';\nimport { PcacProximityPlacement, placeProximity, proximityDistance } from './proximity-layout';\n\n/** Space kept between the center's mark and the nearest an item can sit, in px. */\nconst CENTER_GAP = 6;\n/** Room kept outside the rim for a ring label, in px. */\nconst RIM_LABEL_ROOM = 4;\n/** Room a name takes below its item with `showLabels` - the gap and one line of 11px text - in px. */\nconst ITEM_LABEL_ROOM = 16;\n\n/** The center, or one item around it, as the builder draws it. */\ninterface PlaProximityMark {\n data: PcacData;\n /** `null` for the center. */\n placement: PcacProximityPlacement | null;\n x: number;\n y: number;\n size: number;\n color: string;\n}\n\n/**\n * Provided per-component (see PcacProximityChart's `providers`), like every builder that extends\n * PcacChart: it holds per-chart-instance state, which a root singleton would share between charts.\n */\n@Injectable()\nexport class ProximityChartBuilder extends PcacChart {\n private itemClickedSource = new Subject<PcacData>();\n itemClicked$ = this.itemClickedSource.asObservable();\n\n protected override chartTypeLabel = 'Proximity chart';\n\n buildChart(chartElm: ElementRef, config: PcacProximityChartConfig): void {\n this.hideTooltip();\n if (!config?.center && !config?.data?.length) {\n this.clearChart(chartElm);\n return;\n }\n // No axes, so an even margin all round rather than the axis charts' defaults.\n this.margin = { top: 8, right: 8, bottom: 8, left: 8 };\n if (!this.initializeChartState(chartElm, config)) {\n return;\n }\n const defaults = new PcacProximityChartConfig();\n const closeValue = config.closeValue ?? defaults.closeValue!;\n const farValue = config.farValue ?? defaults.farValue!;\n const centerSize = config.centerSize ?? defaults.centerSize!;\n const itemSize = config.itemSize ?? defaults.itemSize!;\n const placements = placeProximity(config.data ?? [], closeValue, farValue, config.startAngle ?? defaults.startAngle!);\n this.ensureColorCount(placements.length + 1);\n this.applyColorOverride(config.colorOverride);\n\n // Items run from just outside the center's mark to the rim, their own half-size kept inside it -\n // and, with names under them, the name of an item at the bottom of the rim too.\n const inner = centerSize / 2 + CENTER_GAP + itemSize / 2;\n const edgeRoom = itemSize / 2 + (config.showLabels ? ITEM_LABEL_ROOM : RIM_LABEL_ROOM);\n const outer = Math.max(inner, Math.min(this.width, this.height) / 2 - edgeRoom);\n const radiusOf = (distance: number) => inner + distance * (outer - inner);\n\n this.buildContainer(chartElm, true);\n // Ring labels go halfway between the first two items, where no item sits to cover them.\n const labelAngle = (((config.startAngle ?? defaults.startAngle!) * Math.PI) / 180) + Math.PI / Math.max(1, placements.length);\n this.drawRings(config, closeValue, farValue, radiusOf, labelAngle);\n\n const marks: PlaProximityMark[] = placements.map((p) => {\n const r = radiusOf(p.distance);\n return {\n data: p.data,\n placement: p,\n x: r * Math.sin(p.angle),\n y: -r * Math.cos(p.angle),\n size: itemSize,\n color: this.colors[(p.index + 1) % this.colors.length],\n };\n });\n if (config.showSpokes ?? defaults.showSpokes!) {\n this.svg.append('g')\n .attr('class', 'pcac-proximity-spokes')\n .attr('aria-hidden', 'true')\n .selectAll('line')\n .data(marks)\n .enter().append('line')\n .attr('class', 'pcac-proximity-spoke')\n .attr('x1', 0).attr('y1', 0)\n .attr('x2', (m) => m.x).attr('y2', (m) => m.y);\n }\n const center: PlaProximityMark | null = config.center\n ? { data: config.center, placement: null, x: 0, y: 0, size: centerSize, color: this.colors[0] }\n : null;\n this.drawMarks(center ? [...marks, center] : marks, config);\n this.restoreTabStop(chartElm);\n }\n\n /** Faint guide rings at `config.rings`' values, each labelled at `labelAngle` in `config.format`. */\n private drawRings(\n config: PcacProximityChartConfig,\n closeValue: number,\n farValue: number,\n radiusOf: (d: number) => number,\n labelAngle: number,\n ): void {\n const rings = (config.rings ?? []).filter((v) => Number.isFinite(v));\n if (!rings.length) {\n return;\n }\n const groups = this.svg.append('g')\n .attr('class', 'pcac-proximity-rings')\n .attr('aria-hidden', 'true')\n .selectAll('g')\n .data(rings)\n .enter().append('g')\n .attr('class', 'pcac-proximity-ring');\n const r = (v: number) => radiusOf(proximityDistance(v, closeValue, farValue));\n groups.append('circle').attr('r', r).attr('fill', 'none');\n groups.append('text')\n .attr('class', 'pcac-proximity-ring-label')\n .attr('x', (v) => r(v) * Math.sin(labelAngle))\n .attr('y', (v) => -r(v) * Math.cos(labelAngle))\n .attr('text-anchor', 'middle')\n .attr('dominant-baseline', 'middle')\n .text((v) => formatValue(config.format, v) ?? String(v));\n }\n\n private drawMarks(marks: PlaProximityMark[], config: PcacProximityChartConfig): void {\n const self = this;\n const duration = this.transitionService.getTransitionDuration();\n const tooltipOptions = (m: PlaProximityMark, anchor: Element | null): PcacTooltipOptions => ({\n index: m.placement?.index ?? -1,\n parent: null,\n valueFormat: config.format,\n anchor,\n });\n const markOf = (group: SVGGElement) => select(group).select('.pcac-proximity-dot, .pcac-proximity-image').node() as Element | null;\n const highlight = (group: SVGGElement, on: boolean) => select(group).classed('is-active', on);\n\n const groups: Selection<SVGGElement, PlaProximityMark, SVGGElement, unknown> = this.svg.append('g')\n .attr('class', 'pcac-proximity-items')\n .selectAll<SVGGElement, PlaProximityMark>('g')\n .data(marks)\n .enter().append('g')\n .attr('class', (m) => m.placement ? 'pcac-proximity-item' : 'pcac-proximity-item pcac-proximity-center')\n .attr('transform', (m) => `translate(${m.x}, ${m.y})`)\n .on('mouseover', function (this: SVGGElement, event: MouseEvent, m: PlaProximityMark) {\n highlight(this, true);\n self.showTooltip(event, m.data, tooltipOptions(m, markOf(this)));\n })\n .on('mouseout', function (this: SVGGElement) {\n highlight(this, false);\n self.hideTooltip();\n })\n .on('click', (_event: MouseEvent, m: PlaProximityMark) => this.itemClickedSource.next(m.data));\n\n makeMarksAccessible(groups, {\n label: (m) => m.placement\n ? this.markLabel(m.data, { valueFormat: config.format })\n : `${m.data.key ?? ''}, in the center`,\n activate: (m) => this.itemClickedSource.next(m.data),\n focus: (group, m) => {\n highlight(group, true);\n this.showMarkTooltip(group, m.data, tooltipOptions(m, markOf(group)));\n },\n blur: (group) => {\n highlight(group, false);\n this.hideMarkTooltip(group);\n },\n });\n\n groups.filter((m) => !m.data.image)\n .append('circle')\n .attr('class', 'pcac-proximity-dot')\n .attr('r', (m) => m.size / 2)\n .attr('fill', (m) => m.color)\n // What the theme's hover ring (`stroke: currentColor`) takes: the dot's own color.\n .style('color', (m) => m.color);\n groups.filter((m) => !!m.data.image)\n .append('image')\n .attr('class', 'pcac-proximity-image')\n .attr('href', (m) => m.data.image as string)\n .attr('width', (m) => m.size)\n .attr('height', (m) => m.size)\n .attr('x', (m) => -m.size / 2)\n .attr('y', (m) => -m.size / 2)\n .attr('preserveAspectRatio', 'xMidYMid meet');\n\n if (config.showLabels) {\n groups.append('text')\n .attr('class', 'pcac-proximity-label')\n .attr('aria-hidden', 'true')\n .attr('y', (m) => m.size / 2 + 12)\n .attr('text-anchor', 'middle')\n .text((m) => String(m.data.key ?? ''));\n }\n\n // The items fade in from the center outward, closest first.\n groups.attr('opacity', 0)\n .transition()\n .delay((m) => (m.placement ? m.placement.distance * duration / 2 : 0))\n .duration(duration / 2)\n .attr('opacity', 1);\n }\n}\n","import { Component, ElementRef, ViewEncapsulation, contentChild, effect, inject, input, viewChild } from '@angular/core';\nimport { outputFromObservable } from '@angular/core/rxjs-interop';\nimport { ProximityChartBuilder } from './proximity-chart.builder';\nimport { PcacProximityChartConfig } from './proximity-chart.model';\nimport { PcacChartResizeService } from '../core/resize.service';\nimport { PcacTooltipDirective } from '../core/tooltip.directive';\n\n/** A proximity chart: an item in the middle, others around it by closeness (see PcacProximityChartConfig). */\n@Component({\n selector: 'pcac-proximity-chart',\n // See PcacBarVerticalChart: `heightFull` needs the host to hand a height down.\n host: { '[class.pcac-height-full]': 'config().heightFull' },\n templateUrl: './proximity-chart.component.html',\n styleUrl: './proximity-chart.component.scss',\n encapsulation: ViewEncapsulation.None,\n providers: [ProximityChartBuilder]\n})\nexport class PcacProximityChart {\n private chartBuilder = inject(ProximityChartBuilder);\n\n readonly config = input.required<PcacProximityChartConfig>();\n private readonly chartElm = viewChild.required<ElementRef>('chart');\n /** An item - or the center - was clicked, or activated with Enter or Space. */\n readonly itemClicked = outputFromObservable(this.chartBuilder.itemClicked$);\n\n /** Optional consumer `<ng-template pcacTooltip>`, replacing the default tooltip (see PcacTooltipDirective). */\n readonly tooltipTemplate = contentChild(PcacTooltipDirective);\n\n constructor() {\n effect(() => this.buildChart());\n // A getter, so the builder reads the query at hover time rather than in the effect above.\n this.chartBuilder.tooltipTemplate = () => this.tooltipTemplate()?.templateRef;\n inject(PcacChartResizeService).observe(this.chartElm, () => {\n if (this.chartBuilder.containerSizeChanged(this.chartElm())) {\n this.buildChart();\n }\n });\n }\n\n private buildChart(): void {\n const config = this.config();\n // Handed over even when empty: the builder clears what it last drew rather than leaving it.\n if (config) {\n this.chartBuilder.buildChart(this.chartElm(), config);\n }\n }\n}\n","<section class=\"pcac-proximity-chart\">\n <svg #chart></svg>\n</section>\n","import { PcacChartConfig } from '../core/chart.model';\n\n/** Which chart the shared `<pcac-pie-donut-chart>` draws; each wrapper binds its own. */\nexport enum PcacPieDonutChartType {\n Pie = 'pie',\n Donut = 'donut'\n}\n\n/**\n * What the pie and donut charts share. Internal: consumers configure `PcacPieChartConfig` or\n * `PcacDonutChartConfig`, the same way the line, area and plot charts share\n * `PcacLineAreaChartConfig`.\n */\nexport class PcacPieDonutChartConfig extends PcacChartConfig {\n /**\n * Slice colors, any CSS color, in data order - the first slice takes the first color - in place\n * of the theme palette. Repeated when there are more slices than colors. Omitted or empty, the\n * theme palette is used. Match a `<pcac-legend>` to it with each item's `colorOverride`.\n */\n colorOverride?: string[]\n}\n","import { PcacPieDonutChartConfig } from '../pie-donut-chart.model';\n\n/**\n * A pie with its slices drawn as a ring around an empty center, which can hold a short label -\n * typically the total the slices add up to.\n */\nexport class PcacDonutChartConfig extends PcacPieDonutChartConfig {\n /**\n * Radius of the hole as a fraction of the chart's radius, from 0 (no hole - a pie) to 0.9.\n * Values outside that range are clamped.\n */\n innerRadius?: number = 0.6\n\n /**\n * Large text centered in the hole, e.g. `'67'`. Sized to the hole and shrunk to fit across it;\n * left out if it would have to go below 8px. Not drawn when not set.\n */\n label?: string\n\n /** Smaller line under `label`, e.g. `'balls'`, fitted the same way. Not drawn when not set. */\n subLabel?: string\n\n /**\n * `label` color, any CSS color; theme default `$gray-800`. Applied as\n * `--pcac-donut-center-label-color` on the chart's `.pcac-donut-center` group, so a stylesheet\n * can set it on an ancestor instead (a config value wins).\n */\n labelColor?: string\n\n /** `subLabel` color, likewise (`--pcac-donut-center-sub-label-color`); theme default `$gray-600`. */\n subLabelColor?: string\n}\n","import { Injectable, ElementRef } from '@angular/core';\n\n/**\n * D3\n */\nimport { arc, pie, Arc, Pie, PieArcDatum } from 'd3-shape';\nimport { BaseType, select, Selection } from 'd3-selection';\nimport { interpolate } from 'd3-interpolate';\nimport { active, transition } from 'd3-transition';\nimport { color } from 'd3-color';\n\n/**\n * Lib\n */\nimport { PcacPieDonutChartConfig, PcacPieDonutChartType } from './pie-donut-chart.model';\nimport { PcacDonutChartConfig } from './donut/donut.model';\nimport { PcacChart } from '../core/chart';\nimport { makeMarksAccessible } from '../core/marks';\nimport { PcacData } from '../core/chart.model';\n\nimport { Subject } from 'rxjs';\n\n\n/** The largest `PcacDonutChartConfig.innerRadius` honored, so a ring is always left to draw. */\nconst MAX_DONUT_INNER_RADIUS = 0.9;\n\n/** Smallest font a center line is drawn at; a line that can't fit the hole at this size is left out. */\nconst MIN_CENTER_FONT_SIZE = 8;\n\n/** Share of the hole's diameter the center text may span, leaving a margin inside the ring. */\nconst CENTER_TEXT_WIDTH = 1.6;\n\n/**\n * Average glyph width as a fraction of font size. Only used where text can't be measured (no\n * layout, e.g. jsdom); in a browser each line is measured and scaled to fit instead.\n */\nconst ESTIMATED_GLYPH_WIDTH = 0.6;\n\n/**\n * Provided per-component (see PcacPieDonutChartComponent's `providers`), not root-scoped:\n * this builder extends PcacChart, which holds mutable per-chart-instance state (margin, width,\n * height, colors, svg). A root singleton would be shared and clobbered by every\n * <pcac-pie-donut-chart> rendered at once.\n */\n@Injectable()\nexport class PieDonutChartBuilder extends PcacChart {\n private radius!: number;\n private innerRadius = 0;\n private arcShape!: Arc<any, PieArcDatum<PcacData>>;\n private arcOverShape!: Arc<any, PieArcDatum<PcacData>>;\n private pieAngles!: Pie<any, PcacData>;\n private sliceClickedSource = new Subject<PcacData>();\n sliceClicked$ = this.sliceClickedSource.asObservable();\n\n protected override chartTypeLabel = 'Pie chart';\n\n /**\n * Draws `config` as a pie, or - for `PcacPieDonutChartType.Donut` - as a donut, reading the ring\n * settings off the config (`PcacDonutChartConfig`), with its defaults for any left unset.\n */\n buildChart(chartElm: ElementRef, config: PcacPieDonutChartConfig, type: PcacPieDonutChartType): void {\n if (!config?.data?.length) {\n this.clearChart(chartElm);\n return;\n }\n\n // The pie deliberately opts out of `heightFull`: `height` here feeds the radius rather than a\n // drawing area, so growing into a tall container would silently change the size of the pie\n // itself. `PcacPieDonutChartConfig` inherits the property from PcacChartConfig, so it's neutralized\n // here rather than being absent from the type. (`<pcac-pie-donut-chart>` also never gets the\n // `pcac-height-full` class the other charts use to stretch their host.)\n const donut = type === PcacPieDonutChartType.Donut ? donutSettings(config as PcacDonutChartConfig) : null;\n if (type === PcacPieDonutChartType.Pie) {\n this.warnOfDonutOnPie(config);\n }\n // Announced for what it draws: a ring, or - a donut with no hole included - a pie (see\n // PcacChart.chartTypeLabel).\n this.chartTypeLabel = donut && donut.innerRadius > 0 ? 'Donut chart' : 'Pie chart';\n if (!this.initializeChartState(chartElm, { ...config, heightFull: false })) {\n return;\n }\n this.applyColorOverride(config.colorOverride);\n this.radius = Math.min(this.height, this.width) / 2;\n this.buildShapes(donut?.innerRadius ?? 0);\n this.drawChart(chartElm, config);\n if (donut && this.innerRadius > 0) {\n this.drawCenter(donut);\n }\n }\n\n private warnedOfDonutOnPie = false;\n\n /**\n * Development builds only: a pie config still carrying 22.2's `donut` option. It isn't read any\n * more - the donut is PcacDonutChart now - and TypeScript doesn't always catch it (a config built\n * by spreading, or loaded as JSON, compiles fine), so the chart would quietly draw a plain pie.\n * Warned once per chart.\n */\n private warnOfDonutOnPie(config: PcacPieDonutChartConfig): void {\n if (typeof ngDevMode === 'undefined' || !ngDevMode || this.warnedOfDonutOnPie || !('donut' in config)) {\n return;\n }\n this.warnedOfDonutOnPie = true;\n console.warn(\n 'Pioneer Charts: <pcac-pie-chart> ignores `donut`. For a donut, use <pcac-donut-chart> with ' +\n 'PcacDonutChartConfig, which takes innerRadius, label, subLabel, labelColor and subLabelColor ' +\n 'directly - see the 22.2.16 CHANGELOG.',\n );\n }\n\n /** `ratio` is the hole's radius as a share of the chart's: 0 for a pie. */\n private buildShapes(ratio: number): void {\n const radiusOffset = 10;\n // Never negative: in a container under 20px the offset would otherwise turn the pie inside out.\n const outerRadius = Math.max(0, this.radius - radiusOffset);\n // Sized against the resting slice, so the hole stays put when a hovered slice grows outward.\n this.innerRadius = Math.max(0, outerRadius * Math.min(Math.max(ratio, 0), MAX_DONUT_INNER_RADIUS));\n\n this.arcShape = arc<any, PieArcDatum<PcacData>>()\n .innerRadius(this.innerRadius)\n .outerRadius(outerRadius);\n\n // A pie too small to draw anything at rest (see above) doesn't pop out a disc on hover either.\n this.arcOverShape = arc<any, PieArcDatum<PcacData>>()\n .innerRadius(this.innerRadius)\n .outerRadius(outerRadius > 0 ? outerRadius + radiusOffset : 0);\n\n this.pieAngles = pie<PcacData>()\n .sort(null)\n // A hidden slice takes no angle but keeps its index - and so its color, matching a legend -\n // the same way a hidden line/area/plot series keeps its place.\n .value((d: PcacData) => (d.hide ? 0 : Number(d.value ?? 0)));\n }\n\n private drawChart(chartElm: ElementRef, config: PcacPieDonutChartConfig): void {\n this.buildContainer(chartElm, true);\n const self = this;\n // Pops the slice out, darkened, for the pointer and keyboard focus alike (see\n // makeMarksAccessible).\n const pop = (slice: SVGPathElement, d: PieArcDatum<PcacData>) => {\n const t = transition().duration(this.transitionService.getTransitionDuration() / 3)\n const c = color(this.colors[d.index])\n const ct = c ? c.darker(1).toString() : this.colors[d.index]\n const selected = select<SVGPathElement, PieArcDatum<PcacData>>(slice);\n // Hovered mid-way through the enter sweep, the slice is finished first: growing it straight\n // from its part-swept path morphed it oddly on the way out to the hover shape. Only then -\n // re-entering a slice mid-way through its hover shrink must grow it from where it is, not\n // snap it back to rest first (which flickered).\n if (active(slice, 'enter')) {\n selected.interrupt('enter').attr('d', this.arcShape(d));\n }\n selected\n .transition(t)\n .attr('d', this.arcOverShape)\n .style('fill', ct);\n };\n const rest = (slice: SVGPathElement, d: PieArcDatum<PcacData>) => {\n select<SVGPathElement, PieArcDatum<PcacData>>(slice)\n .transition()\n .duration(this.transitionService.getTransitionDuration() / 3)\n .attr('d', this.arcShape)\n .style('fill', this.colors[d.index]);\n };\n const slices = this.svg.selectAll('.pcac-arc')\n .data(this.pieAngles(config.data))\n .enter().append('g')\n .attr('class', 'pcac-arc')\n .append('path')\n .style('fill', (d: PieArcDatum<PcacData>, i: number) => {\n return this.colors[i];\n })\n .on('mouseover', function (this: SVGPathElement, _: MouseEvent, d: PieArcDatum<PcacData>) {\n pop(this, d);\n })\n .on('mousemove', (event: MouseEvent, d: PieArcDatum<PcacData>) => {\n self.showTooltip(event, d.data, { index: d.index });\n })\n .on('mouseout', function (this: SVGPathElement, _: MouseEvent, d: PieArcDatum<PcacData>) {\n self.hideTooltip();\n rest(this, d);\n })\n .on('click', (_event: MouseEvent, d: PieArcDatum<PcacData>) => {\n this.sliceClickedSource.next(d.data);\n });\n makeMarksAccessible(slices, {\n label: (d) => this.markLabel(d.data),\n skip: (d) => !!d.data.hide,\n activate: (d) => this.sliceClickedSource.next(d.data),\n focus: (slice, d) => {\n pop(slice, d);\n this.showMarkTooltip(slice, d.data, { index: d.index });\n },\n blur: (slice, d) => {\n this.hideMarkTooltip(slice);\n rest(slice, d);\n },\n });\n this.restoreTabStop(chartElm);\n slices\n // Named, so the hover transitions (unnamed) and the check above can tell it apart from them.\n .transition('enter')\n .duration(this.transitionService.getTransitionDuration())\n .attrTween('d', (b: PieArcDatum<PcacData>) => {\n return this.tweenChart(b);\n });\n }\n\n /**\n * The donut's `label` / `subLabel`, stacked around the center of the hole. Each line starts at a\n * size proportional to the hole and shrinks until it fits across it; a line that would have to\n * drop below `MIN_CENTER_FONT_SIZE` is left out rather than spill over the slices. Drawn after\n * the slices and ignoring the pointer, so it never blocks a slice's hover or click.\n */\n private drawCenter(donut: PcacDonutChartConfig): void {\n if (!donut.label && !donut.subLabel) {\n return;\n }\n const maxWidth = this.innerRadius * CENTER_TEXT_WIDTH;\n\n const center = this.svg.append('g')\n .attr('class', 'pcac-donut-center')\n .attr('pointer-events', 'none')\n .style('--pcac-donut-center-label-color', () => donut.labelColor ?? null)\n .style('--pcac-donut-center-sub-label-color', () => donut.subLabelColor ?? null);\n\n const label = this.drawCenterLine(center, 'pcac-donut-center-label', donut.label,\n Math.min(this.innerRadius * 0.5, 40), maxWidth);\n const subLabel = this.drawCenterLine(center, 'pcac-donut-center-sub-label', donut.subLabel,\n Math.min(this.innerRadius * 0.2, 16), maxWidth);\n\n if (!label && !subLabel) {\n center.remove();\n return;\n }\n // Stacked as a pair about the center; a line on its own sits on it.\n if (label && subLabel) {\n label.element.attr('y', -subLabel.size * 0.6);\n subLabel.element.attr('y', label.size * 0.55);\n }\n }\n\n /**\n * One centered line of the donut's center text at the largest size up to `preferredSize` that\n * fits `maxWidth`, or nothing (null) when there's no text or it can't fit at a readable size.\n */\n private drawCenterLine(\n center: Selection<SVGGElement, unknown, BaseType, unknown>,\n className: string,\n text: string | undefined,\n preferredSize: number,\n maxWidth: number,\n ): { element: Selection<SVGTextElement, unknown, BaseType, unknown>; size: number } | null {\n if (!text || preferredSize < MIN_CENTER_FONT_SIZE) {\n return null;\n }\n const element = center.append('text')\n .attr('class', className)\n .attr('text-anchor', 'middle')\n .attr('dominant-baseline', 'central')\n .style('font-size', `${preferredSize}px`)\n .text(text);\n\n const node = element.node();\n const measured = node && typeof node.getComputedTextLength === 'function'\n ? node.getComputedTextLength()\n : 0;\n const width = measured > 0 ? measured : text.length * preferredSize * ESTIMATED_GLYPH_WIDTH;\n const size = width > maxWidth ? preferredSize * (maxWidth / width) : preferredSize;\n if (size < MIN_CENTER_FONT_SIZE) {\n element.remove();\n return null;\n }\n element.style('font-size', `${size}px`);\n return { element, size };\n }\n\n private tweenChart(b: PieArcDatum<PcacData>) {\n const i = interpolate({ startAngle: 0, endAngle: 0 }, b);\n return (t: number) => this.arcShape(i(t)) ?? '';\n }\n}\n\n/** A donut config with its defaults filled in for whatever the consumer left unset. */\nfunction donutSettings(config: PcacDonutChartConfig): PcacDonutChartConfig & { innerRadius: number } {\n const defaults = new PcacDonutChartConfig();\n // Unset or not a number (NaN, say - an empty number input's value), the default: a NaN ratio\n // survived the clamp and made every slice's path NaN, so nothing drew.\n const innerRadius = Number.isFinite(config.innerRadius) ? config.innerRadius! : defaults.innerRadius ?? 0;\n return { ...config, innerRadius };\n}\n","import { Component, ElementRef, TemplateRef, ViewEncapsulation, effect, inject, input, viewChild } from '@angular/core';\nimport { outputFromObservable } from '@angular/core/rxjs-interop';\nimport { PcacPieDonutChartConfig, PcacPieDonutChartType } from './pie-donut-chart.model';\nimport { PieDonutChartBuilder } from './pie-donut-chart.builder';\nimport { PcacChartResizeService } from '../core/resize.service';\nimport { PcacTooltipContext } from '../core/tooltip.directive';\n\n/**\n * The chart the pie and donut charts share, drawn by `PcacPieChart` and `PcacDonutChart` with\n * their own `type`. Internal, like `<pcac-line-area-chart>` behind the line, area and plot charts.\n */\n@Component({\n selector: 'pcac-pie-donut-chart',\n templateUrl: './pie-donut-chart.component.html',\n styleUrl: './pie-donut-chart.component.scss',\n encapsulation: ViewEncapsulation.None,\n providers: [PieDonutChartBuilder]\n})\nexport class PcacPieDonutChartComponent {\n private chartBuilder = inject(PieDonutChartBuilder);\n\n readonly config = input.required<PcacPieDonutChartConfig>();\n readonly type = input.required<PcacPieDonutChartType>();\n readonly chartElm = viewChild.required<ElementRef>('chart');\n readonly sliceClicked = outputFromObservable(this.chartBuilder.sliceClicked$);\n\n /**\n * The consumer's `<ng-template pcacTooltip>`, forwarded by the wrapper it was projected into:\n * a content query here wouldn't see it through the wrapper's template (see\n * PcacLineAreaChartComponent.tooltipTemplate).\n */\n readonly tooltipTemplate = input<TemplateRef<PcacTooltipContext>>();\n\n constructor() {\n // Tracks config() and type(), rebuilding whenever either changes.\n effect(() => this.buildChart());\n\n // Handed over as a getter so the builder reads the input at hover time, not in the effect\n // above (see PcacChart.tooltipTemplate).\n this.chartBuilder.tooltipTemplate = () => this.tooltipTemplate();\n\n inject(PcacChartResizeService).observe(this.chartElm, () => {\n // Skip the ResizeObserver's routine initial callback when it lands after the effect above\n // already built successfully at this same width — only a real size change (or a build\n // that never happened, e.g. the 0-width mount race) should trigger a rebuild here.\n if (this.chartBuilder.containerSizeChanged(this.chartElm())) {\n this.buildChart();\n }\n });\n }\n\n buildChart(): void {\n const config = this.config();\n const type = this.type();\n // Handed over even when empty: the builder clears what it last drew rather than leaving it.\n if (config) {\n this.chartBuilder.buildChart(this.chartElm(), config, type);\n }\n }\n}\n","<!-- pcac-pie-chart kept alongside for app CSS written against 22.2 and earlier, when this section\n belonged to the one pie component (the donut included). -->\n<section class=\"pcac-pie-donut-chart pcac-pie-chart\">\n <svg #chart></svg>\n</section>\n\n","import { Component, contentChild, input, output } from '@angular/core';\nimport { PcacPieDonutChartComponent } from '../pie-donut-chart.component';\nimport { PcacPieDonutChartType } from '../pie-donut-chart.model';\nimport { PcacPieChartConfig } from './pie.model';\nimport { PcacData } from '../../core';\nimport { PcacTooltipDirective } from '../../core/tooltip.directive';\n\n@Component({\n selector: 'pcac-pie-chart',\n templateUrl: './pie.component.html',\n imports: [PcacPieDonutChartComponent]\n})\nexport class PcacPieChart {\n readonly config = input.required<PcacPieChartConfig>();\n protected readonly types = PcacPieDonutChartType;\n readonly sliceClicked = output<PcacData>();\n\n /**\n * Optional consumer `<ng-template pcacTooltip>` projected into this element, forwarded to the\n * inner chart (see PcacPieDonutChartComponent.tooltipTemplate).\n */\n readonly tooltipTemplate = contentChild(PcacTooltipDirective);\n}\n","<pcac-pie-donut-chart [config]=\"config()\" [tooltipTemplate]=\"tooltipTemplate()?.templateRef\" [type]=\"types.Pie\" (sliceClicked)=\"sliceClicked.emit($event)\" />\n","import { PcacPieDonutChartConfig } from '../pie-donut-chart.model';\n\nexport class PcacPieChartConfig extends PcacPieDonutChartConfig {\n\n}\n","import { Component, contentChild, input, output } from '@angular/core';\nimport { PcacPieDonutChartComponent } from '../pie-donut-chart.component';\nimport { PcacPieDonutChartType } from '../pie-donut-chart.model';\nimport { PcacDonutChartConfig } from './donut.model';\nimport { PcacData } from '../../core';\nimport { PcacTooltipDirective } from '../../core/tooltip.directive';\n\n@Component({\n selector: 'pcac-donut-chart',\n templateUrl: './donut.component.html',\n imports: [PcacPieDonutChartComponent]\n})\nexport class PcacDonutChart {\n readonly config = input.required<PcacDonutChartConfig>();\n protected readonly types = PcacPieDonutChartType;\n readonly sliceClicked = output<PcacData>();\n\n /**\n * Optional consumer `<ng-template pcacTooltip>` projected into this element, forwarded to the\n * inner chart (see PcacPieDonutChartComponent.tooltipTemplate).\n */\n readonly tooltipTemplate = contentChild(PcacTooltipDirective);\n}\n","<pcac-pie-donut-chart [config]=\"config()\" [tooltipTemplate]=\"tooltipTemplate()?.templateRef\" [type]=\"types.Donut\" (sliceClicked)=\"sliceClicked.emit($event)\" />\n","// The shared <pcac-pie-donut-chart> and its PcacPieDonutChartConfig stay internal, like the\n// line/area/plot charts' base: consumers use the pie and donut wrappers and their configs.\nexport * from './pie/pie.component';\nexport * from './pie/pie.model';\nexport * from './donut/donut.component';\nexport * from './donut/donut.model';\n","/*\n * Public API Surface of pioneer-charts\n */\n\nexport * from './lib/bar-chart/bar-horizontal-chart/public-api';\nexport * from './lib/bar-chart/bar-vertical-chart/public-api';\nexport * from './lib/core/public-api';\nexport * from './lib/dot-plot-chart/public-api';\nexport * from './lib/legend/public-api';\nexport * from './lib/plot-line-area-chart/public-api';\nexport * from './lib/proximity-chart/public-api';\nexport * from './lib/pie-donut-chart/public-api';\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;AAGG;MACU,eAAe,CAAA;IAC1B,IAAI,GAAe,EAAE;AAErB;;AAEG;IACH,MAAM,GAAW,GAAG;AAEpB;;;;;;;;;;;;;AAaG;IACH,UAAU,GAAa,KAAK;AAE5B;;;;AAIG;AACH,IAAA,SAAS;AACV;AAED;;;AAGG;MACU,iBAAiB,CAAA;AAC5B,IAAA,GAAG;AACH,IAAA,GAAG;AACH,IAAA,GAAG;AACJ;AAED;;;;;;;;;;;;AAYG;MACU,cAAc,CAAA;AACzB;;;;AAIG;IACH,IAAI,GAAa,KAAK;AAEtB;;;;;;;AAOG;AACH,IAAA,QAAQ;AAER;;;AAGG;AACH,IAAA,SAAS;AAET;;;;AAIG;IACH,KAAK,GAAY,CAAC;AAElB;;;;;;;;;AASG;AACH,IAAA,QAAQ;AAER;;;;;;;;;;;AAWG;IACH,YAAY,GAAa,KAAK;AAE9B;;;AAGG;AACH,IAAA,SAAS;AAET;;;AAGG;AACH,IAAA,cAAc;AAEd;;;;AAIG;IACH,QAAQ,GAAa,KAAK;AAE1B;;AAEG;AACH,IAAA,SAAS;AAET;;;;;;AAMG;AACH,IAAA,KAAK;;AAGL,IAAA,UAAU;AAEV;;;;;;;AAOG;AACH,IAAA,SAAS;;AAGT,IAAA,aAAa;AAEb;;;;;;;;AAQG;AACH,IAAA,MAAM,GAAoB,cAAc,CAAC,IAAI;AAE7C;;;;;;;AAOG;IACH,SAAS,GAAqB,CAAC;IAC/B,SAAS,GAAqB,GAAG;AAClC;AAsBD;AACM,SAAU,gBAAgB,CAAC,IAAgC,EAAA;AAC/D,IAAA,MAAM,GAAG,GAAG,IAAI,EAAE,SAAS;IAC3B,OAAO,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,GA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AA,EAAA,CAAA;;2FAEzB,cAAc,EAAA,UAAA,EAAA,CAAA;kBAL1B,SAAS;+BACE,kBAAkB,EAAA,OAAA,EAEnB,CAAC,0BAA0B,CAAC,EAAA,QAAA,EAAA,2KAAA,EAAA;4PAWG,oBAAoB,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AErB9D;AACA;;ACDA;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"pioneer-code-pioneer-charts.mjs","sources":["../../../projects/pioneer-charts/src/lib/core/chart.model.ts","../../../projects/pioneer-charts/src/lib/core/tick-format.ts","../../../projects/pioneer-charts/src/lib/core/axis.builder.ts","../../../projects/pioneer-charts/src/lib/core/grid.builder.ts","../../../projects/pioneer-charts/src/lib/core/color.service.ts","../../../projects/pioneer-charts/src/lib/core/transition.service.ts","../../../projects/pioneer-charts/src/lib/core/marks.ts","../../../projects/pioneer-charts/src/lib/core/tooltip.builder.ts","../../../projects/pioneer-charts/src/lib/core/chart.ts","../../../projects/pioneer-charts/src/lib/core/stack.ts","../../../projects/pioneer-charts/src/lib/bar-chart/bar-thresholds.ts","../../../projects/pioneer-charts/src/lib/bar-chart/bar-series.ts","../../../projects/pioneer-charts/src/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.builder.ts","../../../projects/pioneer-charts/src/lib/core/resize.service.ts","../../../projects/pioneer-charts/src/lib/core/tooltip.directive.ts","../../../projects/pioneer-charts/src/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.component.ts","../../../projects/pioneer-charts/src/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.component.html","../../../projects/pioneer-charts/src/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.model.ts","../../../projects/pioneer-charts/src/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.builder.ts","../../../projects/pioneer-charts/src/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.component.ts","../../../projects/pioneer-charts/src/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.component.html","../../../projects/pioneer-charts/src/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.model.ts","../../../projects/pioneer-charts/src/lib/core/public-api.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/plot-line-area-chart.model.ts","../../../projects/pioneer-charts/src/lib/dot-plot-chart/dot-plot-chart.model.ts","../../../projects/pioneer-charts/src/lib/dot-plot-chart/dot-plot-layout.ts","../../../projects/pioneer-charts/src/lib/dot-plot-chart/dot-plot-chart.builder.ts","../../../projects/pioneer-charts/src/lib/dot-plot-chart/dot-plot-chart.component.ts","../../../projects/pioneer-charts/src/lib/dot-plot-chart/dot-plot-chart.component.html","../../../projects/pioneer-charts/src/lib/legend/legend.component.ts","../../../projects/pioneer-charts/src/lib/legend/legend.component.html","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/core/x-format.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/core/builders/has-value.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/core/builders/effects.builders.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/plot/plot.model.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/core/builders/scales.builder.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/core/builders/line-generator.builder.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/core/builders/area-generator.builder.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/core/builders/zoom-behavior.builder.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/core/builders/point-range.builder.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/core/builders/point-gauge.builder.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/core/builders/reference-lines.builder.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/core/builders/fan-out.builder.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/core/builders/chart.builder.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/plot-line-area-chart.component.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/plot-line-area-chart.component.html","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/plot/plot.component.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/plot/plot.component.html","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/line/line.component.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/line/line.component.html","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/line/line.model.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/area/area.component.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/area/area.component.html","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/area/area.model.ts","../../../projects/pioneer-charts/src/lib/plot-line-area-chart/public-api.ts","../../../projects/pioneer-charts/src/lib/proximity-chart/proximity-chart.model.ts","../../../projects/pioneer-charts/src/lib/proximity-chart/proximity-layout.ts","../../../projects/pioneer-charts/src/lib/proximity-chart/proximity-chart.builder.ts","../../../projects/pioneer-charts/src/lib/proximity-chart/proximity-chart.component.ts","../../../projects/pioneer-charts/src/lib/proximity-chart/proximity-chart.component.html","../../../projects/pioneer-charts/src/lib/pie-donut-chart/pie-donut-chart.model.ts","../../../projects/pioneer-charts/src/lib/pie-donut-chart/donut/donut.model.ts","../../../projects/pioneer-charts/src/lib/pie-donut-chart/pie-donut-chart.builder.ts","../../../projects/pioneer-charts/src/lib/pie-donut-chart/pie-donut-chart.component.ts","../../../projects/pioneer-charts/src/lib/pie-donut-chart/pie-donut-chart.component.html","../../../projects/pioneer-charts/src/lib/pie-donut-chart/pie/pie.component.ts","../../../projects/pioneer-charts/src/lib/pie-donut-chart/pie/pie.component.html","../../../projects/pioneer-charts/src/lib/pie-donut-chart/pie/pie.model.ts","../../../projects/pioneer-charts/src/lib/pie-donut-chart/donut/donut.component.ts","../../../projects/pioneer-charts/src/lib/pie-donut-chart/donut/donut.component.html","../../../projects/pioneer-charts/src/lib/pie-donut-chart/public-api.ts","../../../projects/pioneer-charts/src/public-api.ts","../../../projects/pioneer-charts/src/pioneer-code-pioneer-charts.ts"],"sourcesContent":["/**\n * Base configuration for all charts.\n * INewChart extends IChart\n */\nexport class PcacChartConfig {\n data: PcacData[] = []\n\n /**\n * Height in pixels\n */\n height: number = 200\n\n /**\n * When true, `height` becomes a *minimum* height: if the container the chart is placed in is\n * taller than `height`, the chart grows to fill it instead.\n *\n * The chart fills its own host element (`<pcac-bar-vertical-chart>` etc.), which it stretches\n * to `height: 100%` while this is on - so the consumer just needs to give the element wrapping\n * the chart a definite height (an explicit height, or a flex/grid track that resolves to one).\n * If that wrapper turns out to be auto-height, there's nothing definite to fill and the chart\n * falls back to `height`.\n *\n * Optional (rather than defaulted like the properties above) so that adding it doesn't force\n * every existing consumer that builds a config as an object literal to declare it; the `= false`\n * initializer still applies to anything constructed via `new`.\n */\n heightFull?: boolean = false\n\n /**\n * What the chart shows, for screen readers - e.g. `'Sales by month, 2026'`. The chart's `<svg>` is\n * announced as one image with this name; when it isn't set, the chart's type is used (`'Bar\n * chart'`, `'Pie chart'`, ...). Optional for the same reason as `heightFull`.\n */\n ariaLabel?: string\n}\n\n/**\n * Up to three short labels placed along an axis by position rather than by value: `min` at its\n * start, `mid` at its center, `max` at its end. Any subset can be given.\n */\nexport class PcacAxisSubLabels {\n min?: string\n mid?: string\n max?: string\n}\n\n/**\n * Everything configurable about one axis. Used twice per chart, as `xAxis` and `yAxis` on\n * `PcacAxisChartConfig`, so the two never drift apart and a new per-axis option lands in one place.\n *\n * Every field is optional so an object-literal / JSON config can give just the ones it cares\n * about (or omit the axis entirely); the initializers apply to anything built with `new`, and\n * `resolveAxisConfig()` fills the rest in for builders.\n *\n * The `*Color` fields each color one part of this axis, with any CSS color. Unset, the part keeps\n * the theme's color. A color never turns a part on - it only shows once the part is drawn. Each\n * is applied to the axis as the CSS custom property named on the field, so a stylesheet can set\n * the same property on any ancestor instead; a config value wins.\n */\nexport class PcacAxisConfig {\n /**\n * Don't draw this axis at all (labels, tick marks, line), and give the margins it would have\n * occupied back to the plot area. Hiding the y axis reclaims the left and top margins; hiding\n * the x axis reclaims the bottom and right. The chart's total footprint doesn't change.\n */\n hide?: boolean = false\n\n /**\n * Draw grid lines from this axis's ticks (or, on a category axis, from each category) across\n * the plot: horizontal lines for the y axis, vertical for the x. Left unset, each chart keeps\n * the grid it has always drawn - the y axis's on vertical bar and line/area/plot charts, the\n * x axis's on the horizontal bar chart - and no other; set it to turn either grid on or off\n * explicitly. Deliberately has no initializer, since \"unset\" is what carries the per-chart\n * default.\n */\n showGrid?: boolean\n\n /**\n * Grid line color (`--pcac-grid-color`), shown while this axis's grid is drawn - see `showGrid`.\n * Theme default `$gray-200`.\n */\n gridColor?: string\n\n /**\n * Requested number of ticks (D3's `ticks()` hint, so the actual count can differ slightly) -\n * also the number of grid lines for this axis. Ignored by a category (band) axis, which has one\n * tick per category. Default 5.\n */\n ticks?: number = 5\n\n /**\n * Length in pixels of the small tick marks. Tick marks are not drawn at all unless this is set\n * (the theme hides them, as it always has), so setting a size is also what turns them on; D3's\n * default 6px is a sensible first value. `0` keeps them off but still pulls the labels in to\n * the axis. Labels follow the marks (D3 places them at tick length + 3px), and the chart's\n * margins grow or shrink by the same amount so the plot area makes room for them - a longer\n * tick means a slightly smaller plot, never labels pushed off the edge. Only the per-tick marks\n * change; the axis line's two end-caps keep their default length. Colored by `tickColor`, the\n * theme's `$gray-900` (like the axis line) by default. Ignored while `autoTickSize` is on.\n */\n tickSize?: number\n\n /**\n * Size the tick marks from the chart's points instead of `tickSize`: half the largest mark\n * toward this axis, so a point sitting on the axis ends where its tick does and never covers a\n * tick label (D3's 3px tick padding is the gap left between them). This **overrides**\n * `tickSize` - with it on, any `tickSize` given is ignored - and turns the marks on the same\n * way a `tickSize` does. The largest mark is measured as drawn: a hovered dot, an image's box\n * (its height for the x axis, its width for the y axis), and a gauge ring around either,\n * after any shrinking to fit (dot plot). Honored by the charts that draw points - line, area,\n * plot and dot plot; ignored elsewhere. On the dot plot the marks never reach the axis (its\n * bottom row sits a `gap` above it), so there it only spaces the labels to the marks' size.\n * Default false.\n */\n autoTickSize?: boolean = false\n\n /**\n * Tick mark color (`--pcac-axis-tick-color`), shown once `tickSize` has turned the marks on.\n * Theme default `$gray-900`.\n */\n tickColor?: string\n\n /**\n * Tick label color (`--pcac-axis-tick-label-color`) - the values along the axis. Default is the\n * page's text color (`currentColor`), as d3-axis has always drawn them.\n */\n tickLabelColor?: string\n\n /**\n * Draw a solid line along the axis itself (the full length of the axis, with D3's short\n * end-caps). Off by default, as the theme has always hidden it. Colored by `lineColor`, the\n * theme's `$gray-900` by default.\n */\n showLine?: boolean = false\n\n /**\n * Axis line color (`--pcac-axis-line-color`), shown with `showLine` on. Theme default `$gray-900`.\n */\n lineColor?: string\n\n /**\n * A title for the whole axis (e.g. \"Revenue ($)\"), drawn centered along it just inside the\n * chart's edge: below the tick labels for the x axis, rotated to read bottom-to-top left of\n * them for the y axis. The chart's margin grows by `PcacChart.AXIS_LABEL_SPACE` to make room,\n * shrinking the plot area the same way a longer tick does. Not drawn on a hidden axis. Styled\n * by the theme's `.pcac-axis-label` rule.\n */\n label?: string\n\n /** `label` color (`--pcac-axis-label-color`). Theme default `$gray-700`. */\n labelColor?: string\n\n /**\n * Min / mid / max sub labels (e.g. \"Low\" / \"Medium\" / \"High\") in their own row just outside the\n * tick labels, and inside the `label` if there is one: `min` left-aligned at the axis's start,\n * `mid` centered, `max` right-aligned at its end, so they never spill past the axis. On the\n * y axis they run bottom-to-top like the label, `min` at the bottom. The margin grows by\n * `PcacChart.AXIS_SUB_LABEL_SPACE` when any is set, shrinking the plot area. Not drawn on a\n * hidden axis. Styled by the theme's `.pcac-axis-sub-label` rule.\n */\n subLabels?: PcacAxisSubLabels\n\n /** `subLabels` color, all three (`--pcac-axis-sub-label-color`). Theme default `$gray-600`. */\n subLabelColor?: string\n\n /**\n * How the values along this axis are interpreted and shown - the tick labels, and the value\n * (`yAxis`) or key (`xAxis`) in the default tooltip. On the line/area/plot charts the x axis's\n * format is also what decides how a point's `key` maps to an x position (by index for the\n * default, `Decimal` and `DateTime` by the key's own value on a linear/time scale - see\n * `PcacLineAreaChartConfig`); on a bar chart's category axis it only formats keys that are\n * numbers, and shows any other key as it is. Default `None`, which\n * on those charts behaves as `DatasetLength`.\n */\n format?: PcacFormatEnum = PcacFormatEnum.None\n\n /**\n * The value axis's domain: it runs from `domainMin` to `domainMax`, ignoring the data. Defaults\n * 0 and 100. Only the type of axis that has a domain to set reads them - a bar chart's category\n * axis ignores both, its value axis reads `domainMax` only (bars always grow from 0), and a\n * line/area/plot chart's x axis reads them only under the `Decimal` (numbers) and `DateTime`\n * (anything `new Date()` accepts, and required) formats - the index-based formats size the\n * axis from the data.\n */\n domainMin?: number | string = 0\n domainMax?: number | string = 100\n}\n\n/**\n * The `PcacChartMargin` type lives here rather than in chart.ts so the axis builder can take\n * one without importing the class module that imports it back.\n */\nexport interface PcacChartMargin {\n top: number;\n right: number;\n bottom: number;\n left: number;\n}\n\n/**\n * `PcacAxisConfig` with every default applied - what builders work with, so they never have to\n * null-check. `tickSize`, `label`, `subLabels` and the `*Color` fields stay optional: \"not set\"\n * is itself the meaningful default (no marks, no labels, the theme's colors). The color fields\n * are picked up by name, so a new one needs only its declaration on the class.\n */\ntype PcacOptionalAxisFields = 'tickSize' | 'label' | 'subLabels' | Extract<keyof PcacAxisConfig, `${string}Color`>;\nexport type PcacResolvedAxisConfig = Required<Omit<PcacAxisConfig, PcacOptionalAxisFields>> & Pick<PcacAxisConfig, PcacOptionalAxisFields>;\n\n/** True if `axis` has at least one sub label to draw (an empty `subLabels` object counts as none). */\nexport function hasAxisSubLabels(axis: PcacAxisConfig | undefined): boolean {\n const sub = axis?.subLabels;\n return !!sub && (!!sub.min || !!sub.mid || !!sub.max);\n}\n\n/**\n * Room reserved in a margin for an axis `label`: the theme's 12px label plus a gap from the tick\n * labels. Reserved on the side the label sits on (`bottom` for x, `left` for y), and taken out\n * of the plot area, the same way a longer tick is. Change together with `.pcac-axis-label`.\n */\nexport const PCAC_AXIS_LABEL_SPACE = 18;\n\n/** Likewise for a row of `subLabels`: the theme's 11px text plus a gap (`.pcac-axis-sub-label`). */\nexport const PCAC_AXIS_SUB_LABEL_SPACE = 16;\n\n/**\n * Total margin an axis's `label` and `subLabels` take on its side. `PcacChart` reserves it and\n * the axis builder places the text by it, so the two stay in step.\n */\nexport function axisLabelSpace(axis: PcacAxisConfig | undefined): number {\n return (axis?.label ? PCAC_AXIS_LABEL_SPACE : 0) + (hasAxisSubLabels(axis) ? PCAC_AXIS_SUB_LABEL_SPACE : 0);\n}\n\n/**\n * @param showGridDefault what `showGrid` resolves to when the consumer left it unset - each chart\n * passes `true` for the axis whose grid it has always drawn and `false` for the other.\n */\nexport function resolveAxisConfig(axis?: PcacAxisConfig, showGridDefault = false): PcacResolvedAxisConfig {\n const defaults = new PcacAxisConfig();\n // The optional fields (see `PcacOptionalAxisFields`) pass through as given; only the ones with\n // a default are spelled out.\n return {\n ...axis,\n hide: axis?.hide ?? defaults.hide!,\n showGrid: axis?.showGrid ?? showGridDefault,\n ticks: axis?.ticks ?? defaults.ticks!,\n showLine: axis?.showLine ?? defaults.showLine!,\n autoTickSize: axis?.autoTickSize ?? defaults.autoTickSize!,\n format: axis?.format ?? defaults.format!,\n domainMin: axis?.domainMin ?? defaults.domainMin!,\n domainMax: axis?.domainMax ?? defaults.domainMax!,\n };\n}\n\n/**\n * Base configuration for every chart that has an x and y axis (bar, line, area, plot - not pie).\n */\nexport class PcacAxisChartConfig extends PcacChartConfig {\n xAxis?: PcacAxisConfig = new PcacAxisConfig()\n yAxis?: PcacAxisConfig = new PcacAxisConfig()\n}\n\nexport class PcacData {\n key: string | number | null = null\n value: string | number| null = null\n\n /**\n * Hides the item while keeping its place in the color order, so a `<pcac-legend>` can toggle it\n * without the other items changing color. A line/area/plot series draws no line, area, points or\n * hover effects; a bar (or every bar of a group) is drawn at zero size, keeping its slot; a pie\n * slice takes no angle.\n */\n hide: boolean = false\n data: PcacData[] = []\n\n /**\n * URL (or data URI) of an image to draw at this point *in place of* its dot. Currently honored\n * by the line/area/plot charts only, on the innermost (point-level) `PcacData`; sized by the\n * chart config's `pointImage` (see `PcacLineAreaChartConfig.pointImage`). Points without one\n * keep their regular dot, so the two can be mixed within a single series.\n *\n * Optional (rather than defaulted) for the same reason as `PcacChartConfig.heightFull`: so\n * existing object-literal / JSON data doesn't have to declare it.\n */\n image?: string\n\n /**\n * The span this point's `key` / `value` stands for, when the point is really the middle of a\n * range: `x` for the key, `y` for the value, either or both. Currently honored by the\n * line/area/plot charts only, on the innermost (point-level) `PcacData`, and only drawn when\n * the chart config turns `pointRange` on (see `PcacPointRangeConfig`). Nothing is labeled on\n * the chart; a custom tooltip can read it off the point.\n *\n * Optional for the same reason as `image`.\n */\n range?: PcacDataRange\n\n /**\n * A third number for this point, shown as how full a ring around its mark is - on a scatter of\n * two measures, say, a third one per point. Out of the chart config's `pointGauge.max`: at `max`\n * or above the ring is full, at `0` or below it's empty. Currently honored by the line/area/plot\n * charts only, on the innermost (point-level) `PcacData`, and only drawn when the chart config\n * turns `pointGauge` on (see `PcacPointGaugeConfig`). A point without one gets no ring at all,\n * which can itself say something (\"doesn't apply\").\n *\n * Optional for the same reason as `image`.\n */\n gauge?: number\n\n /**\n * The consumer's own identifier for this item - a record's primary key, say. Nothing draws or\n * labels it; it's carried through untouched so a click output (`dotClicked`, `barClicked`,\n * `sliceClicked`, `itemClicked`) can be traced back to the record it came from. Click outputs\n * emit a copy of the item (the chart works on a copy of its config), so matching by object\n * identity doesn't work, and matching by `key` or `image` breaks as soon as two items share one.\n *\n * Optional for the same reason as `image`.\n */\n id?: string | number\n}\n\n/**\n * One side of a `PcacDataRange`. `min` above `max` is read as the other way round; `min` equal to\n * `max` (or either missing) as no range on that axis.\n */\nexport class PcacRangeBounds<T> {\n min!: T\n max!: T\n}\n\n/**\n * `PcacData.range`. `x` is read the way the point's `key` is, per the chart's `xAxis.format`: a\n * number for `Decimal`, anything `new Date()` accepts for `DateTime`, and for every index-based\n * format a (possibly fractional) index - `{ min: 2.5, max: 3.5 }` is half a slot either side of\n * the fourth point. `y` is on the value axis.\n */\nexport class PcacDataRange {\n x?: PcacRangeBounds<number | string>\n y?: PcacRangeBounds<number>\n}\n\nexport enum PcacFormatEnum {\n None = 'none',\n Decimal = 'decimal',\n DatasetLength = 'datasetLength',\n Percentage = 'percentage',\n Minutes = 'minutes',\n DateTime = 'dateTime',\n Fahrenheit = 'fahrenheit',\n\n /**\n * Hours of the day, 0-24, labelled on a 12 hour clock: 0 = 12am, 1 = 1am, 13 = 1pm, 24 = 12am.\n * A value between hours shows its minutes (2.5 = 2:30am).\n */\n OneDayHours = 'oneDayHours'\n}\n\n","import { AxisDomain, AxisScale } from 'd3-axis';\nimport { format } from 'd3-format';\nimport { PcacFormatEnum } from './chart.model';\n\n/** A continuous scale's own `tickFormat`, which picks its precision from the tick step. */\ntype WithTickFormat<Domain> = AxisScale<Domain> & {\n tickFormat?: (count?: number, specifier?: string) => (d: Domain) => string;\n};\n\n/**\n * `Percentage` values are fractions - `0.25` is 25% - on the axis and in the tooltip alike.\n * `~` trims trailing zeros, so 0.07 reads `7%` rather than `7.000000%`.\n */\nexport const formatPercent = format('~%');\n\n/**\n * An hour of the day, 0-24, on a 12-hour clock: 0 and 24 are `12am`, 13 is `1pm`, and a\n * fractional hour gets its minutes (`2.5` is `2:30am`) rather than reading `2.5am`.\n */\nexport function formatHourOfDay(value: number): string {\n let totalMinutes = Math.round(value * 60);\n totalMinutes = ((totalMinutes % 1440) + 1440) % 1440;\n const hour24 = Math.floor(totalMinutes / 60);\n const minutes = totalMinutes % 60;\n const hour = hour24 % 12 === 0 ? 12 : hour24 % 12;\n const period = hour24 < 12 ? 'am' : 'pm';\n return minutes === 0 ? `${hour}${period}` : `${hour}:${String(minutes).padStart(2, '0')}${period}`;\n}\n\n/** Plain numbers with thousands separators - `1,500`, `0.05` - for the `Decimal` format. */\nconst formatDecimal = format(',~f');\n\n/**\n * A single value (not a tick) in `pcacFormat`, the way an axis in that format labels it - so a\n * tooltip reads like the axis it's measured against. Returns null for the formats that have no\n * formatting of their own, and for a value the format can't read as a number, which callers show\n * as it is.\n */\nexport function formatValue(pcacFormat: PcacFormatEnum | undefined, value: unknown): string | null {\n const numeric = typeof value === 'number' || (typeof value === 'string' && value.trim() !== '')\n ? Number(value)\n : NaN;\n switch (pcacFormat) {\n case PcacFormatEnum.Percentage:\n return Number.isFinite(numeric) ? formatPercent(numeric) : null;\n case PcacFormatEnum.Decimal:\n return Number.isFinite(numeric) ? formatDecimal(numeric) : null;\n case PcacFormatEnum.OneDayHours:\n return Number.isFinite(numeric) ? formatHourOfDay(numeric) : null;\n case PcacFormatEnum.Minutes:\n return Number.isFinite(numeric) ? value + 'm' : null;\n case PcacFormatEnum.Fahrenheit:\n return Number.isFinite(numeric) ? value + ' F' : null;\n default:\n return null;\n }\n}\n\n/**\n * The tick label format for an axis in `format`, shared by both axes (so a format means the same\n * thing on x and y) and by anything that labels a value on that axis, like the line/area hover\n * crosshair. Returns null for the formats that keep D3's default labels.\n *\n * Numeric formats take their precision from the scale's tick step where the scale has one: a\n * fixed precision is fine for a whole domain but breaks down once zoom narrows it to a few units.\n *\n * On a category axis (a band scale - a bar chart's groups) only keys that are numbers are formatted\n * - `'0.25'` reads `25%` - and any other key is shown as it is: a format there, easy to set by\n * mistake on the horizontal chart (where y is the category axis), turned every label into `NaN%`\n * or `Chipsm`.\n */\nexport function axisTickFormat<Domain extends AxisDomain>(\n pcacFormat: PcacFormatEnum | undefined,\n scale: AxisScale<Domain>,\n ticks: number | undefined,\n): ((d: Domain) => string) | null {\n const format = valueTickFormat(pcacFormat, scale, ticks);\n if (!format || !('bandwidth' in scale)) {\n return format;\n }\n return (d: Domain) => isNumericKey(d) ? format(d) : String(d);\n}\n\n/** A category key that reads as a number - `0.25`, `'1500'` - rather than text like `'Chips'`. */\nfunction isNumericKey(key: unknown): boolean {\n return (typeof key === 'number' || (typeof key === 'string' && key.trim() !== '')) && Number.isFinite(Number(key));\n}\n\nfunction valueTickFormat<Domain extends AxisDomain>(\n pcacFormat: PcacFormatEnum | undefined,\n scale: AxisScale<Domain>,\n ticks: number | undefined,\n): ((d: Domain) => string) | null {\n const withTicks = scale as WithTickFormat<Domain>;\n switch (pcacFormat) {\n case PcacFormatEnum.Percentage:\n return withTicks.tickFormat ? withTicks.tickFormat(ticks, '~%') : (d) => formatPercent(Number(d));\n case PcacFormatEnum.Decimal:\n // Plain numbers with thousands separators - `1,500`, `0.05` - rather than SI prefixes, which\n // turned a differential of 0.05 into `50m` (reading as minutes, like the Minutes format).\n return withTicks.tickFormat ? withTicks.tickFormat(ticks, ',~f') : (d) => formatDecimal(Number(d));\n case PcacFormatEnum.Minutes:\n return (d) => d + 'm';\n case PcacFormatEnum.Fahrenheit:\n return (d) => d + ' F';\n case PcacFormatEnum.OneDayHours:\n return (d) => formatHourOfDay(Number(d));\n default:\n return null;\n }\n}\n","import { Injectable } from '@angular/core';\nimport { axisBottom, axisLeft, AxisScale, AxisDomain } from 'd3-axis';\nimport { BaseType, Selection } from 'd3-selection';\nimport { PCAC_AXIS_LABEL_SPACE, PcacChartMargin, PcacResolvedAxisConfig } from './chart.model';\nimport { axisTickFormat } from './tick-format';\n\n/**\n * Generic over each axis's own domain type (e.g. `number` for a value axis's `ScaleLinear`,\n * `string` for a category axis's `ScaleBand`) rather than `any`, since the two axes on a chart\n * routinely have different domain types and each real D3 scale already satisfies `AxisScale`\n * structurally - no widening needed at the type level.\n */\nexport interface IPcacAxisBuilderConfig<XDomain extends AxisDomain = AxisDomain, YDomain extends AxisDomain = AxisDomain> {\n svg: Selection<SVGGElement, unknown, BaseType, unknown>;\n /** Plot area size - the axes' own lengths - and the chart's margins, which position a `label`. */\n width: number;\n height: number;\n margin: PcacChartMargin;\n xScale: AxisScale<XDomain>;\n yScale: AxisScale<YDomain>;\n /**\n * The chart's per-axis settings, defaults already applied (`resolveAxisConfig()`). `hide` skips\n * the axis entirely. `tickSize` is D3's `tickSizeInner`; left undefined, D3's default of 6\n * applies to the geometry - but the theme hides tick marks unless the axis group carries\n * `pcac-axis-tick-marks`, which is added exactly when a size is given, so an undefined size\n * means \"no visible marks, labels where they've always been\". `0` is a legitimate value (no\n * marks, labels hugging the axis), hence the `!== undefined` checks below. `showLine` adds\n * `pcac-axis-line`, which un-hides D3's `.domain` path the same way. The domain path keeps\n * D3's default 6px outer end-caps (`tickSizeOuter`), so it reads as a bracket rather than a\n * bare rule; that's D3's standard look and is left as-is. `label` and `subLabels` are drawn\n * inside the axis group (so they're raised and non-interactive along with it) - see `drawLabels`.\n * `format` picks the tick label format; `None` leaves D3's default. The `*Color` fields are\n * applied by `applyColors`.\n */\n xAxis: PcacResolvedAxisConfig;\n yAxis: PcacResolvedAxisConfig;\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class PcacAxisBuilder {\n drawAxis<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacAxisBuilderConfig<XDomain, YDomain>): void {\n this.drawXAxis(config);\n this.drawYAxis(config);\n }\n\n /**\n * Moves both axis groups to the end of the chart's `<g>`, so they paint over everything drawn\n * since `drawAxis()`. Axes are drawn first (so scales and margins are settled before content),\n * which leaves anything sitting at x = 0 - a line chart's first segment and dot, an area's fill,\n * a horizontal bar chart's bars - painting over the y axis line. Builders call this after the\n * content that should sit *under* the axes, and draw anything that should stay on top (the\n * line/area/plot charts' dots) afterwards. Safe to sit above the hover/zoom overlay rects too,\n * because the groups are `pointer-events: none` (set where each group is appended).\n */\n raiseAxes(svg: Selection<SVGGElement, unknown, BaseType, unknown>): void {\n svg.selectAll('.pcac-x-axis, .pcac-y-axis').raise();\n }\n\n drawYAxis<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacAxisBuilderConfig<XDomain, YDomain>) {\n if (config.yAxis.hide) return;\n config.svg.selectAll('.pcac-y-axis').remove();\n\n const yAxis = axisLeft(config.yScale).ticks(config.yAxis.ticks);\n if (config.yAxis.tickSize !== undefined) {\n yAxis.tickSizeInner(config.yAxis.tickSize);\n }\n\n const yFormat = axisTickFormat(config.yAxis.format, config.yScale, config.yAxis.ticks);\n if (yFormat) {\n yAxis.tickFormat(yFormat);\n }\n\n\n const group = config.svg.append('g')\n .attr('class', 'pcac-y-axis')\n // Axes are raised above the interactive overlays (see raiseAxes) and take no mouse events\n .attr('pointer-events', 'none')\n // Nor are they read out: the marks' own names carry each key and value (see marks.ts), and\n // every tick label as well would only bury them.\n .attr('aria-hidden', 'true')\n .classed('pcac-axis-tick-marks', config.yAxis.tickSize !== undefined)\n .classed('pcac-axis-line', config.yAxis.showLine)\n .call(yAxis)\n .call(applyColors, config.yAxis);\n\n this.drawLabels(group, config.yAxis, { length: config.height, outer: config.margin.left, vertical: true });\n }\n\n drawXAxis<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacAxisBuilderConfig<XDomain, YDomain>) {\n if (config.xAxis.hide) return;\n config.svg.selectAll('.pcac-x-axis').remove();\n\n const xAxis = axisBottom(config.xScale).ticks(config.xAxis.ticks);\n if (config.xAxis.tickSize !== undefined) {\n xAxis.tickSizeInner(config.xAxis.tickSize);\n }\n\n const xFormat = axisTickFormat(config.xAxis.format, config.xScale, config.xAxis.ticks);\n if (xFormat) {\n xAxis.tickFormat(xFormat);\n }\n\n\n const group = config.svg.append('g')\n .attr('class', 'pcac-x-axis')\n .attr('pointer-events', 'none')\n .attr('aria-hidden', 'true')\n .classed('pcac-axis-tick-marks', config.xAxis.tickSize !== undefined)\n .classed('pcac-axis-line', config.xAxis.showLine)\n .attr('transform', 'translate(0,' + config.height + ')')\n .call(xAxis)\n .call(applyColors, config.xAxis);\n\n this.drawLabels(group, config.xAxis, { length: config.width, outer: config.margin.bottom, vertical: false });\n }\n\n /**\n * The axis `label` and `subLabels`. Both are placed by two distances: along the axis (0 at its\n * start, `length` at its end - for the y axis, 0 is the bottom) and out from it, toward the\n * chart's edge. The label goes at the very edge (`outer`, i.e. the margin), the sub-label row\n * `PCAC_AXIS_LABEL_SPACE` inside that when there's a label. For the y axis the text is rotated\n * to read bottom-to-top, which swaps the two: after `rotate(-90)` x runs up the axis (so the\n * bottom is x = -length) and y runs left. `fill` is set explicitly because d3-axis puts\n * `fill=\"none\"` on the group; its own tick text does the same.\n */\n private drawLabels(\n group: Selection<SVGGElement, unknown, BaseType, unknown>,\n axis: PcacResolvedAxisConfig,\n layout: { length: number; outer: number; vertical: boolean }\n ): void {\n const text = (cls: string, along: number, out: number, anchor: string, content: string) => {\n group.append('text')\n .attr('class', cls)\n .attr('fill', 'currentColor')\n .attr('text-anchor', anchor)\n .attr('transform', layout.vertical ? 'rotate(-90)' : null)\n .attr('x', layout.vertical ? along - layout.length : along)\n .attr('y', layout.vertical ? -out : out)\n .attr('dy', layout.vertical ? '1em' : '-0.35em')\n .text(content);\n };\n\n if (axis.label) {\n text('pcac-axis-label', layout.length / 2, layout.outer, 'middle', axis.label);\n }\n const sub = axis.subLabels;\n if (sub) {\n const edge = layout.outer - (axis.label ? PCAC_AXIS_LABEL_SPACE : 0);\n if (sub.min) text('pcac-axis-sub-label', 0, edge, 'start', sub.min);\n if (sub.mid) text('pcac-axis-sub-label', layout.length / 2, edge, 'middle', sub.mid);\n if (sub.max) text('pcac-axis-sub-label', layout.length, edge, 'end', sub.max);\n }\n }\n}\n\n/**\n * Sets the axis's `*Color` fields on its group as CSS custom properties, which the theme reads\n * with its own color as the fallback (`var(--pcac-axis-tick-color, ...)`). Custom properties\n * rather than inline `stroke`/`fill` on the elements: the theme still decides what is drawn (a\n * color never un-hides marks or the line), the property reaches everything d3-axis draws in the\n * group, and a stylesheet can set the same property on any ancestor. An unset field sets nothing.\n */\nfunction applyColors(group: Selection<SVGGElement, unknown, BaseType, unknown>, axis: PcacResolvedAxisConfig): void {\n group\n .style('--pcac-axis-tick-color', () => axis.tickColor ?? null)\n .style('--pcac-axis-tick-label-color', () => axis.tickLabelColor ?? null)\n .style('--pcac-axis-line-color', () => axis.lineColor ?? null)\n .style('--pcac-axis-label-color', () => axis.labelColor ?? null)\n .style('--pcac-axis-sub-label-color', () => axis.subLabelColor ?? null);\n}\n","import { Injectable } from '@angular/core';\nimport { BaseType, Selection } from 'd3-selection';\nimport { AxisScale, AxisDomain } from 'd3-axis';\n\n/**\n * Generic over each axis's own domain type, same rationale as `IPcacAxisBuilderConfig`.\n */\nexport interface IPcacGridBuilderConfig<XDomain extends AxisDomain = AxisDomain, YDomain extends AxisDomain = AxisDomain> {\n svg: Selection<SVGGElement, unknown, BaseType, unknown>;\n /**\n * Required for horizontal grid\n */\n width: number;\n /**\n * Required for vertical grid\n */\n height: number;\n xScale: AxisScale<XDomain>;\n yScale: AxisScale<YDomain>;\n /**\n * Tick count hint for a continuous scale (D3's `ticks(n)`); a category (band) scale ignores it\n * and gets one line per category.\n */\n numberOfTicks: number;\n /**\n * Line color (`PcacAxisConfig.gridColor`), set on the grid group as `--pcac-grid-color` for the\n * theme's `.pcac-grid-rule line` rule to read; unset means the theme's color. See the axis\n * builder's `applyColors` for why a custom property.\n */\n color?: string;\n}\n\n/**\n * `AxisScale` (the shape shared by every D3 scale usable here) doesn't declare `.ticks()` -\n * band scales don't have one - nor `.bandwidth()`, which only band scales have. Either kind can\n * drive a grid: a continuous scale puts a line at each tick, a band scale one through the middle\n * of each category, so `gridLines()` sniffs for `.ticks` and handles both.\n */\ntype TickableAxisScale<Domain extends AxisDomain> = AxisScale<Domain> & { ticks(count?: number): Domain[] };\ntype BandAxisScale<Domain extends AxisDomain> = AxisScale<Domain> & { bandwidth(): number };\n\n/** Where along its axis each grid line sits, in pixels. */\nfunction gridLines<Domain extends AxisDomain>(scale: AxisScale<Domain>, numberOfTicks: number): number[] {\n if (typeof (scale as TickableAxisScale<Domain>).ticks === 'function') {\n return (scale as TickableAxisScale<Domain>).ticks(numberOfTicks).map(d => scale(d) ?? 0);\n }\n const band = scale as BandAxisScale<Domain>;\n const half = typeof band.bandwidth === 'function' ? band.bandwidth() / 2 : 0;\n return scale.domain().map(d => (scale(d) ?? 0) + half);\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class PcacGridBuilder {\n /**\n * Vertical lines, one per x-axis tick (or category), running the plot's full height. The group\n * is classed `pcac-grid-vertical` (the horizontal one `pcac-grid-horizontal`) so a chart can\n * find and redraw just one grid - the line/area/plot charts do on zoom, when an axis's ticks move.\n */\n drawVerticalGrid<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacGridBuilderConfig<XDomain, YDomain>): void {\n config.svg.append('g')\n .attr('class', 'pcac-grid pcac-grid-vertical')\n .attr('aria-hidden', 'true')\n .style('--pcac-grid-color', () => config.color ?? null)\n .selectAll('g.rule')\n .data(gridLines(config.xScale, config.numberOfTicks))\n .enter().append('svg:g')\n .attr('class', 'pcac-grid-rule')\n .attr('transform', (x): string => (`translate(${x}, 0)`))\n .append('svg:line')\n .attr('y1', 0)\n .attr('y2', config.height);\n }\n\n /**\n * Horizontal lines, one per y-axis tick (or category), running the plot's full width.\n */\n drawHorizontalGrid<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacGridBuilderConfig<XDomain, YDomain>): void {\n config.svg.append('g')\n .attr('class', 'pcac-grid pcac-grid-horizontal')\n .attr('aria-hidden', 'true')\n .style('--pcac-grid-color', () => config.color ?? null)\n .selectAll('g.pcac-grid-rule')\n .data(gridLines(config.yScale, config.numberOfTicks))\n .enter().append('svg:g')\n .attr('class', 'pcac-grid-rule')\n .append('svg:line')\n .attr('y1', (y) => y)\n .attr('y2', (y) => y)\n .attr('x1', 0)\n .attr('x2', config.width);\n }\n}\n","import { Injectable, signal, untracked } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class PcacColorService {\n private primaryLight = '#a3a1fb';\n private success = '#5ee2a0';\n private danger = '#ff6565';\n private warning = '#fec163';\n private orange = '#ffa177';\n private blue = '#55d8fe';\n private alert = 'red';\n\n /**\n * Bumped by every setter, and read by the getters, so anything reading colors inside a reactive\n * context tracks palette changes: the legend's `colorScale` computed recomputes, and every chart\n * (whose build runs in an `effect`) redraws - together, rather than the legend keeping the old\n * swatches while newly built charts took the new palette.\n */\n private readonly version = signal(0);\n\n /**\n * Bumps `version` from a setter. `untracked`, because Angular forbids writing a signal inside a\n * `computed` - and a consumer deriving its theme reactively (`computed(() => { setScale(...);\n * ... })`) called these setters there without error before they were reactive.\n */\n private changed(): void {\n untracked(() => this.version.update((v) => v + 1));\n }\n\n /** A consumer's own scale from `setScale()`; replaces the default palette while set. */\n private customScale: string[] | null = null;\n\n /**\n * The palette charts cycle through: the `setScale()` one when given, else the default colors\n * built from the current fields - so a setter like `setSuccess()` changes the charts drawn after\n * it, rather than a copy of the colors taken when the service was created.\n */\n private get scale(): string[] {\n return this.customScale ?? [\n this.primaryLight,\n this.success,\n this.danger,\n this.warning,\n this.orange,\n this.blue,\n ];\n }\n\n /**\n * Get a scale of colors dynamically\n * @param numberOfNodes Number of items in dynamically build collection of colors\n */\n getColorScale(numberOfNodes: number): string[] {\n this.version();\n const palette = [] as string[];\n for (let i = 0; i < numberOfNodes; i++) {\n const mark = i % this.scale.length;\n palette.push(this.scale[mark]);\n }\n return palette;\n }\n\n getAlert(): string {\n this.version();\n return this.alert;\n }\n\n /**\n * Set the scale that charts use to set colors of data[x] on the UI, in place of the default\n * palette (and of the individual color setters below, which only shape the default). An empty\n * array goes back to the default palette rather than leaving charts with no colors.\n * @param colors A collection of hex values\n */\n setScale(colors: string[]): void {\n this.customScale = colors.length ? [...colors] : null;\n this.changed();\n }\n\n setPrimaryLight(color: string): void {\n this.primaryLight = color;\n this.changed();\n }\n\n setSuccess(color: string): void {\n this.success = color;\n this.changed();\n }\n\n setDanger(color: string): void {\n this.danger = color;\n this.changed();\n }\n\n setWarning(color: string): void {\n this.warning = color;\n this.changed();\n }\n\n setOrange(color: string): void {\n this.orange = color;\n this.changed();\n }\n\n setBlue(color: string): void {\n this.blue = color;\n this.changed();\n }\n\n setAlert(color: string): void {\n this.alert = color;\n this.changed();\n }\n}\n","import { DOCUMENT, Injectable, inject } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class PcacTransitionService {\n private transitionDuration = 750;\n private document = inject(DOCUMENT);\n\n /**\n * How long the charts animate - bars growing, lines drawing in, hover fades - or 0 when the user\n * has asked their system to reduce motion, so every chart is drawn in its final state at once.\n * Read on every call rather than once, so changing the setting applies from the next draw on.\n */\n getTransitionDuration(): number {\n return this.prefersReducedMotion() ? 0 : this.transitionDuration;\n }\n\n /** `false` where there's no `matchMedia` to ask - server-side rendering, a test environment. */\n private prefersReducedMotion(): boolean {\n return this.document.defaultView?.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false;\n }\n}\n","import { Selection } from 'd3-selection';\n\n/** Marks the elements `makeMarksAccessible` set up, so navigation can find a chart's marks. */\nconst MARK_ATTR = 'data-pcac-mark';\n\n/**\n * How a chart's marks - its bars, slices or points - take part in keyboard and screen reader use.\n * See `makeMarksAccessible`.\n */\nexport interface PcacMarkAccess<E extends Element, D> {\n /** The mark's accessible name, e.g. `\"Chips, 2024: 680\"`. */\n label: (d: D, element: E) => string;\n /** Leaves a mark out of navigation and the accessibility tree: a hidden bar, series or slice. */\n skip?: (d: D) => boolean;\n /** Enter or Space on a mark: what a click does. */\n activate: (d: D) => void;\n /** Keyboard focus arrived on a mark: what hovering it does - highlight it and show its tooltip. */\n focus: (element: E, d: D) => void;\n /** Keyboard focus left a mark, or Escape was pressed on it: what the pointer leaving does. */\n blur: (element: E, d: D) => void;\n}\n\n/**\n * Makes a chart's marks usable from the keyboard and readable by a screen reader, alongside the\n * pointer handlers they already have.\n *\n * Every mark gets a role and a name, but only one of them - the chart's \"tab stop\" - is in the Tab\n * order (see `refreshTabStop`): Tab reaches the chart once, and the arrow keys move between its\n * marks, Home and End to the first and last. A chart of a thousand bars isn't a thousand Tab\n * presses to get past. Focus does what hovering does (`focus`), and Enter or Space what a click\n * does (`activate`); Escape hides the tooltip, as moving the pointer away would - and goes no\n * further while it has one to hide, so it doesn't also close a dialog the chart is in. Keys pressed\n * with Alt, Ctrl or Cmd are left to the browser (Alt+Left is Back).\n *\n * A mark takes focus from the keyboard only: pressing the pointer on one is kept from focusing it,\n * so a click doesn't leave a keyboard-style tooltip and focus ring behind on the clicked mark. It\n * does let go of a mark in the same chart that has focus, which would otherwise stay highlighted,\n * its tooltip gone, while the pointer is at work elsewhere in the chart.\n */\nexport function makeMarksAccessible<E extends Element, D>(\n marks: Selection<E, D, any, any>,\n access: PcacMarkAccess<E, D>,\n): void {\n const skipped = (d: D) => access.skip?.(d) ?? false;\n // The marks showing what focus shows (their tooltip, highlighted), until blur or Escape.\n const open = new WeakSet<Element>();\n marks\n .attr(MARK_ATTR, (d: D) => (skipped(d) ? null : ''))\n .attr('aria-hidden', (d: D) => (skipped(d) ? 'true' : null))\n // An image, with a name, rather than a button: whether the chart's click output has a listener\n // can't be told from here (the pie, donut, line, area and plot charts' own wrappers always\n // listen, to pass it on), and a button that does nothing would be a lie. Enter and Space still\n // do what a click does, and the click listener has browsers report the mark as clickable.\n .attr('role', (d: D) => (skipped(d) ? null : 'img'))\n .attr('aria-label', function (this: E, d: D) {\n return skipped(d) ? null : access.label(d, this);\n })\n .attr('tabindex', (d: D) => (skipped(d) ? null : -1))\n // The events are typed plainly as `Event`: with the element type generic here, d3's typings\n // (@types/d3-selection 3.0.12 on) can't narrow them to `MouseEvent`/`KeyboardEvent`.\n .on('mousedown.pcac-mark', function (this: E, event: Event) {\n event.preventDefault();\n const focused = this.ownerDocument.activeElement;\n if (focused !== this && focused?.hasAttribute(MARK_ATTR) && sameChart(focused, this)) {\n (focused as SVGElement).blur();\n }\n })\n .on('focus.pcac-mark', function (this: E, _event: Event, d: D) {\n open.add(this);\n access.focus(this, d);\n })\n .on('blur.pcac-mark', function (this: E, _event: Event, d: D) {\n open.delete(this);\n access.blur(this, d);\n })\n .on('keydown.pcac-mark', function (this: E, event: Event, d: D) {\n const { key, altKey, ctrlKey, metaKey } = event as KeyboardEvent;\n if (altKey || ctrlKey || metaKey) {\n return;\n }\n switch (key) {\n case 'Enter':\n case ' ':\n event.preventDefault();\n access.activate(d);\n return;\n case 'Escape':\n // Only while there's a tooltip to hide; a second Escape carries on to whatever the\n // chart is in (a dialog closes, as it would have).\n if (open.delete(this)) {\n event.preventDefault();\n event.stopPropagation();\n access.blur(this, d);\n }\n return;\n }\n const target = neighbor(this, key);\n if (target) {\n event.preventDefault();\n moveFocus(this, target);\n }\n });\n}\n\n/** Where a chart's Tab stop was, and whether it had focus: what a redraw puts back. */\nexport interface PcacMarkFocus {\n /** The Tab stop's place among the marks that could take focus. */\n index: number;\n focused: boolean;\n}\n\n/**\n * Notes the chart's Tab stop - and whether it has focus - before a redraw removes every mark, so\n * `refreshTabStop` can put both back: a keyboard user who pressed Enter on a bar, with a click\n * handler that updates the data, stays on that bar rather than being dropped at the top of the\n * page. `null` when the chart has no Tab stop.\n */\nexport function captureMarkFocus(root: Element | null): PcacMarkFocus | null {\n if (!root) {\n return null;\n }\n const marks = navigableMarks(root);\n const index = marks.findIndex((mark) => mark.getAttribute('tabindex') === '0');\n if (index < 0) {\n return null;\n }\n return { index, focused: root.ownerDocument.activeElement === marks[index] };\n}\n\n/**\n * Puts the chart's one Tab stop (`tabindex=\"0\"`) on a mark that can take focus; every other mark\n * is `-1` already (`makeMarksAccessible`). Call once a chart's marks are drawn, and again whenever\n * marks can have been hidden - by zoom, say - so Tab doesn't land on one that can't be focused and\n * skip the chart.\n *\n * Leaves the Tab stop where it is while that mark can still take focus, so coming back to the chart\n * returns to the mark last visited. After a redraw, given what `captureMarkFocus` noted, it goes\n * back to the same place - the last mark, if there are fewer now - and takes focus back if it had\n * it. Touches only the old and new stops, as it runs on every zoom frame.\n */\nexport function refreshTabStop(root: Element | null, previous: PcacMarkFocus | null = null): void {\n if (!root) {\n return;\n }\n const current = root.querySelector(`[${MARK_ATTR}][tabindex=\"0\"]`);\n if (current && !previous && !isNotDisplayed(current, root)) {\n return;\n }\n const marks = navigableMarks(root);\n const stop = previous ? marks[Math.min(previous.index, marks.length - 1)] : marks[0];\n if (current && current !== stop) {\n current.setAttribute('tabindex', '-1');\n }\n if (!stop) {\n return;\n }\n stop.setAttribute('tabindex', '0');\n if (previous?.focused) {\n (stop as SVGElement).focus({ preventScroll: true });\n }\n}\n\n/** Whether two marks are in the same chart (the same `<svg>`). */\nfunction sameChart(a: Element, b: Element): boolean {\n return ((a as SVGElement).ownerSVGElement ?? a.parentElement) === ((b as SVGElement).ownerSVGElement ?? b.parentElement);\n}\n\n/** The chart's marks that can take focus now, in drawing order. */\nfunction navigableMarks(root: Element): Element[] {\n return Array.from(root.querySelectorAll(`[${MARK_ATTR}]`)).filter((mark) => !isNotDisplayed(mark, root));\n}\n\n/**\n * Whether the mark, or a group it's in, isn't displayed: a hidden series, or a point zoomed out of\n * the plot. Read from the `display` attribute and inline style the builders set, rather than from\n * layout, which a browser without one (a test environment) doesn't have.\n */\nfunction isNotDisplayed(mark: Element, root: Element): boolean {\n for (let node: Element | null = mark; node && node !== root; node = node.parentElement) {\n if (node.getAttribute('display') === 'none' || (node as SVGElement).style?.display === 'none') {\n return true;\n }\n }\n return false;\n}\n\n/** The mark an arrow, Home or End key moves to from `mark`, or `null` for any other key. */\nfunction neighbor(mark: Element, key: string): Element | null {\n const root = (mark as SVGElement).ownerSVGElement ?? mark.parentElement;\n if (!root) {\n return null;\n }\n const marks = navigableMarks(root);\n const at = marks.indexOf(mark);\n switch (key) {\n case 'ArrowRight':\n case 'ArrowDown':\n return marks[Math.min(at + 1, marks.length - 1)] ?? null;\n case 'ArrowLeft':\n case 'ArrowUp':\n return marks[Math.max(at - 1, 0)] ?? null;\n case 'Home':\n return marks[0] ?? null;\n case 'End':\n return marks[marks.length - 1] ?? null;\n default:\n return null;\n }\n}\n\n/** Moves focus, and the chart's Tab stop with it, from one mark to another. */\nfunction moveFocus(from: Element, to: Element): void {\n if (from === to) {\n return;\n }\n from.setAttribute('tabindex', '-1');\n to.setAttribute('tabindex', '0');\n (to as SVGElement).focus();\n}\n\n","import { ApplicationRef, DOCUMENT, EmbeddedViewRef, Injectable, OnDestroy, TemplateRef, inject } from '@angular/core';\nimport { PcacData, PcacFormatEnum } from './chart.model';\nimport { PcacTooltipContext } from './tooltip.directive';\nimport { Selection, select } from 'd3-selection';\nimport { formatValue } from './tick-format';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class PcacTooltipBuilder implements OnDestroy {\n private appRef = inject(ApplicationRef);\n private document = inject(DOCUMENT);\n\n private shell: Selection<HTMLDivElement, unknown, null, undefined> | null = null;\n\n /**\n * One tooltip element shared by every chart on the page, appended to `<body>` so it can float\n * over anything. It's only ever a positioning shell: the default look (`.pcac-d3-tooltip-default`)\n * is toggled on when the library renders its own key/value content and off when a consumer's\n * `<ng-template pcacTooltip>` is rendered into it instead, so a custom template owns the whole box.\n *\n * Created on first use rather than with the service, which every chart builder injects: that\n * way nothing touches the DOM until a chart actually shows a tooltip, so building a chart\n * where there's no browser `document` (server-side rendering) doesn't throw. Removed again in\n * `ngOnDestroy()`, when the app that owns this root service is destroyed. The touch listener\n * (see `onPointerDown`) is added and removed with it.\n */\n get tooltip(): Selection<HTMLDivElement, unknown, null, undefined> {\n if (!this.shell) {\n this.shell = select(this.document.body)\n .append('div')\n .attr('class', 'pcac-d3-tooltip')\n .attr('id', PcacTooltipBuilder.ID)\n .attr('role', 'tooltip');\n this.document.addEventListener('pointerdown', this.onPointerDown, { capture: true, passive: true });\n }\n return this.shell;\n }\n\n /**\n * A touch (or pen) coming down anywhere closes the tooltip. A tap shows it by way of the mouse\n * events the browser makes up for the tap, but nothing then moves off the mark to hide it again:\n * without this it stayed up after a tap until the next one happened to land on another mark,\n * scrolled away with the page, and covered whatever opened in response. A tap on another mark\n * still shows its tooltip - this runs first, on the way down, and the made-up mouse events that\n * show the new one come after. A mouse is left alone; it hides the tooltip by leaving the mark.\n */\n private readonly onPointerDown = (event: PointerEvent): void => {\n if (event.pointerType !== 'mouse') {\n this.hideTooltip();\n }\n };\n\n /**\n * The consumer template currently rendered into the shell, if any. Created on the first show\n * of a hover and torn down in `hideTooltip()` - not kept around between hovers - so a view is\n * never left holding onto a declaring component that has since been destroyed (e.g. after a\n * route change). While it lives, repeated `mousemove`s just update its context in place.\n */\n private view: EmbeddedViewRef<PcacTooltipContext> | null = null;\n private viewTemplate: TemplateRef<PcacTooltipContext> | null = null;\n\n /**\n * Whatever showed the tooltip last (a chart passes itself), so `hideTooltip(owner)` from any\n * other chart leaves it alone. The element is shared by every chart on the page: without this, a\n * chart rebuilding or being destroyed would close the tooltip another chart is showing.\n */\n private owner: object | null = null;\n\n /**\n * The tooltip element's id, for a focused mark's `aria-describedby` (see `PcacChart.showMarkTooltip`).\n * One per page, like the element.\n */\n static readonly ID = 'pcac-tooltip';\n\n /** Space left between the tooltip and whatever it's placed next to (the cursor or an anchor). */\n static readonly GAP = 8;\n\n /**\n * Shows the tooltip for a hovered datum. Renders `template` when the chart has one projected;\n * otherwise falls back to the default key/value content, formatted per `valueFormat`/`keyFormat`.\n * Placed beside `anchor` when one is given (see `positionBeside`), else above the event's position.\n * `event` can be `null` only with an `anchor`: a tooltip shown for keyboard focus has no pointer.\n * `owner` is what's showing it (see `hideTooltip`).\n */\n showTooltip(\n event: MouseEvent | null,\n template: TemplateRef<PcacTooltipContext> | undefined,\n context: PcacTooltipContext,\n valueFormat?: PcacFormatEnum,\n keyFormat?: PcacFormatEnum,\n anchor?: Element | null,\n owner?: object\n ): void {\n this.owner = owner ?? null;\n if (template) {\n this.renderTemplate(template, context);\n } else {\n this.renderDefault(context.$implicit, valueFormat, keyFormat);\n }\n const shell = this.measurable();\n if (anchor) {\n this.positionBeside(shell, anchor);\n } else if (event) {\n this.positionAbove(shell, event);\n }\n }\n\n /**\n * Hides the tooltip. Given an `owner`, only if that owner is the one showing it - so a chart can\n * release the tooltip on rebuild or destroy without closing one another chart has open. Without\n * an owner it always hides.\n */\n hideTooltip(owner?: object): void {\n if (owner !== undefined && owner !== this.owner) {\n return;\n }\n this.owner = null;\n if (!this.shell) {\n // Never shown, so there's nothing to hide - and no reason to create the element just to.\n return;\n }\n this.shell.style('display', 'none');\n this.destroyView();\n }\n\n ngOnDestroy(): void {\n this.destroyView();\n if (this.shell) {\n this.document.removeEventListener('pointerdown', this.onPointerDown, { capture: true });\n }\n this.shell?.remove();\n this.shell = null;\n }\n\n /**\n * The library's own key/value content. Built from text nodes, never parsed as HTML: `key` and\n * `value` are consumer data, and markup in them must show as text rather than run.\n */\n private renderDefault(data: PcacData, valueFormat?: PcacFormatEnum, keyFormat?: PcacFormatEnum): void {\n this.destroyView();\n const { key, value } = tooltipText(data, valueFormat, keyFormat);\n const shell = this.tooltip\n .classed('pcac-d3-tooltip-default', true)\n .html(null)\n .node() as HTMLDivElement;\n if (key !== null) {\n shell.append(key, this.document.createElement('br'));\n }\n shell.append(value);\n }\n\n private renderTemplate(template: TemplateRef<PcacTooltipContext>, context: PcacTooltipContext): void {\n if (this.view && this.viewTemplate === template) {\n // Same hover, new mouse position/datum: keep the view and just refresh what it's bound to.\n Object.assign(this.view.context, context);\n } else {\n this.destroyView();\n this.tooltip.classed('pcac-d3-tooltip-default', false).html(null);\n\n // Same technique as the CDK's DomPortalOutlet: create the view off-tree, attach it to the\n // app so it takes part in change detection (a template reading a signal keeps updating\n // while shown), then physically move its nodes into the shell. The view's own injector is\n // the declaring component's, so pipes/DI in the template resolve as they would in place.\n this.view = template.createEmbeddedView(context);\n this.viewTemplate = template;\n this.appRef.attachView(this.view);\n const shell = this.tooltip.node() as HTMLDivElement;\n for (const node of this.view.rootNodes) {\n shell.appendChild(node);\n }\n }\n // The trigger is a D3-native mouse listener, which nothing in Angular observes under zoneless\n // change detection, so the view has to be checked explicitly for the new context to render\n // before it's measured for positioning.\n this.view.detectChanges();\n }\n\n private destroyView(): void {\n if (!this.view) {\n return;\n }\n // `destroy()` also detaches the view from the ApplicationRef it was attached to, but it\n // doesn't pull the nodes we moved into the shell back out of the DOM - that's what a\n // ViewContainerRef would normally do on removal - so the shell is emptied here explicitly.\n this.view.destroy();\n this.view = null;\n this.viewTemplate = null;\n this.shell?.html(null);\n }\n\n /**\n * Shows the (already rendered) shell at the page's top-left so it can be measured. Left where the\n * last hover put it, a shell near the right edge would be squeezed by its containing block and\n * measure narrower (wrapped) than the content really is once it's moved somewhere with room.\n */\n private measurable(): HTMLDivElement {\n return this.tooltip\n .style('left', '0px')\n .style('top', '0px')\n .style('display', 'inline-block')\n .node() as HTMLDivElement;\n }\n\n /**\n * Centers the tooltip horizontally on the cursor and sits it just above. Measured from the real\n * box rather than fixed offsets so it works for content of any size. Kept on screen like\n * `positionBeside`: slid in from whichever side edge it would cross (the left one winning if it's\n * wider than the viewport), and dropped below the cursor when there's no room above - hovering\n * a bar at the page's edge used to cut the tooltip off.\n */\n private positionAbove(shell: HTMLDivElement, event: MouseEvent): void {\n const gap = PcacTooltipBuilder.GAP;\n const width = shell.offsetWidth;\n const height = shell.offsetHeight;\n const viewport = this.document.documentElement;\n const scrollX = this.document.defaultView?.scrollX ?? 0;\n const scrollY = this.document.defaultView?.scrollY ?? 0;\n\n const centered = event.pageX - width / 2;\n const left = Math.max(scrollX, Math.min(centered, scrollX + viewport.clientWidth - width));\n const above = event.pageY - height - gap;\n const top = above >= scrollY ? above : event.pageY + gap;\n\n this.tooltip\n .style('left', left + 'px')\n .style('top', top + 'px');\n }\n\n /**\n * Places the tooltip diagonally off one corner of `anchor`'s rendered box, so it never covers\n * the anchor itself (e.g. a point's image). Prefers above-right - the tooltip's bottom-left\n * corner at the anchor's top-right - and flips each axis independently when the tooltip wouldn't\n * fit in the viewport that way: to the left when there's no room on the right, below when there's\n * no room above. When neither side of an axis fits, it takes whichever side has more room.\n */\n private positionBeside(shell: HTMLDivElement, anchor: Element): void {\n const gap = PcacTooltipBuilder.GAP;\n const box = anchor.getBoundingClientRect();\n const width = shell.offsetWidth;\n const height = shell.offsetHeight;\n // `clientWidth`/`clientHeight` of the root, unlike `innerWidth`/`innerHeight`, exclude scrollbars.\n const viewport = this.document.documentElement;\n const view = this.document.defaultView;\n\n const right = viewport.clientWidth - box.right - gap;\n const left = box.left - gap;\n const above = box.top - gap;\n const below = viewport.clientHeight - box.bottom - gap;\n\n const toRight = width <= right || (width > left && right >= left);\n const toTop = height <= above || (height > below && above >= below);\n\n const x = toRight ? box.right + gap : box.left - gap - width;\n const y = toTop ? box.top - gap - height : box.bottom + gap;\n\n // The rect is in viewport coordinates; the shell is absolutely positioned against the page.\n this.tooltip\n .style('left', x + (view?.scrollX ?? 0) + 'px')\n .style('top', y + (view?.scrollY ?? 0) + 'px');\n }\n}\n\n/**\n * The default tooltip's two lines as plain text; `key` is null when the datum has none. Also what a\n * mark's accessible name is made of (see `PcacChart.markLabel`), so the two read the same.\n */\nexport function tooltipText(\n data: PcacData,\n valueFormat?: PcacFormatEnum,\n keyFormat?: PcacFormatEnum,\n): { key: string | null; value: string } {\n let value = data.value;\n let key = data.key\n\n // Formatted the way the value's axis labels it (see `formatValue`), so the tooltip for a\n // point reads like the axis it sits against - `1:30pm`, not `13.5`, on a OneDayHours axis.\n // A missing value stays blank rather than being formatted as `0%` / `null F`.\n if (value !== null && value !== undefined) {\n value = formatValue(valueFormat, value) ?? value;\n }\n\n if (key !== null && key !== undefined && key !== '') {\n // A key that doesn't parse as a date is shown as it is, rather than as \"Invalid Date\".\n if (keyFormat === PcacFormatEnum.DateTime && !Number.isNaN(new Date(key).getTime())) {\n key = new Date(key).toLocaleDateString('en-US', {\n day: '2-digit',\n month: '2-digit',\n year: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit'\n })\n } else if (keyFormat === PcacFormatEnum.Decimal) {\n // Only where the key *is* the x value. Every other x format positions points by index,\n // so its axis labels the index, not the key - formatting the key would only make it\n // disagree with the axis (and tag text keys with a unit: `Mon` read `Monm` on Minutes).\n key = formatValue(keyFormat, key) ?? key;\n }\n }\n\n // A key of 0 (e.g. hour 0) is a real key; only a missing or empty one leaves the line out.\n return {\n key: key === null || key === undefined || key === '' ? null : String(key),\n value: value === null || value === undefined ? '' : String(value),\n };\n}\n","import { axisLeft, AxisDomain, AxisScale } from 'd3-axis';\nimport { BaseType, Selection } from 'd3-selection';\nimport { IPcacAxisBuilderConfig, PcacAxisBuilder } from './axis.builder';\nimport { PcacGridBuilder } from './grid.builder';\nimport { PcacColorService } from './color.service';\nimport { select } from 'd3-selection';\nimport { ElementRef, Injectable, OnDestroy, TemplateRef, inject } from '@angular/core';\nimport { PCAC_AXIS_LABEL_SPACE, PCAC_AXIS_SUB_LABEL_SPACE, PcacAxisChartConfig, PcacChartConfig, PcacChartMargin, PcacData, PcacFormatEnum, PcacResolvedAxisConfig, axisLabelSpace, resolveAxisConfig } from './chart.model';\nimport { PcacTransitionService } from './transition.service';\nimport { axisTickFormat } from './tick-format';\nimport { PcacMarkFocus, captureMarkFocus, refreshTabStop } from './marks';\nimport { PcacTooltipBuilder, tooltipText } from './tooltip.builder';\nimport { PcacTooltipCoincident, PcacTooltipContext } from './tooltip.directive';\n\n/** The most of its container's width a chart's measured left (label) margin may take. */\nconst MAX_LABEL_MARGIN_SHARE = 0.5;\n\n/** D3's gap between a tick and its label (`axis.tickPadding()`), which the builders never change. */\nconst TICK_PADDING = 3;\n\n/** D3's default tick length (`axis.tickSizeInner()`), used while an axis's `tickSize` isn't set. */\nconst DEFAULT_TICK_SIZE = 6;\n\n/**\n * Everything `showTooltip()` needs beyond the hovered datum itself. `parent`/`isThreshold` feed\n * the consumer template's context; the formats only apply to the default (no template) content.\n */\nexport interface PcacTooltipOptions {\n /** See `PcacTooltipContext.index`. Required so no hover site can forget to supply it. */\n index: number;\n parent?: PcacData | null;\n /** See `PcacTooltipContext.parentIndex`. Defaults to `null`, matching `parent`'s default. */\n parentIndex?: number | null;\n isThreshold?: boolean;\n /** See `PcacTooltipContext.coincident`. Defaults to none. */\n coincident?: PcacTooltipCoincident[];\n valueFormat?: PcacFormatEnum;\n keyFormat?: PcacFormatEnum;\n /**\n * The element the tooltip is placed beside instead of above the cursor: off one of its corners,\n * whichever fits in the viewport (see `PcacTooltipBuilder.positionBeside`), so it never covers it.\n */\n anchor?: Element | null;\n}\n\n\n// Decorated only so Angular accepts its `ngOnDestroy` hook, which the builders extending it inherit;\n// never provided itself - each builder is provided by its own chart component.\n@Injectable()\nexport class PcacChart implements OnDestroy {\n axisBuilder = inject(PcacAxisBuilder);\n gridBuilder = inject(PcacGridBuilder);\n transitionService = inject(PcacTransitionService);\n tooltipBuilder = inject(PcacTooltipBuilder);\n colorService = inject(PcacColorService);\n\n /** D3's own `tickSizeInner` default, which the default `margin` below is sized around. */\n static readonly DEFAULT_TICK_SIZE = 6;\n\n /** See `PCAC_AXIS_LABEL_SPACE` / `PCAC_AXIS_SUB_LABEL_SPACE` in chart.model.ts. */\n static readonly AXIS_LABEL_SPACE = PCAC_AXIS_LABEL_SPACE;\n static readonly AXIS_SUB_LABEL_SPACE = PCAC_AXIS_SUB_LABEL_SPACE;\n\n margin: PcacChartMargin = { top: 8, right: 16, bottom: 20, left: 40 };\n private readonly defaultMargin: PcacChartMargin = { ...this.margin };\n\n /**\n * The current build's per-axis settings with defaults applied, set by `initializeAxisState()`.\n * Builders read these (not the raw `config.xAxis`) everywhere: drawing the axes, choosing\n * whether to draw a grid, how many grid lines, and so on. Pie has no axes and never sets them.\n */\n xAxis: PcacResolvedAxisConfig = resolveAxisConfig();\n yAxis: PcacResolvedAxisConfig = resolveAxisConfig();\n svg!: Selection<SVGGElement, unknown, BaseType, unknown>;\n width = 400;\n height = 400;\n colors = [] as string[];\n /**\n * How wide a y-axis tick label may be once `setHorizontalMarginsBasedOnContent` has capped the\n * margin, or `null` while the labels fit as they are. See `truncateYTickLabels`.\n */\n protected yTickLabelMaxWidth: number | null = null;\n startData: PcacData[] = [];\n\n /** The chart's accessible name when its config gives no `ariaLabel`; each builder names its type. */\n protected chartTypeLabel = 'Chart';\n\n /** Grows the palette to at least `count` colors, repeating it as `getColorScale` does. */\n protected ensureColorCount(count: number): void {\n if (this.colors.length < count) {\n this.colors = this.colorService.getColorScale(count);\n }\n }\n\n /**\n * Swaps a consumer's `colorOverride` in for the theme palette `initializeChartState` set, in\n * order. Checks `length` rather than truthiness: every config class defaults its override to\n * `[]`, and an empty array is truthy - taken as an override, it would leave every mark with no\n * color. Cycled out to at least as many entries as the theme palette, the same way that palette\n * cycles its own colors, so an override shorter than the data repeats rather than leaving the\n * marks past its end with an `undefined` color. Call after `initializeChartState()`.\n */\n protected applyColorOverride(override: readonly string[] | undefined): void {\n if (!override?.length) {\n return;\n }\n this.colors = Array.from(\n { length: Math.max(this.colors.length, override.length) },\n (_, i) => override[i % override.length],\n );\n }\n\n /**\n * Raw, unadjusted container width measured by the last successful `initializeChartState()`\n * call, or `null` if none has succeeded yet. Deliberately tracked separately from `width`:\n * some builders (e.g. bar-horizontal-chart's `setHorizontalMarginsBasedOnContent`) recompute\n * `width`/`margin.left` mid-build from measured axis-label sizes, so `width` alone isn't a\n * stable basis for \"did the container itself resize\" — the raw container measurement is.\n */\n private lastContainerWidth: number | null = null;\n\n /**\n * Raw container height measured by the last successful `initializeChartState()` call, and\n * whether that build was running with `heightFull` on. Only consulted by `containerSizeChanged`\n * when it was: without `heightFull` the container's height is driven *by* the chart's own SVG\n * height, so comparing it would report \"changed\" every time the chart itself grew or shrank.\n */\n private lastContainerHeight: number | null = null;\n private lastHeightFull = false;\n\n /**\n * How much the vertical margins have grown this build beyond their defaults - for tick marks\n * and axis labels (`initializeAxisState()`; negative when a short tick took some away) and for\n * content that hangs past the plot's edge (`reserveEdgeSpace()`). `resolveHeight()` subtracts\n * it from the plot height so the SVG's total height doesn't change with any of them. Reset\n * alongside the margins.\n */\n private reservedHeight = 0;\n\n /**\n * Resolves the consumer's projected `<ng-template pcacTooltip>`, if any. Each chart component\n * points this at its own `contentChild(PcacTooltipDirective)` query. It's a getter rather than\n * a captured value so it's read lazily, at hover time, from inside a D3 listener: reading the\n * query signal in the component's build effect instead would make the effect depend on it and\n * rebuild the whole chart (restarting its entry animation) whenever the query resolves.\n */\n tooltipTemplate: () => TemplateRef<PcacTooltipContext> | undefined = () => undefined;\n\n /**\n * Puts `margin` back to its defaults. `initializeAxisState()` calls this first thing, before any\n * per-build adjustment (hidden axes giving sides back, tick sizes growing them, label widths\n * measured into `margin.left`): `margin` lives on this per-chart instance and so persists\n * between builds, and without a reset an adjustment made for one config silently carries into\n * the next - e.g. axes drawn with no room after `hide` flips back to false.\n */\n resetMargin(): void {\n this.margin = { ...this.defaultMargin };\n this.reservedHeight = 0;\n }\n\n /**\n * Resolves the config's `xAxis`/`yAxis` onto this chart and sets the margins up for them. Axis\n * charts call this at the top of `buildChart()`, on their own copy of the config (it rewrites\n * `config.height` for hidden axes), before `initializeChartState()` measures the plot area.\n * In order:\n *\n * 1. `resetMargin()`.\n * 2. Tick marks: an axis with `autoTickSize` takes its `tickSize` from `autoTickSize` (see below).\n * Then room for a non-default `tickSize` is reserved on each axis that will actually\n * be drawn (`reserveTickSizeMargins`).\n * 3. Labels: `AXIS_LABEL_SPACE` is added to `bottom` / `left` for an axis with a `label`, and\n * `AXIS_SUB_LABEL_SPACE` for one with any `subLabels` (see `axisLabelSpace`), again only if\n * the axis will be drawn.\n * 4. Hidden axes: an axis with `hide` gives its margins back to the plot. The y axis owns\n * `left` and `top` (the top margin is only there so the topmost y label isn't clipped), the\n * x axis `bottom` and `right` (likewise for the rightmost x label). Each reclaimed vertical\n * margin is added onto `config.height` so the SVG's total height stays what the consumer\n * configured; horizontally `initializeChartState()` picks the change up on its own.\n *\n * @param defaultGrid the axis whose grid this chart draws when the consumer hasn't said\n * (`PcacAxisConfig.showGrid`): `'y'` for horizontal lines, `'x'` for vertical.\n * @param hiddenAxisMargin what a hidden axis's sides shrink to, rather than 0. The\n * line/area/plot charts keep 8px so a dot on the edge of the plot isn't clipped by the SVG.\n * @param autoTickSize for the charts that draw points: half their largest mark toward each axis\n * (`x`: its vertical half, `y`: its horizontal half), which an axis with `autoTickSize` takes,\n * rounded up, as its `tickSize` - in place of any `tickSize` the consumer gave. Left out, as by\n * the charts without points, `autoTickSize` does nothing.\n */\n initializeAxisState(\n config: PcacAxisChartConfig, defaultGrid: 'x' | 'y', hiddenAxisMargin = 0, autoTickSize?: { x: number; y: number }\n ): void {\n this.xAxis = resolveAxisConfig(config.xAxis, defaultGrid === 'x');\n this.yAxis = resolveAxisConfig(config.yAxis, defaultGrid === 'y');\n if (autoTickSize && this.xAxis.autoTickSize) {\n this.xAxis.tickSize = Math.ceil(autoTickSize.x);\n }\n if (autoTickSize && this.yAxis.autoTickSize) {\n this.yAxis.tickSize = Math.ceil(autoTickSize.y);\n }\n this.resetMargin();\n this.reserveTickSizeMargins(\n this.xAxis.hide ? undefined : this.xAxis.tickSize,\n this.yAxis.hide ? undefined : this.yAxis.tickSize\n );\n if (!this.xAxis.hide) {\n const space = axisLabelSpace(this.xAxis);\n this.margin.bottom += space;\n this.reservedHeight += space;\n }\n if (!this.yAxis.hide) {\n this.margin.left += axisLabelSpace(this.yAxis);\n }\n if (this.yAxis.hide) {\n config.height = config.height + this.margin.top - hiddenAxisMargin;\n this.margin.top = hiddenAxisMargin;\n this.margin.left = hiddenAxisMargin;\n }\n if (this.xAxis.hide) {\n config.height = config.height + this.margin.bottom - hiddenAxisMargin;\n this.margin.bottom = hiddenAxisMargin;\n this.margin.right = hiddenAxisMargin;\n }\n }\n\n /**\n * The `PcacAxisBuilder` config for this chart's current state - everything but the scales is\n * already on the instance. Builders pass the result to `drawAxis()` (or `drawXAxis()` with a\n * rescaled x, on zoom).\n */\n axisBuilderConfig<XDomain extends AxisDomain, YDomain extends AxisDomain>(\n xScale: AxisScale<XDomain>, yScale: AxisScale<YDomain>\n ): IPcacAxisBuilderConfig<XDomain, YDomain> {\n return {\n svg: this.svg,\n width: this.width,\n height: this.height,\n margin: this.margin,\n xScale,\n yScale,\n xAxis: this.xAxis,\n yAxis: this.yAxis\n };\n }\n\n /**\n * Draws whichever grids the resolved axes ask for: vertical lines from the x axis's ticks,\n * horizontal from the y's (`PcacAxisConfig.showGrid`). `which` restricts it to one axis - the\n * line/area/plot charts redraw just a zoomed axis's grid against its rescaled scale on zoom.\n */\n drawGrids<XDomain extends AxisDomain, YDomain extends AxisDomain>(\n xScale: AxisScale<XDomain>, yScale: AxisScale<YDomain>, which: 'x' | 'y' | 'both' = 'both'\n ): void {\n const base = { svg: this.svg, width: this.width, height: this.height, xScale, yScale };\n if (which !== 'y' && this.xAxis.showGrid) {\n this.gridBuilder.drawVerticalGrid({ ...base, numberOfTicks: this.xAxis.ticks, color: this.xAxis.gridColor });\n }\n if (which !== 'x' && this.yAxis.showGrid) {\n this.gridBuilder.drawHorizontalGrid({ ...base, numberOfTicks: this.yAxis.ticks, color: this.yAxis.gridColor });\n }\n }\n\n /**\n * Makes room in the margins for tick marks longer (or shorter) than D3's default. The default\n * margins are sized around that default (`DEFAULT_TICK_SIZE`), and D3 places each tick label at\n * tick length + padding, so a longer tick pushes its labels outward by exactly the difference -\n * into space the margin doesn't have unless it grows by the same amount. Growing the margin here,\n * *before* `initializeChartState()` measures the plot area, is what makes the chart shrink to fit\n * its labels rather than pushing them off the edge of the SVG. A shorter tick hands the\n * difference back to the plot area the same way.\n *\n * Horizontally that happens on its own: `initializeChartState()` derives `width` from the\n * container minus the margins. Vertically it doesn't - `config.height` is the plot area, and\n * the SVG is that plus the margins - so a taller bottom margin would grow the SVG instead. The\n * delta is therefore also remembered in `reservedHeight` and taken back out of the plot\n * height by `resolveHeight()`, keeping the chart's total footprint where the consumer put it.\n *\n * Called by `initializeAxisState()` right after `resetMargin()`, for the axes that will be\n * drawn. Only the axis a tick size is given for is affected; `undefined` leaves that margin\n * alone.\n * @param xTickSize `tickSizeInner` for the bottom (x) axis, which lives in `margin.bottom`\n * @param yTickSize `tickSizeInner` for the left (y) axis, which lives in `margin.left`\n */\n reserveTickSizeMargins(xTickSize?: number, yTickSize?: number): void {\n if (xTickSize !== undefined) {\n const bottom = Math.max(0, this.margin.bottom + xTickSize - PcacChart.DEFAULT_TICK_SIZE);\n this.reservedHeight = bottom - this.margin.bottom;\n this.margin.bottom = bottom;\n }\n if (yTickSize !== undefined) {\n this.margin.left = Math.max(0, this.margin.left + yTickSize - PcacChart.DEFAULT_TICK_SIZE);\n }\n }\n\n /**\n * Makes sure each given margin is at least that big, for content drawn at the very edge of the\n * plot area that reaches past it - a point image on the line/area/plot charts, say, whose box\n * is centered on a point at the top of the y domain and so hangs half of itself above the plot.\n * Those charts already widen their clip-path to let such a point through; this is what stops\n * the `<svg>` itself from cutting it off, the SVG being only the plot area plus the margins.\n *\n * \"At least\", not \"add\": the default margins, and any tick / label room already reserved in\n * them, may well cover it already (`margin.left` is 40 by default), and adding on top of that\n * would give up plot area for nothing. Vertical growth is taken out of the plot height the same\n * way `reserveTickSizeMargins()`'s is, so the SVG's total height stays what the consumer\n * configured; horizontally `initializeChartState()` picks the change up on its own. A side\n * left `undefined` is untouched.\n *\n * Call after `initializeAxisState()` (which resets the margins) and before\n * `initializeChartState()` (which measures the plot area against them).\n */\n reserveEdgeSpace(space: Partial<PcacChartMargin>): void {\n for (const side of ['top', 'right', 'bottom', 'left'] as const) {\n const wanted = space[side];\n if (wanted === undefined || wanted <= this.margin[side]) {\n continue;\n }\n if (side === 'top' || side === 'bottom') {\n this.reservedHeight += wanted - this.margin[side];\n }\n this.margin[side] = wanted;\n }\n }\n\n /**\n * Shows the tooltip for a hovered datum, through the chart's `pcacTooltip` template when one is\n * projected and the default key/value content otherwise. Every builder's hover handler should\n * go through here rather than `tooltipBuilder` directly so the template is honored everywhere.\n */\n showTooltip(event: MouseEvent | null, data: PcacData, options: PcacTooltipOptions): void {\n this.tooltipBuilder.showTooltip(\n event,\n this.tooltipTemplate(),\n {\n $implicit: data,\n parent: options.parent ?? null,\n isThreshold: options.isThreshold ?? false,\n index: options.index,\n parentIndex: options.parentIndex ?? null,\n coincident: options.coincident ?? [],\n },\n options.valueFormat,\n options.keyFormat,\n options.anchor,\n this\n );\n }\n\n /** Hides the tooltip if this chart is the one showing it; another chart's is left alone. */\n hideTooltip(): void {\n this.tooltipBuilder.hideTooltip(this);\n }\n\n /**\n * A mark's accessible name: its parent's key (the bar's group, the point's series), its own key\n * and its value, formatted as the tooltip formats them - `\"Chips, 2024: 680\"`.\n */\n protected markLabel(\n data: PcacData,\n options: { parent?: PcacData | null; valueFormat?: PcacFormatEnum; keyFormat?: PcacFormatEnum } = {},\n ): string {\n const { key, value } = tooltipText(data, options.valueFormat, options.keyFormat);\n const parentKey = options.parent?.key;\n const names = [parentKey === null || parentKey === undefined || parentKey === '' ? null : String(parentKey), key]\n .filter((name): name is string => name !== null);\n return `${names.join(', ')}${names.length ? ': ' : ''}${value === '' ? 'no value' : value}`;\n }\n\n /**\n * Keyboard focus on a mark: its tooltip, beside it (there's no pointer to put it above). With a\n * consumer `pcacTooltip` template, the mark is also described by the tooltip, so a screen reader\n * reads whatever the template adds to the mark's own name; the default tooltip only repeats it.\n */\n protected showMarkTooltip(element: Element, data: PcacData, options: PcacTooltipOptions): void {\n this.showTooltip(null, data, { ...options, anchor: options.anchor ?? element });\n if (this.tooltipTemplate()) {\n element.setAttribute('aria-describedby', PcacTooltipBuilder.ID);\n }\n }\n\n /**\n * Where the chart's Tab stop was before the last redraw removed its marks, and whether it had\n * focus; put back by `restoreTabStop`. Kept until then - across a build that couldn't draw (no\n * width yet) - and not overwritten by a second clear in the same build, which finds no marks.\n */\n private markFocus: PcacMarkFocus | null = null;\n\n private noteMarkFocus(chartElm: ElementRef): void {\n this.markFocus = captureMarkFocus(chartElm.nativeElement) ?? this.markFocus;\n }\n\n /**\n * Puts the chart's Tab stop on its new marks - where it was before the redraw, with focus if it\n * had it (see marks.ts). Every builder calls this once its marks are drawn.\n */\n protected restoreTabStop(chartElm: ElementRef): void {\n refreshTabStop(chartElm.nativeElement, this.markFocus);\n this.markFocus = null;\n }\n\n /**\n * The chart's accessible name when its config gives no `ariaLabel`: its type, and the titles of\n * the axes it shows - \"Bar chart - x axis: Product, y axis: Units sold\". The titles are drawn\n * inside the axis groups, which are hidden from screen readers (the marks' own names carry each\n * key and value), so this is the only place they're read out.\n */\n private defaultChartName(): string {\n const axes: [string, PcacResolvedAxisConfig][] = [['x', this.xAxis], ['y', this.yAxis]];\n const titles = axes\n .filter(([, axis]) => !axis.hide && !!axis.label)\n .map(([name, axis]) => `${name} axis: ${axis.label}`);\n return titles.length ? `${this.chartTypeLabel} - ${titles.join(', ')}` : this.chartTypeLabel;\n }\n\n /** Keyboard focus leaving a mark: the undoing of `showMarkTooltip`. */\n protected hideMarkTooltip(element: Element): void {\n this.hideTooltip();\n element.removeAttribute('aria-describedby');\n }\n\n /**\n * Builders are provided per chart component, so Angular calls this when the component is\n * destroyed. A chart removed while hovered (an `@if` flip, a route change) gets no `mouseout`,\n * so without this its tooltip - and any consumer template view in it - would stay on screen.\n */\n ngOnDestroy(): void {\n this.hideTooltip();\n }\n\n /**\n * Removes whatever the chart last drew, for a build with no data to draw. Builders call it\n * rather than just returning, which left the previous data on screen when a consumer emptied\n * the chart (e.g. a filter that now matches nothing).\n */\n clearChart(chartElm: ElementRef): void {\n this.hideTooltip();\n this.noteMarkFocus(chartElm);\n select(chartElm.nativeElement).select('g').remove();\n }\n\n /**\n * Prior to building a chart, we need to initialize the state of the chart.\n *\n * Returns `false` (and leaves `width`/`height`/`colors` untouched) if the container hasn't\n * been laid out yet, so its `clientWidth` measures 0 — this happens when a chart mounts\n * already holding data (e.g. behind a loading gate) and its first build `effect` run fires\n * before the browser has committed layout for its own just-created DOM node. Callers should\n * bail out of their build on `false` rather than proceeding with a degenerate width;\n * `PcacChartResizeService` (wired up by every chart component) retries the build once the\n * container has a real size.\n * @param chartElm Reference to SVG on dom\n * @param config Chart specific configuration\n */\n initializeChartState(chartElm: ElementRef, config: PcacChartConfig): boolean {\n // The rebuild removes the hovered element, which gets no mouseout to close its tooltip.\n this.hideTooltip();\n this.noteMarkFocus(chartElm);\n select(chartElm.nativeElement).select('g').remove();\n // One color per group or per series within a group, whichever needs more. Bar charts, which\n // color by series across groups, top this up with `ensureColorCount()`. Read before the width\n // check below, even though a build that fails it draws nothing: this runs inside each chart\n // component's build `effect`, and reading the palette is what makes that effect redraw the\n // chart when the palette changes (see `PcacColorService`) - including a chart whose first\n // build found its container not laid out yet. (A loop rather than `Math.max(...)` over the\n // groups: spreading one argument per group overflows the call stack at a few hundred thousand.)\n const colors = this.colorService.getColorScale(\n config.data.reduce((max, d) => Math.max(max, d.data?.length ?? 0), config.data.length),\n );\n const container = chartElm.nativeElement.parentNode as HTMLElement;\n const containerWidth = container.clientWidth;\n const measuredWidth = containerWidth - this.margin.left - this.margin.right;\n // `!(> 0)` rather than `<= 0`, so a width that can't be measured at all - `NaN`, as when a page\n // is rendered on the server, where there's no layout and `clientWidth` is undefined - also\n // draws nothing, rather than drawing a chart `NaN` pixels wide.\n if (!(measuredWidth > 0)) {\n // The previous drawing was just removed above, so nothing is on screen any more. Forget the\n // size it was drawn at, or a container that comes back at that same width (a hidden tab\n // shown again) would read as unchanged to `containerSizeChanged()` and never be redrawn.\n this.lastContainerWidth = null;\n return false;\n }\n this.width = measuredWidth;\n // A named group of marks, each with its own name and role (see marks.ts), rather than a pile of\n // unlabelled shapes. (A `role=\"img\"`, which this used to be, would hide the marks inside it from\n // a screen reader, and keyboard focus on them would announce nothing.)\n select(chartElm.nativeElement)\n .attr('role', 'group')\n .attr('aria-label', config.ariaLabel || this.defaultChartName());\n this.height = this.resolveHeight(container, config);\n this.colors = colors;\n this.lastContainerWidth = containerWidth;\n this.lastContainerHeight = container.clientHeight;\n this.lastHeightFull = config.heightFull === true;\n return true;\n }\n\n /**\n * `config.height` normally *is* the height of the drawing area. With `config.heightFull` on it\n * becomes a floor instead: the chart fills its container, and only falls back to `config.height`\n * when the container is shorter than that (or has no definite height of its own to fill - see\n * `PcacChartConfig.heightFull`, where an auto-height container measures ~0 here and the\n * `Math.max` keeps the configured height).\n *\n * Note this deliberately subtracts the margins, so it's the *total* SVG that ends up matching\n * the container: `buildContainer()` adds `margin.top`/`margin.bottom` back on top of `height`\n * when sizing the `<svg>`, so filling without this would overflow the container by exactly the\n * vertical margins.\n * @param container The chart's container element (the `<svg>`'s parent)\n * @param config Chart specific configuration\n */\n private resolveHeight(container: HTMLElement, config: PcacChartConfig): number {\n // See `reserveTickSizeMargins()` / `reserveEdgeSpace()`: room made in the vertical margins\n // comes out of the plot area, not added on to the SVG. Applies to the floor in the `heightFull`\n // case too, for the same reason.\n const height = Math.max(0, config.height - this.reservedHeight);\n if (!config.heightFull) {\n return height;\n }\n return Math.max(height, container.clientHeight - this.margin.top - this.margin.bottom);\n }\n\n /**\n * True if the container's current raw layout width differs from the one measured by the last\n * successful build, or if no successful build has happened yet. For a `heightFull` chart, a\n * change in the container's height counts too - that's the whole size the chart is tracking.\n *\n * `PcacChartResizeService`'s `ResizeObserver` is guaranteed to fire once as soon as it starts\n * observing — that's what lets a chart recover from the 0-width race described on\n * `initializeChartState`, but it also means that \"routine\" first callback usually lands\n * moments after the component's build `effect` already built successfully at the same width.\n * Without this check, that redundant callback would restart the chart's enter transition\n * mid-animation for no visual change. Only that effect (which reacts to config, not size) should\n * skip this check.\n * @param chartElm Reference to SVG on dom\n */\n containerSizeChanged(chartElm: ElementRef): boolean {\n if (this.lastContainerWidth === null) {\n return true;\n }\n const container = chartElm.nativeElement.parentNode as HTMLElement;\n const containerWidth = container.clientWidth;\n if (containerWidth > 0 && containerWidth !== this.lastContainerWidth) {\n return true;\n }\n if (!this.lastHeightFull) {\n return false;\n }\n // Height only matters for a `heightFull` chart, and only there is it safe to compare: the\n // container's height is definite (see `resolveHeight`), so it changes when the *layout*\n // changes, not in response to the height this chart just drew itself at.\n const containerHeight = container.clientHeight;\n return containerHeight > 0 && containerHeight !== this.lastContainerHeight;\n }\n\n /**\n * 1) Set the width and height of the SVG\n * 2) Add a group and translate it to state of {{center}} option\n * @param chartElm Reference to SVG on dom\n * @param center Are we pinning x,y to the top,left, or are we centering our drawing group inside the SVG.\n */\n buildContainer(chartElm: ElementRef, center = false): void {\n const combinedHeight = this.height + this.margin.top + this.margin.bottom;\n const combinedWidth = this.width + this.margin.left + this.margin.right;\n this.svg = select(chartElm.nativeElement)\n .attr('width', combinedWidth)\n .attr('height', combinedHeight);\n if (center) {\n this.svg = this.svg\n .append('g')\n .attr('transform', 'translate(' + combinedWidth / 2 + ',' + combinedHeight / 2 + ')');\n return;\n }\n this.svg = this.svg\n .append('g')\n .attr('transform', 'translate(' + this.margin.left + ',' + this.margin.top + ')');\n }\n\n /**\n * Most charts share a default margin(s) state.\n * In some cases, that state needs to be calculated based on the content that resides in that margin.\n * For example, labels on a horizontal bar chart are dynamic and such the margin needs to be calculated ahead of\n * chart axis construction.\n *\n * Measures with the y axis's own `tickSize` (the measured box spans the tick line as well as\n * the label, so measuring at a different length would put the labels off by the difference)\n * and adds its `axisLabelSpace()` back on top, since the measurement replaces whatever\n * `initializeAxisState()` reserved for the label / sub labels.\n *\n * The margin never takes more than `MAX_LABEL_MARGIN_SHARE` of the container: labels wider than\n * that are cut off at the chart's left edge rather than squeezing the plot to nothing (it used\n * to go to a negative width, and no bars drew at all). Returns `false`, like\n * `initializeChartState()`, if there is still no room left to draw in.\n * @param chartElm Reference to SVG on dom\n * @param yScale D3 scale transformation object (d3.ScaleBand)\n */\n setHorizontalMarginsBasedOnContent<Domain extends AxisDomain>(chartElm: ElementRef, yScale: AxisScale<Domain>): boolean {\n this.yTickLabelMaxWidth = null;\n const axisY = axisLeft(yScale).ticks(5);\n if (this.yAxis.tickSize !== undefined) {\n axisY.tickSizeInner(this.yAxis.tickSize);\n }\n // Labelled as the axis will label them, or a unit suffix went unmeasured and ran off the edge.\n const format = axisTickFormat(this.yAxis.format, yScale, this.yAxis.ticks);\n if (format) {\n axisY.tickFormat(format);\n }\n let max = 0;\n select(chartElm.nativeElement).append('g')\n .call(axisY)\n .each((d, i, n) => {\n const width = (n[i] as SVGGraphicsElement).getBBox().width;\n if (width > max) {\n max = width;\n }\n })\n .remove();\n // `width` was already computed net of the current `margin.left` by initializeChartState(),\n // so only the *change* in margin comes out of it. Subtracting the whole measured margin\n // double-counted it, and since `margin` persists on the builder between builds, the amount\n // double-counted grew on the next rebuild - the plot area came out narrower than the\n // container allowed and then shrank further after the first resize.\n const containerWidth = this.width + this.margin.left + this.margin.right;\n const labelSpace = axisLabelSpace(this.yAxis);\n const left = Math.min(max + labelSpace, containerWidth * MAX_LABEL_MARGIN_SHARE);\n this.width = this.width + this.margin.left - left;\n this.margin.left = left;\n if (left < max + labelSpace) {\n // Capped: the labels are shortened to what's left between the axis title's band and the\n // ticks (see `truncateYTickLabels`), rather than running on past the chart's edge - and\n // over the title.\n const tickOverhead = Math.max(this.yAxis.tickSize ?? DEFAULT_TICK_SIZE, 0) + TICK_PADDING;\n this.yTickLabelMaxWidth = Math.max(0, left - labelSpace - tickOverhead);\n }\n return this.width > 0;\n }\n\n /**\n * Shortens every y-axis tick label wider than the room `setHorizontalMarginsBasedOnContent` left\n * for it, ending it in \"…\". Call after the axis is drawn. Does nothing when the labels fit.\n */\n protected truncateYTickLabels(): void {\n const maxWidth = this.yTickLabelMaxWidth;\n if (maxWidth === null) {\n return;\n }\n this.svg.selectAll<SVGTextElement, unknown>('.pcac-y-axis .tick text').each(function () {\n fitText(this, maxWidth);\n });\n }\n}\n\n/**\n * Shortens `text` to the longest prefix that, with \"…\" appended, fits in `maxWidth` - just \"…\"\n * if nothing does. Measured with `getComputedTextLength()`, so the text must be rendered; left\n * alone where that isn't available (a DOM without layout).\n */\nfunction fitText(text: SVGTextElement, maxWidth: number): void {\n if (typeof text.getComputedTextLength !== 'function' || text.getComputedTextLength() <= maxWidth) {\n return;\n }\n const full = text.textContent ?? '';\n const withEllipsis = (length: number) => full.slice(0, length).trimEnd() + '…';\n let fits = 0;\n let tooLong = full.length;\n while (tooLong - fits > 1) {\n const mid = Math.floor((fits + tooLong) / 2);\n text.textContent = withEllipsis(mid);\n if (text.getComputedTextLength() <= maxWidth) {\n fits = mid;\n } else {\n tooLong = mid;\n }\n }\n text.textContent = withEllipsis(fits);\n}\n","import { PcacData } from './chart.model';\n\n/**\n * How long each bar is drawn: its value, or 0 when it can't be drawn - a null or non-numeric\n * value, or `hide` set on the bar or on its whole group. A hidden bar keeps its slot (and so its\n * color) and just draws nothing, the same way a hidden line/area/plot series keeps its place.\n * A negative value is drawn as 0 too: the bar charts only draw upward from a 0 baseline, and a\n * negative size was an invalid SVG `height`/`width` (the bar vanished with a console error) that\n * also pulled the rest of a stack down over the bars before it.\n *\n * Keyed by the bar's own `PcacData` object so D3 callbacks (which only get the datum) can look\n * their size up directly.\n */\nexport function barSizes(groups: PcacData[]): Map<PcacData, number> {\n const sizes = new Map<PcacData, number>();\n for (const group of groups) {\n for (const bar of group.data ?? []) {\n const value = Number(bar.value ?? 0);\n sizes.set(bar, group.hide || bar.hide || !Number.isFinite(value) ? 0 : Math.max(0, value));\n }\n }\n return sizes;\n}\n\n/**\n * Where each bar of a stacked group starts: the running total of the bars before it, in data\n * order, so the first bar sits on the baseline and each later one on top of the previous. Sizes\n * are the bar's *own* (segment), not a pre-accumulated total, taken from `barSizes` - so a null,\n * non-numeric or hidden bar adds nothing to the stack.\n */\nexport function stackStarts(groups: PcacData[], sizes = barSizes(groups)): Map<PcacData, number> {\n const starts = new Map<PcacData, number>();\n for (const group of groups) {\n let total = 0;\n for (const bar of group.data ?? []) {\n starts.set(bar, total);\n total += sizes.get(bar) ?? 0;\n }\n }\n return starts;\n}\n","import { PcacData } from '../core/chart.model';\n\n/** How a bar chart's `thresholds` are laid out; see `barThresholdLayout`. */\nexport type BarThresholdLayout = 'none' | 'chart' | 'group' | 'bar';\n\n/** Whether a threshold entry carries per-bar values in its `data`. */\nfunction hasBars(entry: PcacData): boolean {\n return (entry.data?.length ?? 0) > 0;\n}\n\n/** A threshold is only drawn when its value is a finite number. */\nfunction drawable(threshold: PcacData | undefined): PcacData | null {\n if (!threshold || threshold.value === null || threshold.value === undefined) {\n return null;\n }\n return Number.isFinite(Number(threshold.value)) ? threshold : null;\n}\n\n/**\n * Reads the shape of `thresholds` the way the docs describe it:\n * - one entry with an empty (or no) `data` - a single threshold across the whole chart;\n * - one entry per group, each with an empty `data` - a threshold per group;\n * - one entry per group, each with an entry per bar in its `data` - a threshold per bar.\n *\n * A stacked group is drawn as one bar, so on a stacked chart per-bar entries give per-group\n * thresholds, each group's taken from its entry's first `data` item. Checks `data.length` rather\n * than `data`'s truthiness: `PcacData.data` defaults to `[]`, which is truthy.\n */\nexport function barThresholdLayout(\n thresholds: PcacData[] | undefined,\n isStacked: boolean,\n): BarThresholdLayout {\n if (!thresholds?.length) {\n return 'none';\n }\n if (!thresholds.some(hasBars)) {\n return thresholds.length === 1 ? 'chart' : 'group';\n }\n return isStacked ? 'group' : 'bar';\n}\n\n/**\n * The threshold drawn across the group at `groupIndex` (or across the chart, for index 0 of a\n * `'chart'` layout): the entry itself, or its first `data` item when it has per-bar values. Null\n * when there's no entry for that group or no numeric value to draw.\n */\nexport function groupThreshold(thresholds: PcacData[], groupIndex: number): PcacData | null {\n const entry = thresholds[groupIndex];\n if (!entry) {\n return null;\n }\n return drawable(hasBars(entry) ? entry.data[0] : entry);\n}\n\n/** The threshold drawn across one bar, or null when that bar has none (or no numeric value). */\nexport function barThreshold(\n thresholds: PcacData[],\n groupIndex: number,\n barIndex: number,\n): PcacData | null {\n return drawable(thresholds[groupIndex]?.data?.[barIndex]);\n}\n","import { PcacData } from '../core/chart.model';\n\n/**\n * Every series key across all groups, in first-seen order: the domain of a grouped bar chart's\n * inner band, so each series has its own slot in every group. Taken from the first group alone,\n * a series that only later groups have fell outside the band and was drawn over the first slot.\n */\nexport function seriesKeys(groups: PcacData[]): string[] {\n const keys = new Set<string>();\n for (const group of groups) {\n for (const bar of group.data ?? []) {\n keys.add(bar.key as string);\n }\n }\n return [...keys];\n}\n\n/**\n * The slots a grouped (not stacked) chart places each group's bars in, and which slot a bar takes:\n * its series key - so a series sits in the same place in every group - when the keys tell the\n * series apart (see `hasDistinctSeriesKeys`), and its position in its group otherwise. Placed by\n * key regardless, bars with no key (`PcacData`'s default `null`) or a repeated one all fell into\n * one slot and were drawn on top of each other, only the last visible - though they were already\n * colored by position in that case.\n */\nexport function seriesSlots(groups: PcacData[]): { domain: string[]; slotOf: (bar: PcacData, index: number) => string } {\n if (hasDistinctSeriesKeys(groups)) {\n return { domain: seriesKeys(groups), slotOf: (bar) => bar.key as string };\n }\n const size = groups.reduce((max, group) => Math.max(max, group.data?.length ?? 0), 0);\n return {\n domain: Array.from({ length: size }, (_, i) => String(i)),\n slotOf: (_bar, index) => String(index),\n };\n}\n\n/**\n * Whether every bar has a key that is unique within its own group - what coloring bars by series\n * key needs. Without that (keys left `null`, as `PcacData` defaults them, or repeated within a\n * group, as stacked data often has), coloring by key would paint every bar sharing a key the\n * same color, so the bars fall back to being colored by their position in the group.\n */\nexport function hasDistinctSeriesKeys(groups: PcacData[]): boolean {\n return groups.every((group) => {\n const keys = (group.data ?? []).map((bar) => bar.key);\n return keys.every((key) => key !== null && key !== undefined && key !== '')\n && new Set(keys).size === keys.length;\n });\n}\n\n/**\n * Whether a band scale spanning `length` pixels across `count` bands can round them to whole\n * pixels. Rounding gives crisp bar edges, but it floors the step - so with more bands than pixels\n * every band collapses to 0 and nothing draws. Only rounded while each band gets at least 2px.\n */\nexport function canRoundBands(length: number, count: number): boolean {\n return count > 0 && length / count >= 2;\n}\n\n/**\n * A bar config's `colorOverride` as the plain list of colors every chart now takes. Up to 22.2 the\n * bar charts wrapped it as `{ colors: [...] }`; a config still shaped that way - which TypeScript\n * misses when it's spread together or loaded as JSON - is still read, and `warn` is called (see\n * `colorOverrideWarning`). Only for colors actually set: before 22.2.17 every bar config defaulted\n * to `{ colors: [] }`, so one saved as JSON back then would warn about an override its author\n * never chose.\n */\nexport function barColorOverride(\n override: readonly string[] | { colors?: readonly string[] } | undefined,\n warn: () => void = () => undefined,\n): readonly string[] | undefined {\n if (!override || Array.isArray(override)) {\n return override as readonly string[] | undefined;\n }\n const colors = (override as { colors?: readonly string[] }).colors;\n if (colors?.length) {\n warn();\n }\n return colors;\n}\n\n/**\n * The development-mode warning about the old `colorOverride` shape, for one chart: each bar builder\n * keeps its own, so it warns once per chart - like the pie's leftover-`donut` warning - rather than\n * once per page, which also made it depend on which chart happened to build first.\n */\nexport function colorOverrideWarning(): () => void {\n let warned = false;\n return () => {\n if (warned || typeof ngDevMode === 'undefined' || !ngDevMode) {\n return;\n }\n warned = true;\n console.warn(\n 'Pioneer Charts: a bar chart\\'s `colorOverride` is now a plain array of colors, like the other ' +\n 'charts\\' - use `colorOverride: [...]` rather than `colorOverride: { colors: [...] }`.',\n );\n };\n}\n","import { Injectable, ElementRef } from '@angular/core';\nimport { color } from 'd3-color';\nimport { scaleBand, ScaleBand, scaleLinear, ScaleLinear } from 'd3-scale';\nimport { select, Selection } from 'd3-selection';\nimport { BaseType } from 'd3-selection';\n// Side effect only: adds .transition() to d3-selection's Selection, which the bar animations use.\nimport 'd3-transition';\nimport { Subject } from 'rxjs';\n\n/**\n * Lib\n */\nimport { PcacBarHorizontalChartConfig } from './bar-horizontal-chart.model';\nimport { PcacChart, PcacTooltipOptions } from '../../core/chart';\nimport { makeMarksAccessible } from '../../core/marks';\nimport { PcacData } from '../../core/chart.model';\nimport { barSizes, stackStarts } from '../../core/stack';\nimport { barThreshold, barThresholdLayout, groupThreshold } from '../bar-thresholds';\nimport { barColorOverride, canRoundBands, colorOverrideWarning, hasDistinctSeriesKeys, seriesKeys, seriesSlots } from '../bar-series';\n\n// `BaseType` (not the hand-rolled union this used to be, which omitted `null` and never\n// actually matched what `.selectAll()`'s default generics resolve to).\ntype GroupType = Selection<BaseType, PcacData, BaseType, PcacData>;\n\n/**\n * Provided per-component (see PcacBarHorizontalChart's `providers`), not root-scoped:\n * this builder extends PcacChart, which holds mutable per-chart-instance state (margin, width,\n * height, colors, svg). A root singleton would be shared and clobbered by every\n * <pcac-bar-horizontal-chart> rendered at once.\n */\n@Injectable()\nexport class BarHorizontalChartBuilder extends PcacChart {\n private xScale!: ScaleLinear<number, number>;\n private yScaleStacked!: ScaleBand<string>;\n private yScaleGrouped!: ScaleBand<string>;\n /** Warns, once for this chart, about a `colorOverride` in its old `{ colors }` shape. */\n private readonly warnOfColorOverride = colorOverrideWarning();\n /** A bar's slot in `yScaleGrouped`, from its datum and its index in its group (see `seriesSlots`). */\n private slotOf: (bar: PcacData, index: number) => string = (bar) => bar.key as string;\n private barClickedSource = new Subject<PcacData>();\n barClicked$ = this.barClickedSource.asObservable();\n\n protected override chartTypeLabel = 'Bar chart';\n\n buildChart(chartElm: ElementRef, config: PcacBarHorizontalChartConfig): void {\n if (!config?.data?.length) {\n this.clearChart(chartElm);\n return;\n }\n\n // Shallow copy, as the vertical chart does: initializeAxisState() rewrites `height`, which\n // must not land on the consumer's config - but the data stays the consumer's own objects, so\n // `barClicked` and the tooltip hand back the very `PcacData` they passed in. (A JSON deep copy\n // used to hand back clones, which never matched the consumer's data by identity.)\n config = { ...config };\n this.initializeAxisState(config, 'x');\n if (!this.initializeChartState(chartElm, config)) {\n return;\n }\n\n this.ensureColorCount(seriesKeys(config.data).length);\n this.applyColorOverride(barColorOverride(config.colorOverride, this.warnOfColorOverride));\n if (!this.buildScales(chartElm, config)) {\n return;\n }\n this.drawChart(chartElm, config);\n }\n\n /** Returns `false` if the container leaves no room to draw in once the labels are measured. */\n private buildScales(chartElm: ElementRef, config: PcacBarHorizontalChartConfig): boolean {\n // Bars grow from 0, so only `domainMax` is read; `xAxis.domainMin` is ignored.\n this.xScale = scaleLinear()\n .domain([0, this.xAxis.domainMax as number]);\n\n\n this.yScaleStacked = scaleBand()\n .domain(config.data.map((d) => d.key as string))\n .range([this.height, 0])\n // Rounded to whole pixels for crisp bar edges, while there's room to (see canRoundBands).\n .round(canRoundBands(this.height, config.data.length))\n .padding(0.1);\n\n const slots = seriesSlots(config.data);\n this.slotOf = slots.slotOf;\n this.yScaleGrouped = scaleBand()\n .padding(0.05)\n .range([0, this.yScaleStacked.bandwidth()])\n .round(canRoundBands(this.yScaleStacked.bandwidth(), slots.domain.length))\n .domain(slots.domain);\n\n // The left margin is sized to the y axis's labels - unless there is no y axis to size it to\n if (!this.yAxis.hide && !this.setHorizontalMarginsBasedOnContent(chartElm, this.yScaleStacked)) {\n return false;\n }\n\n this.xScale.range([0, this.width]);\n return true;\n }\n\n private drawChart(chartElm: ElementRef, config: PcacBarHorizontalChartConfig): void {\n this.buildContainer(chartElm);\n this.axisBuilder.drawAxis(this.axisBuilderConfig(this.xScale, this.yScaleStacked));\n this.truncateYTickLabels();\n this.drawGrids(this.xScale, this.yScaleStacked);\n this.addGroups(config);\n this.axisBuilder.raiseAxes(this.svg);\n this.restoreTabStop(chartElm);\n }\n\n private addGroups(config: PcacBarHorizontalChartConfig) {\n const groupsContainer = this.svg.append('g')\n .attr('class', 'pcac-bars')\n .selectAll('g')\n .data(config.data)\n .enter().append('g')\n .attr('class', 'pcac-bar-group')\n .attr('data-group-id', (d: PcacData, i: number) => {\n return i;\n })\n .attr('transform', (d: PcacData) => 'translate(0,' + this.yScaleStacked(d.key as string) + ')');\n\n const group = groupsContainer.selectAll('rect')\n .data((d: PcacData) => {\n return d.data ?? [];\n });\n\n this.drawBarsPerGroup(group, config);\n\n switch (barThresholdLayout(config.thresholds, config.isStacked)) {\n case 'chart':\n this.drawThresholdAcrossChart(config);\n break;\n case 'group':\n this.drawThresholdsPerGroup(config);\n break;\n case 'bar':\n this.drawThresholdsPerBarInGroup(group, config);\n break;\n }\n }\n\n private drawBarsPerGroup(groups: GroupType, config: PcacBarHorizontalChartConfig) {\n const self = this;\n // Stacked bars start where the previous bar in their group ends; every other layout draws\n // from the baseline (start 0).\n // Sizes honor `hide` (and treat a null or non-numeric value as 0), so a hidden bar keeps its\n // slot and color but draws nothing - see `barSizes`.\n const sizes = barSizes(config.data);\n const starts = config.isStacked ? stackStarts(config.data, sizes) : new Map<PcacData, number>();\n const startOf = (d: PcacData) => starts.get(d) ?? 0;\n const endOf = (d: PcacData) => startOf(d) + (sizes.get(d) ?? 0);\n // Colored by series - the bar's key's place among every group's keys, the same slot it's drawn\n // in - rather than by its position in its own group, which differs when groups hold different\n // series. By position after all when the keys can't tell series apart (see\n // `hasDistinctSeriesKeys`), and with `spreadColorsPerGroup`, by group instead.\n const keys = seriesKeys(config.data);\n const byKey = hasDistinctSeriesKeys(config.data);\n const fillOf = (d: PcacData, bar: SVGRectElement) => {\n if (config.spreadColorsPerGroup) {\n return this.colors[Number((bar.parentNode as Element).getAttribute('data-group-id'))];\n }\n return this.colors[byKey ? keys.indexOf(d.key as string) : Number(bar.getAttribute('data-group-bar-id'))];\n };\n // The hover fades run as their own named transition: an unnamed one would cancel the enter\n // transition still growing the bar, leaving it part-grown until the next rebuild. Shared by\n // the pointer and keyboard focus (see makeMarksAccessible).\n const highlight = (bar: SVGRectElement, d: PcacData) => {\n const fill = fillOf(d, bar);\n select(bar)\n .transition('hover')\n .duration(this.transitionService.getTransitionDuration() / 5)\n .style('fill', color(fill)?.darker(1).toString() ?? fill);\n };\n const rest = (bar: SVGRectElement, d: PcacData) => {\n select(bar)\n .transition('hover')\n .duration(this.transitionService.getTransitionDuration() / 5)\n .style('fill', fillOf(d, bar));\n };\n const tooltipOptions = (bar: SVGRectElement): PcacTooltipOptions => {\n const groupIndex = Number((bar.parentNode as Element).getAttribute('data-group-id'));\n const index = Number(bar.getAttribute('data-group-bar-id'));\n return { index, parent: config.data[groupIndex], parentIndex: groupIndex, valueFormat: this.xAxis.format };\n };\n const bars = groups.enter().append('rect')\n .attr('class', 'pcac-bar')\n .attr('x', (d: PcacData) => this.xScale(startOf(d)))\n // A stacked bar spans its whole group, which is already translated into place; looking its\n // series key up in the group band put it off in another group's slot whenever the key\n // matched a group key.\n .attr('y', (d: PcacData, i: number) => config.isStacked ? 0 : this.yScaleGrouped(this.slotOf(d, i)) ?? 0)\n .attr('data-group-bar-id', (_: PcacData, i: number) => {\n return i;\n })\n .attr('height', !config.isStacked ? this.yScaleGrouped.bandwidth() : this.yScaleStacked.bandwidth())\n .style('fill', function (this: SVGRectElement, d: PcacData) {\n return fillOf(d, this);\n })\n .attr('width', 0)\n .on('mouseover', function (this: SVGRectElement, _event: MouseEvent, d: PcacData) {\n highlight(this, d);\n })\n .on('mousemove', function (this: SVGRectElement, event: MouseEvent, d: PcacData) {\n self.showTooltip(event, d, tooltipOptions(this));\n })\n .on('mouseout', function (this: SVGRectElement, _event: MouseEvent, d: PcacData) {\n self.hideTooltip();\n rest(this, d);\n })\n .on('click', (_event: MouseEvent, d: PcacData) => {\n this.barClickedSource.next(d);\n });\n makeMarksAccessible(bars, {\n label: (d, bar) => this.markLabel(d, { parent: tooltipOptions(bar).parent, valueFormat: this.xAxis.format }),\n skip: (d) => !!d.hide,\n activate: (d) => this.barClickedSource.next(d),\n focus: (bar, d) => {\n highlight(bar, d);\n this.showMarkTooltip(bar, d, tooltipOptions(bar));\n },\n blur: (bar, d) => {\n this.hideMarkTooltip(bar);\n rest(bar, d);\n },\n });\n bars\n .transition()\n .duration(this.transitionService.getTransitionDuration())\n .attr('width', (d: PcacData) => {\n return this.xScale(endOf(d)) - this.xScale(startOf(d));\n });\n }\n\n private drawThresholdAcrossChart(config: PcacBarHorizontalChartConfig) {\n const threshold = groupThreshold(config.thresholds, 0);\n if (!threshold) {\n return;\n }\n this.applyPreTransitionThresholdStyles(this.svg.select('.pcac-bars').append('rect'))\n .attr('height', this.height)\n .attr('data-group-threshold-id', 0)\n .on('mousemove', (event: MouseEvent) => {\n this.showTooltip(event, threshold, { index: 0, isThreshold: true, valueFormat: this.xAxis.format });\n })\n .transition()\n .duration(this.transitionService.getTransitionDuration())\n .attr('x', this.xScale(Number(threshold.value)));\n }\n\n /** One threshold across each group that has one; groups without an entry are skipped. */\n private drawThresholdsPerGroup(config: PcacBarHorizontalChartConfig) {\n const self = this;\n const groupIndexOf = (rect: Element) => Number((rect.parentElement as HTMLElement).dataset['groupId']);\n const groups = this.svg.selectAll<SVGGElement, PcacData>('.pcac-bar-group')\n .filter((_: PcacData, i: number) => groupThreshold(config.thresholds, i) !== null);\n this.applyPreTransitionThresholdStyles(groups.append('rect'))\n .attr('height', this.yScaleStacked.bandwidth())\n .attr('data-group-threshold-id', function (this: SVGRectElement) {\n return groupIndexOf(this);\n })\n .on('mousemove', function (this: SVGRectElement, event: MouseEvent) {\n const index = groupIndexOf(this);\n // A threshold's own PcacData is typically just a value, so its parent is the *data* group\n // it's drawn against (which has the key) rather than the threshold entry it came from.\n self.showTooltip(\n event,\n groupThreshold(config.thresholds, index) as PcacData,\n { index, parent: config.data[index], parentIndex: index, isThreshold: true, valueFormat: self.xAxis.format }\n );\n })\n .transition()\n .duration(this.transitionService.getTransitionDuration())\n .attr('x', (_: unknown, i: number, nodes: ArrayLike<Element>) => {\n return this.xScale(Number(groupThreshold(config.thresholds, groupIndexOf(nodes[i]))?.value));\n });\n }\n\n /** One threshold across each bar that has one; bars without an entry are skipped. */\n private drawThresholdsPerBarInGroup(group: GroupType, config: PcacBarHorizontalChartConfig) {\n const self = this;\n const thresholdOf = (rect: Element) => barThreshold(\n config.thresholds,\n Number((rect.parentElement as HTMLElement).dataset['groupId']),\n Number(rect.getAttribute('data-group-threshold-id')),\n );\n const rects = this.applyPreTransitionThresholdStyles(group.enter().append('rect'))\n .attr('data-group-threshold-id', (_: PcacData, i: number) => {\n return i;\n })\n // Placed in its bar's slot up front - only its value (`x`) animates. Set on the transition,\n // it slid in from the top of the group, where the vertical chart's appear in place.\n // ScaleBand can return undefined for a key outside its domain; `.attr()` needs null, not undefined.\n .attr('y', (d: PcacData, i: number) => this.yScaleGrouped(this.slotOf(d, i)) ?? null)\n .attr('height', this.yScaleGrouped.bandwidth());\n rects.filter(function (this: SVGRectElement) {\n return thresholdOf(this) === null;\n }).remove();\n rects.filter(function (this: SVGRectElement) {\n return thresholdOf(this) !== null;\n })\n .on('mousemove', function (this: SVGRectElement, event: MouseEvent) {\n const index = Number(this.getAttribute('data-group-threshold-id'));\n const groupIndex = Number((this.parentElement as HTMLElement).dataset['groupId']);\n // Parent is the data group (see drawThresholdsPerGroup), not the threshold entry itself.\n self.showTooltip(\n event,\n thresholdOf(this) as PcacData,\n { index, parent: config.data[groupIndex], parentIndex: groupIndex, isThreshold: true, valueFormat: self.xAxis.format }\n );\n })\n .transition()\n .duration(this.transitionService.getTransitionDuration())\n .attr('x', (_: PcacData, i: number, nodes: ArrayLike<Element>) => {\n return this.xScale(Number(thresholdOf(nodes[i])?.value));\n });\n }\n\n private applyPreTransitionThresholdStyles<S extends Selection<any, any, any, any>>(elm: S): S {\n return elm.attr('class', 'pcac-threshold')\n .style('fill', () => {\n return this.colorService.getAlert();\n })\n .style('stroke', () => {\n return this.colorService.getAlert();\n })\n .style('stroke-width', () => {\n return 2;\n })\n .attr('width', '3px')\n .on('mouseout', () => {\n this.hideTooltip();\n });\n }\n}\n","import { DestroyRef, ElementRef, Injectable, Signal, afterNextRender, inject } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { Subject } from 'rxjs';\nimport { debounceTime } from 'rxjs/operators';\n\n/**\n * Rebuilds a chart whenever its container's real, laid-out size changes.\n *\n * A plain `window:resize` listener (the previous approach) misses any layout-driven size change\n * that isn't a viewport resize — a sidebar collapsing, a tab becoming active, a flex/grid reflow.\n * It also can't help a chart that mounts already holding data (e.g. behind a loading gate): that\n * chart's first build `effect` run can fire before the browser has committed layout for its own\n * just-created DOM node, so `PcacChart.initializeChartState()` measures a 0-width container and\n * bails out with nothing drawn — and with no resize ever firing, nothing retries it.\n *\n * `ResizeObserver`'s callback contract guarantees real, laid-out dimensions on every firing,\n * including its first, so observing the container naturally retries that exact case.\n */\n@Injectable({ providedIn: 'root' })\nexport class PcacChartResizeService {\n /**\n * Call once from a chart component's constructor (an injection context).\n * @param chartElm Signal resolving to the chart's `<svg>` element ref, e.g. a `viewChild.required` query.\n * @param rebuild Invoked whenever the chart's container size changes: immediately for the\n * observer's first (guaranteed-initial) callback, debounced for every one after that.\n */\n observe(chartElm: Signal<ElementRef>, rebuild: () => void): void {\n const destroyRef = inject(DestroyRef);\n const trigger$ = new Subject<void>();\n trigger$.pipe(\n debounceTime(300),\n takeUntilDestroyed(destroyRef)\n ).subscribe(rebuild);\n\n // chartElm() is a required viewChild query: unreadable until this component's own view has\n // been created, so we defer the observe() call itself rather than reading it eagerly here.\n afterNextRender(() => {\n const container = chartElm().nativeElement.parentNode as HTMLElement;\n // The observer's first callback is its guaranteed initial one (see the class doc comment) -\n // it's correcting an already-wrong first paint (e.g. a host layout, like a Material sidenav,\n // that hasn't finished settling its width yet when this chart's very first build ran), not\n // responding to live resize churn, so it shouldn't sit behind the same 300ms debounce meant\n // for that. Left debounced, that correction could land while the wrong-width build's own\n // enter transition is still visibly mid-animation, restarting it partway through - firing it\n // immediately instead means the correction lands within a frame or two, before there's\n // anything to visibly interrupt. Every callback after the first is still debounced normally.\n let firstCallback = true;\n const observer = new ResizeObserver(() => {\n if (firstCallback) {\n firstCallback = false;\n rebuild();\n return;\n }\n trigger$.next();\n });\n observer.observe(container);\n destroyRef.onDestroy(() => observer.disconnect());\n });\n }\n}\n","import { Directive, TemplateRef, inject } from '@angular/core';\nimport { PcacData } from './chart.model';\n\n/**\n * A datum drawn at the same coordinate as the hovered one (see `PcacTooltipContext.coincident`),\n * located the same way the context locates `$implicit`: `parent` is the series it belongs to,\n * `index` its position in `parent.data`, `parentIndex` the series' position in the chart's `data`.\n */\nexport interface PcacTooltipCoincident {\n data: PcacData;\n parent: PcacData;\n index: number;\n parentIndex: number;\n}\n\n/**\n * Template context handed to a consumer's `<ng-template pcacTooltip>` each time a tooltip is shown.\n */\nexport interface PcacTooltipContext {\n /**\n * The hovered datum: a bar, a line/area/plot point, a pie slice, or a threshold. Bound with a\n * bare `let-point` (or any name) in the template.\n */\n $implicit: PcacData;\n\n /**\n * The `PcacData` the hovered datum sits inside - the group a bar belongs to, or the series a\n * point belongs to. For a threshold, the data group it's drawn against (a threshold's own\n * `PcacData` usually carries only a value, so this is where its label lives). `null` when there\n * is no enclosing level (pie slices, a chart-wide threshold).\n */\n parent: PcacData | null;\n\n /**\n * True when the hovered element is a threshold marker on a bar chart rather than a data point.\n * In that case `$implicit` is the threshold's own `PcacData`.\n */\n isThreshold: boolean;\n\n /**\n * Position of `$implicit` in the array it was taken from: `parent.data` when there is a parent\n * (a bar within its group, a point within its series), or the chart's top-level `data` when\n * there isn't (a pie slice). For a threshold it's the position in `config.thresholds`, or in\n * `config.thresholds[parentIndex].data` for a per-bar threshold.\n *\n * Together with `parentIndex` this lets a template reach back into whatever collection the\n * `PcacData` was built from, as long as that collection is parallel to `data` (same order, no\n * filtering): `items[parentIndex][index]` for a two-level chart, `items[index]` for a pie.\n * Charts never reorder `data`, so the correspondence is stable across builds and resizes.\n */\n index: number;\n\n /**\n * Position of `parent` in the chart's top-level `data`; `null` whenever `parent` is.\n */\n parentIndex: number | null;\n\n /**\n * Every *other* datum drawn at exactly the same coordinate as `$implicit`, in data order, so a\n * template can list who else is at the hovered point. Set by the line, area and plot charts,\n * whether or not the plot chart's `pointFanOut` has spread the points apart (without it, the\n * hovered point is the only one of them visible, which makes this list all the more useful).\n * Empty on the other charts and whenever nothing shares the point.\n */\n coincident: PcacTooltipCoincident[];\n}\n\n/**\n * Marks an `<ng-template>` projected into any chart component as that chart's tooltip. When\n * present it replaces the default key/value tooltip *entirely* - the library only positions the\n * rendered template; it applies no background, padding or text styling of its own, so the template\n * owns the whole box.\n *\n * ```html\n * <pcac-bar-vertical-chart [config]=\"config\">\n * <ng-template pcacTooltip let-point let-group=\"parent\">\n * <div class=\"my-tooltip\">{{ group?.key }} / {{ point.key }}: {{ point.value | number }}</div>\n * </ng-template>\n * </pcac-bar-vertical-chart>\n * ```\n *\n * The template is rendered with full Angular semantics (pipes, directives, components, DI from\n * the declaring component), so anything a normal template can do works here too. `index` and\n * `parentIndex` locate the hovered datum within `data`, so a template can pull extra fields from\n * the consumer's own source collection when that collection is parallel to `data`:\n *\n * ```html\n * <ng-template pcacTooltip let-point let-i=\"index\" let-g=\"parentIndex\">\n * <div class=\"my-tooltip\">{{ orders[g!][i].customer }}: {{ point.value | number }}</div>\n * </ng-template>\n * ```\n *\n * `coincident` lists the other points at the hovered coordinate, each located the same way:\n *\n * ```html\n * <ng-template pcacTooltip let-point let-others=\"coincident\">\n * <div class=\"my-tooltip\">\n * {{ point.key }}, {{ point.value }}\n * @for (other of others; track other.parentIndex) { <div>Also here: {{ other.parent.key }}</div> }\n * </div>\n * </ng-template>\n * ```\n */\n@Directive({\n selector: 'ng-template[pcacTooltip]'\n})\nexport class PcacTooltipDirective {\n readonly templateRef = inject<TemplateRef<PcacTooltipContext>>(TemplateRef);\n\n /**\n * Lets the template type-checker know the shape of `let-` variables declared on the\n * `<ng-template>`, so `point.value` etc. are checked against `PcacData` under strictTemplates.\n */\n static ngTemplateContextGuard(_dir: PcacTooltipDirective, _ctx: unknown): _ctx is PcacTooltipContext {\n return true;\n }\n}\n","import { Component, ElementRef, ViewEncapsulation, contentChild, effect, inject, viewChild, input } from '@angular/core';\nimport { outputFromObservable } from '@angular/core/rxjs-interop';\nimport { BarHorizontalChartBuilder } from './bar-horizontal-chart.builder';\nimport { PcacBarHorizontalChartConfig } from './bar-horizontal-chart.model';\nimport { PcacChartResizeService } from '../../core/resize.service';\nimport { PcacTooltipDirective } from '../../core/tooltip.directive';\n\n@Component({\n selector: 'pcac-bar-horizontal-chart',\n // While `config().heightFull` is on, the chart fills its container instead of using a fixed\n // height (see PcacChartConfig.heightFull). That only works if this host element itself has a\n // height to hand down, so the class stretches it to `height: 100%`; the styling lives in CSS\n // rather than being measured/set in JS so the browser resolves it as part of normal layout.\n host: { '[class.pcac-height-full]': 'config().heightFull' },\n templateUrl: './bar-horizontal-chart.component.html',\n styleUrl: './bar-horizontal-chart.component.scss',\n encapsulation: ViewEncapsulation.None,\n providers: [BarHorizontalChartBuilder]\n})\nexport class PcacBarHorizontalChart {\n private chartBuilder = inject(BarHorizontalChartBuilder);\n\n readonly config = input.required<PcacBarHorizontalChartConfig>();\n private readonly chartElm = viewChild.required<ElementRef>('chart');\n readonly barClicked = outputFromObservable(this.chartBuilder.barClicked$);\n\n /**\n * Optional consumer `<ng-template pcacTooltip>` projected into this element; replaces the\n * default tooltip when present (see PcacTooltipDirective).\n */\n readonly tooltipTemplate = contentChild(PcacTooltipDirective);\n\n constructor() {\n // Reacts to config() the same way ngOnChanges used to — reading it here (rather than a\n // lifecycle hook) is what makes this an effect: it tracks config() as its dependency and\n // reruns whenever a new value comes in, signal-input-changes-drive-behavior all the way down.\n effect(() => this.buildChart());\n\n // Handed over as a getter so the builder reads the query at hover time, not in the effect\n // above (see PcacChart.tooltipTemplate).\n this.chartBuilder.tooltipTemplate = () => this.tooltipTemplate()?.templateRef;\n\n inject(PcacChartResizeService).observe(this.chartElm, () => {\n // Skip the ResizeObserver's routine initial callback when it lands after the effect above\n // already built successfully at this same width — only a real size change (or a build\n // that never happened, e.g. the 0-width mount race) should trigger a rebuild here.\n if (this.chartBuilder.containerSizeChanged(this.chartElm())) {\n this.buildChart();\n }\n });\n }\n\n private buildChart(): void {\n const config = this.config();\n // Handed over even when empty: the builder clears what it last drew rather than leaving it.\n if (config) {\n this.chartBuilder.buildChart(this.chartElm(), config);\n }\n }\n}\n","<section class=\"pcac-bar-horizontal-chart\">\n <svg #chart></svg>\n</section>\n","import { PcacAxisChartConfig, PcacData } from '../../core/chart.model';\n\nexport class PcacBarHorizontalChartConfig extends PcacAxisChartConfig {\n isStacked: boolean = false;\n thresholds: PcacData[] = [];\n spreadColorsPerGroup: boolean = false\n /**\n * Bar colors, any CSS color, in place of the theme palette - by series, or by group with\n * `spreadColorsPerGroup`. Repeated when there are more series (or groups) than colors. Omitted\n * or empty, the theme palette is used - optional, as on every chart's config.\n */\n colorOverride?: string[]\n}\n","import { Injectable, ElementRef } from '@angular/core';\n\nimport { select, Selection, BaseType } from 'd3-selection';\nimport { scaleBand, ScaleBand, scaleLinear, ScaleLinear } from 'd3-scale';\nimport { color } from 'd3-color';\n// Imported for its side effect only: this is what adds .transition() to d3-selection's\n// Selection prototype, which this builder leans on throughout.\nimport 'd3-transition';\n\n/**\n * Lib\n */\nimport { PcacBarVerticalChartConfig } from './bar-vertical-chart.model';\nimport { PcacChart, PcacTooltipOptions } from '../../core/chart';\nimport { makeMarksAccessible } from '../../core/marks';\nimport { PcacData } from '../../core/chart.model';\nimport { barSizes, stackStarts } from '../../core/stack';\nimport { barThreshold, barThresholdLayout, groupThreshold } from '../bar-thresholds';\nimport { barColorOverride, canRoundBands, colorOverrideWarning, hasDistinctSeriesKeys, seriesKeys, seriesSlots } from '../bar-series';\n\nimport { Subject } from 'rxjs';\n\n// `BaseType` (not the hand-rolled union this used to be, which omitted `null` and never\n// actually matched what `.selectAll()`'s default generics resolve to).\ntype GroupType = Selection<BaseType, PcacData, BaseType, PcacData>;\n\n/**\n * Provided per-component (see PcacBarVerticalChart's `providers`), not root-scoped:\n * this builder extends PcacChart, which holds mutable per-chart-instance state (margin, width,\n * height, colors, svg). A root singleton would be shared and clobbered by every\n * <pcac-bar-vertical-chart> rendered at once.\n */\n@Injectable()\nexport class BarVerticalChartBuilder extends PcacChart {\n private xScaleStacked!: ScaleBand<string>;\n private xScaleGrouped!: ScaleBand<string>;\n /** Warns, once for this chart, about a `colorOverride` in its old `{ colors }` shape. */\n private readonly warnOfColorOverride = colorOverrideWarning();\n /** A bar's slot in `xScaleGrouped`, from its datum and its index in its group (see `seriesSlots`). */\n private slotOf: (bar: PcacData, index: number) => string = (bar) => bar.key as string;\n private yScale!: ScaleLinear<number, number>;\n private barClickedSource = new Subject<PcacData>();\n barClicked$ = this.barClickedSource.asObservable();\n\n\n\n protected override chartTypeLabel = 'Bar chart';\n\n buildChart(chartElm: ElementRef, config: PcacBarVerticalChartConfig): void {\n if (!config?.data?.length) {\n this.clearChart(chartElm);\n return;\n }\n\n // Shallow copy: initializeAxisState() rewrites `height` for hidden axes, and that must not\n // land on the consumer's own config object (it previously did, growing it by the margins on\n // first build).\n config = { ...config };\n this.initializeAxisState(config, 'y');\n if (!this.initializeChartState(chartElm, config)) {\n return;\n }\n\n this.ensureColorCount(seriesKeys(config.data).length);\n this.applyColorOverride(barColorOverride(config.colorOverride, this.warnOfColorOverride));\n this.buildScales(config);\n this.drawChart(chartElm, config);\n }\n\n private buildScales(config: PcacBarVerticalChartConfig) {\n // `this.height`, not `config.height`: with `heightFull` on they differ (see\n // PcacChart.resolveHeight), and the axis, grid and bar baselines all use the resolved one.\n // Bars grow from 0, so only `domainMax` is read; `yAxis.domainMin` is ignored.\n this.yScale = scaleLinear()\n .rangeRound([0, this.height])\n .domain([this.yAxis.domainMax as number, 0]);\n\n this.xScaleStacked = scaleBand()\n .domain(config.data.map((d) => d.key as string))\n .range([0, this.width])\n // Rounded to whole pixels for crisp bar edges, while there's room to (see canRoundBands).\n .round(canRoundBands(this.width, config.data.length))\n .padding(0.1);\n\n const slots = seriesSlots(config.data);\n this.slotOf = slots.slotOf;\n this.xScaleGrouped = scaleBand()\n .padding(0.2)\n .range([0, this.xScaleStacked.bandwidth()])\n .round(canRoundBands(this.xScaleStacked.bandwidth(), slots.domain.length))\n .domain(slots.domain);\n }\n\n private drawChart(chartElm: ElementRef, config: PcacBarVerticalChartConfig): void {\n this.buildContainer(chartElm);\n this.axisBuilder.drawAxis(this.axisBuilderConfig(this.xScaleStacked, this.yScale));\n this.drawGrids(this.xScaleStacked, this.yScale);\n this.addGroups(config);\n this.axisBuilder.raiseAxes(this.svg);\n this.restoreTabStop(chartElm);\n }\n\n private addGroups(config: PcacBarVerticalChartConfig) {\n const groupsContainer = this.svg.append('g')\n .attr('class', 'pcac-bars')\n .selectAll('g')\n .data(config.data)\n .enter().append('g')\n .attr('class', 'pcac-bar-group')\n .attr('data-group-id', (d: PcacData, i: number) => {\n return i;\n })\n .attr('transform', (d: PcacData) => {\n return 'translate(' + this.xScaleStacked(d.key as string) + ',0)';\n });\n\n const group = groupsContainer.selectAll('rect')\n .data((d: PcacData) => {\n return d.data ?? [];\n });\n\n this.drawBarsPerGroup(group, config);\n\n switch (barThresholdLayout(config.thresholds, config.isStacked)) {\n case 'chart':\n this.drawThresholdAcrossChart(config);\n break;\n case 'group':\n this.drawThresholdsPerGroup(config);\n break;\n case 'bar':\n this.drawThresholdsPerBarInGroup(group, config);\n break;\n }\n }\n\n private drawBarsPerGroup(group: GroupType, config: PcacBarVerticalChartConfig) {\n const self = this;\n // Stacked bars sit on top of the ones before them in their group; every other layout draws\n // from the baseline (start 0).\n // Sizes honor `hide` (and treat a null or non-numeric value as 0), so a hidden bar keeps its\n // slot and color but draws nothing - see `barSizes`.\n const sizes = barSizes(config.data);\n const starts = config.isStacked ? stackStarts(config.data, sizes) : new Map<PcacData, number>();\n const startOf = (d: PcacData) => starts.get(d) ?? 0;\n const endOf = (d: PcacData) => startOf(d) + (sizes.get(d) ?? 0);\n // Colored by series - the bar's key's place among every group's keys, the same slot it's drawn\n // in - rather than by its position in its own group, which differs when groups hold different\n // series. By position after all when the keys can't tell series apart (see\n // `hasDistinctSeriesKeys`), and with `spreadColorsPerGroup`, by group instead.\n const keys = seriesKeys(config.data);\n const byKey = hasDistinctSeriesKeys(config.data);\n const fillOf = (d: PcacData, bar: SVGRectElement) => {\n if (config.spreadColorsPerGroup) {\n return this.colors[Number((bar.parentNode as Element).getAttribute('data-group-id'))];\n }\n return this.colors[byKey ? keys.indexOf(d.key as string) : Number(bar.getAttribute('data-group-bar-id'))];\n };\n // The hover fades run as their own named transition: an unnamed one would cancel the enter\n // transition still growing the bar, leaving it part-grown until the next rebuild. Shared by\n // the pointer and keyboard focus (see makeMarksAccessible).\n const highlight = (bar: SVGRectElement, d: PcacData) => {\n const fill = fillOf(d, bar);\n select(bar)\n .transition('hover')\n .duration(this.transitionService.getTransitionDuration() / 5)\n .style('fill', color(fill)?.darker(1).toString() ?? fill);\n };\n const rest = (bar: SVGRectElement, d: PcacData) => {\n select(bar)\n .transition('hover')\n .duration(this.transitionService.getTransitionDuration() / 5)\n .style('fill', fillOf(d, bar));\n };\n const tooltipOptions = (bar: SVGRectElement): PcacTooltipOptions => {\n const groupIndex = Number((bar.parentNode as Element).getAttribute('data-group-id'));\n const index = Number(bar.getAttribute('data-group-bar-id'));\n return { index, parent: config.data[groupIndex], parentIndex: groupIndex, valueFormat: this.yAxis.format };\n };\n const bars = group.enter().append('rect')\n .attr('class', 'pcac-bar')\n // A stacked bar spans its whole group, which is already translated into place; looking its\n // series key up in the group band put it off in another group's slot whenever the key\n // matched a group key.\n .attr('x', (d: PcacData, i: number) => config.isStacked ? 0 : this.xScaleGrouped(this.slotOf(d, i)) ?? 0)\n .attr('data-group-bar-id', (_: PcacData, i: number) => {\n return i;\n })\n .style('fill', function (this: SVGRectElement, d: PcacData) {\n return fillOf(d, this);\n })\n .attr('y', () => {\n return this.height;\n })\n .attr('height', 0)\n .on('mouseover', function (this: SVGRectElement, _event: MouseEvent, d: PcacData) {\n highlight(this, d);\n })\n .on('mousemove', function (this: SVGRectElement, event: MouseEvent, d: PcacData) {\n self.showTooltip(event, d, tooltipOptions(this));\n })\n .on('mouseout', function (this: SVGRectElement, _event: MouseEvent, d: PcacData) {\n self.hideTooltip();\n rest(this, d);\n })\n .on('click', (_, d: PcacData) => {\n this.barClickedSource.next(d);\n });\n makeMarksAccessible(bars, {\n label: (d, bar) => this.markLabel(d, { parent: tooltipOptions(bar).parent, valueFormat: this.yAxis.format }),\n skip: (d) => !!d.hide,\n activate: (d) => this.barClickedSource.next(d),\n focus: (bar, d) => {\n highlight(bar, d);\n this.showMarkTooltip(bar, d, tooltipOptions(bar));\n },\n blur: (bar, d) => {\n this.hideMarkTooltip(bar);\n rest(bar, d);\n },\n });\n bars\n .transition()\n .duration(this.transitionService.getTransitionDuration())\n .attr('width', !config.isStacked ? this.xScaleGrouped.bandwidth() : this.xScaleStacked.bandwidth())\n .attr('y', (d: PcacData) => {\n return this.yScale(endOf(d));\n })\n .attr('height', (d: PcacData) => {\n return this.yScale(startOf(d)) - this.yScale(endOf(d));\n });\n }\n\n private drawThresholdAcrossChart(config: PcacBarVerticalChartConfig) {\n const threshold = groupThreshold(config.thresholds, 0);\n if (!threshold) {\n return;\n }\n this.applyPreTransitionThresholdStyles(this.svg.select('.pcac-bars').append('rect'))\n .attr('width', this.width)\n .attr('data-group-threshold-id', 0)\n .on('mousemove', (event: MouseEvent) => {\n this.showTooltip(event, threshold, { index: 0, isThreshold: true, valueFormat: this.yAxis.format });\n })\n .transition()\n .duration(this.transitionService.getTransitionDuration())\n .attr('y', this.yScale(Number(threshold.value)));\n }\n\n /** One threshold across each group that has one; groups without an entry are skipped. */\n private drawThresholdsPerGroup(config: PcacBarVerticalChartConfig) {\n const self = this;\n const groupIndexOf = (rect: Element) => Number((rect.parentElement as HTMLElement).dataset['groupId']);\n const groups = this.svg.selectAll<SVGGElement, PcacData>('.pcac-bar-group')\n .filter((_: PcacData, i: number) => groupThreshold(config.thresholds, i) !== null);\n this.applyPreTransitionThresholdStyles(groups.append('rect'))\n // Spans its whole group: the pre-transition styles place a rect by bar key, which a group\n // key can collide with.\n .attr('x', 0)\n .attr('width', this.xScaleStacked.bandwidth())\n .attr('data-group-threshold-id', function (this: SVGRectElement) {\n return groupIndexOf(this);\n })\n .on('mousemove', function (this: SVGRectElement, event: MouseEvent) {\n const index = groupIndexOf(this);\n // A threshold's own PcacData is typically just a value, so its parent is the *data* group\n // it's drawn against (which has the key) rather than the threshold entry it came from.\n self.showTooltip(\n event,\n groupThreshold(config.thresholds, index) as PcacData,\n { index, parent: config.data[index], parentIndex: index, isThreshold: true, valueFormat: self.yAxis.format }\n );\n })\n .transition()\n .duration(this.transitionService.getTransitionDuration())\n .attr('y', (_: unknown, i: number, nodes: ArrayLike<Element>) => {\n return this.yScale(Number(groupThreshold(config.thresholds, groupIndexOf(nodes[i]))?.value));\n });\n }\n\n /** One threshold across each bar that has one; bars without an entry are skipped. */\n private drawThresholdsPerBarInGroup(group: GroupType, config: PcacBarVerticalChartConfig) {\n const self = this;\n const thresholdOf = (rect: Element) => barThreshold(\n config.thresholds,\n Number((rect.parentElement as HTMLElement).dataset['groupId']),\n Number(rect.getAttribute('data-group-threshold-id')),\n );\n const rects = this.applyPreTransitionThresholdStyles(group.enter().append('rect'))\n .attr('data-group-threshold-id', (_: PcacData, i: number) => {\n return i;\n })\n .attr('width', this.xScaleGrouped.bandwidth());\n rects.filter(function (this: SVGRectElement) {\n return thresholdOf(this) === null;\n }).remove();\n rects.filter(function (this: SVGRectElement) {\n return thresholdOf(this) !== null;\n })\n .on('mousemove', function (this: SVGRectElement, event: MouseEvent) {\n const index = Number(this.getAttribute('data-group-threshold-id'));\n const groupIndex = Number((this.parentElement as HTMLElement).dataset['groupId']);\n // Parent is the data group (see drawThresholdsPerGroup), not the threshold entry itself.\n self.showTooltip(\n event,\n thresholdOf(this) as PcacData,\n { index, parent: config.data[groupIndex], parentIndex: groupIndex, isThreshold: true, valueFormat: self.yAxis.format }\n );\n })\n .transition()\n .duration(this.transitionService.getTransitionDuration())\n .attr('y', (_: PcacData, i: number, nodes: ArrayLike<Element>) => {\n return this.yScale(Number(thresholdOf(nodes[i])?.value));\n });\n }\n\n private applyPreTransitionThresholdStyles<S extends Selection<any, any, any, any>>(elm: S): S {\n return elm.attr('class', 'pcac-threshold')\n .attr('x', (d: any, i: number) => {\n // Not every caller's selection has a per-item PcacData bound (the whole-chart threshold\n // rect has none), hence the defensive fallback rather than assuming `d` is always present.\n const datum = d as PcacData | undefined;\n // ScaleBand can return undefined for a key outside its domain; `.attr()` needs null, not undefined.\n return this.xScaleGrouped(datum ? this.slotOf(datum, i) : '') ?? null;\n })\n .attr('y', () => {\n return this.height;\n })\n .attr('height', 0)\n .style('fill', () => {\n return this.colorService.getAlert();\n })\n .style('stroke', () => {\n return this.colorService.getAlert();\n })\n .style('stroke-width', () => {\n return 2;\n })\n .on('mouseout', () => {\n this.hideTooltip();\n })\n .attr('height', () => {\n return '3px';\n });\n }\n}\n","import { Component, ElementRef, ViewEncapsulation, contentChild, effect, inject, viewChild, input } from '@angular/core';\nimport { outputFromObservable } from '@angular/core/rxjs-interop';\nimport { BarVerticalChartBuilder } from './bar-vertical-chart.builder';\nimport { PcacBarVerticalChartConfig } from './bar-vertical-chart.model';\nimport { PcacChartResizeService } from '../../core/resize.service';\nimport { PcacTooltipDirective } from '../../core/tooltip.directive';\n\n@Component({\n selector: 'pcac-bar-vertical-chart',\n // While `config().heightFull` is on, the chart fills its container instead of using a fixed\n // height (see PcacChartConfig.heightFull). That only works if this host element itself has a\n // height to hand down, so the class stretches it to `height: 100%`; the styling lives in CSS\n // rather than being measured/set in JS so the browser resolves it as part of normal layout.\n host: { '[class.pcac-height-full]': 'config().heightFull' },\n templateUrl: './bar-vertical-chart.component.html',\n styleUrl: './bar-vertical-chart.component.scss',\n encapsulation: ViewEncapsulation.None,\n providers: [BarVerticalChartBuilder]\n})\nexport class PcacBarVerticalChart {\n private chartBuilder = inject(BarVerticalChartBuilder);\n\n readonly config = input.required<PcacBarVerticalChartConfig>();\n private readonly chartElm = viewChild.required<ElementRef>('chart');\n readonly barClicked = outputFromObservable(this.chartBuilder.barClicked$);\n\n /**\n * Optional consumer `<ng-template pcacTooltip>` projected into this element; replaces the\n * default tooltip when present (see PcacTooltipDirective).\n */\n readonly tooltipTemplate = contentChild(PcacTooltipDirective);\n\n constructor() {\n // Reacts to config() the same way ngOnChanges used to — reading it here (rather than a\n // lifecycle hook) is what makes this an effect: it tracks config() as its dependency and\n // reruns whenever a new value comes in, signal-input-changes-drive-behavior all the way down.\n effect(() => this.buildChart());\n\n // Handed over as a getter so the builder reads the query at hover time, not in the effect\n // above (see PcacChart.tooltipTemplate).\n this.chartBuilder.tooltipTemplate = () => this.tooltipTemplate()?.templateRef;\n\n inject(PcacChartResizeService).observe(this.chartElm, () => {\n // Skip the ResizeObserver's routine initial callback when it lands after the effect above\n // already built successfully at this same width — only a real size change (or a build\n // that never happened, e.g. the 0-width mount race) should trigger a rebuild here.\n if (this.chartBuilder.containerSizeChanged(this.chartElm())) {\n this.buildChart();\n }\n });\n }\n\n private buildChart(): void {\n const config = this.config();\n // Handed over even when empty: the builder clears what it last drew rather than leaving it.\n if (config) {\n this.chartBuilder.buildChart(this.chartElm(), config);\n }\n }\n}\n","<section class=\"pcac-bar-vertical-chart\">\n <svg #chart></svg>\n</section>\n","import { PcacAxisChartConfig, PcacData } from '../../core/chart.model';\n\nexport class PcacBarVerticalChartConfig extends PcacAxisChartConfig {\n isStacked: boolean = false;\n thresholds: PcacData[] = [];\n spreadColorsPerGroup: boolean = false\n /**\n * Bar colors, any CSS color, in place of the theme palette - by series, or by group with\n * `spreadColorsPerGroup`. Repeated when there are more series (or groups) than colors. Omitted\n * or empty, the theme palette is used - optional, as on every chart's config.\n */\n colorOverride?: string[]\n}\n","// Only what a consumer configures, binds or styles with. The chart plumbing - the `PcacChart`\n// base class and the builders, the axis/grid/tooltip/transition/resize services, and the\n// resolved-config helpers - is internal, so it can change without breaking anyone.\nexport {\n PcacAxisChartConfig,\n PcacAxisConfig,\n PcacAxisSubLabels,\n PcacChartConfig,\n PcacData,\n PcacDataRange,\n PcacFormatEnum,\n PcacRangeBounds,\n} from './chart.model';\nexport * from './color.service';\nexport * from './tooltip.directive';\n","import { PcacAxisChartConfig } from '../core/chart.model';\n\nexport enum PcacLineAreaPlotChartConfigType {\n Line = 'line',\n Area = 'area',\n Plot = 'plot'\n}\n\n/**\n * Sizing for the images drawn in place of a point's dot (see `PcacData.image`). An image is\n * scaled uniformly (up or down) to fit inside a `maxWidth` x `maxHeight` box, preserving its\n * aspect ratio, and is centered on the data point exactly where the dot would have been.\n */\nexport class PcacPointImageConfig {\n maxWidth: number = 16\n maxHeight: number = 16\n}\n\n/** How a point's `range` is drawn (see `PcacPointRangeConfig.style`). */\nexport enum PcacPointRangeStyle {\n /** Error bars: a line across each range, capped at both ends. */\n Whiskers = 'whiskers',\n /** A rectangle spanning the x range by the y range; a thin strip when only one is set. */\n Box = 'box',\n /**\n * A fill strongest at the point's value and fading out to the range's edges: an oval glow\n * with both ranges (brightest on the value, even off-center), a fading bar with one.\n */\n Fade = 'fade'\n}\n\n/** When a point's `range` shows (see `PcacPointRangeConfig.show`). */\nexport enum PcacPointRangeShow {\n /** Only the hovered point's range. */\n Hover = 'hover',\n /** Every range at `faintOpacity`, the hovered point's at full strength. */\n Faint = 'faint',\n /** Every range at full strength; the others dim while a point is hovered. */\n Always = 'always'\n}\n\n/**\n * Drawing for `PcacData.range` on the line/area/plot charts. Ranges sit above the lines/areas and\n * below the points, on the point's true coordinate (a fanned-out point's range stays on its\n * anchor), clipped to the plot area and following zoom. The chart draws no numbers for them; a\n * custom tooltip gets the point, `range` included.\n */\nexport class PcacPointRangeConfig {\n style: PcacPointRangeStyle = PcacPointRangeStyle.Whiskers\n show: PcacPointRangeShow = PcacPointRangeShow.Faint\n\n /** Opacity of the ranges at rest under `show: Faint`, 0 - 1. */\n faintOpacity: number = 0.2\n\n /**\n * Any CSS color for every range on the chart. Unset, each takes its series' color. Applied as\n * `--pcac-point-range-color` on the chart's `.point-ranges` group, so a stylesheet can set it\n * on an ancestor instead (a config value wins).\n */\n color?: string\n}\n\n/**\n * Drawing for `PcacData.gauge` on the line/area/plot charts: a ring around each point's mark (its\n * dot, or its image) whose arc fills clockwise from 12 o'clock in proportion to `gauge / max`,\n * over a faint full-circle track. Drawn with the mark, so it moves with zoom and fan-out; fan-out\n * spacing and the chart's edge space grow to fit it. Points without a `gauge` get no ring.\n */\nexport class PcacPointGaugeConfig {\n /** The `gauge` value of a full ring. Default 1, for values that are already a fraction. */\n max: number = 1\n\n /** Ring thickness in px. */\n width: number = 2.5\n\n /** Space between the mark (the image box, or a hovered dot) and the ring, in px. */\n gap: number = 3\n\n /** Draw the unfilled rest of the ring, so an arc reads as a share of a whole. */\n showTrack: boolean = true\n\n /**\n * What the gauge measures, e.g. `'PSA'`. When set, each point's screen reader name ends with it\n * and the point's value - \"…, PSA 0.018\" - since the ring itself is only visual. Unset, the\n * ring isn't read at all; say what it means in the chart's `ariaLabel`, or a custom tooltip.\n */\n name?: string\n\n /**\n * Any CSS color for the filled arc. Unset, each takes its series' color. Applied as\n * `--pcac-point-gauge-color` on the chart's `.dots` groups, so a stylesheet can set it on an\n * ancestor instead (a config value wins).\n */\n color?: string\n\n /** Any CSS color for the track (`--pcac-point-gauge-track-color`). Theme default `$gray-200`. */\n trackColor?: string\n}\n\n/**\n * A line across the plot at one value on an axis (see `PcacLineAreaChartConfig.referenceLines`):\n * a target, a threshold, a median. Drawn dashed, over the grid and under the series, clipped to\n * the plot area, and moved with zoom like the data.\n */\nexport class PcacReferenceLine {\n /** Which axis `value` is on: `'y'` draws a horizontal line, `'x'` a vertical one. */\n axis: 'x' | 'y' = 'y'\n\n /**\n * Where the line sits, in the axis's own terms: a number on the y axis; on the x axis, whatever\n * a point's `key` would be under `xAxis.format` - a number for `Decimal`, a date (or anything\n * `new Date()` reads) for `DateTime`, a series index otherwise.\n */\n value: number | string = 0\n\n /**\n * A few words drawn at one end of the line, inside the plot (see `labelPosition`). Styled by the\n * theme's `.reference-line-label` rule.\n */\n label?: string\n\n /**\n * Which end of the line `label` sits at. `'end'`, the default, is above the right end of a\n * horizontal line and beside the top of a vertical one; `'start'` is above its left end and beside\n * its bottom - for when the far end is crowded, say by a corner label.\n */\n labelPosition: 'start' | 'end' = 'end'\n\n /**\n * Any CSS color for the line and its label. Theme default `$gray-500`. Applied as\n * `--pcac-reference-line-color` on the line's group, so a stylesheet can set it on an ancestor\n * instead (a config value wins).\n */\n color?: string\n}\n\n/**\n * Text pinned to the plot area's corners (see `PcacLineAreaChartConfig.cornerLabels`) - names for\n * the regions the plot divides into, such as the quadrants between two reference lines. Pinned to\n * the plot's frame rather than to data, so they stay put when the chart is zoomed. Drawn under the\n * series, so a point in the corner covers its label rather than the other way round, unless the\n * chart sets `labelsOnTop`. Any corner left unset is left empty.\n */\nexport class PcacCornerLabels {\n topLeft?: string\n topRight?: string\n bottomLeft?: string\n bottomRight?: string\n\n /**\n * Any CSS color for all four. Theme default `$gray-600`. Applied as `--pcac-corner-label-color`\n * on their group, so a stylesheet can set it on an ancestor instead (a config value wins).\n */\n color?: string\n}\n\n/**\n * The axes' `format` and `domainMin`/`domainMax` (`PcacAxisConfig`) do more here than on the bar\n * charts. `yAxis.domainMin`/`domainMax` are the y scale's domain (default 0..100). `xAxis.format`\n * decides how each point's `key` becomes an x position: `Decimal` reads it as a number on a\n * linear scale from `xAxis.domainMin` to `domainMax`, `DateTime` parses it with `new Date()` on\n * a time scale between the two (both required), and every other format - including the default -\n * places points by their index within their series, sizing the axis from the first series'\n * length and ignoring the domain fields.\n */\nexport class PcacLineAreaChartConfig extends PcacAxisChartConfig {\n enableEffects: boolean = true\n /**\n * Zoom and pan along the x / y axis (scroll / pinch to zoom 1x-10x, drag to pan, never leaving\n * the original domain). Either, or both, can be on. A gesture is always two-dimensional, so with\n * only one enabled the other axis simply stays put. Both off by default. The zoom is kept when\n * the chart redraws - a new config, a series toggled in a legend, a resize (which keeps the same\n * part of the domain in view) - and dropped when zoom is turned off or the zoomable axes change.\n */\n enableZoomX: boolean = false\n enableZoomY: boolean = false\n\n /**\n * Series colors, any CSS color, in place of the theme palette, one per series in order. Repeats\n * from the start when there are more series than colors, as the default palette does. Omitted or\n * empty, the theme palette is used - optional, as on every chart's config.\n */\n colorOverride?: string[]\n\n /**\n * Bounding box for any point images (`PcacData.image`) on this chart. Optional; each field falls\n * back to the `PcacPointImageConfig` default when not given, so a consumer only setting `image`\n * on their data still gets a sensibly-sized result.\n */\n pointImage?: Partial<PcacPointImageConfig>\n\n /**\n * Draw each point's `range` (see `PcacData.range`). Off when not set; `{}` turns it on with\n * every `PcacPointRangeConfig` default. Points without a `range` draw nothing extra.\n */\n pointRange?: Partial<PcacPointRangeConfig>\n\n /**\n * Dashed lines at chosen values on either axis (see `PcacReferenceLine`). None when not set.\n * They are decoration for sighted readers - hidden from screen readers like the grid - so when\n * one carries meaning, say so in the chart's `ariaLabel`.\n */\n referenceLines?: Partial<PcacReferenceLine>[]\n\n /**\n * Draw each point's `gauge` as a ring around its mark (see `PcacData.gauge`). Off when not set;\n * `{}` turns it on with every `PcacPointGaugeConfig` default. Points without a `gauge` draw\n * nothing extra.\n */\n pointGauge?: Partial<PcacPointGaugeConfig>\n\n /**\n * Labels in the plot's four corners (see `PcacCornerLabels`). None when not set. Hidden from\n * screen readers like the grid, so when they carry meaning, say so in the chart's `ariaLabel`.\n */\n cornerLabels?: PcacCornerLabels\n\n /**\n * Draw the corner labels and reference-line labels over the series instead of under it, each\n * outlined in a halo so it stays readable on whatever it crosses - for a chart whose points crowd\n * the corners or the lines' ends, where they'd otherwise hide the labels. Default false. The halo\n * is `--pcac-label-halo-color`, the theme's `$white` by default: set it to the chart's background\n * (a dark one, say) on the chart or any ancestor. The labels never take the pointer, so a point\n * under one can still be hovered and clicked. The reference lines themselves stay under the series.\n */\n labelsOnTop?: boolean\n}\n","import { PcacAxisChartConfig } from '../core/chart.model';\nimport { PcacPointImageConfig } from '../plot-line-area-chart/plot-line-area-chart.model';\n\n/**\n * A dot plot: every point placed along one value axis (x), and points that share a value - or,\n * with `binWidth`, fall in the same bin - stacked into a column above it, one mark per point. It\n * shows how values are distributed while keeping every item visible and hoverable, which suits\n * items with their own identity (and their own `image`) better than a histogram's bars.\n *\n * `data` is series, each holding its points - the same shape as the plot chart - so points can be\n * colored by group. A point's `value` is its position on the axis and its `key` its name (in the\n * tooltip and to screen readers). A point whose `value` isn't a number is left out, as is a series\n * or point with `hide`.\n *\n * The axes: `xAxis` is the value axis - `domainMin` / `domainMax` fix its span (by default it\n * spans the data, rounded out to nice ticks), `format` formats its ticks and the tooltip's value,\n * and every label, sub label, tick and grid setting applies. There is no y scale - a column's\n * height is a count of marks, not a value - so the y axis is never drawn; `yAxis` is ignored.\n */\nexport class PcacDotPlotChartConfig extends PcacAxisChartConfig {\n /**\n * Group values into bins this wide, in the axis's units, and stack each bin at its center: with\n * values 7, 7.5 and 8 and a `binWidth` of 1, the 7 and 7.5 share a column. Unset (the default),\n * only equal values stack. Bins start at `xAxis.domainMin`, or 0 without one.\n */\n binWidth?: number\n\n /**\n * Radius of a point's dot, in px; default 6. Points with an `image` are sized by `pointImage`\n * instead. Optional, as `colorOverride` is on every chart, so an object literal needn't spell it out.\n */\n dotRadius?: number = 6\n\n /** Space between marks stacked in a column, in px; default 2. Optional, likewise. */\n gap?: number = 2\n\n /**\n * Bounding box for points' images (`PcacData.image`), drawn in place of their dots, as on the\n * plot chart. Each field falls back to its `PcacPointImageConfig` default.\n *\n * A column too tall for the chart's height shrinks every mark on the chart evenly until it fits,\n * so no point is ever cut off; give the chart more `height` to keep marks at full size. The\n * chart's `markFit` output reports how far they were shrunk.\n */\n pointImage?: Partial<PcacPointImageConfig>\n\n /**\n * Series colors, any CSS color, in place of the theme palette, one per series in order. Repeats\n * when there are more series than colors. Omitted or empty, the theme palette is used.\n */\n colorOverride?: string[]\n}\n","import { PcacData } from '../core/chart.model';\n\n/** Where one point sits in a dot plot, before it's scaled to pixels. */\nexport interface PcacDotPlacement {\n /** The point itself (the element from its series' `data`). */\n data: PcacData;\n /** Its series, and that series' index in `config.data` - which color it takes. */\n series: PcacData;\n seriesIndex: number;\n /** Its index within its series' `data`. */\n index: number;\n /** Where its column sits on the value axis: its value, or its bin's center. */\n position: number;\n /** Its place in the column, 0 at the bottom. */\n level: number;\n}\n\n/** A point's value as a number to place it by, or `null` when it has none. */\nexport function dotValue(d: PcacData): number | null {\n const value = typeof d.value === 'number' ? d.value : typeof d.value === 'string' && d.value.trim() !== '' ? Number(d.value) : NaN;\n return Number.isFinite(value) ? value : null;\n}\n\n/**\n * Stacks every drawable point into columns: points with an equal value share a column or, with a\n * positive `binWidth`, points in the same bin (bins run from `origin`, each `binWidth` wide) share\n * one at the bin's center. Within a column, points take levels in data order - series order, then\n * each series' own order - so the first is at the bottom. Hidden series and points, and points\n * with no numeric value, are left out.\n */\nexport function stackDots(series: PcacData[], binWidth?: number, origin = 0): PcacDotPlacement[] {\n const binned = !!binWidth && binWidth > 0;\n const levels = new Map<number, number>();\n const placements: PcacDotPlacement[] = [];\n series.forEach((s, seriesIndex) => {\n if (s.hide) {\n return;\n }\n (s.data ?? []).forEach((d, index) => {\n const value = dotValue(d);\n if (d.hide || value === null) {\n return;\n }\n const position = binned\n ? origin + (Math.floor((value - origin) / binWidth!) + 0.5) * binWidth!\n : value;\n const level = levels.get(position) ?? 0;\n levels.set(position, level + 1);\n placements.push({ data: d, series: s, seriesIndex, index, position, level });\n });\n });\n return placements;\n}\n\n/** How many marks the tallest column holds; 0 with none. */\nexport function tallestColumn(placements: PcacDotPlacement[]): number {\n return placements.reduce((tallest, p) => Math.max(tallest, p.level + 1), 0);\n}\n","import { ElementRef, Injectable } from '@angular/core';\nimport { select } from 'd3-selection';\nimport { extent } from 'd3-array';\nimport { scaleLinear, ScaleLinear } from 'd3-scale';\n// Imported for its side effect only: adds .transition() to d3-selection's Selection.\nimport 'd3-transition';\nimport { Subject, distinctUntilChanged } from 'rxjs';\n\nimport { PcacChart, PcacTooltipOptions } from '../core/chart';\nimport { PcacData } from '../core/chart.model';\nimport { makeMarksAccessible } from '../core/marks';\nimport { PcacPointImageConfig } from '../plot-line-area-chart/plot-line-area-chart.model';\nimport { PcacDotPlotChartConfig } from './dot-plot-chart.model';\nimport { PcacDotPlacement, stackDots, tallestColumn } from './dot-plot-layout';\n\n/** How much a hovered dot grows, in px of radius - also room kept for it at the plot's edges. */\nconst DOT_HOVER_GROWTH = 2;\n\n/**\n * Provided per-component (see PcacDotPlotChart's `providers`), like every builder that extends\n * PcacChart: it holds per-chart-instance state, which a root singleton would share between charts.\n */\n@Injectable()\nexport class DotPlotChartBuilder extends PcacChart {\n private dotClickedSource = new Subject<PcacData>();\n dotClicked$ = this.dotClickedSource.asObservable();\n /** The fit each draw settled on (see PcacDotPlotChart's `markFit`), only when it changes. */\n private markFitSource = new Subject<number>();\n markFit$ = this.markFitSource.pipe(distinctUntilChanged());\n\n protected override chartTypeLabel = 'Dot plot';\n\n private xScale!: ScaleLinear<number, number>;\n private placements: PcacDotPlacement[] = [];\n private pointImage!: PcacPointImageConfig;\n /** A mark's size and the gap between stacked marks this build, after any shrinking to fit. */\n private markSize = 0;\n private markGap = 0;\n private dotRadius = 0;\n\n buildChart(chartElm: ElementRef, config: PcacDotPlotChartConfig): void {\n if (!config?.data?.length) {\n this.hideTooltip();\n this.clearChart(chartElm);\n return;\n }\n this.hideTooltip();\n\n // A column's height is a count of marks, not a value, so there's no y axis to draw.\n const rawXAxis = config.xAxis;\n config = { ...config, yAxis: { ...config.yAxis, hide: true } };\n\n const defaults = new PcacDotPlotChartConfig();\n const dotRadius = config.dotRadius ?? defaults.dotRadius!;\n const gap = config.gap ?? defaults.gap!;\n this.pointImage = { ...new PcacPointImageConfig(), ...config.pointImage };\n const origin = rawXAxis?.domainMin !== undefined ? Number(rawXAxis.domainMin) : 0;\n this.placements = stackDots(config.data, config.binWidth, origin);\n const hasImages = this.placements.some((p) => !!p.data.image);\n const hasDots = this.placements.some((p) => !p.data.image);\n const fullSize = hasImages\n ? Math.max(this.pointImage.maxWidth, this.pointImage.maxHeight)\n : 2 * (dotRadius + DOT_HOVER_GROWTH);\n const tallest = tallestColumn(this.placements);\n // `autoTickSize`: half the tallest mark at a given fit - a hovered dot (its growth isn't\n // scaled) or an image's box - toward the x axis.\n const markHalf = (fit: number) => Math.max(\n hasDots ? dotRadius * fit + DOT_HOVER_GROWTH : 0,\n hasImages ? this.pointImage.maxHeight * fit / 2 : 0,\n );\n\n // The fit shrinks marks to the plot's height, which an auto tick takes its length out of, so\n // with `autoTickSize` the layout is settled in up to three passes: at full size; at the size\n // that fit, if smaller; and - should the height that handed back have grown the marks past\n // that, rounding up a pixel - at the length they now need, which is still no longer than the\n // first, so the marks can only shrink again and never outgrow the tick.\n let tick = markHalf(1);\n let fit: number;\n for (let pass = 0; ; pass++) {\n if (!this.layout(chartElm, config, tick, fullSize)) {\n return;\n }\n fit = tallest ? Math.min(1, this.height / (tallest * (fullSize + gap))) : 1;\n this.markSize = fullSize * fit;\n this.markGap = gap * fit;\n this.dotRadius = dotRadius * fit;\n const needed = Math.ceil(markHalf(fit));\n if (!this.xAxis.autoTickSize || this.xAxis.hide || needed === this.xAxis.tickSize || pass === 2) {\n break;\n }\n tick = needed;\n }\n this.ensureColorCount(config.data.length);\n this.applyColorOverride(config.colorOverride);\n\n this.xScale = this.buildXScale(rawXAxis?.domainMin, rawXAxis?.domainMax);\n this.drawChart(chartElm);\n this.markFitSource.next(fit);\n }\n\n /**\n * Sets the axes and margins up and measures the plot area, with `tick` as the x axis's length\n * under `autoTickSize`. Returns `initializeChartState`'s result. On a copy of the config each\n * time: initializeAxisState() rewrites `height`, which mustn't reach the consumer's object or\n * build up over passes.\n */\n private layout(chartElm: ElementRef, config: PcacDotPlotChartConfig, tick: number, fullSize: number): boolean {\n config = { ...config };\n this.initializeAxisState(config, 'x', 0, { x: tick, y: 0 });\n // A mark at the domain's edge is centered on it, so half of it hangs past the plot area.\n const half = Math.ceil(fullSize / 2);\n this.reserveEdgeSpace({ left: half, right: half });\n return this.initializeChartState(chartElm, config);\n }\n\n /**\n * The value axis: `xAxis.domainMin` / `domainMax` where given, otherwise the data's extent\n * rounded out to nice ticks - checked on the consumer's own axis config, since the resolved one\n * fills in 0 - 100 for anything unset.\n */\n private buildXScale(domainMin: number | string | undefined, domainMax: number | string | undefined): ScaleLinear<number, number> {\n const [lo, hi] = extent(this.placements, (p) => p.position) as [number | undefined, number | undefined];\n const min = domainMin !== undefined ? Number(domainMin) : lo ?? 0;\n const max = domainMax !== undefined ? Number(domainMax) : hi ?? 1;\n const scale = scaleLinear().domain(min === max ? [min - 1, max + 1] : [min, max]).range([0, this.width]);\n return domainMin === undefined || domainMax === undefined ? scale.nice(this.xAxis.ticks) : scale;\n }\n\n private drawChart(chartElm: ElementRef): void {\n this.buildContainer(chartElm);\n const yScale = scaleLinear().domain([0, 1]).range([this.height, 0]);\n this.axisBuilder.drawAxis(this.axisBuilderConfig(this.xScale, yScale));\n this.drawGrids(this.xScale, yScale);\n this.axisBuilder.raiseAxes(this.svg);\n this.drawDots();\n this.restoreTabStop(chartElm);\n }\n\n /** The center of a placed point's mark, in plot pixels: its column's x, its level's y. */\n private center(p: PcacDotPlacement): { x: number; y: number } {\n const step = this.markSize + this.markGap;\n return {\n x: this.xScale(p.position),\n y: this.height - this.markGap - this.markSize / 2 - p.level * step,\n };\n }\n\n private drawDots(): void {\n const self = this;\n const duration = this.transitionService.getTransitionDuration();\n const { maxWidth, maxHeight } = this.pointImage;\n const fit = this.markSize / (this.placements.some((p) => !!p.data.image) ? Math.max(maxWidth, maxHeight) : 1);\n const imageWidth = maxWidth * fit;\n const imageHeight = maxHeight * fit;\n const color = (p: PcacDotPlacement) => this.colors[p.seriesIndex];\n const tooltipOptions = (p: PcacDotPlacement, anchor: Element | null = null): PcacTooltipOptions => ({\n index: p.index,\n parent: p.series,\n parentIndex: p.seriesIndex,\n valueFormat: this.xAxis.format,\n anchor,\n });\n const grow = (mark: SVGGElement, p: PcacDotPlacement, hovered: boolean) => {\n select(mark).select('.pcac-dot')\n .interrupt('hover')\n .transition('hover')\n .duration(duration / 3)\n .attr('r', hovered ? this.dotRadius + DOT_HOVER_GROWTH : this.dotRadius)\n .attr('fill', hovered ? color(p) : 'var(--pcac-dot-fill, #fff)');\n };\n\n const marks = this.svg.append('g')\n .attr('class', 'pcac-dots')\n .selectAll<SVGGElement, PcacDotPlacement>('.pcac-dot-mark')\n .data(this.placements)\n .enter().append('g')\n .attr('class', 'pcac-dot-mark')\n .attr('transform', (p) => `translate(${this.center(p).x}, ${this.center(p).y})`)\n .on('mouseover', function (this: SVGGElement, event: MouseEvent, p: PcacDotPlacement) {\n grow(this, p, true);\n self.showTooltip(event, p.data, tooltipOptions(p, select(this).select('.pcac-dot, .pcac-dot-image').node() as Element | null));\n })\n .on('mouseout', function (this: SVGGElement, _event: MouseEvent, p: PcacDotPlacement) {\n grow(this, p, false);\n self.hideTooltip();\n })\n .on('click', (_event: MouseEvent, p: PcacDotPlacement) => this.dotClickedSource.next(p.data));\n\n makeMarksAccessible(marks, {\n label: (p) => this.markLabel(p.data, { parent: p.series, valueFormat: this.xAxis.format }),\n activate: (p) => this.dotClickedSource.next(p.data),\n focus: (mark, p) => {\n grow(mark, p, true);\n this.showMarkTooltip(mark, p.data, tooltipOptions(p, select(mark).select('.pcac-dot, .pcac-dot-image').node() as Element | null));\n },\n blur: (mark, p) => {\n grow(mark, p, false);\n this.hideMarkTooltip(mark);\n },\n });\n\n // Each column builds up from the axis: a mark fades in a beat after the one below it.\n const delay = (p: PcacDotPlacement) => Math.min(p.level * 40, duration);\n marks.filter((p) => !p.data.image)\n .append('circle')\n .attr('class', 'pcac-dot')\n .attr('r', this.dotRadius)\n .attr('stroke', color)\n .attr('fill', 'var(--pcac-dot-fill, #fff)')\n .attr('opacity', 0)\n .transition()\n .delay(delay)\n .duration(duration / 2)\n .attr('opacity', 1);\n\n marks.filter((p) => !!p.data.image)\n .append('image')\n .attr('class', 'pcac-dot-image')\n .attr('href', (p) => p.data.image as string)\n .attr('width', imageWidth)\n .attr('height', imageHeight)\n .attr('x', -imageWidth / 2)\n .attr('y', -imageHeight / 2)\n .attr('preserveAspectRatio', 'xMidYMid meet')\n .attr('opacity', 0)\n .transition()\n .delay(delay)\n .duration(duration / 2)\n .attr('opacity', 1);\n }\n}\n","import { Component, ElementRef, ViewEncapsulation, contentChild, effect, inject, input, viewChild } from '@angular/core';\nimport { outputFromObservable } from '@angular/core/rxjs-interop';\nimport { DotPlotChartBuilder } from './dot-plot-chart.builder';\nimport { PcacDotPlotChartConfig } from './dot-plot-chart.model';\nimport { PcacChartResizeService } from '../core/resize.service';\nimport { PcacTooltipDirective } from '../core/tooltip.directive';\n\n/** A dot plot: points along one value axis, stacked into columns where they share a value (see PcacDotPlotChartConfig). */\n@Component({\n selector: 'pcac-dot-plot-chart',\n // See PcacBarVerticalChart: `heightFull` needs the host to hand a height down.\n host: { '[class.pcac-height-full]': 'config().heightFull' },\n templateUrl: './dot-plot-chart.component.html',\n styleUrl: './dot-plot-chart.component.scss',\n encapsulation: ViewEncapsulation.None,\n providers: [DotPlotChartBuilder]\n})\nexport class PcacDotPlotChart {\n private chartBuilder = inject(DotPlotChartBuilder);\n\n readonly config = input.required<PcacDotPlotChartConfig>();\n private readonly chartElm = viewChild.required<ElementRef>('chart');\n readonly dotClicked = outputFromObservable(this.chartBuilder.dotClicked$);\n /**\n * How much the marks were scaled to fit the chart's height, after a draw that changed it: 1 at\n * full size, below 1 once a column too tall for the chart shrank every mark evenly (see\n * `pointImage`). An image is drawn `pointImage.maxWidth * fit` by `maxHeight * fit`, a dot at\n * `dotRadius * fit` - so a size control can show what was actually drawn.\n */\n readonly markFit = outputFromObservable(this.chartBuilder.markFit$);\n\n /** Optional consumer `<ng-template pcacTooltip>`, replacing the default tooltip (see PcacTooltipDirective). */\n readonly tooltipTemplate = contentChild(PcacTooltipDirective);\n\n constructor() {\n effect(() => this.buildChart());\n // A getter, so the builder reads the query at hover time rather than in the effect above.\n this.chartBuilder.tooltipTemplate = () => this.tooltipTemplate()?.templateRef;\n inject(PcacChartResizeService).observe(this.chartElm, () => {\n if (this.chartBuilder.containerSizeChanged(this.chartElm())) {\n this.buildChart();\n }\n });\n }\n\n private buildChart(): void {\n const config = this.config();\n // Handed over even when empty: the builder clears what it last drew rather than leaving it.\n if (config) {\n this.chartBuilder.buildChart(this.chartElm(), config);\n }\n }\n}\n","<section class=\"pcac-dot-plot-chart\">\n <svg #chart></svg>\n</section>\n","import { Component, computed, inject, model, output } from '@angular/core';\nimport { PcacColorService } from '../core';\n\nexport class PcacLegendConfigItem {\n label!: string;\n checked: boolean = true;\n colorOverride: string | null = null;\n}\n\nexport class PcacLegendConfig {\n heading: string | null = null;\n items: PcacLegendConfigItem[] = [];\n}\n\nlet nextLegendId = 0;\n\n@Component({\n selector: 'pcac-legend',\n templateUrl: './legend.component.html',\n styleUrl: './legend.component.scss',\n // One named group of switches, so a screen reader announces the heading (\"Series\") on entering\n // the legend, and each switch as part of it, rather than a heading and some unrelated switches.\n host: {\n role: 'group',\n '[attr.aria-labelledby]': 'config().heading ? headingId : null',\n },\n})\nexport class PcacLegend {\n readonly headingId = `pcac-legend-heading-${nextLegendId++}`;\n private readonly colorService = inject(PcacColorService);\n config = model.required<PcacLegendConfig>();\n itemClicked = output<PcacLegendConfigItem[]>();\n\n colorScale = computed(() => \n this.colorService.getColorScale(this.config().items.length)\n );\n\n onItemClicked(index: number) {\n const items = this.config().items.map((item, i) =>\n i === index ? { ...item, checked: !item.checked } : item\n );\n this.config.set({ ...this.config(), items });\n this.itemClicked.emit(items);\n }\n}\n","@if (config().heading) {\n<div class=\"pcac-legend-label\" [id]=\"headingId\"><small>{{config().heading}}</small></div>\n}\n@for(item of config().items; track $index; let i = $index) {\n<div class=\"pcac-legend-item\" [class.pcac-legend-unchecked]=\"!item.checked\"\n role=\"switch\" [attr.aria-checked]=\"item.checked\" tabindex=\"0\" (click)=\"onItemClicked(i)\"\n (keydown.enter)=\"onItemClicked(i)\" (keydown.space)=\"onItemClicked(i); $event.preventDefault()\">\n @let color = item.colorOverride ? item.colorOverride : colorScale()[i];\n <div class=\"pcac-legend-circle\" [style.backgroundColor]=\"color\"></div>\n <small>{{ item.label }}</small>\n</div>\n}\n","import { ScaleLinear, ScaleTime } from \"d3-scale\";\nimport { PcacData, PcacFormatEnum } from \"../../core\";\n\n/**\n * Whether a point has an x key to position by. An explicit emptiness check, not truthiness: a\n * Decimal key of `0` is a perfectly good coordinate (the left edge of a `domainMin: 0` axis) and\n * used to be read as \"no key\" - drawn at pixel 0 whatever the domain, and pinned there under zoom.\n */\nexport function hasKey(data: PcacData): boolean {\n return data.key !== null && data.key !== undefined && data.key !== '';\n}\n\nexport function getXFormat(type: PcacFormatEnum, data: PcacData, index: number, xScale: ScaleLinear<number, number> | ScaleTime<number, number, never>) {\n switch (type) {\n case PcacFormatEnum.DateTime:\n if (hasKey(data)) {\n return xScale(new Date(data.key as string | number));\n }\n return 0\n case PcacFormatEnum.Decimal:\n if (hasKey(data)) {\n return xScale(Number(data.key));\n }\n return 0\n default:\n return xScale(index)\n }\n}\n","import { PcacData } from '../../../core';\n\n/** Whether a point has a numeric value to draw at. */\nexport function hasValue(d: PcacData): boolean {\n return d.value !== null && d.value !== undefined && d.value !== '' && Number.isFinite(Number(d.value));\n}\n","import { Selection, BaseType } from 'd3-selection';\nimport { ScaleLinear, ScaleTime } from 'd3-scale';\nimport { PcacData, PcacFormatEnum } from '../../../core';\nimport { axisTickFormat } from '../../../core/tick-format';\nimport { Injectable } from '@angular/core';\nimport { select } from 'd3-selection';\nimport { getXFormat } from '../x-format';\nimport { hasValue } from './has-value';\n\nexport interface IPlaChartEffectsBuilderConfig {\n colors: string[];\n data: PcacData[];\n width: number;\n height: number;\n svg: Selection<SVGGElement, unknown, BaseType, unknown>;\n x: ScaleLinear<number, number> | ScaleTime<number, number, never>;\n y: ScaleLinear<number, number> | ScaleTime<number, number, never>;\n /** The x axis's format, so the crosshair positions points the way the lines do (`getXFormat`). */\n xFormat: PcacFormatEnum;\n /** The y axis's format and tick count, so the crosshair's value reads like the axis labels. */\n yFormat?: PcacFormatEnum;\n yTicks?: number;\n}\n\n/**\n * Provided per-component (see PcacLineAreaChartComponent's `providers`), not root-scoped: this\n * holds mutable per-chart-instance state (`config`, `series`) despite looking like a stateless\n * helper. A root singleton would be shared and clobbered by every `<pcac-line-area-chart>`\n * rendered at once — each instance's hover effects would end up reading/writing whichever\n * chart's `buildEffects()` ran last, not their own.\n */\n@Injectable()\nexport class PlaChartEffectsBuilder {\n private config!: IPlaChartEffectsBuilderConfig;\n // The series that get an effect group, each with its index in `config.data` (which is what its\n // line's color is picked by, so a skipped empty series doesn't shift the colors after it).\n private series: { data: PcacData; index: number }[] = [];\n /** Where the cursor last was over the plot, while the crosshair is showing; null otherwise. */\n private lastMousePos: [number, number] | null = null;\n\n buildEffects(config: IPlaChartEffectsBuilderConfig): void {\n this.config = config;\n this.lastMousePos = null;\n this.series = config.data\n .map((data, index) => ({ data, index }))\n .filter(({ data }) => data.data.length > 0);\n this.buildCollection();\n this.buildCanvas();\n }\n\n /**\n * Swaps in the scales a zoom has rescaled. The crosshair positions and labels its points\n * against the scales, so a zoom has to hand them over here or it would track the unzoomed\n * lines.\n */\n updateScales(x: IPlaChartEffectsBuilderConfig['x'], y: IPlaChartEffectsBuilderConfig['y']): void {\n this.config.x = x;\n this.config.y = y;\n // A wheel zoom moves the lines under a cursor that stays put, and sends no mousemove - so the\n // crosshair is re-read at the same spot, or it would sit on the pre-zoom values until the\n // mouse next moved.\n if (this.lastMousePos) {\n this.onMouseMove(this.lastMousePos);\n }\n }\n\n private buildCollection() {\n const collection = this.config.svg.append('g')\n .attr('class', 'effects')\n // The hover crosshair repeats, for the pointer, what the points' own names say.\n .attr('aria-hidden', 'true');\n\n collection.append('path')\n .attr('class', 'effect-line');\n\n const mousePerLine = collection.selectAll('.effect-group')\n .data(this.series)\n .enter().append('g')\n .attr('class', 'effect-group')\n .attr('style', ({ data }) => data.hide ? 'display: none' : null);\n\n mousePerLine.append('circle')\n .attr('r', 7)\n .attr('class', 'effect-circle')\n .style('stroke', ({ index }) => this.config.colors[index]);\n\n mousePerLine.append('text')\n .attr('class', 'effect-text')\n .attr('y', 1.5)\n .attr('transform', 'translate(10,3)');\n }\n\n private buildCanvas(): void {\n this.config.svg.append('rect')\n .attr('class', 'effects-canvas')\n .attr('width', this.config.width)\n .attr('height', this.config.height)\n .attr('pointer-events', 'all')\n .on('mouseout', () => {\n this.hideEffects();\n })\n .on('mouseover', () => {\n this.showEffects();\n })\n .on('mousemove', (event: MouseEvent) => {\n const current = event.currentTarget as Element\n const parent = current.parentElement\n const xForms = parent?.getAttribute('transform')\n if(!xForms) \n return this.onMouseMove([event.offsetX, event.offsetY]);\n \n const parts = /translate\\(\\s*([^\\s,)]+)[ ,]([^\\s,)]+)/.exec(xForms);\n if(!parts) \n return this.onMouseMove([event.offsetX, event.offsetY]);\n const x = Number(parts[1])\n this.onMouseMove([event.offsetX - x, event.offsetY]);\n });\n }\n\n private showEffects() {\n this.config.svg.select('.effect-line')\n .style('opacity', '1');\n this.config.svg.selectAll('.effect-group circle')\n .style('opacity', '1');\n this.config.svg.selectAll('.effect-group text')\n .style('opacity', '1');\n }\n\n private hideEffects() {\n this.lastMousePos = null;\n this.config.svg.select('.effect-line')\n .style('opacity', '0');\n this.config.svg.selectAll('.effect-group circle')\n .style('opacity', '0');\n this.config.svg.selectAll('.effect-group text')\n .style('opacity', '0');\n }\n\n private onMouseMove(mousePos: [number, number]) {\n this.lastMousePos = mousePos;\n this.updateLine(mousePos);\n this.updateEffects(mousePos);\n }\n\n private updateLine(mousePos: [number, number]) {\n this.config.svg.select('.effect-line')\n .attr('d', () => 'M' + mousePos[0] + ',' + this.config.height + ' ' + mousePos[0] + ',' + 0);\n }\n\n private updateEffects(mousePos: [number, number]) {\n this.config.svg.selectAll<SVGGElement, { data: PcacData }>('.effect-group')\n .each((series, index, nodes) => {\n const group = select(nodes[index]);\n const value = this.valueAt(series.data.data, mousePos[0]);\n // No value under the cursor (a gap in the series): nothing to mark, so the group is\n // hidden rather than left at its last position.\n group.attr('visibility', value === null ? 'hidden' : null);\n if (value === null) {\n return;\n }\n group.attr('transform', 'translate(' + mousePos[0] + ',' + this.config.y(value) + ')');\n group.select('text').text(this.formatValue(value));\n });\n }\n\n /**\n * The series' value at plot x `mouseX`, interpolated along the segment of the line that spans it\n * - the same (linear) join the line/area draws between two consecutive points - or null if it\n * falls in a gap, where the line isn't drawn. Beyond the line's leftmost/rightmost point it holds\n * that point's value.\n *\n * Works on the segments in data order and never assumes x increases along them: DateTime or\n * Decimal data can come newest-first (or in any order), and the line still joins consecutive\n * points - reading \"the first point\" as the leftmost one showed the newest value everywhere.\n *\n * Worked out from the data rather than by walking the drawn path: an area's outline doubles\n * back along its baseline, so a search over the path's geometry could land on the bottom edge\n * and read the wrong value.\n */\n private valueAt(points: PcacData[], mouseX: number): number | null {\n const xAt = (i: number) => getXFormat(this.config.xFormat, points[i], i, this.config.x);\n const valueOf = (i: number) => Number(points[i].value);\n const drawn = points.map((_, i) => i).filter((i) => hasValue(points[i]));\n if (!drawn.length) {\n return null;\n }\n\n // A segment joins two points next to each other in the data, both with a value - a point\n // without one between them breaks the line (`defined(hasValue)`).\n for (let i = 1; i < points.length; i++) {\n if (!hasValue(points[i - 1]) || !hasValue(points[i])) {\n continue;\n }\n const [xa, xb] = [xAt(i - 1), xAt(i)];\n if (mouseX < Math.min(xa, xb) || mouseX > Math.max(xa, xb)) {\n continue;\n }\n const [va, vb] = [valueOf(i - 1), valueOf(i)];\n return xb === xa ? vb : va + (vb - va) * (mouseX - xa) / (xb - xa);\n }\n\n const leftmost = drawn.reduce((min, i) => (xAt(i) < xAt(min) ? i : min));\n const rightmost = drawn.reduce((max, i) => (xAt(i) > xAt(max) ? i : max));\n if (mouseX <= xAt(leftmost)) {\n return valueOf(leftmost);\n }\n if (mouseX >= xAt(rightmost)) {\n return valueOf(rightmost);\n }\n return null;\n }\n\n /**\n * The crosshair's value, formatted the way the y axis labels its ticks - same format, same\n * step-based precision - rather than rounded to a whole number, which read a 0-1 axis as 0 or 1.\n */\n private formatValue(value: number): string {\n const y = this.config.y as ScaleLinear<number, number>;\n const formatter = axisTickFormat(this.config.yFormat, y, this.config.yTicks)\n ?? y.tickFormat(this.config.yTicks);\n return formatter(value);\n }\n}\n","import { PcacLineAreaChartConfig } from \"../plot-line-area-chart.model\";\n\n/**\n * How the plot chart spreads out points that share a coordinate (see\n * `PcacPlotChartConfig.pointFanOut`). Each group of coincident points is placed evenly around\n * a ring centered on the shared coordinate, starting at 12 o'clock and going clockwise in data\n * order (series order, then point order), so every point stays visible and hoverable. A ring at\n * the edge of the domain is moved back inside the plot area as one, so no member hangs over an\n * axis by more than half its mark - the same as a lone point there; the anchor stays put.\n */\nexport class PcacPointFanOutConfig {\n /**\n * Ring radius in px, the same for every group. When not set, each group gets the smallest\n * radius at which its neighbors sit `gap` px apart - so a pair barely moves while a group of\n * five spreads as far as it has to.\n */\n radius?: number\n\n /**\n * Space between neighboring points on the ring, in px, when `radius` is not set. Measured\n * between their image boxes (or hovered dots), not their centers.\n */\n gap: number = 4\n\n /**\n * Draw a dot at the shared coordinate - the value the group's points actually have - with a\n * spoke out to each of them. Styled by the theme's `.fan-out-anchor` / `.fan-out-spoke` rules,\n * whose colors `anchorColor` / `spokeColor` override.\n */\n showAnchor: boolean = true\n\n /**\n * Spoke color, any CSS color; theme default `$gray-400`. Applied as `--pcac-fan-out-spoke-color`\n * on the chart's `.fan-outs` group, so a stylesheet can set it on an ancestor instead (a config\n * value wins). Needs `showAnchor`.\n */\n spokeColor?: string\n\n /** Anchor dot color, likewise (`--pcac-fan-out-anchor-color`); theme default `$gray-600`. */\n anchorColor?: string\n}\n\nexport class PcacPlotChartConfig extends PcacLineAreaChartConfig {\n /**\n * Spread points that share a coordinate around it instead of drawing them on top of one\n * another (where only the last series' point shows, and only it can be hovered). Off when not\n * set; `{}` turns it on with every `PcacPointFanOutConfig` default. The fanned points keep\n * their true value in the tooltip, and the hovered point's tooltip context lists the others at\n * its coordinate in `coincident` (see `PcacTooltipContext`).\n *\n * Plot chart only: a line or area chart's points are joined in series order, so moving one\n * would kink the line.\n */\n pointFanOut?: Partial<PcacPointFanOutConfig>\n}\n","\nimport { scaleTime } from 'd3-scale';\nimport { ScaleLinear, scaleLinear, ScaleTime } from 'd3-scale';\n\n\nimport { PcacData, PcacFormatEnum, PcacResolvedAxisConfig } from '../../../core/chart.model';\n\nexport class PlaChartScales {\n x!: ScaleLinear<number, number> | ScaleTime<number, number, never>;\n y!: ScaleLinear<number, number>;\n}\n\n/**\n * Takes the chart's *resolved* axes (`PcacChart.xAxis`/`yAxis`), not the raw config, so the\n * `format`/`domainMin`/`domainMax` defaults are already applied - see `PcacLineAreaChartConfig`\n * for what each format does with them.\n */\n/** The number of points in the longest series. */\nexport function longestSeriesLength(data: PcacData[]): number {\n return data.reduce((max, series) => Math.max(max, series.data.length), 0);\n}\n\nexport class PlaChartScalesBuilder {\n build(\n xAxis: PcacResolvedAxisConfig, yAxis: PcacResolvedAxisConfig, data: PcacData[], chartWidth: number, chartHeight: number\n ): PlaChartScales {\n const resp = new PlaChartScales();\n resp.x = this.buildXScale(xAxis, data, chartWidth);\n resp.y = this.buildYScale(yAxis, chartHeight);\n return resp;\n }\n\n private buildXScale(\n xAxis: PcacResolvedAxisConfig, data: PcacData[], chartWidth: number\n ): ScaleLinear<number, number> | ScaleTime<number, number, never> {\n switch (xAxis.format) {\n case PcacFormatEnum.DateTime:\n return scaleTime()\n .domain([new Date(xAxis.domainMin), new Date(xAxis.domainMax)])\n .range([0, chartWidth]);\n case PcacFormatEnum.Decimal:\n return scaleLinear()\n .domain([xAxis.domainMin as number, xAxis.domainMax as number])\n .range([0, chartWidth]);\n default:\n // DatasetLength and every other format position points by index - across the longest\n // series, not the first, which may be shorter or empty (an empty one gave [0, -1], an\n // inverted scale that pushed every point off the plot).\n return scaleLinear()\n .domain([0, Math.max(0, longestSeriesLength(data) - 1)])\n .range([0, chartWidth]);\n }\n }\n\n private buildYScale(yAxis: PcacResolvedAxisConfig, chartHeight: number): ScaleLinear<number, number> {\n return scaleLinear()\n .domain([yAxis.domainMin as number, yAxis.domainMax as number])\n .range([chartHeight, 0]);\n }\n}\n","import { line, Line } from 'd3-shape';\nimport { getXFormat } from '../x-format';\nimport { PcacData, PcacFormatEnum } from '../../../core';\nimport { PlaChartScales } from './scales.builder';\nimport { hasValue } from './has-value';\n\nexport function buildLineGenerator(format: PcacFormatEnum, scales: PlaChartScales): Line<PcacData> {\n return line<PcacData>()\n // A point with no numeric value leaves a gap rather than a NaN in the path, which browsers stop\n // drawing at - hiding the rest of the line.\n .defined(hasValue)\n .x((d: PcacData, i) => {\n return getXFormat(format, d, i, scales.x)\n })\n .y((d: PcacData) => {\n return scales.y(d.value as number);\n });\n}","import { Area, area } from 'd3-shape';\nimport { getXFormat } from '../x-format';\nimport { PcacData, PcacFormatEnum } from '../../../core';\nimport { PlaChartScales } from './scales.builder';\nimport { hasValue } from './has-value';\n\nexport function buildAreaGenerator(format: PcacFormatEnum, scales: PlaChartScales, chartHeight: number): Area<PcacData> {\n return area<PcacData>()\n // A point with no numeric value leaves a gap rather than a NaN in the path, which browsers stop\n // drawing at - hiding the rest of the area.\n .defined(hasValue)\n .x((d: PcacData, i) => {\n return getXFormat(format, d, i, scales.x);\n })\n .y0(chartHeight)\n .y1((d: PcacData) => {\n return scales.y(d.value as number);\n });\n}","import { D3ZoomEvent, ZoomBehavior, zoom } from \"d3-zoom\";\n\n/**\n * `extent` (the viewport the gesture happens in) is set to the plot area explicitly rather than\n * left to d3's default, which reads the *owning `<svg>`'s* size - plot plus margins. With the\n * viewport wider than `translateExtent`, d3's constraint centers the plot within it instead of\n * pinning the two together, so the first gesture (even one that zooms straight back out to k = 1)\n * left the chart shifted right/down by half the margins: x domain min detached from the y axis,\n * domain max pushed off the right edge.\n */\nexport function buildZoomBehavior(width: number, height: number, zoomedFn: (event: D3ZoomEvent<Element, unknown>) => void): ZoomBehavior<Element, unknown> {\n return zoom()\n .scaleExtent([1, 10])\n .extent([[0, 0], [width, height]])\n .translateExtent([[0, 0], [width, height]])\n .on(\"zoom\", zoomedFn);\n}\n","import { BaseType, Selection } from 'd3-selection';\nimport { PcacData, PcacFormatEnum } from '../../../core/chart.model';\nimport { PcacPointRangeStyle } from '../../plot-line-area-chart.model';\nimport { PlaChartScales } from './scales.builder';\n\n/**\n * A point's `range` in pixels, alongside the point's own position. `x0 < x1` and `y0 < y1` (so\n * `y0` is the range's *max* - the y scale runs top-down); an axis without a usable range has\n * neither of its pair.\n */\nexport interface PlaRangeExtent {\n cx: number;\n cy: number;\n x0?: number;\n x1?: number;\n y0?: number;\n y1?: number;\n}\n\n/** Half the length of a whisker's end cap, in px. */\nexport const RANGE_CAP = 5;\n/** How thick a box is drawn along an axis the point has no range on, in px. */\nexport const RANGE_STRIP = 4;\n/** How thick a fade is drawn along an axis the point has no range on, in px. */\nexport const RANGE_FADE_BAR = 10;\n\n/**\n * Where an x range bound lands, read the way `getXFormat` reads a key: a date for `DateTime`, a\n * number for `Decimal`, and a (possibly fractional) index for every index-based format. `NaN`\n * for anything that doesn't parse.\n */\nfunction xBound(value: number | string, format: PcacFormatEnum, scales: PlaChartScales): number {\n if (value === null || value === undefined || value === '') {\n return NaN;\n }\n if (format === PcacFormatEnum.DateTime) {\n return scales.x(new Date(value)) as number;\n }\n return scales.x(Number(value)) as number;\n}\n\n/**\n * Sorts a pair of pixel bounds, or returns nothing if either isn't a real number - or if they're\n * the same, since a range that doesn't span anything has nothing to draw (whiskers would be a\n * stray pair of caps, a box or fade zero-sized).\n */\nfunction span(a: number, b: number): [number, number] | undefined {\n if (!Number.isFinite(a) || !Number.isFinite(b) || a === b) {\n return undefined;\n }\n return a <= b ? [a, b] : [b, a];\n}\n\n/**\n * `d`'s range at these scales, drawn around `(cx, cy)` - the point's true coordinate - or `null`\n * when it has no range on either axis that can be placed.\n */\nexport function rangeExtent(\n d: PcacData, cx: number, cy: number, format: PcacFormatEnum, scales: PlaChartScales\n): PlaRangeExtent | null {\n const range = d.range;\n if (!range) {\n return null;\n }\n const xs = range.x ? span(xBound(range.x.min, format, scales), xBound(range.x.max, format, scales)) : undefined;\n const ys = range.y ? span(scales.y(Number(range.y.min)), scales.y(Number(range.y.max))) : undefined;\n if (!xs && !ys) {\n return null;\n }\n const extent: PlaRangeExtent = { cx, cy };\n if (xs) {\n [extent.x0, extent.x1] = xs;\n }\n if (ys) {\n [extent.y0, extent.y1] = ys;\n }\n return extent;\n}\n\n/**\n * Where the point sits within its range's box, as 0 - 1 fractions: the fade's brightest spot.\n * An axis without a range has the point in the middle.\n */\nexport function rangeFocus(extent: PlaRangeExtent): { fx: number; fy: number } {\n const fraction = (v: number, lo?: number, hi?: number) =>\n lo === undefined || hi === undefined || hi === lo ? 0.5 : Math.min(1, Math.max(0, (v - lo) / (hi - lo)));\n return { fx: fraction(extent.cx, extent.x0, extent.x1), fy: fraction(extent.cy, extent.y0, extent.y1) };\n}\n\n/**\n * (Re)draws one point's range into `group`, in plot coordinates, replacing whatever was there -\n * the same call serves the first draw and every zoom. `gradientId` must be unique in the page;\n * only the fade uses it. Colors, stroke widths and opacity all come from the theme (see\n * plot-line-area-chart.component.scss), so nothing here depends on the series.\n */\nexport function drawRange(\n group: Selection<SVGGElement, unknown, BaseType, unknown>,\n extent: PlaRangeExtent,\n style: PcacPointRangeStyle,\n gradientId: string\n): void {\n group.selectAll('*').remove();\n const { cx, cy, x0, x1, y0, y1 } = extent;\n\n switch (style) {\n case PcacPointRangeStyle.Box: {\n const left = x0 ?? cx - RANGE_STRIP / 2;\n const right = x1 ?? cx + RANGE_STRIP / 2;\n const top = y0 ?? cy - RANGE_STRIP / 2;\n const bottom = y1 ?? cy + RANGE_STRIP / 2;\n group.append('rect')\n .attr('class', 'point-range-box')\n .attr('x', left)\n .attr('y', top)\n .attr('width', right - left)\n .attr('height', bottom - top)\n .attr('rx', 2);\n return;\n }\n\n case PcacPointRangeStyle.Fade: {\n const { fx, fy } = rangeFocus(extent);\n const stops = (gradient: Selection<any, unknown, BaseType, unknown>, offsets: [number, number][]) => {\n for (const [offset, opacity] of offsets) {\n gradient.append('stop')\n .attr('class', 'point-range-stop')\n .attr('offset', offset)\n .attr('stop-opacity', opacity);\n }\n };\n // The gradient lives inside the point's own group, not the chart's <defs>, so its stops\n // inherit the color custom properties set on the series group above it. Sized in\n // objectBoundingBox units, so the brightest spot stays on the point as zoom stretches it.\n const defs = group.append('defs');\n if (x0 !== undefined && x1 !== undefined && y0 !== undefined && y1 !== undefined) {\n const gradient = defs.append('radialGradient')\n .attr('id', gradientId)\n .attr('cx', 0.5).attr('cy', 0.5).attr('r', 0.5)\n .attr('fx', fx).attr('fy', fy);\n stops(gradient, [[0, 0.8], [0.5, 0.35], [1, 0]]);\n group.append('ellipse')\n .attr('class', 'point-range-fade')\n .attr('cx', (x0 + x1) / 2)\n .attr('cy', (y0 + y1) / 2)\n .attr('rx', (x1 - x0) / 2)\n .attr('ry', (y1 - y0) / 2)\n .attr('fill', `url(#${gradientId})`);\n return;\n }\n const vertical = y0 !== undefined && y1 !== undefined;\n const gradient = defs.append('linearGradient')\n .attr('id', gradientId)\n .attr('x1', 0).attr('y1', 0)\n .attr('x2', vertical ? 0 : 1).attr('y2', vertical ? 1 : 0);\n stops(gradient, [[0, 0.05], [vertical ? fy : fx, 0.8], [1, 0.05]]);\n const left = x0 ?? cx - RANGE_FADE_BAR / 2;\n const right = x1 ?? cx + RANGE_FADE_BAR / 2;\n const top = y0 ?? cy - RANGE_FADE_BAR / 2;\n const bottom = y1 ?? cy + RANGE_FADE_BAR / 2;\n group.append('rect')\n .attr('class', 'point-range-fade')\n .attr('x', left)\n .attr('y', top)\n .attr('width', right - left)\n .attr('height', bottom - top)\n .attr('rx', RANGE_FADE_BAR / 2)\n .attr('fill', `url(#${gradientId})`);\n return;\n }\n\n default: {\n // Whiskers\n const line = (xa: number, ya: number, xb: number, yb: number, cls: string) =>\n group.append('line')\n .attr('class', cls)\n .attr('x1', xa).attr('y1', ya)\n .attr('x2', xb).attr('y2', yb);\n if (y0 !== undefined && y1 !== undefined) {\n line(cx, y0, cx, y1, 'point-range-whisker');\n line(cx - RANGE_CAP, y0, cx + RANGE_CAP, y0, 'point-range-cap');\n line(cx - RANGE_CAP, y1, cx + RANGE_CAP, y1, 'point-range-cap');\n }\n if (x0 !== undefined && x1 !== undefined) {\n line(x0, cy, x1, cy, 'point-range-whisker');\n line(x0, cy - RANGE_CAP, x0, cy + RANGE_CAP, 'point-range-cap');\n line(x1, cy - RANGE_CAP, x1, cy + RANGE_CAP, 'point-range-cap');\n }\n }\n }\n}\n","import { Selection } from 'd3-selection';\nimport { arc } from 'd3-shape';\nimport { PcacData } from '../../../core/chart.model';\nimport { PcacPointGaugeConfig } from '../../plot-line-area-chart.model';\n\n/** A hovered dot's radius - the largest a dot gets, so a ring around it never touches it. */\nexport const GAUGE_DOT_RADIUS = 6;\n\n/** Whether a point has a gauge value to draw. */\nexport function hasGauge(d: PcacData): boolean {\n return typeof d.gauge === 'number' && Number.isFinite(d.gauge);\n}\n\n/** How far a ring reaches past the mark it surrounds: its gap plus its full width. */\nexport function gaugeExtent(config: PcacPointGaugeConfig): number {\n return config.gap + config.width;\n}\n\n/** The share of the ring a value fills, clamped to 0 - 1. A `max` of 0 or less fills nothing. */\nexport function gaugeFraction(value: number, max: number): number {\n return max > 0 ? Math.min(1, Math.max(0, value / max)) : 0;\n}\n\n/**\n * Appends a `.point-gauge` ring to each point in `points` that has a `gauge`: a `.point-gauge-track`\n * circle (unless `showTrack` is off) and a `.point-gauge-arc` path filling clockwise from 12\n * o'clock. `markRadius` is half of what the ring surrounds - the image box, or a hovered dot - so\n * the ring's centerline sits `gap + width / 2` beyond it. Returned so the caller can place the\n * rings (see `drawDots`, which moves them with each point's fan-out offset and enter rise).\n */\nexport function drawPointGauges(\n points: Selection<SVGGElement, PcacData, SVGGElement, unknown>,\n config: PcacPointGaugeConfig,\n markRadius: (d: PcacData) => number,\n): Selection<SVGGElement, PcacData, SVGGElement, unknown> {\n const radius = (d: PcacData) => markRadius(d) + config.gap + config.width / 2;\n const gauges = points.filter(hasGauge)\n .append('g')\n .attr('class', 'point-gauge')\n .attr('aria-hidden', 'true');\n if (config.showTrack) {\n gauges.append('circle')\n .attr('class', 'point-gauge-track')\n .attr('r', radius)\n .attr('stroke-width', config.width);\n }\n gauges.append('path')\n .attr('class', 'point-gauge-arc')\n .attr('d', (d: PcacData) => {\n const fraction = gaugeFraction(d.gauge as number, config.max);\n if (fraction === 0) {\n return null;\n }\n const r = radius(d);\n // Rounded ends read as a gauge; a full ring has no ends to round.\n return arc().cornerRadius(fraction < 1 ? config.width / 2 : 0)({\n innerRadius: r - config.width / 2,\n outerRadius: r + config.width / 2,\n startAngle: 0,\n endAngle: 2 * Math.PI * fraction,\n });\n });\n return gauges;\n}\n","import { BaseType, Selection } from 'd3-selection';\nimport { PcacFormatEnum } from '../../../core/chart.model';\nimport { PcacCornerLabels, PcacReferenceLine } from '../../plot-line-area-chart.model';\nimport { PlaChartScales } from './scales.builder';\n\n/** How far a reference line's label, and a corner label, sits in from what it's attached to, in px. */\nconst LABEL_INSET = 4;\nconst CORNER_INSET = 8;\n\n/** A `PcacReferenceLine` with its defaults filled in. */\ntype PlaReferenceLine = PcacReferenceLine;\n\n/**\n * Where a reference line sits on its axis, in plot pixels, or `null` when its value doesn't place\n * (a date that won't parse, a non-numeric value) - such a line isn't drawn. An x value is read the\n * way a point's `key` is under the axis's format (see `getXFormat`).\n */\nexport function referenceLinePosition(\n line: PlaReferenceLine,\n scales: PlaChartScales,\n xFormat: PcacFormatEnum | undefined,\n): number | null {\n const position = line.axis === 'x'\n ? scales.x(xFormat === PcacFormatEnum.DateTime ? new Date(line.value) : Number(line.value))\n : scales.y(Number(line.value));\n return Number.isFinite(position) ? position : null;\n}\n\n/**\n * Draws `lines` into one `.reference-lines` group, clipped to the plot (`clipPathId`) so a line\n * zoomed past an edge disappears there, each a `.reference-line` group holding the dashed `<line>`.\n * Their labels go in a `.reference-line-labels` group of their own, clipped the same way, so they\n * can be raised over the series (`raiseLabels`) without the lines. Both hidden from screen readers,\n * as the grid is.\n */\nexport function drawReferenceLines(\n svg: Selection<SVGGElement, unknown, BaseType, unknown>,\n lines: Partial<PcacReferenceLine>[] | undefined,\n scales: PlaChartScales,\n xFormat: PcacFormatEnum | undefined,\n width: number,\n height: number,\n clipPathId: string,\n): void {\n if (!lines?.length) {\n return;\n }\n const resolved = lines.map((line): PlaReferenceLine => ({ ...new PcacReferenceLine(), ...line }));\n const groups = svg.append('g')\n .attr('class', 'reference-lines')\n .attr('clip-path', `url(#${clipPathId})`)\n .attr('aria-hidden', 'true')\n .selectAll('.reference-line')\n .data(resolved)\n .enter().append('g')\n .attr('class', (line: PlaReferenceLine) => `reference-line reference-line-${line.axis}`)\n .style('--pcac-reference-line-color', (line: PlaReferenceLine) => line.color ?? null);\n groups.append('line').attr('class', 'reference-line-stroke');\n const labelled = resolved.filter((line) => !!line.label);\n if (labelled.length) {\n svg.append('g')\n .attr('class', 'reference-line-labels')\n .attr('clip-path', `url(#${clipPathId})`)\n .attr('aria-hidden', 'true')\n .selectAll('.reference-line-label')\n .data(labelled)\n .enter().append('text')\n .attr('class', (line: PlaReferenceLine) => `reference-line-label reference-line-label-${line.axis}`)\n .style('--pcac-reference-line-color', (line: PlaReferenceLine) => line.color ?? null)\n .text((line: PlaReferenceLine) => line.label!);\n }\n positionReferenceLines(svg, scales, xFormat, width, height);\n}\n\n/**\n * Places the chart's reference lines, and their labels, against `scales` - on the first draw and\n * again on every zoom. A horizontal line's label sits above its right end, or its left with\n * `labelPosition: 'start'`; a vertical line's beside its top, or its bottom.\n */\nexport function positionReferenceLines(\n svg: Selection<SVGGElement, unknown, BaseType, unknown>,\n scales: PlaChartScales,\n xFormat: PcacFormatEnum | undefined,\n width: number,\n height: number,\n): void {\n const hidden = (line: PlaReferenceLine) => referenceLinePosition(line, scales, xFormat) === null ? 'none' : null;\n const groups = svg.selectAll<SVGGElement, PlaReferenceLine>('.reference-line').attr('display', hidden);\n const at = (line: PlaReferenceLine) => referenceLinePosition(line, scales, xFormat) ?? 0;\n const atStart = (line: PlaReferenceLine) => line.labelPosition === 'start';\n groups.select('.reference-line-stroke')\n .attr('x1', (line: PlaReferenceLine) => line.axis === 'x' ? at(line) : 0)\n .attr('x2', (line: PlaReferenceLine) => line.axis === 'x' ? at(line) : width)\n .attr('y1', (line: PlaReferenceLine) => line.axis === 'x' ? 0 : at(line))\n .attr('y2', (line: PlaReferenceLine) => line.axis === 'x' ? height : at(line));\n svg.selectAll<SVGTextElement, PlaReferenceLine>('.reference-line-label')\n .attr('display', hidden)\n .attr('x', (line: PlaReferenceLine) => line.axis === 'x'\n ? at(line) + LABEL_INSET\n : atStart(line) ? LABEL_INSET : width - LABEL_INSET)\n .attr('y', (line: PlaReferenceLine) => line.axis === 'x'\n ? atStart(line) ? height - LABEL_INSET : LABEL_INSET\n : at(line) - LABEL_INSET)\n .attr('text-anchor', (line: PlaReferenceLine) => line.axis === 'y' && !atStart(line) ? 'end' : 'start')\n .attr('dominant-baseline', (line: PlaReferenceLine) => line.axis === 'x' && !atStart(line) ? 'hanging' : 'auto');\n}\n\n/**\n * Draws `labels` into a `.corner-labels` group, each a `.corner-label` inset from its corner of\n * the plot area. Pinned to the frame, so zoom leaves them alone. Hidden from screen readers, as\n * the grid is.\n */\nexport function drawCornerLabels(\n svg: Selection<SVGGElement, unknown, BaseType, unknown>,\n labels: PcacCornerLabels | undefined,\n width: number,\n height: number,\n): void {\n if (!labels) {\n return;\n }\n const corners = [\n { text: labels.topLeft, x: CORNER_INSET, y: CORNER_INSET, anchor: 'start', baseline: 'hanging', name: 'top-left' },\n { text: labels.topRight, x: width - CORNER_INSET, y: CORNER_INSET, anchor: 'end', baseline: 'hanging', name: 'top-right' },\n { text: labels.bottomLeft, x: CORNER_INSET, y: height - CORNER_INSET, anchor: 'start', baseline: 'auto', name: 'bottom-left' },\n { text: labels.bottomRight, x: width - CORNER_INSET, y: height - CORNER_INSET, anchor: 'end', baseline: 'auto', name: 'bottom-right' },\n ].filter((corner) => !!corner.text);\n if (corners.length === 0) {\n return;\n }\n svg.append('g')\n .attr('class', 'corner-labels')\n .attr('aria-hidden', 'true')\n .style('--pcac-corner-label-color', () => labels.color ?? null)\n .selectAll('.corner-label')\n .data(corners)\n .enter().append('text')\n .attr('class', (corner) => `corner-label corner-label-${corner.name}`)\n .attr('x', (corner) => corner.x)\n .attr('y', (corner) => corner.y)\n .attr('text-anchor', (corner) => corner.anchor)\n .attr('dominant-baseline', (corner) => corner.baseline)\n .text((corner) => corner.text!);\n}\n\n/**\n * With `labelsOnTop`, moves the corner labels and reference-line labels above everything drawn\n * so far - the series included - and marks them for the theme's halo. Called after each draw and\n * each zoom, which re-raises the series over the axes it redraws.\n */\nexport function raiseLabels(svg: Selection<SVGGElement, unknown, BaseType, unknown>): void {\n svg.selectAll('.corner-labels, .reference-line-labels')\n .classed('pcac-labels-on-top', true)\n .raise();\n}\n","import { PcacData, PcacFormatEnum } from '../../../core/chart.model';\nimport { hasKey } from '../x-format';\nimport { hasValue } from './has-value';\n\n/** A point along with where it sits in the chart's `data`, the way a tooltip context reports it. */\nexport interface PlaCoincidentPoint {\n data: PcacData;\n series: PcacData;\n /** Position of `data` within `series.data`. */\n index: number;\n /** Position of `series` within the chart's top-level `data`. */\n seriesIndex: number;\n}\n\n/** Two or more points that would be drawn at exactly the same coordinate, in data order. */\nexport interface PlaCoincidentGroup {\n members: PlaCoincidentPoint[];\n}\n\n/** How far a fanned-out point is drawn from its true coordinate, in px. */\nexport interface PlaPointOffset {\n dx: number;\n dy: number;\n}\n\n/**\n * Finds every set of points that share a coordinate across all of the chart's visible series.\n * Coincidence is decided from the data rather than from scaled pixels, so this can run before\n * the scales exist (the space the fan-out needs has to be reserved before the plot area, and so\n * the scales, is sized): two points coincide when they have the same y `value` and the same x\n * position under `xFormat` - the same numeric `key` (`Decimal`), the same instant (`DateTime`), or\n * the same index within their series (every other format, which positions by index). Mirrors\n * `getXFormat()`, which is what actually places them. Hidden series and points without a value\n * are left out, as they aren't drawn.\n */\nexport function findCoincidentGroups(series: PcacData[], xFormat: PcacFormatEnum): PlaCoincidentGroup[] {\n const byPosition = new Map<string, PlaCoincidentPoint[]>();\n series.forEach((s, seriesIndex) => {\n if (s.hide) {\n return;\n }\n s.data.forEach((data, index) => {\n // Same test as the line/dots use, so a point that isn't drawn (`''`, NaN) never joins a ring.\n if (!hasValue(data)) {\n return;\n }\n // By numeric value, so `5` and `'5'` - drawn at the same spot - are recognized as sharing it.\n const key = `${xPositionKey(xFormat, data, index)}|${Number(data.value)}`;\n let members = byPosition.get(key);\n if (!members) {\n members = [];\n byPosition.set(key, members);\n }\n members.push({ data, series: s, index, seriesIndex });\n });\n });\n return Array.from(byPosition.values())\n .filter((members) => members.length > 1)\n .map((members) => ({ members }));\n}\n\nfunction xPositionKey(xFormat: PcacFormatEnum, data: PcacData, index: number): string | number {\n switch (xFormat) {\n case PcacFormatEnum.DateTime:\n return hasKey(data) ? new Date(data.key as string | number).getTime() : 'none';\n case PcacFormatEnum.Decimal:\n return hasKey(data) ? Number(data.key) : 'none';\n default:\n return index;\n }\n}\n\n/**\n * The smallest ring radius at which `count` marks of `size` px sit `gap` px apart from their\n * neighbors: the chord between adjacent ring positions is `2r sin(π/n)`, so solve it for\n * `size + gap`. A pair (n = 2) lands `size + gap` apart along a diameter, as expected.\n */\nexport function fanOutRadius(count: number, size: number, gap: number): number {\n return (size + gap) / (2 * Math.sin(Math.PI / count));\n}\n\n/**\n * Places each group's members evenly around a ring centered on their shared coordinate, the\n * first member at 12 o'clock and the rest clockwise. `radius` is called per group so it can\n * depend on the group's size (see `fanOutRadius`). Keyed by the point objects themselves,\n * which are the very elements the builder binds to the DOM, so lookups are exact.\n */\nexport function fanOutOffsets(groups: PlaCoincidentGroup[], radius: (group: PlaCoincidentGroup) => number): Map<PcacData, PlaPointOffset> {\n const offsets = new Map<PcacData, PlaPointOffset>();\n for (const group of groups) {\n const r = radius(group);\n const n = group.members.length;\n group.members.forEach((member, i) => {\n const angle = -Math.PI / 2 + (i * 2 * Math.PI) / n;\n offsets.set(member.data, { dx: round(r * Math.cos(angle)), dy: round(r * Math.sin(angle)) });\n });\n }\n return offsets;\n}\n\n/** Two decimal places is plenty for an SVG coordinate and keeps `cos(π/2)` from reading as `6e-17`. */\nfunction round(value: number): number {\n return Math.round(value * 100) / 100;\n}\n\n/** A pixel position within the plot area, the way the scales report one. */\nexport interface PlaPoint {\n x: number;\n y: number;\n}\n\n/**\n * How far to move a whole fanned-out ring so that none of its members' centers leave the plot\n * area - so a member at the edge of the domain hangs over the axis by at most half its mark,\n * exactly as a lone point at that coordinate would, rather than by half its mark plus the ring's\n * radius. The ring moves as one (its members keep their spacing) and the anchor stays put, so the\n * spokes simply get longer on the side that was pushed back. Per axis: if the ring pokes out past\n * 0 it comes back by that much, else if it pokes out past the far edge it comes back by that; a\n * ring too big to fit is kept in at the axis end, where the origin is.\n *\n * `anchor` is clamped to the plot area first, so once zoom carries a group's coordinate out of the\n * domain its members follow it out at the same pace instead of staying pinned to the edge (or\n * snapping the ring's radius the moment the anchor crosses): at the edge the correction is exactly\n * the outermost member's offset, and stays so beyond it.\n */\nexport function fanOutShift(anchor: PlaPoint, offsets: PlaPointOffset[], plot: { width: number; height: number }): PlaPointOffset {\n const dxs = offsets.map((o) => o.dx);\n const dys = offsets.map((o) => o.dy);\n return {\n dx: axisShift(clamp(anchor.x, 0, plot.width), Math.min(...dxs), Math.max(...dxs), plot.width),\n dy: axisShift(clamp(anchor.y, 0, plot.height), Math.min(...dys), Math.max(...dys), plot.height),\n };\n}\n\nfunction axisShift(anchor: number, min: number, max: number, size: number): number {\n if (anchor + min < 0) {\n return round(-(anchor + min));\n }\n if (anchor + max > size) {\n return round(size - (anchor + max));\n }\n return 0;\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n","import { ElementRef, Injectable, inject } from '@angular/core';\nimport { select, Selection } from 'd3-selection';\nimport { Line, Area } from 'd3-shape';\nimport { range } from 'd3-array';\nimport { ZoomBehavior, ZoomTransform, zoomIdentity } from 'd3-zoom';\n// Side effect only: adds .transition() to d3-selection's Selection, which the entry animations use.\nimport 'd3-transition';\nimport { Subject } from 'rxjs';\n\n/**\n * Lib\n */\nimport { PlaChartEffectsBuilder } from './effects.builders';\nimport { PcacLineAreaChartConfig, PcacLineAreaPlotChartConfigType, PcacPointGaugeConfig, PcacPointImageConfig, PcacPointRangeConfig } from '../../plot-line-area-chart.model';\nimport { PcacPlotChartConfig, PcacPointFanOutConfig } from '../../plot/plot.model';\nimport { PcacChart } from '../../../core/chart';\nimport { makeMarksAccessible, refreshTabStop } from '../../../core/marks';\nimport { PcacTooltipBuilder } from '../../../core/tooltip.builder';\nimport { PcacData } from '../../../core/chart.model';\nimport { PcacTooltipCoincident } from '../../../core/tooltip.directive';\nimport { PlaChartScalesBuilder, PlaChartScales, longestSeriesLength } from './scales.builder';\nimport { getXFormat } from '../x-format';\nimport { buildLineGenerator } from './line-generator.builder';\nimport { buildAreaGenerator } from './area-generator.builder';\nimport { buildZoomBehavior } from './zoom-behavior.builder';\nimport { hasValue } from './has-value';\nimport { drawRange, rangeExtent } from './point-range.builder';\nimport { GAUGE_DOT_RADIUS, drawPointGauges, gaugeExtent, hasGauge } from './point-gauge.builder';\nimport { drawCornerLabels, drawReferenceLines, positionReferenceLines, raiseLabels } from './reference-lines.builder';\nimport { PlaCoincidentGroup, PlaCoincidentPoint, PlaPoint, PlaPointOffset, fanOutOffsets, fanOutRadius, fanOutShift, findCoincidentGroups } from './fan-out.builder';\n\n/** Half the theme's 2px line stroke: how far the lines/areas/fan-outs clip-path reaches past the plot. */\nconst PLOT_CLIP_ALLOWANCE = 1;\n\n/**\n * Names for the dot's transitions. d3 lets only one transition *per name* run on an element: a\n * new one cancels the old. The enter rise (`cy`) keeps the default name; the hover grow/shrink\n * and the entry's size-in (`r`) each get their own, so hovering a dot while the chart is still\n * animating in no longer cancels its rise and strands it short of its value. Hover interrupts\n * the size-in explicitly instead, since both tween `r`.\n */\nconst DOT_GROW_TRANSITION = 'pcac-dot-grow';\nconst DOT_HOVER_TRANSITION = 'pcac-dot-hover';\n/** See `revealAfterEntry`. */\nconst REVEAL_TRANSITION = 'pcac-reveal';\n\n/** Each chart type's accessible name when its config gives no `ariaLabel`. */\nconst CHART_TYPE_LABELS: Record<PcacLineAreaPlotChartConfigType, string> = {\n [PcacLineAreaPlotChartConfigType.Line]: 'Line chart',\n [PcacLineAreaPlotChartConfigType.Area]: 'Area chart',\n [PcacLineAreaPlotChartConfigType.Plot]: 'Plot chart',\n};\n\n/**\n * Provided per-component (see PcacLineAreaChartComponent's `providers`), not root-scoped: this\n * builder extends PcacChart, which holds mutable per-chart-instance state (margin, width,\n * height, colors, svg). A root singleton would be shared and clobbered by every\n * <pcac-line-area-chart> rendered at once.\n */\n@Injectable()\nexport class PlaChartBuilder extends PcacChart {\n private effectsBuilder = inject(PlaChartEffectsBuilder);\n /**\n * The scales as drawn: `baseScales` with the zoom this build started at (see `keptZoom`) applied.\n * A zoom gesture rescales from `baseScales`, never from these.\n */\n private scales!: PlaChartScales;\n /** The unzoomed scales, spanning the whole domain. */\n private baseScales!: PlaChartScales;\n /**\n * The zoom a rebuild picks up again, so a new config (a series toggled in the legend, live\n * data) or a resize doesn't throw away where the user had zoomed to. The pan is kept as a share\n * of the plot's size, which is what carries it across a resize: the same part of the domain\n * stays in view. `axes` is which axes were zoomable; a build where that differs starts unzoomed.\n */\n private keptZoom: { k: number; x: number; y: number; axes: string } | null = null;\n /** The zoom this build starts at, if any; applied to the zoom behavior once it's attached. */\n private startZoom: ZoomTransform | null = null;\n /** Set while `startZoom` is handed to the zoom behavior, whose resulting zoom event is skipped. */\n private restoringZoom = false;\n private lineGenerator!: Line<PcacData>;\n private areaGenerator!: Area<PcacData>;\n /** This build's zoom behavior; `null` while zoom is off. */\n private zoomBehavior: ZoomBehavior<Element, unknown> | null = null;\n private dotClickedSource = new Subject<PcacData>();\n private config!: PcacLineAreaChartConfig;\n /**\n * Numbers this chart's clip-path ids (and, through `plotClipPathId`, its range gradients'),\n * which have to be unique in the whole page: `url(#id)` resolves to the first match in the\n * document, so a duplicate would clip one chart with another's rect. A per-instance counter\n * rather than the timestamp-plus-random stamp this used to be, which two charts rebuilding in\n * the same millisecond (every chart on a page reacts to a window resize at once) could share.\n */\n private static nextInstanceId = 0;\n private readonly instanceId = ++PlaChartBuilder.nextInstanceId;\n private clipPathId!: string;\n /**\n * A second clip-path for everything that isn't a point - lines, areas, fan-out anchors and\n * spokes: the plot area plus `PLOT_CLIP_ALLOWANCE`. These have no business past the axes; the\n * points' buffer below used to apply to them too, so a line chart with big point images had\n * its lines run on half an image past the axes once zoomed.\n */\n private plotClipPathId!: string;\n /**\n * How far the points' clip-path rect extends past the drawable [0, width] x [0, height] area on\n * every side, so a point sitting exactly on the domain's edge isn't cut in half. 10px\n * comfortably clears a dot (r = 4, or 6 on hover); a point image or a gauge ring can be much\n * bigger than that, so `reservePointSpace()` widens this to half the largest mark on the chart\n * (and grows the margins to match, since the clip-path only matters up to the edge of the SVG).\n * The buffer is only there for points whose center is inside the plot; one whose center zoom\n * has carried past an edge is hidden outright (see `pointVisible`), rather than left showing up\n * to a whole half-mark beyond the axis.\n */\n private clipBuffer = 10;\n private pointImage!: PcacPointImageConfig;\n /**\n * Points that share a coordinate, found by `resolvePointLayout()`. `coincidentOf` looks a\n * point's group up for its tooltip and for its ring's shift (see `fanOutShift`); `fanOutOffsets`\n * only matters when `fanOut` is on (plot chart with `pointFanOut`) and is where each member sits\n * on its ring relative to the shared coordinate, before that shift.\n */\n private coincidentGroups: PlaCoincidentGroup[] = [];\n private coincidentOf = new Map<PcacData, PlaCoincidentGroup>();\n private fanOut: PcacPointFanOutConfig | null = null;\n private fanOutOffsets = new Map<PcacData, PlaPointOffset>();\n /** The `.point` group under the cursor, between its mouseover and mouseout (see `leavePoint`). */\n private hoveredPoint: SVGGElement | null = null;\n /** `config.pointRange` with its defaults applied, or `null` while ranges are off. */\n private pointRange: PcacPointRangeConfig | null = null;\n /** `pointGauge` with its defaults, or `null` while it's off. */\n private pointGauge: PcacPointGaugeConfig | null = null;\n /** Each drawn range's `.point-range` group, by its point, so hover can find the one to focus. */\n private rangeGroupOf = new Map<PcacData, SVGGElement>();\n /**\n * Whether this build has the hover crosshair: `enableEffects`, on a line or area chart. A plot\n * chart has no line for it to follow, so it gets none - its circles had nowhere to go and sat\n * stacked in the plot's top-left corner.\n */\n private effectsEnabled = false;\n dotClicked$ = this.dotClickedSource.asObservable();\n\n\n buildChart(chartElm: ElementRef, config: PcacLineAreaChartConfig, type: PcacLineAreaPlotChartConfigType): void {\n if (!config?.data?.length) {\n this.leavePoint();\n this.clearChart(chartElm);\n return;\n }\n\n // A rebuild throws the hovered point away with everything else, and a removed element gets\n // no mouseout, so its tooltip is closed here (see `leavePoint`).\n this.leavePoint();\n this.config = JSON.parse(JSON.stringify(config));\n this.startData = range(longestSeriesLength(this.config.data)).map((): PcacData => ({\n key: '',\n value: 0,\n hide: false,\n data: []\n }));\n\n // Before the axes and the layout: the marks' size feeds `autoTickSize`, and a ring widens what\n // fan-out and the edge space have to make room for.\n this.pointImage = { ...new PcacPointImageConfig(), ...this.config.pointImage };\n this.pointGauge = this.config.pointGauge ? { ...new PcacPointGaugeConfig(), ...this.config.pointGauge } : null;\n // A hidden axis keeps 8px rather than 0 so a dot on the edge of the plot isn't clipped\n this.initializeAxisState(this.config, 'y', 8, this.largestMarkHalf());\n this.chartTypeLabel = CHART_TYPE_LABELS[type];\n this.resolvePointLayout(type);\n this.reservePointSpace();\n this.pointRange = this.config.pointRange ? { ...new PcacPointRangeConfig(), ...this.config.pointRange } : null;\n\n if (!this.initializeChartState(chartElm, this.config)) {\n return;\n }\n this.applyColorOverride(this.config.colorOverride);\n\n this.baseScales = new PlaChartScalesBuilder().build(this.xAxis, this.yAxis, this.config.data, this.width, this.height);\n this.startZoom = this.resumeZoom();\n this.scales = this.startZoom ? this.zoomedScales(this.startZoom) : this.baseScales;\n this.lineGenerator = buildLineGenerator(this.xAxis.format, this.scales);\n this.areaGenerator = buildAreaGenerator(this.xAxis.format, this.scales, this.height);\n\n if (this.zoomEnabled) {\n const behavior = buildZoomBehavior(this.width, this.height, (event) => {\n // Zoom moves the points, not the mouse: the hovered one slides out from under a still\n // cursor (or is hidden outright, see `pointDisplay`), and either way the browser never\n // sends it a mouseout - its tooltip would stay up, and its dot stay grown, until the\n // cursor happened to cross it again. So the hover is ended here, on every zoom event.\n // The build's own starting zoom, handed to the behavior: already drawn that way. And a\n // gesture begun on an earlier build - a drag still going when live data or a resize redrew\n // the chart, which d3-zoom carries on through listeners on the window - belongs to a\n // drawing that's gone: left to run, it moved this one and overwrote the kept zoom with its\n // own, and the next gesture snapped back.\n if (this.restoringZoom || behavior !== this.zoomBehavior) {\n return;\n }\n this.leavePoint();\n this.keepZoom(event.transform);\n\n const zoomedScales = this.zoomedScales(event.transform);\n const { x: newX, y: newY } = zoomedScales;\n\n // Update the zoomed axes, each with its grid: the grid hangs off the axis's ticks, so it\n // is redrawn against the rescaled scale and dropped back underneath everything (append\n // puts it on top).\n if (this.config.enableZoomX) {\n this.axisBuilder.drawXAxis(this.axisBuilderConfig(newX, newY));\n this.svg.selectAll('.pcac-grid-vertical').remove();\n this.drawGrids(newX, newY, 'x');\n }\n if (this.config.enableZoomY) {\n this.axisBuilder.drawYAxis(this.axisBuilderConfig(newX, newY));\n this.svg.selectAll('.pcac-grid-horizontal').remove();\n this.drawGrids(newX, newY, 'y');\n }\n this.svg.selectAll('.pcac-grid').lower();\n\n // Update lines/areas. Fresh generators against the rescaled scales, so they go through\n // the same getXFormat() as the dots below - positioning by bare index here (which this\n // used to do, and which also overwrote the original generators' x accessor for good) is\n // only right for the default DatasetLength format; a DateTime/Decimal chart's lines\n // drifted away from its dots as soon as it was zoomed.\n // Interrupted first: a zoom during the enter transition would otherwise have the rest of\n // that transition keep drawing the unzoomed shape over this one.\n const zoomedLine = buildLineGenerator(this.xAxis.format, zoomedScales);\n const zoomedArea = buildAreaGenerator(this.xAxis.format, zoomedScales, this.height);\n this.svg.selectAll<SVGPathElement, PcacData[]>('.line').interrupt().attr('d', (d: PcacData[]) => zoomedLine(d));\n this.svg.selectAll<SVGPathElement, PcacData[]>('.area').interrupt().attr('d', (d: PcacData[]) => zoomedArea(d));\n\n // Update dots / point images. Nested selectAll (not a flat svg.selectAll('.point')) so\n // that `i` is the point's index *within its own series* - the x format default\n // (DatasetLength) positions by index, and a flat selection would number every series'\n // points consecutively, shoving the second series' points off to the right on zoom.\n this.svg.selectAll('.dots').selectAll<SVGGElement, PcacData>('.point')\n .attr('transform', (d: PcacData, i: number) => this.pointTransform(d, i, zoomedScales))\n .attr('display', (d: PcacData, i: number) => this.pointDisplay(d, i, zoomedScales));\n // The chart's Tab stop may just have been zoomed out of the plot, and hidden.\n refreshTabStop(this.svg.node()?.ownerSVGElement ?? null);\n // A fan-out's anchor is positioned like the points it belongs to, so it moves the same way;\n // its spokes are re-aimed because the ring's shift back into the plot (`fanOutShift`)\n // depends on where the anchor now is.\n this.svg.selectAll<SVGGElement, PlaCoincidentGroup>('.fan-out')\n .attr('transform', (g: PlaCoincidentGroup) => this.fanOutTransform(g, zoomedScales))\n .selectAll<SVGLineElement, PlaCoincidentPoint>('.fan-out-spoke')\n .attr('x2', (member: PlaCoincidentPoint) => this.spokeEnd(member, zoomedScales).dx)\n .attr('y2', (member: PlaCoincidentPoint) => this.spokeEnd(member, zoomedScales).dy);\n\n // Reference lines sit at data values, so they move with it; corner labels are pinned to the\n // frame and stay put.\n positionReferenceLines(this.svg, zoomedScales, this.xAxis.format, this.width, this.height);\n\n // The hover crosshair positions and labels against the scales, so it takes the zoomed ones.\n if (this.effectsEnabled) {\n this.effectsBuilder.updateScales(newX, newY);\n }\n\n // Ranges are drawn in plot coordinates rather than hung off a translate, so every one is\n // redrawn against the zoomed scales.\n this.updatePointRanges(zoomedScales);\n\n // Redrawing an axis appends it at the end of the group, above the dots; put them back\n // on top so a point on the baseline isn't covered (see drawChart's draw order).\n this.svg.selectAll('.point-ranges').raise();\n this.svg.selectAll('.fan-outs').raise();\n this.svg.selectAll('.dots').raise();\n if (this.config.labelsOnTop) {\n raiseLabels(this.svg);\n }\n });\n this.zoomBehavior = behavior;\n } else {\n this.zoomBehavior = null;\n }\n\n this.drawChart(chartElm, this.config, type);\n }\n\n private drawChart(chartElm: ElementRef, config: PcacLineAreaChartConfig, type: PcacLineAreaPlotChartConfigType): void {\n this.buildContainer(chartElm);\n this.attachZoomBehavior();\n this.createReusableClipPath(); \n\n this.axisBuilder.drawAxis(this.axisBuilderConfig(this.scales.x, this.scales.y));\n\n this.drawGrids(this.scales.x, this.scales.y);\n\n // Over the grid, under the series: guides, not data.\n drawCornerLabels(this.svg, config.cornerLabels, this.width, this.height);\n drawReferenceLines(this.svg, config.referenceLines, this.scales, this.xAxis.format, this.width, this.height, this.plotClipPathId);\n\n this.drawLineArea(config, type);\n\n this.effectsEnabled = !!config.enableEffects && type !== PcacLineAreaPlotChartConfigType.Plot;\n if (this.effectsEnabled) {\n this.effectsBuilder.buildEffects({\n svg: this.svg,\n height: this.height,\n width: this.width,\n data: config.data,\n colors: this.colors,\n x: this.scales.x,\n y: this.scales.y,\n xFormat: this.xAxis.format,\n yFormat: this.yAxis.format,\n yTicks: this.yAxis.ticks,\n });\n }\n\n // Axes above the lines/areas (so an axis line isn't covered by a series sitting at x = 0),\n // but the dots above the axes: a point on the baseline or the y axis stays whole. Fan-out\n // spokes go between the two so they run underneath the points they lead to, and point\n // ranges under those.\n this.axisBuilder.raiseAxes(this.svg);\n this.drawPointRanges();\n this.drawFanOuts();\n this.drawDots(config);\n // Labels asked to stay readable go over all of it (see `labelsOnTop`).\n if (config.labelsOnTop) {\n raiseLabels(this.svg);\n }\n this.restoreTabStop(chartElm);\n }\n\n /**\n * Finds the points that share a coordinate and, on a plot chart with\n * `pointFanOut`, works out where to draw each of them instead. Coincidence is found from the\n * data (see `findCoincidentGroups`) so this can run before the scales exist. Line and area\n * charts still get the groups, for the tooltip's `coincident` list, but never an offset.\n */\n private resolvePointLayout(type: PcacLineAreaPlotChartConfigType): void {\n this.coincidentGroups = findCoincidentGroups(this.config.data, this.xAxis.format);\n this.coincidentOf = new Map(\n this.coincidentGroups.flatMap((group) => group.members.map((member) => [member.data, group] as const))\n );\n\n const fanOut = type === PcacLineAreaPlotChartConfigType.Plot\n ? (this.config as PcacPlotChartConfig).pointFanOut\n : undefined;\n if (!fanOut) {\n this.fanOut = null;\n this.fanOutOffsets = new Map();\n return;\n }\n this.fanOut = { ...new PcacPointFanOutConfig(), ...fanOut };\n // A group's members are kept apart by the size of what's drawn for them: the image box when\n // any member has an image, else a hovered dot (r = 6) - plus a gauge ring on both sides when\n // any member has one.\n const { maxWidth, maxHeight } = this.pointImage;\n const ring = (group: PlaCoincidentGroup) =>\n this.pointGauge && group.members.some((member) => hasGauge(member.data)) ? 2 * gaugeExtent(this.pointGauge) : 0;\n const markSize = (group: PlaCoincidentGroup) =>\n (group.members.some((member) => !!member.data.image) ? Math.max(maxWidth, maxHeight) : 2 * GAUGE_DOT_RADIUS) + ring(group);\n const radius = (group: PlaCoincidentGroup) =>\n this.fanOut!.radius ?? fanOutRadius(group.members.length, markSize(group), this.fanOut!.gap);\n this.fanOutOffsets = fanOutOffsets(this.coincidentGroups, radius);\n }\n\n /**\n * Half the largest mark on the chart toward each axis, for `autoTickSize` and the edge space\n * (`reservePointSpace`): `x` its vertical half (what reaches down to the x axis), `y` its\n * horizontal half. Measured as drawn - a hovered dot (`GAUGE_DOT_RADIUS`), an image's box, and\n * a gauge ring around either (circular, so the same both ways). Points in a hidden series\n * count, so toggling one in a legend doesn't move the axes; a gap (no value) draws nothing and\n * doesn't. Needs `pointImage` and `pointGauge` resolved.\n */\n private largestMarkHalf(): { x: number; y: number } {\n const { maxWidth, maxHeight } = this.pointImage;\n const half = { x: 0, y: 0 };\n for (const point of this.config.data.flatMap((series) => series.data ?? [])) {\n if (!hasValue(point)) {\n continue;\n }\n let x = point.image ? maxHeight / 2 : GAUGE_DOT_RADIUS;\n let y = point.image ? maxWidth / 2 : GAUGE_DOT_RADIUS;\n if (this.pointGauge && hasGauge(point)) {\n // The ring surrounds the mark's larger side - see `markRadius` in `drawDots`.\n const ring = (point.image ? Math.max(maxWidth, maxHeight) / 2 : GAUGE_DOT_RADIUS) + gaugeExtent(this.pointGauge);\n x = Math.max(x, ring);\n y = Math.max(y, ring);\n }\n half.x = Math.max(half.x, x);\n half.y = Math.max(half.y, y);\n }\n return half;\n }\n\n /**\n * Makes room for the points at the edge of the domain: the clip-path buffer grows to half the\n * largest mark (`largestMarkHalf()` - an image box, a ring, or a hovered dot) so the `.dots`\n * group lets it through, and the margins grow to at least that same amount so the `<svg>`\n * doesn't cut off what the clip-path let through (a mark is centered on its point, so at the top\n * of the y domain half of it sits above the plot area - in `margin.top`, which is only 8px by\n * default). A ring is measured around the image box's larger side, as `drawDots` draws it, on\n * both axes; measured against the box's own side, a ringed wide image at the top of the domain\n * had the top of its ring cut off by the SVG. Half a mark is all a fan-out needs too: a\n * fanned-out ring is shifted back inside the plot area (`fanOutShift`), so no member's center\n * ever sits past the edge either. A plain dot fits the default 10px buffer and every margin\n * already. Must run after `resolvePointLayout()` and between `initializeAxisState()` and\n * `initializeChartState()`, see `reserveEdgeSpace`.\n */\n private reservePointSpace(): void {\n const half = this.largestMarkHalf();\n const halfWidth = Math.ceil(half.y);\n const halfHeight = Math.ceil(half.x);\n this.clipBuffer = Math.max(10, halfWidth, halfHeight);\n this.reserveEdgeSpace({ top: halfHeight, bottom: halfHeight, left: halfWidth, right: halfWidth });\n }\n\n private createReusableClipPath(): void {\n // The previous build's <defs> went with the rest of its drawing (see initializeChartState),\n // so the same ids are free again.\n this.clipPathId = `pcac-clip-${this.instanceId}`;\n this.plotClipPathId = `pcac-clip-plot-${this.instanceId}`;\n const defs = this.svg.append('defs');\n defs.append('clipPath')\n .attr('id', this.clipPathId)\n .append('rect')\n // Extend the clip-path past the drawable area on every side so a dot (or point image) at\n // the x-domain's min/max, or the top/bottom of the y range, isn't cut in half. See clipBuffer.\n .attr('x', -this.clipBuffer)\n .attr('y', -this.clipBuffer)\n .attr('width', this.width + this.clipBuffer * 2)\n .attr('height', this.height + this.clipBuffer * 2);\n // Lines, areas and the fan-out anchors and spokes get the plot area itself, give or take a\n // stroke: a line along the domain's max keeps its full width rather than being halved at\n // the edge, but nothing runs on into the points' buffer - a spoke to a member that zoom has\n // carried out of the plot (and hidden, see `pointVisible`) stops at the axis.\n defs.append('clipPath')\n .attr('id', this.plotClipPathId)\n .append('rect')\n .attr('x', -PLOT_CLIP_ALLOWANCE)\n .attr('y', -PLOT_CLIP_ALLOWANCE)\n .attr('width', this.width + PLOT_CLIP_ALLOWANCE * 2)\n .attr('height', this.height + PLOT_CLIP_ALLOWANCE * 2);\n }\n\n private get zoomEnabled(): boolean {\n return !!(this.config.enableZoomX || this.config.enableZoomY);\n }\n\n /** Which axes zoom, as `keptZoom.axes` records them. */\n private get zoomAxes(): string {\n return `${!!this.config.enableZoomX}${!!this.config.enableZoomY}`;\n }\n\n /**\n * `baseScales` under a zoom transform. A d3 zoom transform is always two-dimensional; only the\n * enabled axes follow it and the other keeps its original scale, so that component of the\n * gesture is simply ignored.\n */\n private zoomedScales(transform: ZoomTransform): PlaChartScales {\n return {\n x: this.config.enableZoomX ? transform.rescaleX(this.baseScales.x) : this.baseScales.x,\n y: this.config.enableZoomY ? transform.rescaleY(this.baseScales.y) : this.baseScales.y,\n };\n }\n\n /** Records a zoom for the next build to resume (see `keptZoom`). */\n private keepZoom(transform: ZoomTransform): void {\n this.keptZoom = {\n k: transform.k,\n x: transform.x / this.width,\n y: transform.y / this.height,\n axes: this.zoomAxes,\n };\n }\n\n /**\n * The zoom this build starts at: the kept one, fitted to this build's plot size, or `null` for\n * none - zoom off, the zoomable axes changed, or never zoomed. Forgets the kept zoom when it\n * can't be resumed, so turning zoom off and on again starts unzoomed.\n */\n private resumeZoom(): ZoomTransform | null {\n const kept = this.keptZoom;\n if (!kept || !this.zoomEnabled || kept.axes !== this.zoomAxes) {\n this.keptZoom = null;\n return null;\n }\n return zoomIdentity.translate(kept.x * this.width, kept.y * this.height).scale(kept.k);\n }\n\n private attachZoomBehavior(): void {\n const zoom = this.zoomBehavior;\n if (!this.zoomEnabled || !zoom) return;\n\n // A transparent rect so the empty plot area is a hit target too: a `<g>` has no area of its\n // own, so wheel/drag only reaches it through something painted. The rect is only ever that -\n // the behavior is attached once, to the group, and the rect's events bubble up to it. It used\n // to be `.call()`ed on both, and d3-zoom keeps its transform per element (`__zoom`): a wheel\n // over a point never passes through the rect (a sibling of the `.dots`, not an ancestor), so\n // only the group's transform advanced, and once the point had slid out from under the cursor\n // the next tick hit the rect - whose handler redrew from its own stale, near-identity\n // transform before the group's redrew from the real one, every tick, flickering the chart\n // between the two.\n //\n // d3's `ZoomBehavior<Element, unknown>` vs. our concretely-typed `Selection<SVGGElement, ...>`\n // is a known D3+TS typings friction point: `.call()` structurally compares nested generic Selection\n // methods (`.merge()`, `.select()`, ...) and those never line up across two different concrete element\n // types, even though a zoom behavior works on any element at runtime. Narrow, local `any` escape hatch.\n this.svg.insert('rect', ':first-child')\n .attr('width', this.width)\n .attr('height', this.height)\n .attr('fill', 'none')\n .attr('pointer-events', 'all');\n\n this.svg.call(zoom as any);\n\n // A resumed zoom is already drawn (`scales`); the behavior is told it too, so the next gesture\n // carries on from there rather than from the whole domain.\n if (this.startZoom) {\n this.restoringZoom = true;\n this.svg.call(zoom.transform as any, this.startZoom);\n this.restoringZoom = false;\n }\n }\n\n private drawLineArea(config: PcacLineAreaChartConfig, type: PcacLineAreaPlotChartConfigType): void {\n for (let i = 0; i < config.data.length; i++) {\n if (type === PcacLineAreaPlotChartConfigType.Area) {\n this.drawArea(config.data[i].data, i, config.data[i].hide);\n } else if (type === PcacLineAreaPlotChartConfigType.Line) {\n this.drawLine(config.data[i].data, i, config.data[i].hide);\n }\n }\n }\n\n private drawLine(lineData: PcacData[], index: number, hide = false): void {\n this.svg.append('g')\n .attr('class', 'lines')\n .attr('clip-path', `url(#${this.plotClipPathId})`)\n .append('path')\n .datum(lineData)\n .attr('class', 'line')\n // Set up front rather than on the transition, so a zoom interrupting it (see the zoom\n // handler) doesn't leave the line uncolored, or a hidden one showing.\n .attr('stroke', this.colors[index])\n .attr('fill', 'none')\n .attr('style', hide ? 'display: none' : null)\n .attr('d', this.lineGenerator(this.startData))\n .transition()\n .duration(this.transitionService.getTransitionDuration())\n .attr('d', this.lineGenerator);\n }\n\n private drawArea(lineData: PcacData[], index: number, hide = false) {\n this.svg.append('g')\n .attr('class', 'areas')\n .attr('clip-path', `url(#${this.plotClipPathId})`)\n .append('path')\n .datum(lineData)\n .attr('class', 'area')\n // Same `hide` handling as drawLine()/drawDots(); the area used to ignore it and paint\n // a hidden series' fill anyway.\n .style('display', () => hide ? 'none' : null)\n .style('opacity', 0.5)\n .style('fill', () => {\n return this.colors[index];\n })\n .attr('d', this.areaGenerator(this.startData))\n .transition()\n .duration(this.transitionService.getTransitionDuration())\n .attr('d', this.areaGenerator);\n }\n\n /**\n * Draws one `<g class=\"point-ranges\">` holding a group per series and, inside it, a\n * `<g class=\"point-range\">` per point that has a `range` - only while `pointRange` is on. Clipped\n * to the plot area and deaf to the pointer, so it never gets in the way of hover or zoom. When\n * each range shows is entirely the theme's business, driven by classes: `pcac-range-<show>` on\n * the outer group sets the resting opacity, and hover (`focusPointRange`) marks the hovered\n * point's range `is-focused` and the outer group `has-focus`. The colors are custom properties\n * - the series' own on its group, `color` (when set) on the outer one, which wins - see\n * plot-line-area-chart.component.scss.\n */\n private drawPointRanges(): void {\n this.rangeGroupOf = new Map();\n if (!this.pointRange) {\n return;\n }\n const { show, faintOpacity, color } = this.pointRange;\n const layer = this.svg.append('g')\n .attr('class', `point-ranges pcac-range-${show}`)\n .attr('clip-path', `url(#${this.plotClipPathId})`)\n .attr('pointer-events', 'none')\n .style('--pcac-point-range-color', () => color ?? null)\n .style('--pcac-point-range-faint-opacity', () => faintOpacity);\n\n this.config.data.forEach((series, seriesIndex) => {\n const seriesGroup = layer.append('g')\n .attr('class', 'point-range-series')\n .style('--pcac-point-range-series-color', () => this.colors[seriesIndex])\n .style('display', () => series.hide ? 'none' : null);\n series.data.forEach((point) => {\n // A point with no value draws no dot (see `pointDisplay`), so it draws no range either -\n // one would stand around a coordinate with nothing on it (on the baseline, for `''`).\n if (point.range && hasValue(point)) {\n this.rangeGroupOf.set(point, seriesGroup.append('g').attr('class', 'point-range').node()!);\n }\n });\n });\n this.updatePointRanges(this.scales);\n this.revealAfterEntry(layer);\n }\n\n /**\n * Draws every range against `scales`, around its point's true coordinate - a fanned-out point's\n * range stays on the anchor, not on the ring. A range with nothing placeable is left empty.\n */\n private updatePointRanges(scales: PlaChartScales): void {\n if (!this.pointRange) {\n return;\n }\n const style = this.pointRange.style;\n this.config.data.forEach((series, seriesIndex) => {\n series.data.forEach((point, index) => {\n const node = this.rangeGroupOf.get(point);\n if (!node) {\n return;\n }\n const group = select(node);\n const { x, y } = this.pointPosition(point, index, scales);\n const extent = rangeExtent(point, x, y, this.xAxis.format, scales);\n if (!extent) {\n group.selectAll('*').remove();\n return;\n }\n drawRange(group, extent, style, `${this.plotClipPathId}-range-${seriesIndex}-${index}`);\n });\n });\n }\n\n /** Brings `d`'s range forward (see `drawPointRanges`), or with `null` puts every range back to rest. */\n private focusPointRange(d: PcacData | null): void {\n if (!this.pointRange || !this.svg) {\n return;\n }\n this.svg.selectAll('.point-range.is-focused').classed('is-focused', false);\n const node = d ? this.rangeGroupOf.get(d) : undefined;\n if (node) {\n select(node).classed('is-focused', true);\n }\n this.svg.select('.point-ranges').classed('has-focus', !!node);\n }\n\n /**\n * Draws one `<g class=\"fan-outs\">` holding a `<g class=\"fan-out\">` per group of coincident\n * points: a spoke from the shared coordinate to where each member is drawn, and an anchor dot\n * on the coordinate itself. Only when the fan-out is on and asks for anchors. The group sits on\n * the true coordinate (unlike a point group, which also carries its ring's shift - see\n * `pointTransform`), so zoom moves it the same way and everything inside is relative to the\n * coordinate; each spoke ends where its member is actually drawn, ring offset plus shift. It\n * fades in over the points' own entry transition. `spokeColor` / `anchorColor` go on the outer\n * group as custom properties for the theme's `.fan-out-spoke` / `.fan-out-anchor` rules (see\n * the axis builder's `applyColors`).\n */\n private drawFanOuts(): void {\n if (!this.fanOut?.showAnchor || this.coincidentGroups.length === 0) {\n return;\n }\n const { spokeColor, anchorColor } = this.fanOut;\n const groups = this.svg.append('g')\n .attr('class', 'fan-outs')\n .attr('clip-path', `url(#${this.plotClipPathId})`)\n .style('--pcac-fan-out-spoke-color', () => spokeColor ?? null)\n .style('--pcac-fan-out-anchor-color', () => anchorColor ?? null)\n .selectAll('.fan-out')\n .data(this.coincidentGroups)\n .enter().append('g')\n .attr('class', 'fan-out')\n .attr('transform', (group: PlaCoincidentGroup) => this.fanOutTransform(group, this.scales));\n\n groups.selectAll('.fan-out-spoke')\n .data((group: PlaCoincidentGroup) => group.members)\n .enter().append('line')\n .attr('class', 'fan-out-spoke')\n .attr('x1', 0)\n .attr('y1', 0)\n .attr('x2', (member: PlaCoincidentPoint) => this.spokeEnd(member, this.scales).dx)\n .attr('y2', (member: PlaCoincidentPoint) => this.spokeEnd(member, this.scales).dy);\n\n groups.append('circle')\n .attr('class', 'fan-out-anchor')\n .attr('r', 3);\n\n this.revealAfterEntry(groups);\n }\n\n /**\n * Keeps `selection` hidden while the points rise in from the baseline, then fades it in. For\n * the guides drawn around the points (fan-out spokes and anchors, point ranges): they're drawn\n * where the points end up, so showing them during the rise has them pointing at empty space.\n * Its own transition name so that nothing else animating the same element cancels it.\n */\n private revealAfterEntry(selection: Selection<any, any, any, any>): void {\n const duration = this.transitionService.getTransitionDuration();\n selection.attr('opacity', 0)\n .transition(REVEAL_TRANSITION)\n .delay(duration)\n .duration(duration / 3)\n .attr('opacity', 1);\n }\n\n /**\n * Draws one `<g class=\"dots\">` per series holding a `<g class=\"point\">` per data point. The\n * point group carries the position (as a translate) so that zoom, on either axis, only has to\n * touch that one attribute regardless of what's inside; the child is either the regular\n * `<circle class=\"dot\">` or, when the point has a `PcacData.image`, an `<image class=\"dot-image\">`\n * in its place, and sits at the group's origin. Both animate in from the baseline the same way\n * - the start is the baseline expressed relative to the point, since the group is already on\n * the point - and the tooltip / click handlers sit on the group so they behave identically for\n * either. A fanned-out point's ring offset is applied to the child, inside the group, so it too\n * is untouched by zoom; only its ring's shift back into the plot area, which depends on where\n * the coordinate is, rides along in the group's translate (see `pointTransform`).\n */\n private drawDots(config: PcacLineAreaChartConfig): void {\n const self = this;\n const duration = this.transitionService.getTransitionDuration();\n const { maxWidth, maxHeight } = this.pointImage;\n const rise = (d: PcacData) => this.scales.y(0) - this.scales.y(d.value as number);\n\n for (let index = 0; index < config.data.length; index++) {\n const series = config.data[index];\n const points = this.svg.append('g')\n .attr('class', 'dots')\n .attr('clip-path', `url(#${this.clipPathId})`)\n .attr('style', series.hide ? 'display: none' : null)\n // After `style`, which replaces the whole attribute.\n .style('--pcac-point-gauge-color', () => this.pointGauge?.color ?? null)\n .style('--pcac-point-gauge-track-color', () => this.pointGauge?.trackColor ?? null)\n .selectAll('.point')\n .data(series.data)\n .enter().append('g')\n .attr('class', 'point')\n .attr('transform', (d: PcacData, i: number) => this.pointTransform(d, i, this.scales))\n .attr('display', (d: PcacData, i: number) => this.pointDisplay(d, i, this.scales))\n .on('mouseover', function (this: SVGGElement, _event: MouseEvent, d: PcacData) {\n self.enterPoint(this, d, series, index);\n })\n .on('mouseout', () => this.leavePoint())\n .on('click', (_event: MouseEvent, d: PcacData) => {\n this.dotClickedSource.next(d);\n });\n makeMarksAccessible(points, {\n label: (d) => this.markLabel(d, { parent: series, valueFormat: this.yAxis.format, keyFormat: this.xAxis.format })\n + this.gaugeLabel(d),\n activate: (d) => this.dotClickedSource.next(d),\n focus: (point, d) => {\n this.enterPoint(point, d, series, index);\n if (this.tooltipTemplate()) {\n point.setAttribute('aria-describedby', PcacTooltipBuilder.ID);\n }\n },\n blur: (point) => {\n this.leavePoint();\n point.removeAttribute('aria-describedby');\n },\n });\n\n points.filter((d: PcacData) => !d.image)\n .append('circle')\n .attr('class', 'dot')\n .attr('stroke', this.colors[index])\n .attr('cx', (d: PcacData) => this.offsetOf(d).dx)\n .attr('cy', rise)\n .attr('fill', '#fff')\n .call((dots) => dots.transition()\n .duration(duration)\n .attr('cy', (d: PcacData) => this.offsetOf(d).dy))\n .transition(DOT_GROW_TRANSITION)\n .duration(duration)\n .attr('r', 4);\n\n // `preserveAspectRatio=\"xMidYMid meet\"` is what does the \"resize to fit\" - the image is\n // scaled uniformly to fit inside the maxWidth x maxHeight box and centered within it, so\n // a non-square image still lands centered on the point. x/y offset by half the box so the\n // box (not its top-left corner) is centered on the point group's origin, matching where a\n // dot sits.\n points.filter((d: PcacData) => !!d.image)\n .append('image')\n .attr('class', 'dot-image')\n .attr('href', (d: PcacData) => d.image as string)\n .attr('width', maxWidth)\n .attr('height', maxHeight)\n .attr('preserveAspectRatio', 'xMidYMid meet')\n .attr('x', (d: PcacData) => -maxWidth / 2 + this.offsetOf(d).dx)\n .attr('y', (d: PcacData) => rise(d) - maxHeight / 2)\n .transition()\n .duration(duration)\n .attr('y', (d: PcacData) => -maxHeight / 2 + this.offsetOf(d).dy);\n\n // Gauge rings around the image box or the dot, rising in with the mark they surround.\n if (this.pointGauge) {\n const markRadius = (d: PcacData) => d.image ? Math.max(maxWidth, maxHeight) / 2 : GAUGE_DOT_RADIUS;\n drawPointGauges(points, this.pointGauge, markRadius)\n .style('--pcac-point-gauge-series-color', () => this.colors[index])\n .attr('transform', (d: PcacData) => `translate(${this.offsetOf(d).dx}, ${rise(d)})`)\n .transition()\n .duration(duration)\n // Tweened as a number rather than `.attr('transform', ...)`: d3's transform interpolation\n // parses through SVG DOM APIs (`transform.baseVal`) that not every environment has.\n .attrTween('transform', (d: PcacData) => {\n const { dx, dy } = this.offsetOf(d);\n const from = rise(d);\n return (t: number) => `translate(${dx}, ${from + (dy - from) * t})`;\n });\n }\n }\n }\n\n /**\n * The end of a point's screen reader name for its gauge - \", PSA 0.018\" - when `pointGauge` has a\n * `name` and the point a `gauge`; otherwise nothing, the ring being only visual.\n */\n private gaugeLabel(d: PcacData): string {\n return this.pointGauge?.name && hasGauge(d) ? `, ${this.pointGauge.name} ${d.gauge}` : '';\n }\n\n /**\n * Starts a hover on a point - its tooltip, beside it; its range brought forward; its dot grown -\n * for the pointer and keyboard focus alike (see makeMarksAccessible). Ended by `leavePoint`.\n */\n private enterPoint(point: SVGGElement, d: PcacData, series: PcacData, index: number): void {\n const duration = this.transitionService.getTransitionDuration();\n this.hoveredPoint = point;\n this.focusPointRange(d);\n // `d` is the very element bound from `series.data`, so identity lookup is exact.\n this.showTooltip(null, d, {\n index: series.data.indexOf(d),\n parent: series,\n parentIndex: index,\n coincident: this.coincidentWith(d),\n valueFormat: this.yAxis.format,\n keyFormat: this.xAxis.format,\n // The dot or image itself rather than the group, so the tooltip clears what's drawn.\n anchor: select(point).select('.dot, .dot-image').node() as Element | null ?? point,\n });\n // No-op for an image point (no circle inside to grow). Its own transition name, so it\n // runs alongside the enter rise rather than cancelling it (see DOT_HOVER_TRANSITION);\n // it only takes over the entry's size tween, which it would otherwise fight over `r`.\n select(point).select('.dot')\n .interrupt(DOT_GROW_TRANSITION)\n .transition(DOT_HOVER_TRANSITION)\n .duration(duration / 3)\n .attr('r', 6)\n .attr('fill', this.colors[index]);\n }\n\n /**\n * Ends the current hover, if there is one: hides the tooltip and shrinks the dot back. Shared by\n * the point's own mouseout and the zoom handler, which has to end a hover the browser won't\n * (the point moves, the cursor doesn't - see `buildChart`'s zoom callback).\n */\n private leavePoint(): void {\n if (!this.hoveredPoint) {\n return;\n }\n const point = this.hoveredPoint;\n this.hoveredPoint = null;\n this.hideTooltip();\n this.focusPointRange(null);\n select(point).select('.dot')\n .interrupt(DOT_GROW_TRANSITION)\n .transition(DOT_HOVER_TRANSITION)\n .duration(this.transitionService.getTransitionDuration() / 3)\n .attr('r', 4)\n .attr('fill', '#fff');\n }\n\n /**\n * Where a point's group goes: its true coordinate, plus - for a fanned-out point - however far\n * its ring had to be shifted to stay inside the plot area at these scales. The shift is on the\n * group rather than the child because it changes as zoom moves the coordinate (the ring offset,\n * on the child, doesn't), and this is the one attribute zoom already updates.\n */\n private pointTransform(d: PcacData, i: number, scales: PlaChartScales): string {\n const { x, y } = this.pointPlacement(d, i, scales);\n return `translate(${x}, ${y})`;\n }\n\n /**\n * The `display` of a point's group at these scales: shown while its center is inside the plot\n * area, `none` once zoom has carried it past an edge. Together with the clip-path's buffer this\n * is what bounds how far a mark may hang over an axis: a point on the edge is drawn whole, half\n * of it outside the plot, and that half is the most that ever shows - the alternative, letting\n * the clip-path's buffer do the work, showed a point up to a whole half-mark beyond the axis\n * with its center already outside. Also takes it out of hover's reach, as a hidden group\n * receives no pointer events.\n *\n * A point with no value to plot isn't drawn at all - the same test the line/area uses to leave\n * a gap (`hasValue`). An empty string used to slip through: the scale reads `''` as 0, so the\n * line left a gap while a dot sat (hoverable) on the baseline.\n */\n private pointDisplay(d: PcacData, i: number, scales: PlaChartScales): string | null {\n return hasValue(d) && this.pointVisible(d, i, scales) ? null : 'none';\n }\n\n private pointVisible(d: PcacData, i: number, scales: PlaChartScales): boolean {\n const { x, y } = this.markCenter(d, i, scales);\n // A hair of slack, so a point on the domain's edge isn't lost to a rescaled scale landing on\n // -0.0000001 instead of 0.\n const slack = 0.5;\n return x >= -slack && x <= this.width + slack && y >= -slack && y <= this.height + slack;\n }\n\n /** Where the point's group is drawn: its coordinate plus its ring's shift, if it's fanned out. */\n private pointPlacement(d: PcacData, i: number, scales: PlaChartScales): PlaPoint {\n const { x, y } = this.pointPosition(d, i, scales);\n const shift = this.shiftOf(d, scales);\n return { x: x + shift.dx, y: y + shift.dy };\n }\n\n /** Where the mark itself is centered: the group's placement plus the ring offset on the child. */\n private markCenter(d: PcacData, i: number, scales: PlaChartScales): PlaPoint {\n const { x, y } = this.pointPlacement(d, i, scales);\n const offset = this.offsetOf(d);\n return { x: x + offset.dx, y: y + offset.dy };\n }\n\n /** A fan-out sits on its members' true coordinate, with no shift applied; any member locates it. */\n private fanOutTransform(group: PlaCoincidentGroup, scales: PlaChartScales): string {\n const { data, index } = group.members[0];\n const { x, y } = this.pointPosition(data, index, scales);\n return `translate(${x}, ${y})`;\n }\n\n private pointPosition(d: PcacData, i: number, scales: PlaChartScales): PlaPoint {\n return { x: getXFormat(this.xAxis.format, d, i, scales.x), y: scales.y(d.value as number) };\n }\n\n /** A member's ring offset from the shared coordinate, `0` for a point that isn't fanned out. */\n private offsetOf(d: PcacData): PlaPointOffset {\n return this.fanOutOffsets.get(d) ?? { dx: 0, dy: 0 };\n }\n\n /** How far `d`'s ring is moved back into the plot area at these scales (see `fanOutShift`). */\n private shiftOf(d: PcacData, scales: PlaChartScales): PlaPointOffset {\n const group = this.coincidentOf.get(d);\n if (!group || !this.fanOutOffsets.has(d)) {\n return { dx: 0, dy: 0 };\n }\n const { data, index } = group.members[0];\n const offsets = group.members.map((member) => this.offsetOf(member.data));\n return fanOutShift(this.pointPosition(data, index, scales), offsets, { width: this.width, height: this.height });\n }\n\n /** Where a spoke ends, relative to its anchor: where the member is drawn, ring offset plus shift. */\n private spokeEnd(member: PlaCoincidentPoint, scales: PlaChartScales): PlaPointOffset {\n const offset = this.offsetOf(member.data);\n const shift = this.shiftOf(member.data, scales);\n return { dx: offset.dx + shift.dx, dy: offset.dy + shift.dy };\n }\n\n /** The other points at `d`'s coordinate, for the tooltip context (see `PcacTooltipContext.coincident`). */\n private coincidentWith(d: PcacData): PcacTooltipCoincident[] {\n const group = this.coincidentOf.get(d);\n if (!group) {\n return [];\n }\n return group.members\n .filter((member) => member.data !== d)\n .map((member) => ({ data: member.data, parent: member.series, index: member.index, parentIndex: member.seriesIndex }));\n }\n}\n","import { Component, ElementRef, TemplateRef, ViewEncapsulation, effect, inject, viewChild, input } from '@angular/core';\nimport { outputFromObservable } from '@angular/core/rxjs-interop';\n\nimport { PcacLineAreaChartConfig, PcacLineAreaPlotChartConfigType } from './plot-line-area-chart.model';\nimport { PlaChartBuilder } from './core/builders/chart.builder';\nimport { PlaChartEffectsBuilder } from './core/builders/effects.builders';\nimport { PcacChartResizeService } from '../core/resize.service';\nimport { PcacTooltipContext } from '../core/tooltip.directive';\n\n@Component({\n selector: 'pcac-line-area-chart',\n // While `config().heightFull` is on, the chart fills its container instead of using a fixed\n // height (see PcacChartConfig.heightFull). That only works if this host element itself has a\n // height to hand down, so the class stretches it to `height: 100%`; the styling lives in CSS\n // rather than being measured/set in JS so the browser resolves it as part of normal layout.\n host: { '[class.pcac-height-full]': 'config().heightFull' },\n templateUrl: './plot-line-area-chart.component.html',\n styleUrl: './plot-line-area-chart.component.scss',\n encapsulation: ViewEncapsulation.None,\n // PlaChartEffectsBuilder must be listed here too, not just PlaChartBuilder: it's injected\n // *inside* PlaChartBuilder, but its own per-instance state (see its class doc) still needs\n // this component's injector to shadow its (default) root scope, or every <pcac-line-area-chart>\n // on the page would share one PlaChartEffectsBuilder instance.\n providers: [PlaChartBuilder, PlaChartEffectsBuilder]\n})\nexport class PcacLineAreaChartComponent {\n private chartBuilder = inject(PlaChartBuilder);\n\n readonly config = input.required<PcacLineAreaChartConfig>();\n readonly type = input.required<PcacLineAreaPlotChartConfigType>();\n\n readonly chartElm = viewChild.required<ElementRef>('chart');\n readonly dotClicked = outputFromObservable(this.chartBuilder.dotClicked$);\n\n /**\n * The consumer's `<ng-template pcacTooltip>`, forwarded by the PcacLineChart/PcacAreaChart/\n * PcacPlotChart wrapper it was projected into. An input rather than a `contentChild()` query\n * of this component's own: content queries only see nodes declared directly inside the\n * element in the consumer's template, not ones the wrapper re-projects through `<ng-content>`,\n * so the wrapper has to run the query and pass the result down.\n */\n readonly tooltipTemplate = input<TemplateRef<PcacTooltipContext>>();\n\n constructor() {\n // Reacts to config()/type() the same way ngOnChanges used to — reading them here (rather\n // than a lifecycle hook) is what makes this an effect: it tracks whichever signals\n // buildChart() reads and reruns whenever either changes. That includes type(), which the old\n // ngOnChanges deliberately ignored (it only compared changes['config']) — in practice type()\n // is always bound to a constant per wrapper (PcacLineChart/PcacAreaChart/PcacPlotChart), so\n // this is unreachable today, but reacting to it is the more correct behavior regardless.\n effect(() => this.buildChart());\n\n // Handed over as a getter so the builder reads the input at hover time, not in the effect\n // above (see PcacChart.tooltipTemplate).\n this.chartBuilder.tooltipTemplate = () => this.tooltipTemplate();\n\n inject(PcacChartResizeService).observe(this.chartElm, () => {\n // Skip the ResizeObserver's routine initial callback when it lands after the effect above\n // already built successfully at this same width — only a real size change (or a build\n // that never happened, e.g. the 0-width mount race) should trigger a rebuild here.\n if (this.chartBuilder.containerSizeChanged(this.chartElm())) {\n this.buildChart();\n }\n });\n }\n\n buildChart(): void {\n const config = this.config();\n // Handed over even when empty: the builder clears what it last drew rather than leaving it.\n if (config) {\n this.chartBuilder.buildChart(this.chartElm(), config, this.type());\n }\n }\n}\n","<section class=\"pcac-line-area-chart\">\n <svg #chart></svg>\n</section>\n\n","import { Component, contentChild, input, output } from \"@angular/core\";\nimport { PcacLineAreaChartComponent } from \"../plot-line-area-chart.component\";\nimport { PcacPlotChartConfig } from \"./plot.model\";\nimport { PcacLineAreaPlotChartConfigType } from \"../plot-line-area-chart.model\";\nimport { PcacData } from \"../../core\";\nimport { PcacTooltipDirective } from \"../../core/tooltip.directive\";\n\n@Component({\n selector: 'pcac-plot-chart',\n // Passes `heightFull` down the wrapper: the inner <pcac-line-area-chart> can only fill a host\n // that has a height itself (see PcacChartConfig.heightFull).\n host: { '[class.pcac-height-full]': 'config().heightFull' },\n templateUrl: './plot.component.html',\n imports: [PcacLineAreaChartComponent]\n})\nexport class PcacPlotChart {\n readonly config = input.required<PcacPlotChartConfig>();\n protected readonly types = PcacLineAreaPlotChartConfigType;\n readonly dotClicked = output<PcacData>();\n\n /**\n * Optional consumer `<ng-template pcacTooltip>` projected into this element, forwarded to the\n * inner chart (see PcacLineAreaChartComponent.tooltipTemplate for why it can't query it itself).\n */\n readonly tooltipTemplate = contentChild(PcacTooltipDirective);\n}\n","<pcac-line-area-chart [config]=\"config()\" [tooltipTemplate]=\"tooltipTemplate()?.templateRef\" [type]=\"types.Plot\" (dotClicked)=\"dotClicked.emit($event)\"/>","import { Component, contentChild, input, output } from \"@angular/core\";\nimport { PcacLineAreaChartComponent } from \"../plot-line-area-chart.component\";\nimport { PcacLineChartConfig } from \"./line.model\";\nimport { PcacLineAreaPlotChartConfigType } from \"../plot-line-area-chart.model\";\nimport { PcacData } from \"../../core\";\nimport { PcacTooltipDirective } from \"../../core/tooltip.directive\";\n\n@Component({\n selector: 'pcac-line-chart',\n // Passes `heightFull` down the wrapper: the inner <pcac-line-area-chart> can only fill a host\n // that has a height itself (see PcacChartConfig.heightFull).\n host: { '[class.pcac-height-full]': 'config().heightFull' },\n templateUrl: \"./line.component.html\",\n imports: [PcacLineAreaChartComponent]\n})\nexport class PcacLineChart {\n readonly config = input.required<PcacLineChartConfig>();\n protected readonly types = PcacLineAreaPlotChartConfigType;\n readonly dotClicked = output<PcacData>()\n\n /**\n * Optional consumer `<ng-template pcacTooltip>` projected into this element, forwarded to the\n * inner chart (see PcacLineAreaChartComponent.tooltipTemplate for why it can't query it itself).\n */\n readonly tooltipTemplate = contentChild(PcacTooltipDirective);\n}\n","<pcac-line-area-chart [config]=\"config()\" [tooltipTemplate]=\"tooltipTemplate()?.templateRef\" [type]=\"types.Line\" (dotClicked)=\"dotClicked.emit($event)\" />","import { PcacLineAreaChartConfig } from \"../plot-line-area-chart.model\";\n\nexport class PcacLineChartConfig extends PcacLineAreaChartConfig {\n\n}","import { Component, contentChild, input, output } from \"@angular/core\";\nimport { PcacAreaChartConfig } from \"./area.model\";\nimport { PcacLineAreaChartComponent } from \"../plot-line-area-chart.component\";\nimport { PcacLineAreaPlotChartConfigType } from \"../plot-line-area-chart.model\";\nimport { PcacData } from \"../../core\";\nimport { PcacTooltipDirective } from \"../../core/tooltip.directive\";\n\n@Component({\n selector: 'pcac-area-chart',\n // Passes `heightFull` down the wrapper: the inner <pcac-line-area-chart> can only fill a host\n // that has a height itself (see PcacChartConfig.heightFull).\n host: { '[class.pcac-height-full]': 'config().heightFull' },\n templateUrl: './area.component.html',\n imports: [PcacLineAreaChartComponent]\n})\nexport class PcacAreaChart {\n readonly config = input.required<PcacAreaChartConfig>();\n protected readonly types = PcacLineAreaPlotChartConfigType;\n readonly dotClicked = output<PcacData>()\n\n /**\n * Optional consumer `<ng-template pcacTooltip>` projected into this element, forwarded to the\n * inner chart (see PcacLineAreaChartComponent.tooltipTemplate for why it can't query it itself).\n */\n readonly tooltipTemplate = contentChild(PcacTooltipDirective);\n}\n","<pcac-line-area-chart [config]=\"config()\" [tooltipTemplate]=\"tooltipTemplate()?.templateRef\" [type]=\"types.Area\" (dotClicked)=\"dotClicked.emit($event)\" />","import { PcacLineAreaChartConfig } from \"../plot-line-area-chart.model\";\n\nexport class PcacAreaChartConfig extends PcacLineAreaChartConfig {\n\n}","// export * from './plot-line-area-chart.builder';\n// export * from './plot-line-area-chart.component';\n// export * from './plot-line-area-chart.model';\n// The rest of that model stays internal (the shared PcacLineAreaChartConfig is reached through\n// the per-chart PcacLineChartConfig/PcacAreaChartConfig/PcacPlotChartConfig subclasses), but\n// the point-image, point-range, point-gauge, reference-line and corner-label types are part of those configs'\n// public shape, so they're exported alone.\nexport {\n PcacCornerLabels,\n PcacPointGaugeConfig,\n PcacPointImageConfig,\n PcacPointRangeConfig,\n PcacPointRangeShow,\n PcacPointRangeStyle,\n PcacReferenceLine,\n} from './plot-line-area-chart.model';\nexport * from './plot/plot.component';\nexport * from './plot/plot.model';\nexport * from './line/line.component';\nexport * from './line/line.model';\nexport * from './area/area.component';\nexport * from './area/area.model';","import { PcacChartConfig, PcacData, PcacFormatEnum } from '../core/chart.model';\n\n/**\n * A proximity chart: one item in the middle (`center`) and others (`data`) around it, each placed\n * closer in or further out by its `value` - how similar it is to the center, say, or how far from\n * it. It answers \"what's nearest to this?\" at a glance: the closest matches sit tight around the\n * center, weaker ones out on the rim.\n *\n * Each item in `data` is one point: `key` is its name (tooltip, screen readers), `value` its\n * closeness in whatever units the chart's `closeValue` / `farValue` use, and `image` optionally\n * drawn in place of its dot. Items go around the center clockwise from `startAngle` in data order,\n * evenly spaced, so put the closest first to have it at the top. An item whose `value` isn't a\n * number, or with `hide`, is left out. Best with a handful to a dozen or so items; past that they\n * crowd one another around the ring.\n */\nexport class PcacProximityChartConfig extends PcacChartConfig {\n /** The item the others are measured against, drawn in the middle. Its `value` isn't used. */\n center: PcacData = new PcacData()\n\n /**\n * The `value` that sits right up against the center, and the one that sits on the outer rim;\n * values in between are placed proportionally, and anything beyond either is held at it.\n * The defaults suit a similarity from 0 to 1 (1 = identical, closest in). For a distance, swap\n * them: `closeValue: 0, farValue: <largest distance>`.\n */\n closeValue?: number = 1\n farValue?: number = 0\n\n /**\n * Values to draw a faint guide ring at, each labelled in `format` - e.g. `[0.95, 0.9, 0.85]` with\n * `Percentage` reads \"95%\", \"90%\", \"85%\". None when not set.\n */\n rings?: number[]\n\n /** How values read on the ring labels, in the tooltip and to screen readers; see `PcacFormatEnum`. */\n format?: PcacFormatEnum\n\n /**\n * Write each item's `key` under it, and the center's under the center. Default false: names are\n * in the tooltip either way. Keep it off for long names or a crowded ring.\n */\n showLabels?: boolean = false\n\n /** Draw a faint line from the center to each item. Default true. */\n showSpokes?: boolean = true\n\n /** Where the first item sits, in degrees clockwise from 12 o'clock. Default 0. */\n startAngle?: number = 0\n\n /** Size of the center item's image (or twice its dot's radius), in px. Default 64. */\n centerSize?: number = 64\n\n /** Size of each surrounding item's image (or twice its dot's radius), in px. Default 40. */\n itemSize?: number = 40\n\n /**\n * Item colors, any CSS color, used in data order for the dots of items without an `image` (the\n * center takes the first). Repeated when there are more items than colors. Omitted or empty, the\n * theme palette is used.\n */\n colorOverride?: string[]\n}\n","import { PcacData } from '../core/chart.model';\n\n/** Where one surrounding item sits, in polar terms around the center. */\nexport interface PcacProximityPlacement {\n data: PcacData;\n /** Its index in `config.data`: which color it takes. */\n index: number;\n /** The item's value, as a number. */\n value: number;\n /** Clockwise from 12 o'clock, in radians. */\n angle: number;\n /** How far out it sits, from 0 (the center) to 1 (the outer rim). */\n distance: number;\n}\n\n/** An item's value as a number, or `null` when it has none. */\nexport function proximityValue(d: PcacData): number | null {\n const value = typeof d.value === 'number' ? d.value : typeof d.value === 'string' && d.value.trim() !== '' ? Number(d.value) : NaN;\n return Number.isFinite(value) ? value : null;\n}\n\n/**\n * Where a value sits between the center and the rim: 0 at `closeValue`, 1 at `farValue`, in\n * proportion between them and held at either end beyond them. Equal ends put everything at 0.\n */\nexport function proximityDistance(value: number, closeValue: number, farValue: number): number {\n if (closeValue === farValue) {\n return 0;\n }\n return Math.min(1, Math.max(0, (value - closeValue) / (farValue - closeValue)));\n}\n\n/**\n * Places every drawable item evenly around the center, clockwise from `startAngle` (degrees from\n * 12 o'clock) in data order, each at its value's distance. Hidden items and items without a\n * numeric value are left out, and don't take up a slot.\n */\nexport function placeProximity(\n data: PcacData[],\n closeValue: number,\n farValue: number,\n startAngle = 0,\n): PcacProximityPlacement[] {\n const drawable = data\n .map((d, index) => ({ d, index, value: proximityValue(d) }))\n .filter((item): item is { d: PcacData; index: number; value: number } => !item.d.hide && item.value !== null);\n const start = (startAngle * Math.PI) / 180;\n return drawable.map(({ d, index, value }, slot) => ({\n data: d,\n index,\n value,\n angle: start + (slot / drawable.length) * 2 * Math.PI,\n distance: proximityDistance(value, closeValue, farValue),\n }));\n}\n","import { ElementRef, Injectable } from '@angular/core';\nimport { select, Selection } from 'd3-selection';\n// Imported for its side effect only: adds .transition() to d3-selection's Selection.\nimport 'd3-transition';\nimport { Subject } from 'rxjs';\n\nimport { PcacChart, PcacTooltipOptions } from '../core/chart';\nimport { PcacData } from '../core/chart.model';\nimport { makeMarksAccessible } from '../core/marks';\nimport { formatValue } from '../core/tick-format';\nimport { PcacProximityChartConfig } from './proximity-chart.model';\nimport { PcacProximityPlacement, placeProximity, proximityDistance } from './proximity-layout';\n\n/** Space kept between the center's mark and the nearest an item can sit, in px. */\nconst CENTER_GAP = 6;\n/** Room kept outside the rim for a ring label, in px. */\nconst RIM_LABEL_ROOM = 4;\n/** Room a name takes below its item with `showLabels` - the gap and one line of 11px text - in px. */\nconst ITEM_LABEL_ROOM = 16;\n\n/** The center, or one item around it, as the builder draws it. */\ninterface PlaProximityMark {\n data: PcacData;\n /** `null` for the center. */\n placement: PcacProximityPlacement | null;\n x: number;\n y: number;\n size: number;\n color: string;\n}\n\n/**\n * Provided per-component (see PcacProximityChart's `providers`), like every builder that extends\n * PcacChart: it holds per-chart-instance state, which a root singleton would share between charts.\n */\n@Injectable()\nexport class ProximityChartBuilder extends PcacChart {\n private itemClickedSource = new Subject<PcacData>();\n itemClicked$ = this.itemClickedSource.asObservable();\n\n protected override chartTypeLabel = 'Proximity chart';\n\n buildChart(chartElm: ElementRef, config: PcacProximityChartConfig): void {\n this.hideTooltip();\n if (!config?.center && !config?.data?.length) {\n this.clearChart(chartElm);\n return;\n }\n // No axes, so an even margin all round rather than the axis charts' defaults.\n this.margin = { top: 8, right: 8, bottom: 8, left: 8 };\n if (!this.initializeChartState(chartElm, config)) {\n return;\n }\n const defaults = new PcacProximityChartConfig();\n const closeValue = config.closeValue ?? defaults.closeValue!;\n const farValue = config.farValue ?? defaults.farValue!;\n const centerSize = config.centerSize ?? defaults.centerSize!;\n const itemSize = config.itemSize ?? defaults.itemSize!;\n const placements = placeProximity(config.data ?? [], closeValue, farValue, config.startAngle ?? defaults.startAngle!);\n this.ensureColorCount(placements.length + 1);\n this.applyColorOverride(config.colorOverride);\n\n // Items run from just outside the center's mark to the rim, their own half-size kept inside it -\n // and, with names under them, the name of an item at the bottom of the rim too.\n const inner = centerSize / 2 + CENTER_GAP + itemSize / 2;\n const edgeRoom = itemSize / 2 + (config.showLabels ? ITEM_LABEL_ROOM : RIM_LABEL_ROOM);\n const outer = Math.max(inner, Math.min(this.width, this.height) / 2 - edgeRoom);\n const radiusOf = (distance: number) => inner + distance * (outer - inner);\n\n this.buildContainer(chartElm, true);\n // Ring labels go halfway between the first two items, where no item sits to cover them.\n const labelAngle = (((config.startAngle ?? defaults.startAngle!) * Math.PI) / 180) + Math.PI / Math.max(1, placements.length);\n this.drawRings(config, closeValue, farValue, radiusOf, labelAngle);\n\n const marks: PlaProximityMark[] = placements.map((p) => {\n const r = radiusOf(p.distance);\n return {\n data: p.data,\n placement: p,\n x: r * Math.sin(p.angle),\n y: -r * Math.cos(p.angle),\n size: itemSize,\n color: this.colors[(p.index + 1) % this.colors.length],\n };\n });\n if (config.showSpokes ?? defaults.showSpokes!) {\n this.svg.append('g')\n .attr('class', 'pcac-proximity-spokes')\n .attr('aria-hidden', 'true')\n .selectAll('line')\n .data(marks)\n .enter().append('line')\n .attr('class', 'pcac-proximity-spoke')\n .attr('x1', 0).attr('y1', 0)\n .attr('x2', (m) => m.x).attr('y2', (m) => m.y);\n }\n const center: PlaProximityMark | null = config.center\n ? { data: config.center, placement: null, x: 0, y: 0, size: centerSize, color: this.colors[0] }\n : null;\n this.drawMarks(center ? [...marks, center] : marks, config);\n this.restoreTabStop(chartElm);\n }\n\n /** Faint guide rings at `config.rings`' values, each labelled at `labelAngle` in `config.format`. */\n private drawRings(\n config: PcacProximityChartConfig,\n closeValue: number,\n farValue: number,\n radiusOf: (d: number) => number,\n labelAngle: number,\n ): void {\n const rings = (config.rings ?? []).filter((v) => Number.isFinite(v));\n if (!rings.length) {\n return;\n }\n const groups = this.svg.append('g')\n .attr('class', 'pcac-proximity-rings')\n .attr('aria-hidden', 'true')\n .selectAll('g')\n .data(rings)\n .enter().append('g')\n .attr('class', 'pcac-proximity-ring');\n const r = (v: number) => radiusOf(proximityDistance(v, closeValue, farValue));\n groups.append('circle').attr('r', r).attr('fill', 'none');\n groups.append('text')\n .attr('class', 'pcac-proximity-ring-label')\n .attr('x', (v) => r(v) * Math.sin(labelAngle))\n .attr('y', (v) => -r(v) * Math.cos(labelAngle))\n .attr('text-anchor', 'middle')\n .attr('dominant-baseline', 'middle')\n .text((v) => formatValue(config.format, v) ?? String(v));\n }\n\n private drawMarks(marks: PlaProximityMark[], config: PcacProximityChartConfig): void {\n const self = this;\n const duration = this.transitionService.getTransitionDuration();\n const tooltipOptions = (m: PlaProximityMark, anchor: Element | null): PcacTooltipOptions => ({\n index: m.placement?.index ?? -1,\n parent: null,\n valueFormat: config.format,\n anchor,\n });\n const markOf = (group: SVGGElement) => select(group).select('.pcac-proximity-dot, .pcac-proximity-image').node() as Element | null;\n const highlight = (group: SVGGElement, on: boolean) => select(group).classed('is-active', on);\n\n const groups: Selection<SVGGElement, PlaProximityMark, SVGGElement, unknown> = this.svg.append('g')\n .attr('class', 'pcac-proximity-items')\n .selectAll<SVGGElement, PlaProximityMark>('g')\n .data(marks)\n .enter().append('g')\n .attr('class', (m) => m.placement ? 'pcac-proximity-item' : 'pcac-proximity-item pcac-proximity-center')\n .attr('transform', (m) => `translate(${m.x}, ${m.y})`)\n .on('mouseover', function (this: SVGGElement, event: MouseEvent, m: PlaProximityMark) {\n highlight(this, true);\n self.showTooltip(event, m.data, tooltipOptions(m, markOf(this)));\n })\n .on('mouseout', function (this: SVGGElement) {\n highlight(this, false);\n self.hideTooltip();\n })\n .on('click', (_event: MouseEvent, m: PlaProximityMark) => this.itemClickedSource.next(m.data));\n\n makeMarksAccessible(groups, {\n label: (m) => m.placement\n ? this.markLabel(m.data, { valueFormat: config.format })\n : `${m.data.key ?? ''}, in the center`,\n activate: (m) => this.itemClickedSource.next(m.data),\n focus: (group, m) => {\n highlight(group, true);\n this.showMarkTooltip(group, m.data, tooltipOptions(m, markOf(group)));\n },\n blur: (group) => {\n highlight(group, false);\n this.hideMarkTooltip(group);\n },\n });\n\n groups.filter((m) => !m.data.image)\n .append('circle')\n .attr('class', 'pcac-proximity-dot')\n .attr('r', (m) => m.size / 2)\n .attr('fill', (m) => m.color)\n // What the theme's hover ring (`stroke: currentColor`) takes: the dot's own color.\n .style('color', (m) => m.color);\n groups.filter((m) => !!m.data.image)\n .append('image')\n .attr('class', 'pcac-proximity-image')\n .attr('href', (m) => m.data.image as string)\n .attr('width', (m) => m.size)\n .attr('height', (m) => m.size)\n .attr('x', (m) => -m.size / 2)\n .attr('y', (m) => -m.size / 2)\n .attr('preserveAspectRatio', 'xMidYMid meet');\n\n if (config.showLabels) {\n groups.append('text')\n .attr('class', 'pcac-proximity-label')\n .attr('aria-hidden', 'true')\n .attr('y', (m) => m.size / 2 + 12)\n .attr('text-anchor', 'middle')\n .text((m) => String(m.data.key ?? ''));\n }\n\n // The items fade in from the center outward, closest first.\n groups.attr('opacity', 0)\n .transition()\n .delay((m) => (m.placement ? m.placement.distance * duration / 2 : 0))\n .duration(duration / 2)\n .attr('opacity', 1);\n }\n}\n","import { Component, ElementRef, ViewEncapsulation, contentChild, effect, inject, input, viewChild } from '@angular/core';\nimport { outputFromObservable } from '@angular/core/rxjs-interop';\nimport { ProximityChartBuilder } from './proximity-chart.builder';\nimport { PcacProximityChartConfig } from './proximity-chart.model';\nimport { PcacChartResizeService } from '../core/resize.service';\nimport { PcacTooltipDirective } from '../core/tooltip.directive';\n\n/** A proximity chart: an item in the middle, others around it by closeness (see PcacProximityChartConfig). */\n@Component({\n selector: 'pcac-proximity-chart',\n // See PcacBarVerticalChart: `heightFull` needs the host to hand a height down.\n host: { '[class.pcac-height-full]': 'config().heightFull' },\n templateUrl: './proximity-chart.component.html',\n styleUrl: './proximity-chart.component.scss',\n encapsulation: ViewEncapsulation.None,\n providers: [ProximityChartBuilder]\n})\nexport class PcacProximityChart {\n private chartBuilder = inject(ProximityChartBuilder);\n\n readonly config = input.required<PcacProximityChartConfig>();\n private readonly chartElm = viewChild.required<ElementRef>('chart');\n /** An item - or the center - was clicked, or activated with Enter or Space. */\n readonly itemClicked = outputFromObservable(this.chartBuilder.itemClicked$);\n\n /** Optional consumer `<ng-template pcacTooltip>`, replacing the default tooltip (see PcacTooltipDirective). */\n readonly tooltipTemplate = contentChild(PcacTooltipDirective);\n\n constructor() {\n effect(() => this.buildChart());\n // A getter, so the builder reads the query at hover time rather than in the effect above.\n this.chartBuilder.tooltipTemplate = () => this.tooltipTemplate()?.templateRef;\n inject(PcacChartResizeService).observe(this.chartElm, () => {\n if (this.chartBuilder.containerSizeChanged(this.chartElm())) {\n this.buildChart();\n }\n });\n }\n\n private buildChart(): void {\n const config = this.config();\n // Handed over even when empty: the builder clears what it last drew rather than leaving it.\n if (config) {\n this.chartBuilder.buildChart(this.chartElm(), config);\n }\n }\n}\n","<section class=\"pcac-proximity-chart\">\n <svg #chart></svg>\n</section>\n","import { PcacChartConfig } from '../core/chart.model';\n\n/** Which chart the shared `<pcac-pie-donut-chart>` draws; each wrapper binds its own. */\nexport enum PcacPieDonutChartType {\n Pie = 'pie',\n Donut = 'donut'\n}\n\n/**\n * What the pie and donut charts share. Internal: consumers configure `PcacPieChartConfig` or\n * `PcacDonutChartConfig`, the same way the line, area and plot charts share\n * `PcacLineAreaChartConfig`.\n */\nexport class PcacPieDonutChartConfig extends PcacChartConfig {\n /**\n * Slice colors, any CSS color, in data order - the first slice takes the first color - in place\n * of the theme palette. Repeated when there are more slices than colors. Omitted or empty, the\n * theme palette is used. Match a `<pcac-legend>` to it with each item's `colorOverride`.\n */\n colorOverride?: string[]\n}\n","import { PcacPieDonutChartConfig } from '../pie-donut-chart.model';\n\n/**\n * A pie with its slices drawn as a ring around an empty center, which can hold a short label -\n * typically the total the slices add up to.\n */\nexport class PcacDonutChartConfig extends PcacPieDonutChartConfig {\n /**\n * Radius of the hole as a fraction of the chart's radius, from 0 (no hole - a pie) to 0.9.\n * Values outside that range are clamped.\n */\n innerRadius?: number = 0.6\n\n /**\n * Large text centered in the hole, e.g. `'67'`. Sized to the hole and shrunk to fit across it;\n * left out if it would have to go below 8px. Not drawn when not set.\n */\n label?: string\n\n /** Smaller line under `label`, e.g. `'balls'`, fitted the same way. Not drawn when not set. */\n subLabel?: string\n\n /**\n * `label` color, any CSS color; theme default `$gray-800`. Applied as\n * `--pcac-donut-center-label-color` on the chart's `.pcac-donut-center` group, so a stylesheet\n * can set it on an ancestor instead (a config value wins).\n */\n labelColor?: string\n\n /** `subLabel` color, likewise (`--pcac-donut-center-sub-label-color`); theme default `$gray-600`. */\n subLabelColor?: string\n}\n","import { Injectable, ElementRef } from '@angular/core';\n\n/**\n * D3\n */\nimport { arc, pie, Arc, Pie, PieArcDatum } from 'd3-shape';\nimport { BaseType, select, Selection } from 'd3-selection';\nimport { interpolate } from 'd3-interpolate';\nimport { active, transition } from 'd3-transition';\nimport { color } from 'd3-color';\n\n/**\n * Lib\n */\nimport { PcacPieDonutChartConfig, PcacPieDonutChartType } from './pie-donut-chart.model';\nimport { PcacDonutChartConfig } from './donut/donut.model';\nimport { PcacChart } from '../core/chart';\nimport { makeMarksAccessible } from '../core/marks';\nimport { PcacData } from '../core/chart.model';\n\nimport { Subject } from 'rxjs';\n\n\n/** The largest `PcacDonutChartConfig.innerRadius` honored, so a ring is always left to draw. */\nconst MAX_DONUT_INNER_RADIUS = 0.9;\n\n/** Smallest font a center line is drawn at; a line that can't fit the hole at this size is left out. */\nconst MIN_CENTER_FONT_SIZE = 8;\n\n/** Share of the hole's diameter the center text may span, leaving a margin inside the ring. */\nconst CENTER_TEXT_WIDTH = 1.6;\n\n/**\n * Average glyph width as a fraction of font size. Only used where text can't be measured (no\n * layout, e.g. jsdom); in a browser each line is measured and scaled to fit instead.\n */\nconst ESTIMATED_GLYPH_WIDTH = 0.6;\n\n/**\n * Provided per-component (see PcacPieDonutChartComponent's `providers`), not root-scoped:\n * this builder extends PcacChart, which holds mutable per-chart-instance state (margin, width,\n * height, colors, svg). A root singleton would be shared and clobbered by every\n * <pcac-pie-donut-chart> rendered at once.\n */\n@Injectable()\nexport class PieDonutChartBuilder extends PcacChart {\n private radius!: number;\n private innerRadius = 0;\n private arcShape!: Arc<any, PieArcDatum<PcacData>>;\n private arcOverShape!: Arc<any, PieArcDatum<PcacData>>;\n private pieAngles!: Pie<any, PcacData>;\n private sliceClickedSource = new Subject<PcacData>();\n sliceClicked$ = this.sliceClickedSource.asObservable();\n\n protected override chartTypeLabel = 'Pie chart';\n\n /**\n * Draws `config` as a pie, or - for `PcacPieDonutChartType.Donut` - as a donut, reading the ring\n * settings off the config (`PcacDonutChartConfig`), with its defaults for any left unset.\n */\n buildChart(chartElm: ElementRef, config: PcacPieDonutChartConfig, type: PcacPieDonutChartType): void {\n if (!config?.data?.length) {\n this.clearChart(chartElm);\n return;\n }\n\n // The pie deliberately opts out of `heightFull`: `height` here feeds the radius rather than a\n // drawing area, so growing into a tall container would silently change the size of the pie\n // itself. `PcacPieDonutChartConfig` inherits the property from PcacChartConfig, so it's neutralized\n // here rather than being absent from the type. (`<pcac-pie-donut-chart>` also never gets the\n // `pcac-height-full` class the other charts use to stretch their host.)\n const donut = type === PcacPieDonutChartType.Donut ? donutSettings(config as PcacDonutChartConfig) : null;\n if (type === PcacPieDonutChartType.Pie) {\n this.warnOfDonutOnPie(config);\n }\n // Announced for what it draws: a ring, or - a donut with no hole included - a pie (see\n // PcacChart.chartTypeLabel).\n this.chartTypeLabel = donut && donut.innerRadius > 0 ? 'Donut chart' : 'Pie chart';\n if (!this.initializeChartState(chartElm, { ...config, heightFull: false })) {\n return;\n }\n this.applyColorOverride(config.colorOverride);\n this.radius = Math.min(this.height, this.width) / 2;\n this.buildShapes(donut?.innerRadius ?? 0);\n this.drawChart(chartElm, config);\n if (donut && this.innerRadius > 0) {\n this.drawCenter(donut);\n }\n }\n\n private warnedOfDonutOnPie = false;\n\n /**\n * Development builds only: a pie config still carrying 22.2's `donut` option. It isn't read any\n * more - the donut is PcacDonutChart now - and TypeScript doesn't always catch it (a config built\n * by spreading, or loaded as JSON, compiles fine), so the chart would quietly draw a plain pie.\n * Warned once per chart.\n */\n private warnOfDonutOnPie(config: PcacPieDonutChartConfig): void {\n if (typeof ngDevMode === 'undefined' || !ngDevMode || this.warnedOfDonutOnPie || !('donut' in config)) {\n return;\n }\n this.warnedOfDonutOnPie = true;\n console.warn(\n 'Pioneer Charts: <pcac-pie-chart> ignores `donut`. For a donut, use <pcac-donut-chart> with ' +\n 'PcacDonutChartConfig, which takes innerRadius, label, subLabel, labelColor and subLabelColor ' +\n 'directly - see the 22.2.16 CHANGELOG.',\n );\n }\n\n /** `ratio` is the hole's radius as a share of the chart's: 0 for a pie. */\n private buildShapes(ratio: number): void {\n const radiusOffset = 10;\n // Never negative: in a container under 20px the offset would otherwise turn the pie inside out.\n const outerRadius = Math.max(0, this.radius - radiusOffset);\n // Sized against the resting slice, so the hole stays put when a hovered slice grows outward.\n this.innerRadius = Math.max(0, outerRadius * Math.min(Math.max(ratio, 0), MAX_DONUT_INNER_RADIUS));\n\n this.arcShape = arc<any, PieArcDatum<PcacData>>()\n .innerRadius(this.innerRadius)\n .outerRadius(outerRadius);\n\n // A pie too small to draw anything at rest (see above) doesn't pop out a disc on hover either.\n this.arcOverShape = arc<any, PieArcDatum<PcacData>>()\n .innerRadius(this.innerRadius)\n .outerRadius(outerRadius > 0 ? outerRadius + radiusOffset : 0);\n\n this.pieAngles = pie<PcacData>()\n .sort(null)\n // A hidden slice takes no angle but keeps its index - and so its color, matching a legend -\n // the same way a hidden line/area/plot series keeps its place.\n .value((d: PcacData) => (d.hide ? 0 : Number(d.value ?? 0)));\n }\n\n private drawChart(chartElm: ElementRef, config: PcacPieDonutChartConfig): void {\n this.buildContainer(chartElm, true);\n const self = this;\n // Pops the slice out, darkened, for the pointer and keyboard focus alike (see\n // makeMarksAccessible).\n const pop = (slice: SVGPathElement, d: PieArcDatum<PcacData>) => {\n const t = transition().duration(this.transitionService.getTransitionDuration() / 3)\n const c = color(this.colors[d.index])\n const ct = c ? c.darker(1).toString() : this.colors[d.index]\n const selected = select<SVGPathElement, PieArcDatum<PcacData>>(slice);\n // Hovered mid-way through the enter sweep, the slice is finished first: growing it straight\n // from its part-swept path morphed it oddly on the way out to the hover shape. Only then -\n // re-entering a slice mid-way through its hover shrink must grow it from where it is, not\n // snap it back to rest first (which flickered).\n if (active(slice, 'enter')) {\n selected.interrupt('enter').attr('d', this.arcShape(d));\n }\n selected\n .transition(t)\n .attr('d', this.arcOverShape)\n .style('fill', ct);\n };\n const rest = (slice: SVGPathElement, d: PieArcDatum<PcacData>) => {\n select<SVGPathElement, PieArcDatum<PcacData>>(slice)\n .transition()\n .duration(this.transitionService.getTransitionDuration() / 3)\n .attr('d', this.arcShape)\n .style('fill', this.colors[d.index]);\n };\n const slices = this.svg.selectAll('.pcac-arc')\n .data(this.pieAngles(config.data))\n .enter().append('g')\n .attr('class', 'pcac-arc')\n .append('path')\n .style('fill', (d: PieArcDatum<PcacData>, i: number) => {\n return this.colors[i];\n })\n .on('mouseover', function (this: SVGPathElement, _: MouseEvent, d: PieArcDatum<PcacData>) {\n pop(this, d);\n })\n .on('mousemove', (event: MouseEvent, d: PieArcDatum<PcacData>) => {\n self.showTooltip(event, d.data, { index: d.index });\n })\n .on('mouseout', function (this: SVGPathElement, _: MouseEvent, d: PieArcDatum<PcacData>) {\n self.hideTooltip();\n rest(this, d);\n })\n .on('click', (_event: MouseEvent, d: PieArcDatum<PcacData>) => {\n this.sliceClickedSource.next(d.data);\n });\n makeMarksAccessible(slices, {\n label: (d) => this.markLabel(d.data),\n skip: (d) => !!d.data.hide,\n activate: (d) => this.sliceClickedSource.next(d.data),\n focus: (slice, d) => {\n pop(slice, d);\n this.showMarkTooltip(slice, d.data, { index: d.index });\n },\n blur: (slice, d) => {\n this.hideMarkTooltip(slice);\n rest(slice, d);\n },\n });\n this.restoreTabStop(chartElm);\n slices\n // Named, so the hover transitions (unnamed) and the check above can tell it apart from them.\n .transition('enter')\n .duration(this.transitionService.getTransitionDuration())\n .attrTween('d', (b: PieArcDatum<PcacData>) => {\n return this.tweenChart(b);\n });\n }\n\n /**\n * The donut's `label` / `subLabel`, stacked around the center of the hole. Each line starts at a\n * size proportional to the hole and shrinks until it fits across it; a line that would have to\n * drop below `MIN_CENTER_FONT_SIZE` is left out rather than spill over the slices. Drawn after\n * the slices and ignoring the pointer, so it never blocks a slice's hover or click.\n */\n private drawCenter(donut: PcacDonutChartConfig): void {\n if (!donut.label && !donut.subLabel) {\n return;\n }\n const maxWidth = this.innerRadius * CENTER_TEXT_WIDTH;\n\n const center = this.svg.append('g')\n .attr('class', 'pcac-donut-center')\n .attr('pointer-events', 'none')\n .style('--pcac-donut-center-label-color', () => donut.labelColor ?? null)\n .style('--pcac-donut-center-sub-label-color', () => donut.subLabelColor ?? null);\n\n const label = this.drawCenterLine(center, 'pcac-donut-center-label', donut.label,\n Math.min(this.innerRadius * 0.5, 40), maxWidth);\n const subLabel = this.drawCenterLine(center, 'pcac-donut-center-sub-label', donut.subLabel,\n Math.min(this.innerRadius * 0.2, 16), maxWidth);\n\n if (!label && !subLabel) {\n center.remove();\n return;\n }\n // Stacked as a pair about the center; a line on its own sits on it.\n if (label && subLabel) {\n label.element.attr('y', -subLabel.size * 0.6);\n subLabel.element.attr('y', label.size * 0.55);\n }\n }\n\n /**\n * One centered line of the donut's center text at the largest size up to `preferredSize` that\n * fits `maxWidth`, or nothing (null) when there's no text or it can't fit at a readable size.\n */\n private drawCenterLine(\n center: Selection<SVGGElement, unknown, BaseType, unknown>,\n className: string,\n text: string | undefined,\n preferredSize: number,\n maxWidth: number,\n ): { element: Selection<SVGTextElement, unknown, BaseType, unknown>; size: number } | null {\n if (!text || preferredSize < MIN_CENTER_FONT_SIZE) {\n return null;\n }\n const element = center.append('text')\n .attr('class', className)\n .attr('text-anchor', 'middle')\n .attr('dominant-baseline', 'central')\n .style('font-size', `${preferredSize}px`)\n .text(text);\n\n const node = element.node();\n const measured = node && typeof node.getComputedTextLength === 'function'\n ? node.getComputedTextLength()\n : 0;\n const width = measured > 0 ? measured : text.length * preferredSize * ESTIMATED_GLYPH_WIDTH;\n const size = width > maxWidth ? preferredSize * (maxWidth / width) : preferredSize;\n if (size < MIN_CENTER_FONT_SIZE) {\n element.remove();\n return null;\n }\n element.style('font-size', `${size}px`);\n return { element, size };\n }\n\n private tweenChart(b: PieArcDatum<PcacData>) {\n const i = interpolate({ startAngle: 0, endAngle: 0 }, b);\n return (t: number) => this.arcShape(i(t)) ?? '';\n }\n}\n\n/** A donut config with its defaults filled in for whatever the consumer left unset. */\nfunction donutSettings(config: PcacDonutChartConfig): PcacDonutChartConfig & { innerRadius: number } {\n const defaults = new PcacDonutChartConfig();\n // Unset or not a number (NaN, say - an empty number input's value), the default: a NaN ratio\n // survived the clamp and made every slice's path NaN, so nothing drew.\n const innerRadius = Number.isFinite(config.innerRadius) ? config.innerRadius! : defaults.innerRadius ?? 0;\n return { ...config, innerRadius };\n}\n","import { Component, ElementRef, TemplateRef, ViewEncapsulation, effect, inject, input, viewChild } from '@angular/core';\nimport { outputFromObservable } from '@angular/core/rxjs-interop';\nimport { PcacPieDonutChartConfig, PcacPieDonutChartType } from './pie-donut-chart.model';\nimport { PieDonutChartBuilder } from './pie-donut-chart.builder';\nimport { PcacChartResizeService } from '../core/resize.service';\nimport { PcacTooltipContext } from '../core/tooltip.directive';\n\n/**\n * The chart the pie and donut charts share, drawn by `PcacPieChart` and `PcacDonutChart` with\n * their own `type`. Internal, like `<pcac-line-area-chart>` behind the line, area and plot charts.\n */\n@Component({\n selector: 'pcac-pie-donut-chart',\n templateUrl: './pie-donut-chart.component.html',\n styleUrl: './pie-donut-chart.component.scss',\n encapsulation: ViewEncapsulation.None,\n providers: [PieDonutChartBuilder]\n})\nexport class PcacPieDonutChartComponent {\n private chartBuilder = inject(PieDonutChartBuilder);\n\n readonly config = input.required<PcacPieDonutChartConfig>();\n readonly type = input.required<PcacPieDonutChartType>();\n readonly chartElm = viewChild.required<ElementRef>('chart');\n readonly sliceClicked = outputFromObservable(this.chartBuilder.sliceClicked$);\n\n /**\n * The consumer's `<ng-template pcacTooltip>`, forwarded by the wrapper it was projected into:\n * a content query here wouldn't see it through the wrapper's template (see\n * PcacLineAreaChartComponent.tooltipTemplate).\n */\n readonly tooltipTemplate = input<TemplateRef<PcacTooltipContext>>();\n\n constructor() {\n // Tracks config() and type(), rebuilding whenever either changes.\n effect(() => this.buildChart());\n\n // Handed over as a getter so the builder reads the input at hover time, not in the effect\n // above (see PcacChart.tooltipTemplate).\n this.chartBuilder.tooltipTemplate = () => this.tooltipTemplate();\n\n inject(PcacChartResizeService).observe(this.chartElm, () => {\n // Skip the ResizeObserver's routine initial callback when it lands after the effect above\n // already built successfully at this same width — only a real size change (or a build\n // that never happened, e.g. the 0-width mount race) should trigger a rebuild here.\n if (this.chartBuilder.containerSizeChanged(this.chartElm())) {\n this.buildChart();\n }\n });\n }\n\n buildChart(): void {\n const config = this.config();\n const type = this.type();\n // Handed over even when empty: the builder clears what it last drew rather than leaving it.\n if (config) {\n this.chartBuilder.buildChart(this.chartElm(), config, type);\n }\n }\n}\n","<!-- pcac-pie-chart kept alongside for app CSS written against 22.2 and earlier, when this section\n belonged to the one pie component (the donut included). -->\n<section class=\"pcac-pie-donut-chart pcac-pie-chart\">\n <svg #chart></svg>\n</section>\n\n","import { Component, contentChild, input, output } from '@angular/core';\nimport { PcacPieDonutChartComponent } from '../pie-donut-chart.component';\nimport { PcacPieDonutChartType } from '../pie-donut-chart.model';\nimport { PcacPieChartConfig } from './pie.model';\nimport { PcacData } from '../../core';\nimport { PcacTooltipDirective } from '../../core/tooltip.directive';\n\n@Component({\n selector: 'pcac-pie-chart',\n templateUrl: './pie.component.html',\n imports: [PcacPieDonutChartComponent]\n})\nexport class PcacPieChart {\n readonly config = input.required<PcacPieChartConfig>();\n protected readonly types = PcacPieDonutChartType;\n readonly sliceClicked = output<PcacData>();\n\n /**\n * Optional consumer `<ng-template pcacTooltip>` projected into this element, forwarded to the\n * inner chart (see PcacPieDonutChartComponent.tooltipTemplate).\n */\n readonly tooltipTemplate = contentChild(PcacTooltipDirective);\n}\n","<pcac-pie-donut-chart [config]=\"config()\" [tooltipTemplate]=\"tooltipTemplate()?.templateRef\" [type]=\"types.Pie\" (sliceClicked)=\"sliceClicked.emit($event)\" />\n","import { PcacPieDonutChartConfig } from '../pie-donut-chart.model';\n\nexport class PcacPieChartConfig extends PcacPieDonutChartConfig {\n\n}\n","import { Component, contentChild, input, output } from '@angular/core';\nimport { PcacPieDonutChartComponent } from '../pie-donut-chart.component';\nimport { PcacPieDonutChartType } from '../pie-donut-chart.model';\nimport { PcacDonutChartConfig } from './donut.model';\nimport { PcacData } from '../../core';\nimport { PcacTooltipDirective } from '../../core/tooltip.directive';\n\n@Component({\n selector: 'pcac-donut-chart',\n templateUrl: './donut.component.html',\n imports: [PcacPieDonutChartComponent]\n})\nexport class PcacDonutChart {\n readonly config = input.required<PcacDonutChartConfig>();\n protected readonly types = PcacPieDonutChartType;\n readonly sliceClicked = output<PcacData>();\n\n /**\n * Optional consumer `<ng-template pcacTooltip>` projected into this element, forwarded to the\n * inner chart (see PcacPieDonutChartComponent.tooltipTemplate).\n */\n readonly tooltipTemplate = contentChild(PcacTooltipDirective);\n}\n","<pcac-pie-donut-chart [config]=\"config()\" [tooltipTemplate]=\"tooltipTemplate()?.templateRef\" [type]=\"types.Donut\" (sliceClicked)=\"sliceClicked.emit($event)\" />\n","// The shared <pcac-pie-donut-chart> and its PcacPieDonutChartConfig stay internal, like the\n// line/area/plot charts' base: consumers use the pie and donut wrappers and their configs.\nexport * from './pie/pie.component';\nexport * from './pie/pie.model';\nexport * from './donut/donut.component';\nexport * from './donut/donut.model';\n","/*\n * Public API Surface of pioneer-charts\n */\n\nexport * from './lib/bar-chart/bar-horizontal-chart/public-api';\nexport * from './lib/bar-chart/bar-vertical-chart/public-api';\nexport * from './lib/core/public-api';\nexport * from './lib/dot-plot-chart/public-api';\nexport * from './lib/legend/public-api';\nexport * from './lib/plot-line-area-chart/public-api';\nexport * from './lib/proximity-chart/public-api';\nexport * from './lib/pie-donut-chart/public-api';\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;AAGG;MACU,eAAe,CAAA;IAC1B,IAAI,GAAe,EAAE;AAErB;;AAEG;IACH,MAAM,GAAW,GAAG;AAEpB;;;;;;;;;;;;;AAaG;IACH,UAAU,GAAa,KAAK;AAE5B;;;;AAIG;AACH,IAAA,SAAS;AACV;AAED;;;AAGG;MACU,iBAAiB,CAAA;AAC5B,IAAA,GAAG;AACH,IAAA,GAAG;AACH,IAAA,GAAG;AACJ;AAED;;;;;;;;;;;;AAYG;MACU,cAAc,CAAA;AACzB;;;;AAIG;IACH,IAAI,GAAa,KAAK;AAEtB;;;;;;;AAOG;AACH,IAAA,QAAQ;AAER;;;AAGG;AACH,IAAA,SAAS;AAET;;;;AAIG;IACH,KAAK,GAAY,CAAC;AAElB;;;;;;;;;AASG;AACH,IAAA,QAAQ;AAER;;;;;;;;;;;AAWG;IACH,YAAY,GAAa,KAAK;AAE9B;;;AAGG;AACH,IAAA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