ngx-mira-charts 0.2.1-dev.1 → 0.2.1-dev.2

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.
@@ -561,8 +561,9 @@ const CARTESIAN_CHART_STYLES = [
561
561
  `,
562
562
  ];
563
563
  const DEFAULT_MARGIN = { top: 10, right: 20, bottom: 10, left: 10 };
564
- // The size a chart draws at until it can measure its container: on the
565
- // server, in the browser's first frame, and while it's hidden.
564
+ // The size a chart draws at where it can't take one from its container: on
565
+ // the server, in the browser's first frame, while it's hidden, and in a
566
+ // container that gives it no height or no width.
566
567
  const FALLBACK_SIZE = { width: 600, height: 300 };
567
568
  /**
568
569
  * What every chart with an x and a y axis has, whatever its series: data, a
@@ -596,7 +597,11 @@ const FALLBACK_SIZE = { width: 600, height: 300 };
596
597
  class MiraCartesianChart {
597
598
  /** The rows to plot, a `ChartDatum` each. */
598
599
  data = input([], ...(ngDevMode ? [{ debugName: "data" }] : []));
599
- /** The width in px. Without it, the chart is as wide as its container. */
600
+ /**
601
+ * The width in px. Without it, the chart is as wide as its container, and
602
+ * doesn't widen it: a container as wide as its content, such as an
603
+ * inline-block or a dialog, needs a width of its own.
604
+ */
600
605
  width = input(undefined, ...(ngDevMode ? [{ debugName: "width", transform: optionalNumber }] : [{
601
606
  transform: optionalNumber,
602
607
  }]));
@@ -616,8 +621,10 @@ class MiraCartesianChart {
616
621
  /** The size the chart draws at, in px: its inputs, or its container's. */
617
622
  size = computed(() => {
618
623
  const measured = this.#measured();
619
- // A size of 0 means the chart is hidden, or its container has no height:
620
- // drawing at 0 would keep it at 0 once it shows.
624
+ // A size of 0 means the chart is hidden, or its container gives it none:
625
+ // it has no height, or it takes its width from its content. Drawing at 0
626
+ // would keep the height at 0 once the chart shows, and hide a chart whose
627
+ // container needs a width, rather than show it past the container.
621
628
  return {
622
629
  width: this.width() ?? (measured?.width || FALLBACK_SIZE.width),
623
630
  height: this.height() ?? (measured?.height || FALLBACK_SIZE.height),
@@ -788,16 +795,25 @@ class MiraCartesianChart {
788
795
  return { x, y };
789
796
  }
790
797
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: MiraCartesianChart, deps: [], target: i0.ɵɵFactoryTarget.Directive });
791
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "20.3.35", type: MiraCartesianChart, isStandalone: true, inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, margin: { classPropertyName: "margin", publicName: "margin", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.display": "\"block\"", "style.height": "height() === undefined ? \"100%\" : null" } }, queries: [{ propertyName: "series", predicate: MiraSeries, isSignal: true }, { propertyName: "layers", predicate: MiraChartLayer, isSignal: true }, { propertyName: "xAxis", first: true, predicate: MiraXAxis, isSignal: true }, { propertyName: "yAxis", first: true, predicate: MiraYAxis, isSignal: true }, { propertyName: "legend", first: true, predicate: ChartLegend, isSignal: true }], viewQueries: [{ propertyName: "svg", first: true, predicate: ["svg"], descendants: true, isSignal: true }], ngImport: i0 });
798
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "20.3.35", type: MiraCartesianChart, isStandalone: true, inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, margin: { classPropertyName: "margin", publicName: "margin", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.display": "\"block\"", "style.width": "width() === undefined ? \"100%\" : null", "style.height": "height() === undefined ? \"100%\" : null", "style.contain": "width() === undefined ? \"inline-size\" : null" } }, queries: [{ propertyName: "series", predicate: MiraSeries, isSignal: true }, { propertyName: "layers", predicate: MiraChartLayer, isSignal: true }, { propertyName: "xAxis", first: true, predicate: MiraXAxis, isSignal: true }, { propertyName: "yAxis", first: true, predicate: MiraYAxis, isSignal: true }, { propertyName: "legend", first: true, predicate: ChartLegend, isSignal: true }], viewQueries: [{ propertyName: "svg", first: true, predicate: ["svg"], descendants: true, isSignal: true }], ngImport: i0 });
792
799
  }
793
800
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: MiraCartesianChart, decorators: [{
794
801
  type: Directive,
795
802
  args: [{
796
803
  host: {
797
804
  '[style.display]': '"block"',
805
+ // Fills its container's width, even where the container would center it,
806
+ // as a flex column with `align-items: center` does.
807
+ '[style.width]': 'width() === undefined ? "100%" : null',
798
808
  // Fills a container that has a height. In one without, the chart is as
799
809
  // tall as it draws itself.
800
810
  '[style.height]': 'height() === undefined ? "100%" : null',
811
+ // Without a width, what it draws doesn't count toward its container's
812
+ // width. If it did, the svg would hold a grid column or a flex item at the
813
+ // svg's width, the chart would measure that width again, and never get
814
+ // narrower. With a width, it counts, so a flex row of charts with a width
815
+ // lays out by them.
816
+ '[style.contain]': 'width() === undefined ? "inline-size" : null',
801
817
  },
802
818
  }]
803
819
  }], ctorParameters: () => [], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], margin: [{ type: i0.Input, args: [{ isSignal: true, alias: "margin", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], series: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => MiraSeries), { isSignal: true }] }], layers: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => MiraChartLayer), { isSignal: true }] }], xAxis: [{ type: i0.ContentChild, args: [i0.forwardRef(() => MiraXAxis), { ...{ descendants: false }, isSignal: true }] }], yAxis: [{ type: i0.ContentChild, args: [i0.forwardRef(() => MiraYAxis), { ...{ descendants: false }, isSignal: true }] }], legend: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ChartLegend), { ...{ descendants: false }, isSignal: true }] }], svg: [{ type: i0.ViewChild, args: ['svg', { isSignal: true }] }] } });
@@ -1 +1 @@
1
- {"version":3,"file":"ngx-mira-charts.mjs","sources":["../../../projects/ngx-mira-charts/src/lib/core/chart-layer.ts","../../../projects/ngx-mira-charts/src/lib/core/series.ts","../../../projects/ngx-mira-charts/src/lib/core/theme.ts","../../../projects/ngx-mira-charts/src/lib/core/utils/data.ts","../../../projects/ngx-mira-charts/src/lib/core/utils/scale.ts","../../../projects/ngx-mira-charts/src/lib/core/cartesian/cartesian-context.ts","../../../projects/ngx-mira-charts/src/lib/core/cartesian/x-axis.ts","../../../projects/ngx-mira-charts/src/lib/core/cartesian/y-axis.ts","../../../projects/ngx-mira-charts/src/lib/core/cartesian/cartesian-chart.ts","../../../projects/ngx-mira-charts/src/lib/core/cartesian/cartesian-grid.ts","../../../projects/ngx-mira-charts/src/lib/core/cartesian/cursor.ts","../../../projects/ngx-mira-charts/src/lib/core/cartesian/tooltip.ts","../../../projects/ngx-mira-charts/src/lib/core/cartesian/legend.ts","../../../projects/ngx-mira-charts/src/lib/core/cartesian/provide-cartesian-chart.ts","../../../projects/ngx-mira-charts/src/lib/core/layer-outlet.ts","../../../projects/ngx-mira-charts/src/lib/line-chart/line-chart.ts","../../../projects/ngx-mira-charts/src/lib/core/utils/path.ts","../../../projects/ngx-mira-charts/src/lib/line-chart/line.ts","../../../projects/ngx-mira-charts/src/lib/bar-chart/bar-chart.ts","../../../projects/ngx-mira-charts/src/lib/bar-chart/bar.ts","../../../projects/ngx-mira-charts/src/public-api.ts","../../../projects/ngx-mira-charts/src/ngx-mira-charts.ts"],"sourcesContent":["import { Directive, TemplateRef, viewChild } from '@angular/core'\n\n/**\n * Something a chart draws in its svg: a line, an axis, the grid, or a layer\n * of your own. A layer is an element of its own in the chart's content and\n * renders nothing where it's written: the chart renders the layer's\n * `<ng-template>` into its svg, in the order the layers are written, so the\n * first one ends up at the bottom.\n *\n * To draw a layer of your own, extend this class, provide your component\n * under it, and put what it draws in an `<ng-template>`, as `svg:` elements.\n * Inject {@link MiraCartesianChart} for the plot area and the scales. The\n * template runs again when a signal it reads changes, or when your component\n * is checked, as on a new input: keep what it reads in signals, or call\n * `markForCheck()` when that changes.\n *\n * @example\n * ```ts\n * @Component({\n * selector: 'app-target',\n * providers: [\n * { provide: MiraChartLayer, useExisting: forwardRef(() => Target) },\n * ],\n * template: `\n * <ng-template>\n * <svg:line [attr.y1]=\"y()\" [attr.y2]=\"y()\" … />\n * </ng-template>\n * `,\n * })\n * export class Target extends MiraChartLayer {\n * readonly value = input.required<number>()\n *\n * protected readonly y = computed(() => this.#chart.yScale()(this.value()))\n *\n * readonly #chart = inject(MiraCartesianChart)\n * }\n * ```\n */\n@Directive()\nexport abstract class MiraChartLayer {\n /** What the layer draws: the first `<ng-template>` in its own template. */\n readonly template = viewChild(TemplateRef)\n}\n","import { Directive, type Signal, computed, input, model } from '@angular/core'\n\nimport { MiraChartLayer } from './chart-layer'\n\n/** The shape that marks a series in the legend, in the series' color. */\nexport type LegendIcon = 'circle' | 'line' | 'square'\n\n/**\n * A layer that plots the values under a key of the chart's data: a line or\n * bars now, areas later. The chart fits its y axis to the values of all its\n * series that aren't hidden, whatever kind they are.\n *\n * A series extends this class, and provides itself under it as well as under\n * {@link MiraChartLayer}. It also implements `color`, the color it's drawn\n * in.\n */\n@Directive()\nexport abstract class MiraSeries extends MiraChartLayer {\n /** The key of the values to plot. */\n readonly dataKey = input.required<string>()\n\n /**\n * What the tooltip and the legend call the series. Unset, they call it by\n * its `dataKey`.\n */\n readonly name = input<string>()\n\n /**\n * Whether the series is hidden: the chart doesn't draw it, fits its y axis\n * to the series that aren't, and leaves it out of the tooltip; the bars of\n * the visible series share its room in the band. Shown by default. A click\n * on its item in a toggleable legend toggles it. Write `[hidden]=\"true\"`,\n * not a bare `hidden`, to start hidden, or `[(hidden)]` to keep the state in\n * your app. An app that sets the state after a click binds it both ways: a\n * one-way binding takes effect only when its own value changes, so setting\n * the value it last set does nothing.\n */\n readonly hidden = model(false)\n\n /** What the series is called: its `name`, or its `dataKey` without one. */\n readonly displayName = computed(() => this.name() ?? this.dataKey())\n\n /**\n * The shape that marks the series in the legend: `'line'` for a line,\n * `'square'` for bars, and `'circle'` by default. A series of your own picks\n * the shape that looks like what it draws by overriding the field:\n * `override readonly legendIcon: LegendIcon = 'square'`.\n */\n readonly legendIcon: LegendIcon = 'circle'\n\n /**\n * The color the series is drawn in: a line's `stroke`, a bar's `fill`. The\n * tooltip marks the series' value with it, and the legend its name.\n */\n abstract readonly color: Signal<string>\n}\n","/**\n * Styles every chart takes: the colors its layers draw with, for a light page\n * and a dark one. The layers read the `--_mira-*` properties set here; an app\n * sets the `--mira-*` ones (see `MiraCartesianChart`).\n *\n * Browsers without `light-dark()` (Chrome before 123, Firefox before 120,\n * Safari before 17.5) take the light colors.\n *\n * @internal\n */\nexport const CHART_THEME = `\n :host {\n --_mira-axis-color: var(--mira-axis-color, #666);\n --_mira-grid-color: var(--mira-grid-color, #ccc);\n --_mira-background: var(--mira-background, #fff);\n --_mira-cursor-color: var(--mira-cursor-color, #999);\n }\n\n @supports (color: light-dark(#000, #fff)) {\n :host {\n --_mira-axis-color: var(--mira-axis-color, light-dark(#666, #999));\n --_mira-grid-color: var(--mira-grid-color, light-dark(#ccc, #333));\n --_mira-background: var(--mira-background, Canvas);\n --_mira-cursor-color: var(--mira-cursor-color, light-dark(#999, #666));\n }\n }\n`\n","import type { ChartDatum } from '../types'\n\n/** @internal */\nexport function valueAt(datum: ChartDatum, key: string): unknown {\n return (datum as Record<string, unknown>)[key]\n}\n\n/**\n * The value under `key` as a number to plot, or null when there's nothing to\n * plot there: no value, null, NaN, or something other than a number.\n *\n * @internal\n */\nexport function numberAt(datum: ChartDatum, key: string): number | null {\n const value = valueAt(datum, key)\n\n return typeof value === 'number' && Number.isFinite(value) ? value : null\n}\n\n/**\n * The smallest and the largest number under the keys, across the data, or\n * null when there's no number at all.\n *\n * @internal\n */\nexport function extentOf(\n data: readonly ChartDatum[],\n keys: readonly string[],\n): [number, number] | null {\n let min = Infinity\n let max = -Infinity\n\n for (const datum of data) {\n for (const key of keys) {\n const value = numberAt(datum, key)\n\n if (value === null) continue\n\n min = Math.min(min, value)\n max = Math.max(max, value)\n }\n }\n\n return min <= max ? [min, max] : null\n}\n","/**\n * Two ends of a stretch of numbers: values for a domain, px for a range.\n *\n * @internal\n */\nexport type Extent = readonly [number, number]\n\n/**\n * Round ticks over a domain, and the domain rounded out to them.\n *\n * @internal\n */\nexport type LinearTicks = {\n readonly domain: Extent\n readonly ticks: readonly number[]\n}\n\n/**\n * Bands of one width side by side: the middle of each, in order, and the\n * width they share.\n *\n * @internal\n */\nexport type Bands = {\n readonly positions: readonly number[]\n readonly bandwidth: number\n}\n\n// Where a raw step moves up to the next round one: 1, 2, 5 or 10 times a\n// power of ten, whichever is closest. The thresholds of d3-array's ticks().\nconst E10 = Math.sqrt(50)\nconst E5 = Math.sqrt(10)\nconst E2 = Math.sqrt(2)\n\n// Rounding the domain out can change the step, which rounds it out again.\n// d3-scale's nice() gives up after as many rounds.\nconst MAX_NICE_ROUNDS = 10\n\n/**\n * Maps a value from the domain onto the range, in a straight line.\n *\n * @internal\n */\nexport function linearScale(\n domain: Extent,\n range: Extent,\n): (value: number) => number {\n const [d0, d1] = domain\n const [r0, r1] = range\n const k = d1 === d0 ? 0 : (r1 - r0) / (d1 - d0)\n\n return (value) => r0 + (value - d0) * k\n}\n\n/**\n * Picks about `count` ticks on round values (1, 2 or 5 times a power of ten\n * apart) and rounds the domain out to them, so the axis starts and ends on a\n * tick. A domain of a single value widens to that value plus one.\n *\n * @internal\n */\nexport function linearTicks([min, max]: Extent, count: number): LinearTicks {\n if (!Number.isFinite(min) || !Number.isFinite(max)) {\n return { domain: [0, 1], ticks: [] }\n }\n\n let domain: Extent = max > min ? [min, max] : [min, min + 1]\n let increment = 0\n\n for (let round = 0; round < MAX_NICE_ROUNDS; round++) {\n const next = tickIncrement(domain, count)\n\n if (next === increment) break\n\n increment = next\n domain = roundOut(domain, increment)\n }\n\n return { domain, ticks: ticksBetween(domain, increment) }\n}\n\n/**\n * Spreads `count` points over the range, the first at its start and the last\n * at its end. A single point sits in the middle.\n *\n * @internal\n */\nexport function pointPositions(count: number, range: Extent): number[] {\n const [start, end] = range\n\n if (count === 1) return [(start + end) / 2]\n\n const step = (end - start) / (count - 1)\n\n return Array.from({ length: count }, (_, index) => start + index * step)\n}\n\n/**\n * Splits the range into `count` bands of one width, edge to edge, from its\n * start to its end: a band per category, for its bars to share. What\n * d3-scale's scaleBand does with no padding: the gaps between the bars are\n * theirs to leave.\n *\n * @internal\n */\nexport function bandPositions(count: number, range: Extent): Bands {\n const [start, end] = range\n const step = count > 0 ? (end - start) / count : 0\n\n return {\n positions: Array.from(\n { length: count },\n (_, index) => start + (index + 0.5) * step,\n ),\n // A range that runs backwards has bands as wide.\n bandwidth: Math.abs(step),\n }\n}\n\n/**\n * The index of the position nearest `x`, the lower one on a tie; null for no\n * positions. The positions go up, as they do from {@link pointPositions} and\n * {@link bandPositions} over a range that runs forward.\n *\n * @internal\n */\nexport function nearestIndex(\n positions: readonly number[],\n x: number,\n): number | null {\n if (positions.length === 0) return null\n\n // The first position at or past x, or the last one.\n let low = 0\n let high = positions.length - 1\n\n while (low < high) {\n const middle = (low + high) >> 1\n\n if (positions[middle] < x) low = middle + 1\n else high = middle\n }\n\n return low > 0 && x - positions[low - 1] <= positions[low] - x ? low - 1 : low\n}\n\n/*\n * The step between round ticks as a whole number: the step itself when it's\n * 1 or more, minus its inverse when it's less (-10 for 0.1). Whole numbers\n * keep the ticks exact: 3 / 10 is 0.3, where 3 * 0.1 is 0.30000000000000004.\n * The same rule as d3-array's tickIncrement().\n */\nfunction tickIncrement([min, max]: Extent, count: number): number {\n const raw = (max - min) / Math.max(1, count || 1)\n const power = Math.floor(Math.log10(raw))\n const error = raw / 10 ** power\n const factor = error >= E10 ? 10 : error >= E5 ? 5 : error >= E2 ? 2 : 1\n\n return power >= 0 ? factor * 10 ** power : -(10 ** -power) / factor\n}\n\nfunction roundOut([min, max]: Extent, increment: number): Extent {\n if (increment > 0) {\n return [\n Math.floor(min / increment) * increment,\n Math.ceil(max / increment) * increment,\n ]\n }\n\n const inverse = -increment\n\n return [\n Math.floor(min * inverse) / inverse,\n Math.ceil(max * inverse) / inverse,\n ]\n}\n\nfunction ticksBetween([min, max]: Extent, increment: number): number[] {\n const ticks: number[] = []\n\n if (increment > 0) {\n for (let i = Math.ceil(min / increment); i * increment <= max; i++) {\n ticks.push(i * increment)\n }\n } else {\n const inverse = -increment\n\n for (let i = Math.ceil(min * inverse); i / inverse <= max; i++) {\n ticks.push(i / inverse)\n }\n }\n\n return ticks\n}\n","import type { Signal } from '@angular/core'\n\nimport type { MiraSeries } from '../series'\nimport type { ChartDatum, ChartSize } from '../types'\nimport type { Point } from '../utils/path'\nimport type { LegendPosition } from './legend'\n\n/**\n * The rectangle the series are drawn in: the chart less its margin and the\n * room its axes and its legend take, in px within the chart's svg.\n */\nexport type PlotArea = {\n readonly left: number\n readonly top: number\n readonly width: number\n readonly height: number\n}\n\n/** A tick on the y axis: its value, and its y in px within the chart's svg. */\nexport type Tick = {\n readonly value: number\n readonly offset: number\n}\n\n/** The datum under the pointer, and where it is. */\nexport type ActiveDatum = {\n /** Its index in the data. */\n readonly index: number\n /** The row itself. */\n readonly datum: ChartDatum\n /** Its x in px within the chart's svg. */\n readonly x: number\n /** Its label along x. */\n readonly label: string\n}\n\n/**\n * About how many ticks the y scale aims for, unless the y axis asks for\n * another number.\n *\n * @internal\n */\nexport const DEFAULT_TICK_COUNT = 5\n\n/**\n * What the parts of a chart with an x and a y axis, its layers, its tooltip\n * and its legend, draw by: the data, the series, the size, the plot area, the\n * scales, the labels along x, and the pointer and the datum under it. Every\n * kind of chart provides itself under it, with `provideCartesianChart`, and\n * the library's own parts inject it: they can't import the chart, which\n * imports the axes to leave room for them. The way Angular Material's tabs\n * inject `MAT_TAB_GROUP`.\n *\n * @internal\n */\nexport abstract class CartesianContext {\n /** The rows to plot. */\n abstract readonly data: Signal<readonly ChartDatum[]>\n /** The series, of whatever kind, in the order they're written, hidden too. */\n abstract readonly series: Signal<readonly MiraSeries[]>\n /** The series that aren't hidden, in the order they're written. */\n abstract readonly visibleSeries: Signal<readonly MiraSeries[]>\n /** The size the chart draws at, in px. */\n abstract readonly size: Signal<ChartSize>\n /** Where the series are drawn. */\n abstract readonly plot: Signal<PlotArea>\n /** Maps a value to its y. */\n abstract readonly yScale: Signal<(value: number) => number>\n /** Round values over the y scale, for the y axis and the grid to mark. */\n abstract readonly yTicks: Signal<readonly Tick[]>\n /** The x of each datum, in the order of the data. */\n abstract readonly xPositions: Signal<readonly number[]>\n /** The label of each datum along x, in the order of the data. */\n abstract readonly xLabels: Signal<readonly string[]>\n /**\n * The width of each datum's band along x, centered on its x. Only a chart\n * with a band per datum has it, as the bar chart does: in a line chart, each\n * datum is a point.\n */\n abstract readonly xBandwidth?: Signal<number>\n /** Where the pointer last moved over the svg, in its px, or null. */\n abstract readonly pointer: Signal<Point | null>\n /** The index of the datum under the pointer, or null. */\n abstract readonly activeIndex: Signal<number | null>\n /** The datum under the pointer and where it is, or null. */\n abstract readonly active: Signal<ActiveDatum | null>\n}\n\n/**\n * The legend as the chart sees it: the edge it sits along, and the room it\n * takes there. The legend provides itself under it, so the chart finds it\n * without importing it, and an app without a legend doesn't ship one.\n *\n * @internal\n */\nexport abstract class ChartLegend {\n /** The edge of the chart the legend sits along. */\n abstract readonly position: Signal<LegendPosition>\n /** The room it takes from the chart along that edge, in px. */\n abstract readonly room: Signal<number>\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n forwardRef,\n inject,\n input,\n numberAttribute,\n} from '@angular/core'\n\nimport { MiraChartLayer } from '../chart-layer'\nimport { CartesianContext } from './cartesian-context'\n\n/**\n * The category axis under the plot: a tick per datum, labelled with the\n * datum's value under `dataKey`. Its line runs at zero, where values rise and\n * fall from; the ticks and labels stay under the plot, clear of values below\n * zero.\n *\n * @example\n * ```html\n * <mira-x-axis dataKey=\"month\" />\n * ```\n */\n@Component({\n selector: 'mira-x-axis',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n { provide: MiraChartLayer, useExisting: forwardRef(() => MiraXAxis) },\n ],\n template: `\n <ng-template>\n <svg:g class=\"mira-x-axis\">\n <svg:line\n [attr.x1]=\"chart.plot().left\"\n [attr.x2]=\"chart.plot().left + chart.plot().width\"\n [attr.y1]=\"baseline()\"\n [attr.y2]=\"baseline()\"\n />\n @for (tick of ticks(); track $index) {\n <svg:g\n [attr.transform]=\"'translate(' + tick.offset + ',' + bottom() + ')'\"\n >\n <svg:line y2=\"6\" />\n <svg:text y=\"9\" dy=\"0.71em\" text-anchor=\"middle\">\n {{ tick.label }}\n </svg:text>\n </svg:g>\n }\n </svg:g>\n </ng-template>\n `,\n styles: `\n .mira-x-axis {\n font-size: 12px;\n }\n\n line {\n stroke: var(--_mira-axis-color);\n }\n\n text {\n fill: var(--_mira-axis-color);\n }\n `,\n})\nexport class MiraXAxis extends MiraChartLayer {\n /** The key of each datum's category. Without one, the ticks show indexes. */\n readonly dataKey = input<string>()\n /** The room the axis takes under the plot, in px: 30 by default. */\n readonly height = input(30, { transform: numberAttribute })\n\n protected readonly chart = inject(CartesianContext)\n // Where the ticks and labels hang from: the bottom of the plot.\n protected readonly bottom = computed(\n () => this.chart.plot().top + this.chart.plot().height,\n )\n\n // Where the axis line runs: at zero, kept on the plot.\n protected readonly baseline = computed(() => {\n const zero = this.chart.yScale()(0)\n\n return Math.min(this.bottom(), Math.max(this.chart.plot().top, zero))\n })\n\n // A tick at each datum, with its label: the chart makes the labels from\n // the `dataKey` of its x axis.\n protected readonly ticks = computed(() => {\n const xs = this.chart.xPositions()\n\n return this.chart\n .xLabels()\n .map((label, index) => ({ offset: xs[index], label }))\n })\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n LOCALE_ID,\n computed,\n forwardRef,\n inject,\n input,\n numberAttribute,\n} from '@angular/core'\n\nimport { MiraChartLayer } from '../chart-layer'\nimport {\n CartesianContext,\n DEFAULT_TICK_COUNT,\n type Tick,\n} from './cartesian-context'\n\n/**\n * The value axis left of the plot. It fits the values of every series in the\n * chart that isn't hidden, and zero, rounded out to round ticks. The ticks\n * read as numbers in the app's locale (`LOCALE_ID`).\n *\n * @example\n * ```html\n * <mira-y-axis [tickCount]=\"4\" />\n * ```\n */\n@Component({\n selector: 'mira-y-axis',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n { provide: MiraChartLayer, useExisting: forwardRef(() => MiraYAxis) },\n ],\n template: `\n <ng-template>\n <svg:g class=\"mira-y-axis\">\n <svg:line\n [attr.x1]=\"x()\"\n [attr.x2]=\"x()\"\n [attr.y1]=\"chart.plot().top\"\n [attr.y2]=\"chart.plot().top + chart.plot().height\"\n />\n @for (tick of ticks(); track tick.value) {\n <svg:g\n [attr.transform]=\"'translate(' + x() + ',' + tick.offset + ')'\"\n >\n <svg:line x2=\"-6\" />\n <svg:text x=\"-9\" dy=\"0.32em\" text-anchor=\"end\">\n {{ tick.label }}\n </svg:text>\n </svg:g>\n }\n </svg:g>\n </ng-template>\n `,\n styles: `\n .mira-y-axis {\n font-size: 12px;\n }\n\n line {\n stroke: var(--_mira-axis-color);\n }\n\n text {\n fill: var(--_mira-axis-color);\n }\n `,\n})\nexport class MiraYAxis extends MiraChartLayer {\n /** The room the axis takes left of the plot, in px: 60 by default. */\n readonly width = input(60, { transform: numberAttribute })\n\n /**\n * About how many ticks to show, 5 by default. The axis keeps its ticks 1, 2\n * or 5 times a power of ten apart, so it may show a few more or a few fewer.\n */\n readonly tickCount = input(DEFAULT_TICK_COUNT, {\n transform: numberAttribute,\n })\n\n protected readonly chart = inject(CartesianContext)\n protected readonly x = computed(() => this.chart.plot().left)\n protected readonly ticks = computed(() => {\n const ticks = this.chart.yTicks()\n const format = this.#format(ticks)\n\n return ticks.map((tick) => ({ ...tick, label: format(tick.value) }))\n })\n\n readonly #locale = inject(LOCALE_ID)\n\n // As many decimals as the step between the ticks has: 2,000 but 0.5.\n #format(ticks: readonly Tick[]): (value: number) => string {\n const step =\n ticks.length > 1 ? Math.abs(ticks[1].value - ticks[0].value) : 1\n const digits = Math.max(0, -Math.floor(Math.log10(step)))\n const format = new Intl.NumberFormat(this.#locale, {\n maximumFractionDigits: digits,\n })\n\n return (value) => format.format(value)\n }\n}\n","import {\n DestroyRef,\n Directive,\n ElementRef,\n type Signal,\n afterNextRender,\n computed,\n contentChild,\n contentChildren,\n inject,\n input,\n numberAttribute,\n signal,\n viewChild,\n} from '@angular/core'\n\nimport { MiraChartLayer } from '../chart-layer'\nimport { MiraSeries } from '../series'\nimport { CHART_THEME } from '../theme'\nimport type { ChartDatum, ChartMargin, ChartSize } from '../types'\nimport { extentOf, valueAt } from '../utils/data'\nimport type { Point } from '../utils/path'\nimport { linearScale, linearTicks, nearestIndex } from '../utils/scale'\nimport {\n type ActiveDatum,\n type CartesianContext,\n ChartLegend,\n DEFAULT_TICK_COUNT,\n type PlotArea,\n type Tick,\n} from './cartesian-context'\nimport { MiraXAxis } from './x-axis'\nimport { MiraYAxis } from './y-axis'\n\n/**\n * The template of every chart with an x and a y axis: an svg with the\n * chart's layers in it, less the hidden series, in the order they're\n * written, each in an outlet of its own; and over the svg, the chart's\n * content itself, for what it shows in HTML, such as the tooltip and the\n * legend. A chart that takes it imports `LayerOutlet`.\n *\n * @internal\n */\nexport const CARTESIAN_CHART_TEMPLATE = `\n <div class=\"mira-chart\">\n <svg\n #svg\n role=\"img\"\n [attr.width]=\"size().width\"\n [attr.height]=\"size().height\"\n [attr.viewBox]=\"viewBox()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n >\n @for (layer of drawnLayers(); track layer) {\n <svg:g [miraLayerOutlet]=\"layer.template()\" />\n }\n </svg>\n <div class=\"mira-chart-overlay\">\n <ng-content />\n </div>\n </div>\n`\n\n/**\n * The styles of every chart with an x and a y axis, its theme among them.\n *\n * @internal\n */\nexport const CARTESIAN_CHART_STYLES = [\n CHART_THEME,\n `\n /* The svg and the content laid over it share a cell, which is as big as\n the svg, in a page that runs right to left as well: the content takes\n the svg's px, and the svg itself isn't positioned, so it isn't drawn\n over the positioned parts of the page around it. */\n .mira-chart {\n display: grid;\n width: fit-content;\n }\n\n .mira-chart > * {\n grid-area: 1 / 1;\n }\n\n svg {\n display: block;\n }\n\n /* Positioned, so its HTML can be placed in the svg's px, and clear for\n the pointer, which the svg tracks. Isolated, so what's stacked in it,\n the tooltip over the legend, stays stacked within the chart. */\n .mira-chart-overlay {\n position: relative;\n pointer-events: none;\n isolation: isolate;\n }\n `,\n]\n\nconst DEFAULT_MARGIN: ChartMargin = { top: 10, right: 20, bottom: 10, left: 10 }\n\n// The size a chart draws at until it can measure its container: on the\n// server, in the browser's first frame, and while it's hidden.\nconst FALLBACK_SIZE: ChartSize = { width: 600, height: 300 }\n\n/**\n * What every chart with an x and a y axis has, whatever its series: data, a\n * size, a margin, the plot area they leave, a y scale that fits the values of\n * its visible series, a label for each datum, and the pointer and the datum\n * under it. Nothing about a kind of chart: a line chart extends it with a\n * point per datum along x, and a bar chart with a band per datum.\n *\n * Inject it in a layer of your own ({@link MiraChartLayer}) to draw where the\n * series are, or in a component of your own that shows something in HTML:\n * what isn't a layer in the chart's content is laid over the svg, in the\n * svg's px, and lets the pointer through to it, as `<mira-tooltip>` is.\n *\n * Its colors are CSS custom properties, to set anywhere above the chart:\n *\n * - `--mira-axis-color`: the axes' lines and labels;\n * - `--mira-grid-color`: the grid, and the tooltip's border unless it has one\n * of its own;\n * - `--mira-cursor-color`: the cursor at the datum under the pointer, a line\n * or, in a chart with bands, a band in the same color at 25% opacity;\n * - `--mira-background`: what's behind the chart, for the ring around a dot\n * under the pointer, and the tooltip's box unless it has one of its own.\n * `Canvas` by default, the browser's own background for the scheme: set it\n * wherever what's behind the chart has another color, a card or the page\n * itself.\n *\n * Unset, they suit the `color-scheme` the chart is in: light by default, dark\n * under `color-scheme: dark`, and the system's under `light dark`. A line's\n * own color is its `stroke`, and a bar's its `fill`.\n */\n@Directive({\n host: {\n '[style.display]': '\"block\"',\n // Fills a container that has a height. In one without, the chart is as\n // tall as it draws itself.\n '[style.height]': 'height() === undefined ? \"100%\" : null',\n },\n})\nexport abstract class MiraCartesianChart implements CartesianContext {\n /** The rows to plot, a `ChartDatum` each. */\n readonly data = input<readonly ChartDatum[]>([])\n /** The width in px. Without it, the chart is as wide as its container. */\n readonly width = input<number | undefined, unknown>(undefined, {\n transform: optionalNumber,\n })\n\n /**\n * The height in px. Without it, the chart is as tall as its container, or\n * 300px in a container without a height.\n */\n readonly height = input<number | undefined, unknown>(undefined, {\n transform: optionalNumber,\n })\n\n /**\n * Overrides some sides of the default margin: 10px, and 20px on the right.\n */\n readonly margin = input<Partial<ChartMargin>>({})\n /** What the chart shows, for screen readers. */\n readonly ariaLabel = input<string>()\n\n /** The size the chart draws at, in px: its inputs, or its container's. */\n readonly size = computed<ChartSize>(\n () => {\n const measured = this.#measured()\n\n // A size of 0 means the chart is hidden, or its container has no height:\n // drawing at 0 would keep it at 0 once it shows.\n return {\n width: this.width() ?? (measured?.width || FALLBACK_SIZE.width),\n height: this.height() ?? (measured?.height || FALLBACK_SIZE.height),\n }\n },\n { equal: sameSize },\n )\n\n /**\n * Where the series are drawn: the chart less its margin, its axes and its\n * legend.\n */\n readonly plot = computed<PlotArea>(() => {\n const { width, height } = this.size()\n const margin = { ...DEFAULT_MARGIN, ...this.margin() }\n const legend = this.legend()\n\n // The legend takes its room at the edge it sits along, outside the margin.\n if (legend) margin[legend.position()] += legend.room()\n\n const left = margin.left + (this.yAxis()?.width() ?? 0)\n const bottom = margin.bottom + (this.xAxis()?.height() ?? 0)\n\n return {\n left,\n top: margin.top,\n width: Math.max(0, width - left - margin.right),\n height: Math.max(0, height - margin.top - bottom),\n }\n })\n\n /** Maps a value to its y. */\n readonly yScale = computed(() => {\n const { top, height } = this.plot()\n\n return linearScale(this.#yNice().domain, [top + height, top])\n })\n\n /** Round values over the y scale, for the y axis and the grid to mark. */\n readonly yTicks = computed<readonly Tick[]>(() => {\n const scale = this.yScale()\n\n return this.#yNice().ticks.map((value) => ({ value, offset: scale(value) }))\n })\n\n /**\n * The label of each datum along x, in the order of the data: its value\n * under the x axis's `dataKey`, or its index without one. The x axis marks\n * its ticks with them, and the tooltip titles its box with one.\n */\n readonly xLabels = computed<readonly string[]>(() => {\n const key = this.xAxis()?.dataKey()\n\n return this.data().map((datum, index) =>\n key === undefined ? String(index) : String(valueAt(datum, key) ?? ''),\n )\n })\n\n /**\n * Where the pointer last moved over the svg, in the svg's px, or null once\n * it's left. It's placed again when the chart resizes under a pointer that\n * stays put, but not when the chart moves under it, as when the page\n * scrolls: then it waits for the pointer to move.\n */\n readonly pointer = computed(() => this.#pointer())\n\n /**\n * The index of the datum nearest the pointer along x, or null while the\n * pointer is off the plot. It follows the data and the size as they change\n * under a pointer that stays put.\n */\n readonly activeIndex = computed(() => {\n const pointer = this.#pointer()\n\n if (!pointer) return null\n\n const { left, top, width, height } = this.plot()\n const onPlot =\n pointer.x >= left &&\n pointer.x <= left + width &&\n pointer.y >= top &&\n pointer.y <= top + height\n\n if (!onPlot) return null\n\n return nearestIndex(this.xPositions(), pointer.x)\n })\n\n /**\n * The datum under the pointer: its index, the row itself, its x and its\n * label; or null while the pointer is off the plot.\n */\n readonly active = computed<ActiveDatum | null>(() => {\n const index = this.activeIndex()\n\n return index === null\n ? null\n : {\n index,\n datum: this.data()[index],\n x: this.xPositions()[index],\n label: this.xLabels()[index],\n }\n })\n\n /** The series, of whatever kind, in the order they're written, hidden too. */\n readonly series = contentChildren(MiraSeries)\n\n /**\n * The series that aren't hidden, in the order they're written: the y axis\n * fits their values, and the tooltip shows them.\n */\n readonly visibleSeries = computed<readonly MiraSeries[]>(() =>\n this.series().filter((series) => !series.hidden()),\n )\n\n /** The x of each datum, in the order of the data: the kind of chart's call. */\n abstract readonly xPositions: Signal<readonly number[]>\n\n /** The chart's layers, in the order they're written. */\n protected readonly layers = contentChildren(MiraChartLayer)\n\n /** What the chart draws: its layers, less the hidden series. */\n protected readonly drawnLayers = computed<readonly MiraChartLayer[]>(() =>\n this.layers().filter(\n (layer) => !(layer instanceof MiraSeries && layer.hidden()),\n ),\n )\n\n /** The chart's axes, if it has them: the plot leaves room for them. */\n protected readonly xAxis = contentChild(MiraXAxis, { descendants: false })\n protected readonly yAxis = contentChild(MiraYAxis, { descendants: false })\n /** The chart's legend, if it has one: the plot leaves room for it too. */\n protected readonly legend = contentChild(ChartLegend, { descendants: false })\n /** The chart's svg, where the pointer is tracked. */\n protected readonly svg = viewChild.required<ElementRef<SVGSVGElement>>('svg')\n\n protected readonly viewBox = computed(() => {\n const { width, height } = this.size()\n\n return `0 0 ${width} ${height}`\n })\n\n // The size of the chart's element, as the browser last laid it out.\n readonly #measured = signal<ChartSize | null>(null, { equal: sameSize })\n // The pointer in the svg's own px, while it's over the svg.\n readonly #pointer = signal<Point | null>(null)\n\n // The values of every visible series, and zero, rounded out to round ticks.\n readonly #yNice = computed(() => {\n const keys = this.visibleSeries().map((series) => series.dataKey())\n const [min, max] = extentOf(this.data(), keys) ?? [0, 0]\n const count = this.yAxis()?.tickCount() ?? DEFAULT_TICK_COUNT\n\n return linearTicks([Math.min(0, min), Math.max(0, max)], count)\n })\n\n /** @internal */\n constructor() {\n const element = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement\n const destroyRef = inject(DestroyRef)\n\n // In the browser only: on the server there's no layout to measure, and no\n // pointer.\n afterNextRender(() => {\n const svg = this.svg().nativeElement\n // The pointer's last place on the page: the svg can resize under a\n // pointer that stays put.\n let client: Point | null = null\n\n const observer = new ResizeObserver(([entry]) => {\n const { width, height } = entry.contentRect\n\n // Whole px, so a fraction of a px can't nudge the layout back and forth.\n this.#measured.set({\n width: Math.floor(width),\n height: Math.floor(height),\n })\n\n if (client) this.#pointer.set(this.#inSvg(client))\n })\n\n // Listened to outside the template, where every event would check the\n // chart again: here, a pointer moving about the same datum re-runs no\n // template, as the active index doesn't change.\n const listening = new AbortController()\n const options = { signal: listening.signal }\n const track = (event: PointerEvent): void => {\n client = { x: event.clientX, y: event.clientY }\n this.#pointer.set(this.#inSvg(client))\n }\n const leave = (): void => {\n client = null\n this.#pointer.set(null)\n }\n\n observer.observe(element)\n svg.addEventListener('pointermove', track, options)\n svg.addEventListener('pointerdown', track, options)\n svg.addEventListener('pointerleave', leave, options)\n\n destroyRef.onDestroy(() => {\n observer.disconnect()\n listening.abort()\n })\n })\n }\n\n // A point on the page, in the svg's own px, whatever scales the svg there.\n #inSvg(client: Point): Point | null {\n const matrix = this.svg().nativeElement.getScreenCTM()\n\n if (!matrix) return null\n\n const { x, y } = new DOMPoint(client.x, client.y).matrixTransform(\n matrix.inverse(),\n )\n\n return { x, y }\n }\n}\n\nfunction sameSize(a: ChartSize | null, b: ChartSize | null): boolean {\n return a?.width === b?.width && a?.height === b?.height\n}\n\n// Takes `width=\"640\"` as well as `[width]=\"640\"`, and no value at all. A value\n// that isn't a number, like `width=\"auto\"`, counts as none.\nfunction optionalNumber(value: unknown): number | undefined {\n if (value == null || value === '') return undefined\n\n const number = numberAttribute(value)\n\n return Number.isNaN(number) ? undefined : number\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n booleanAttribute,\n forwardRef,\n inject,\n input,\n} from '@angular/core'\n\nimport { MiraChartLayer } from '../chart-layer'\nimport { CartesianContext } from './cartesian-context'\n\n/**\n * Grid lines across the plot: across at the ticks of the y scale, and down\n * at each datum. Write it before the series, so they're drawn over it.\n *\n * @example\n * ```html\n * <mira-cartesian-grid strokeDasharray=\"3 3\" [vertical]=\"false\" />\n * ```\n */\n@Component({\n selector: 'mira-cartesian-grid',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: MiraChartLayer,\n useExisting: forwardRef(() => MiraCartesianGrid),\n },\n ],\n template: `\n <ng-template>\n <svg:g\n class=\"mira-cartesian-grid\"\n [attr.stroke-dasharray]=\"strokeDasharray() ?? null\"\n >\n @if (horizontal()) {\n @for (tick of chart.yTicks(); track tick.value) {\n <svg:line\n [attr.x1]=\"chart.plot().left\"\n [attr.x2]=\"chart.plot().left + chart.plot().width\"\n [attr.y1]=\"tick.offset\"\n [attr.y2]=\"tick.offset\"\n />\n }\n }\n @if (vertical()) {\n @for (x of chart.xPositions(); track $index) {\n <svg:line\n [attr.x1]=\"x\"\n [attr.x2]=\"x\"\n [attr.y1]=\"chart.plot().top\"\n [attr.y2]=\"chart.plot().top + chart.plot().height\"\n />\n }\n }\n </svg:g>\n </ng-template>\n `,\n styles: `\n line {\n stroke: var(--_mira-grid-color);\n }\n `,\n})\nexport class MiraCartesianGrid extends MiraChartLayer {\n /** Lines across, at the ticks of the y scale. On by default. */\n readonly horizontal = input(true, { transform: booleanAttribute })\n /** Lines down, at each datum. On by default. */\n readonly vertical = input(true, { transform: booleanAttribute })\n /** Dashes the lines, as the svg attribute does: `\"3 3\"`. */\n readonly strokeDasharray = input<string>()\n\n protected readonly chart = inject(CartesianContext)\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n forwardRef,\n inject,\n} from '@angular/core'\n\nimport { MiraChartLayer } from '../chart-layer'\nimport { CartesianContext } from './cartesian-context'\n\n// What the cursor draws. A type of its own, so the template can't take a\n// field of one shape for the other.\ntype CursorShape =\n | {\n readonly kind: 'line'\n readonly x: number\n readonly top: number\n readonly bottom: number\n }\n | {\n readonly kind: 'band'\n readonly x: number\n readonly y: number\n readonly width: number\n readonly height: number\n }\n\n/**\n * Marks the datum under the pointer across the plot: a vertical line at its\n * x, or its whole band in a chart with bands, such as the bar chart. Write it\n * after the grid and before the series, so it's drawn between them.\n *\n * @example\n * ```html\n * <mira-line-chart [data]=\"day\">\n * <mira-cartesian-grid />\n * <mira-cursor />\n * <mira-line dataKey=\"solar\" />\n * </mira-line-chart>\n * ```\n */\n@Component({\n selector: 'mira-cursor',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n { provide: MiraChartLayer, useExisting: forwardRef(() => MiraCursor) },\n ],\n template: `\n <ng-template>\n @if (shape(); as shape) {\n @if (shape.kind === 'band') {\n <svg:rect\n class=\"mira-cursor-band\"\n [attr.x]=\"shape.x\"\n [attr.y]=\"shape.y\"\n [attr.width]=\"shape.width\"\n [attr.height]=\"shape.height\"\n />\n } @else {\n <svg:line\n class=\"mira-cursor\"\n [attr.x1]=\"shape.x\"\n [attr.x2]=\"shape.x\"\n [attr.y1]=\"shape.top\"\n [attr.y2]=\"shape.bottom\"\n />\n }\n }\n </ng-template>\n `,\n styles: `\n /* The pointer goes through, to whatever is drawn under the cursor. */\n .mira-cursor,\n .mira-cursor-band {\n pointer-events: none;\n }\n\n .mira-cursor {\n stroke: var(--_mira-cursor-color);\n }\n\n /* The line's color, faint: the grid shows through, and it doesn't vie\n with the bars. */\n .mira-cursor-band {\n fill: var(--_mira-cursor-color);\n fill-opacity: 0.25;\n }\n `,\n})\nexport class MiraCursor extends MiraChartLayer {\n // What to draw while the pointer is on the plot: the datum's band where the\n // chart has bands, a line at its x where each datum is a point.\n protected readonly shape = computed<CursorShape | null>(() => {\n const active = this.#chart.active()\n\n if (active === null) return null\n\n const { x } = active\n const { top, height } = this.#chart.plot()\n const bandwidth = this.#chart.xBandwidth?.()\n\n return bandwidth === undefined\n ? { kind: 'line', x, top, bottom: top + height }\n : { kind: 'band', x: x - bandwidth / 2, y: top, width: bandwidth, height }\n })\n\n readonly #chart = inject(CartesianContext)\n}\n","import { NgTemplateOutlet } from '@angular/common'\nimport {\n ChangeDetectionStrategy,\n Component,\n Directive,\n type ElementRef,\n LOCALE_ID,\n TemplateRef,\n afterRenderEffect,\n computed,\n contentChild,\n inject,\n signal,\n viewChild,\n} from '@angular/core'\n\nimport type { ChartDatum } from '../types'\nimport { numberAt } from '../utils/data'\nimport { CartesianContext } from './cartesian-context'\n\n// The room between the box and the datum beside it, and between the box and\n// the pointer, in px: it clears the halo around a line's active dot.\nconst GAP = 12\n\ntype Size = { readonly width: number; readonly height: number }\n\n/** A series' value at the datum under the pointer. */\nexport type TooltipItem = {\n /** What the series is called: its `name`, or its `dataKey` without one. */\n readonly name: string\n /** The key of the series' values. */\n readonly dataKey: string\n /** The value, as it is in the data. */\n readonly value: number\n /** The series' color. */\n readonly color: string\n}\n\n/**\n * What a template of your own for the tooltip gets (`MiraTooltipContent`):\n * the items as `let-items`, then `label`, `datum` and `index`.\n */\nexport type TooltipContext = {\n /**\n * A value for each visible series that has one at the datum, in the order\n * the series are written: the rows of the tooltip's own box. Never empty:\n * where no series has a value, the tooltip doesn't show.\n */\n readonly $implicit: readonly TooltipItem[]\n /** The datum's label along x: the title of the tooltip's own box. */\n readonly label: string\n /**\n * The datum itself, its row of the chart's data. It's typed as any row:\n * read a field of yours as `$any(datum).solar`, or in a method of yours that\n * knows the row's type.\n */\n readonly datum: ChartDatum\n /** The datum's index in the data. */\n readonly index: number\n}\n\n/**\n * Marks a template of your own for `<mira-tooltip>`. It replaces the whole\n * box, border and background too; the tooltip still places it, and shows it\n * while the datum under the pointer has a value in a visible series. Its\n * context is a `TooltipContext`, and typed: `let-items` holds a `TooltipItem`\n * for each visible series with a value at the datum, and `label`, `datum` and\n * `index` describe the datum.\n *\n * @example\n * ```html\n * <mira-tooltip>\n * <ng-template miraTooltipContent let-items let-label=\"label\">\n * <div class=\"my-tooltip\">\n * <b>{{ label }}</b>\n * <ul>@for (item of items; track $index) {\n * <li>{{ item.name }}: {{ item.value }} kW</li>\n * }</ul>\n * </div>\n * </ng-template>\n * </mira-tooltip>\n * ```\n */\n@Directive({ selector: 'ng-template[miraTooltipContent]' })\nexport class MiraTooltipContent {\n /**\n * Types the template's context, for Angular's template checks.\n *\n * @internal\n */\n static ngTemplateContextGuard(\n directive: MiraTooltipContent,\n context: unknown,\n ): context is TooltipContext {\n return true\n }\n}\n\n/**\n * Shows the values at the datum under the pointer, in a box beside it: the\n * datum's label along x, then a row for each visible series with a value\n * there, in the order the series are written. A row has the series' color, its\n * name and the value, as a number in the app's locale (`LOCALE_ID`), with\n * three decimals at most, or three digits of its own below 1: 0.0004 rather\n * than 0. Where no visible series has a value, the tooltip doesn't show.\n *\n * The box goes past the datum, or past the edge of its band in a chart with\n * bands: on its right where it fits, else on its left. It follows the pointer\n * up and down: below it where it fits, else above. Where it fits on neither\n * side, it's pressed onto the plot, over the datum; a box bigger than the\n * plot starts at its edge and runs past it.\n *\n * The box's text takes the chart's `color`. The rest are CSS custom\n * properties, to set anywhere above the tooltip:\n *\n * - `--mira-font-size`: the size of the text, `0.75rem` by default; the room\n * around the text follows it;\n * - `--mira-tooltip-background`: the box, the chart's `--mira-background` by\n * default;\n * - `--mira-tooltip-border-color`: its border, the chart's\n * `--mira-grid-color` by default.\n *\n * For a box of your own, write its template inside, as an `<ng-template\n * miraTooltipContent>`, and import `MiraTooltipContent` along with\n * `MiraTooltip`: without it, the template goes unnoticed, and the tooltip\n * shows its own box.\n *\n * @example\n * ```html\n * <mira-line-chart [data]=\"day\">\n * <mira-x-axis dataKey=\"hour\" />\n * <mira-y-axis />\n * <mira-line dataKey=\"solar\" name=\"Solar\" stroke=\"#d97706\" />\n * <mira-tooltip />\n * </mira-line-chart>\n * ```\n */\n@Component({\n selector: 'mira-tooltip',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [NgTemplateOutlet],\n template: `\n @if (context(); as context) {\n <div\n #frame\n class=\"mira-tooltip-frame\"\n [style.left.px]=\"position()?.left\"\n [style.top.px]=\"position()?.top\"\n >\n @if (template(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"context\"\n />\n } @else {\n <div class=\"mira-tooltip\">\n <div class=\"mira-tooltip-label\">{{ context.label }}</div>\n @for (row of rows(); track $index) {\n <span\n class=\"mira-tooltip-swatch\"\n [style.background]=\"row.color\"\n ></span>\n <span>{{ row.name }}</span>\n <span class=\"mira-tooltip-value\">{{ row.value }}</span>\n }\n </div>\n }\n </div>\n }\n `,\n styles: `\n /* Where the box goes, as big as the box, which is measured there to keep\n it on the plot. Over the legend, wherever either is written: a box\n bigger than the plot runs past it, onto the legend. */\n .mira-tooltip-frame {\n position: absolute;\n z-index: 1;\n width: max-content;\n }\n\n /* A grid, so the values line up from row to row, at its right edge. It\n sets no color of its own: a series in currentColor has the same color\n in its swatch as in the svg, unless a color is set on the tooltip or\n around it. */\n .mira-tooltip {\n display: grid;\n grid-template-columns: auto 1fr auto;\n column-gap: 0.5em;\n align-items: center;\n padding: 0.5em 0.75em;\n border: 1px solid\n var(--mira-tooltip-border-color, var(--_mira-grid-color));\n border-radius: 4px;\n /* What's behind the chart, but Canvas rather than the theme's white\n where light-dark() is missing: the text follows the page's scheme\n there, and the box has to as well. */\n background: var(\n --mira-tooltip-background,\n var(--mira-background, Canvas)\n );\n box-shadow: 0 2px 6px rgb(0 0 0 / 15%);\n font-size: var(--mira-font-size, 0.75rem);\n line-height: 1.6;\n }\n\n .mira-tooltip-label {\n grid-column: 1 / -1;\n }\n\n /* Kept in forced colors and in print, as the series keep theirs in the\n svg. */\n .mira-tooltip-swatch {\n width: 0.75em;\n height: 0.75em;\n border-radius: 50%;\n forced-color-adjust: none;\n print-color-adjust: exact;\n }\n\n .mira-tooltip-value {\n padding-inline-start: 0.75em;\n font-weight: 600;\n font-variant-numeric: tabular-nums;\n text-align: end;\n }\n `,\n})\nexport class MiraTooltip {\n // What the tooltip shows while a datum is under the pointer, as a template\n // of your own gets it; null where it has no value to show.\n protected readonly context = computed<TooltipContext | null>(() => {\n const active = this.#chart.active()\n\n if (active === null) return null\n\n const items = this.#chart.visibleSeries().flatMap((series) => {\n const value = numberAt(active.datum, series.dataKey())\n\n if (value === null) return []\n\n return {\n name: series.displayName(),\n dataKey: series.dataKey(),\n value,\n color: series.color(),\n }\n })\n\n if (items.length === 0) return null\n\n const { label, datum, index } = active\n\n return { $implicit: items, label, datum, index }\n })\n\n // The rows of the tooltip's own box: the items, with their values as text.\n protected readonly rows = computed(() =>\n (this.context()?.$implicit ?? []).map((item) => ({\n ...item,\n value: this.#format(item.value),\n })),\n )\n\n // A template of your own for the box, if there's one.\n protected readonly template = contentChild(MiraTooltipContent, {\n read: TemplateRef,\n })\n\n // Where the box goes, in the svg's px: beside the datum along x, beside the\n // pointer along y.\n protected readonly position = computed(() => {\n const active = this.#chart.active()\n const y = this.#pointerY()\n\n if (active === null || y === null) return null\n\n const { x } = active\n const { left, top, width, height } = this.#chart.plot()\n const size = this.#size()\n // From the datum's x to the edge of its band, where it has one.\n const half = (this.#chart.xBandwidth?.() ?? 0) / 2\n\n return {\n left: beside(x - half - GAP, x + half + GAP, size.width, left, width),\n top: beside(y - GAP, y + GAP, size.height, top, height),\n }\n })\n\n // The box, while it shows, to measure.\n protected readonly frame = viewChild<ElementRef<HTMLElement>>('frame')\n\n readonly #chart = inject(CartesianContext)\n // The box's size, as the browser last laid it out.\n readonly #size = signal<Size>(\n { width: 0, height: 0 },\n { equal: (a, b) => a.width === b.width && a.height === b.height },\n )\n\n readonly #locale = inject(LOCALE_ID)\n // At most three decimals, or, below 1, three digits of the value's own:\n // 0.0004 rather than 0.\n readonly #decimals = new Intl.NumberFormat(this.#locale, {\n maximumFractionDigits: 3,\n })\n\n readonly #digits = new Intl.NumberFormat(this.#locale, {\n maximumSignificantDigits: 3,\n })\n\n // The pointer's height while a datum is under it: a move along x within the\n // datum leaves it as it is, and the box where it is.\n readonly #pointerY = computed(() =>\n this.#chart.active() === null ? null : (this.#chart.pointer()?.y ?? null),\n )\n\n /** @internal */\n constructor() {\n // The box is measured after a render that changes what it shows, and\n // placed again before the page is painted: a new box shows where it fits.\n afterRenderEffect({\n earlyRead: () => {\n this.context()\n this.template()\n\n const frame = this.frame()?.nativeElement\n\n return frame ? sizeOf(frame) : null\n },\n write: (measured) => {\n const size = measured()\n\n if (size) this.#size.set(size)\n },\n })\n\n // And again whenever it changes size on its own, as a box of your own can\n // with an image that loads: then it's placed again a frame later.\n afterRenderEffect((onCleanup) => {\n const frame = this.frame()?.nativeElement\n\n if (!frame) return\n\n const observer = new ResizeObserver(() => this.#size.set(sizeOf(frame)))\n\n observer.observe(frame)\n onCleanup(() => observer.disconnect())\n })\n }\n\n #format(value: number): string {\n return (Math.abs(value) < 1 ? this.#digits : this.#decimals).format(value)\n }\n}\n\n// The box's size as laid out, in the svg's px: a transform on the page around\n// the chart scales both alike.\nfunction sizeOf(element: HTMLElement): Size {\n return { width: element.offsetWidth, height: element.offsetHeight }\n}\n\n// Where a box of `size` starts along one axis of the plot, beside something:\n// `after` is where it starts past that thing, and `before` where it ends\n// short of it. Past it where the box fits on the plot, else short of it,\n// else as near past it as the plot allows.\nfunction beside(\n before: number,\n after: number,\n size: number,\n start: number,\n length: number,\n): number {\n const end = start + length\n\n if (after + size <= end) return after\n if (before - size >= start) return before - size\n\n return Math.max(start, Math.min(after, end - size))\n}\n","import { NgTemplateOutlet } from '@angular/common'\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n Directive,\n ElementRef,\n TemplateRef,\n afterNextRender,\n afterRenderEffect,\n booleanAttribute,\n computed,\n contentChild,\n forwardRef,\n inject,\n input,\n linkedSignal,\n} from '@angular/core'\n\nimport type { LegendIcon, MiraSeries } from '../series'\nimport { CHART_THEME } from '../theme'\nimport type { MiraCartesianChart } from './cartesian-chart'\nimport { CartesianContext, ChartLegend } from './cartesian-context'\n\n/** The edge of the chart that a legend sits along. */\nexport type LegendPosition = 'top' | 'right' | 'bottom' | 'left'\n\n/** A series, as the legend lists it. */\nexport type LegendItem = {\n /** What the series is called: its `name`, or its `dataKey` without one. */\n readonly name: string\n /** The series' color. */\n readonly color: string\n /** The shape that marks the series: its `legendIcon`. */\n readonly icon: LegendIcon\n /** Whether the series is hidden. */\n readonly hidden: boolean\n}\n\n/**\n * What a template of your own for an item of the legend gets\n * (`MiraLegendItemContent`): the item as `let-item`.\n */\nexport type LegendItemContext = {\n /** The series, as the legend lists it. */\n readonly $implicit: LegendItem\n}\n\n/**\n * Marks a template of your own for what each item of `<mira-legend>` shows,\n * in place of its icon and its name. It flows as text inside the item, which\n * stays the legend's: in a toggleable legend, a button, marked `aria-pressed`,\n * that hides or shows the series. A hidden series' item takes a gray color,\n * which your template can keep or set its own from `item.hidden`. Its context\n * is a `LegendItemContext`, and typed: `let-item` holds the series' `name`,\n * `color`, `icon` and `hidden`.\n *\n * Screen readers read the template's text out, as the button's name in a\n * toggleable legend:\n *\n * - keep the series' name in it, the same whether the series is hidden or\n * not, and show the state in the look: the button already tells it;\n * - mark what only decorates, such as a swatch or an emoji,\n * `aria-hidden=\"true\"`;\n * - in a toggleable legend, put no buttons or links in it, as it's inside a\n * button.\n *\n * Forced colors replace the colors you set, and print drops backgrounds by\n * default: give what shows the series' color `forced-color-adjust: none` and\n * `print-color-adjust: exact`, as the legend's own icons have.\n *\n * @example\n * ```html\n * <mira-legend>\n * <ng-template miraLegendItemContent let-item>\n * <span\n * aria-hidden=\"true\"\n * [style.color]=\"item.hidden ? null : item.color\"\n * >●</span>\n * <b>{{ item.name }}</b>\n * </ng-template>\n * </mira-legend>\n * ```\n */\n@Directive({ selector: 'ng-template[miraLegendItemContent]' })\nexport class MiraLegendItemContent {\n /**\n * Types the template's context, for Angular's template checks.\n *\n * @internal\n */\n static ngTemplateContextGuard(\n directive: MiraLegendItemContent,\n context: unknown,\n ): context is LegendItemContext {\n return true\n }\n}\n\n// The height of a legend of one row along the top or the bottom, as its\n// styles lay it out in the browser's default font size, in px: the row and\n// the room beside it for the focus ring. The plot leaves it until the legend\n// is measured, on the server.\nconst ROW_HEIGHT = 22\n\n/**\n * Lists the chart's series along one of its edges, in the order they're\n * written, each with its icon in its color and its name: a stretch of line\n * marks a line, a square marks bars, and a circle any other series (the\n * series' `legendIcon`). A series is called by its `name`, or its `dataKey`\n * without one. The plot leaves room for the legend, as it does for the axes,\n * and the chart stays as big as it is.\n *\n * Along the bottom, by default, or the top, the items go in rows, centered,\n * as many as they take. Up the right or the left side, they go in a column in\n * the middle of the chart's height, at most 40% of its width wide, where a\n * longer name wraps. Left and right are as the svg is drawn, in a page that\n * runs right to left too, where the y axis stays on the left. A legend on a\n * side leaves the plot no room on the server: its width is known only once\n * the browser lays it out.\n *\n * It's a list to read, unless it's `toggleable`: then each item is a button\n * that hides its series, or shows it again, and the chart fits its y axis to\n * the series that are left. The state is the series' own `hidden`, to bind\n * as `[(hidden)]`. A hidden series' item stays, grayed and struck through.\n * In a toggleable legend it's marked `aria-pressed=\"false\"` for screen\n * readers; in a list to read, screen readers and the keyboard skip it, as the\n * chart doesn't draw it.\n *\n * The legend's text takes the `color` around it, the chart's in a chart. The\n * rest are CSS custom properties, to set anywhere above the legend:\n *\n * - `--mira-font-size`: the size of the text, `0.75rem` by default; the room\n * around the text follows it;\n * - `--mira-legend-inactive-color`: a hidden series' item,\n * `--mira-axis-color` by default.\n *\n * For items that show something of your own, write their template inside, as\n * an `<ng-template miraLegendItemContent>`, and import `MiraLegendItemContent`\n * along with `MiraLegend`: without it, the template goes unnoticed, and the\n * legend shows its own icon and name.\n *\n * Anywhere else on the page, name the chart with `for`. There the legend sits\n * where the page puts it, as a block, and the chart leaves it no room; its\n * `position` only picks its layout, rows for the top or the bottom, a column\n * for a side. Its colors come from above it, as in a chart: set the custom\n * properties above both to change them alike.\n *\n * @example\n * ```html\n * <mira-line-chart [data]=\"day\">\n * <mira-x-axis dataKey=\"hour\" />\n * <mira-y-axis />\n * <mira-line dataKey=\"solar\" name=\"Solar\" stroke=\"#d97706\" />\n * <mira-line dataKey=\"usage\" name=\"Usage\" stroke=\"#3b82f6\" />\n * <mira-legend position=\"right\" toggleable />\n * </mira-line-chart>\n * ```\n *\n * ```html\n * <header>\n * <h2>A sunny day</h2>\n * <mira-legend [for]=\"chart\" />\n * </header>\n * <mira-line-chart #chart [data]=\"day\">…</mira-line-chart>\n * ```\n */\n@Component({\n selector: 'mira-legend',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [NgTemplateOutlet],\n providers: [\n { provide: ChartLegend, useExisting: forwardRef(() => MiraLegend) },\n ],\n host: {\n '[attr.data-position]': 'placement()',\n '[attr.data-layout]': 'layout()',\n },\n template: `\n <ul class=\"mira-legend\" role=\"list\">\n @for (entry of entries(); track entry.series) {\n <li\n [attr.data-hidden]=\"entry.item.hidden || null\"\n [attr.inert]=\"entry.item.hidden && !toggleable() ? '' : null\"\n >\n @if (toggleable()) {\n <button\n type=\"button\"\n class=\"mira-legend-item\"\n [attr.aria-pressed]=\"!entry.item.hidden\"\n (click)=\"toggle(entry.series)\"\n >\n <ng-container\n [ngTemplateOutlet]=\"template() ?? own\"\n [ngTemplateOutletContext]=\"{ $implicit: entry.item }\"\n />\n </button>\n } @else {\n <ng-container\n [ngTemplateOutlet]=\"template() ?? own\"\n [ngTemplateOutletContext]=\"{ $implicit: entry.item }\"\n />\n }\n </li>\n }\n </ul>\n\n <ng-template #own let-item>\n <span class=\"mira-legend-label\">\n <span\n class=\"mira-legend-icon\"\n [attr.data-icon]=\"item.icon\"\n [style.color]=\"item.hidden ? null : item.color\"\n ></span>\n <span class=\"mira-legend-name\">{{ item.name }}</span>\n </span>\n </ng-template>\n `,\n styles: [\n CHART_THEME,\n `\n /* Out of a chart, where the page puts it. */\n :host {\n display: block;\n }\n\n /* In a chart, at an edge of its svg: along the top or the bottom, as\n wide as the svg; or up a side, as tall as the svg, with the list in its\n middle, from its top where the list is taller, and no more than 40% of\n the svg's width. */\n :host([data-position]) {\n position: absolute;\n }\n\n :host([data-position='top']) {\n inset: 0 0 auto;\n }\n\n :host([data-position='bottom']) {\n inset: auto 0 0;\n }\n\n :host([data-position='left']) {\n inset: 0 auto 0 0;\n }\n\n :host([data-position='right']) {\n inset: 0 0 0 auto;\n }\n\n :host([data-position='left']),\n :host([data-position='right']) {\n display: flex;\n align-items: center;\n align-items: safe center;\n max-width: 40%;\n }\n\n /* In rows, centered; what can't wrap and is wider than the chart runs\n off its end rather than off both sides. A name too long for the room\n wraps, inside a word where it has to. The list keeps its role in\n Safari, which drops it from a list without bullets. Rows are 24px\n apart at least, center to center, whatever the font, so a button never\n touches the next. */\n .mira-legend {\n display: flex;\n flex-wrap: wrap;\n justify-content: center;\n justify-content: safe center;\n gap: max(0.5em, 24px - 1.5em) 1.25em;\n margin: 0;\n padding: 0 0.75em;\n list-style: none;\n font-size: var(--mira-font-size, 0.75rem);\n line-height: 1.5;\n overflow-wrap: anywhere;\n }\n\n /* Room for the focus ring at the chart's edge, in a container that\n clips. */\n :host([data-position='top']) .mira-legend {\n padding-top: 4px;\n }\n\n :host([data-position='bottom']) .mira-legend {\n padding-bottom: 4px;\n }\n\n :host([data-layout='column']) .mira-legend {\n flex-direction: column;\n align-items: flex-start;\n }\n\n /* In a chart, an item takes the pointer that the chart's overlay lets\n through: a button, or a link in a template of your own. */\n :host([data-position]) li {\n pointer-events: auto;\n }\n\n /* In a toggleable legend, a button that looks just like the text of a\n list to read. */\n .mira-legend-item {\n all: unset;\n display: block;\n cursor: pointer;\n }\n\n /* The browser's own focus ring, clear of the text. */\n .mira-legend-item:focus-visible {\n outline: revert;\n outline-offset: 2px;\n }\n\n /* A hidden series' item is gray, and its own name struck through. */\n li[data-hidden] {\n color: var(--mira-legend-inactive-color, var(--_mira-axis-color));\n }\n\n li[data-hidden] .mira-legend-name {\n text-decoration: line-through;\n }\n\n @media (forced-colors: active) {\n li[data-hidden] {\n color: GrayText;\n }\n }\n\n /* The legend's own item: the icon beside the name, by the first line of\n a name that wraps. */\n .mira-legend-label {\n display: flex;\n gap: 0.5em;\n }\n\n /* The series' icon, in its color, set on it; or, for a hidden series, in\n the item's. Kept in forced colors and in print as well, which drops\n backgrounds by default, as the series keep their colors in the svg:\n it's what tells them apart. As wide as the widest icon, so the names\n line up in a column, and as tall as a line. */\n .mira-legend-icon {\n display: grid;\n flex: none;\n place-items: center;\n width: 1em;\n height: 1.5em;\n forced-color-adjust: none;\n print-color-adjust: exact;\n }\n\n /* A circle, for a series that sets no icon. */\n .mira-legend-icon::before {\n content: '';\n width: 0.75em;\n height: 0.75em;\n border-radius: 50%;\n background: currentColor;\n }\n\n /* A square, for bars. */\n .mira-legend-icon[data-icon='square']::before {\n border-radius: 0.125em;\n }\n\n /* A stretch of line, as thick as a line is drawn by default. */\n .mira-legend-icon[data-icon='line']::before {\n width: 100%;\n height: 2px;\n border-radius: 0;\n }\n `,\n ],\n})\nexport class MiraLegend implements ChartLegend {\n /** The edge of the chart the legend sits along: `'bottom'` by default. */\n readonly position = input<LegendPosition>('bottom')\n\n /**\n * Whether a click on an item, or Enter or Space on it, hides its series or\n * shows it again. Off by default: the legend is then a list to read.\n */\n readonly toggleable = input(false, { transform: booleanAttribute })\n\n /**\n * The chart whose series the legend lists, for a legend out of it: give\n * the chart a reference, `<mira-line-chart #chart>`, and name it,\n * `<mira-legend [for]=\"chart\" />`. Unset, the chart the legend is in. With\n * no chart, as while a chart named through a query is in an `@if` that's\n * off, the legend lists nothing.\n */\n readonly for = input<MiraCartesianChart>()\n\n /**\n * The room the legend takes from the chart along its edge, in px: its\n * height along the top or the bottom, its width up a side, as the browser\n * last laid it out there. Until then, a row's height along the top or the\n * bottom, and none on a side.\n *\n * @internal\n */\n readonly room = computed(\n () => this.#measured() ?? (inRows(this.position()) ? ROW_HEIGHT : 0),\n )\n\n // Where the legend sits: at an edge of the chart it's in. Out of a chart,\n // where the page puts it.\n protected readonly placement = computed(() =>\n this.#parent ? this.position() : null,\n )\n\n // How it lays out its items: in rows, or in a column.\n protected readonly layout = computed(() =>\n inRows(this.position()) ? 'rows' : 'column',\n )\n\n // What the legend lists: each series of the chart it names, or of the one\n // it's in, hidden ones too.\n protected readonly entries = computed(() => {\n const all = (this.for() ?? this.#parent)?.series() ?? []\n\n return all.flatMap((series) => {\n const name = nameOf(series)\n\n if (name === null) return []\n\n const item: LegendItem = {\n name,\n color: series.color(),\n icon: series.legendIcon,\n hidden: series.hidden(),\n }\n\n return { series, item }\n })\n })\n\n // A template of your own for the items, if there's one.\n protected readonly template = contentChild(MiraLegendItemContent, {\n read: TemplateRef,\n })\n\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement\n // The chart the legend is in, if it's in one.\n readonly #parent = inject(CartesianContext, { optional: true })\n // The room the legend took, as the browser last laid it out: none yet on a\n // side it has just moved to, which the old room says nothing about.\n readonly #measured = linkedSignal<LegendPosition, number | null>({\n source: this.position,\n computation: () => null,\n })\n\n /** @internal */\n constructor() {\n const parent = this.#parent\n const destroyRef = inject(DestroyRef)\n\n // Out of a chart, there's no room to leave the legend, and nothing to\n // measure.\n if (!parent) return\n\n // The legend is measured after a render that changes what it lists, how\n // it shows it, its side, or the chart's size, which can wrap it onto more\n // rows or fewer; and the plot leaves it room before the page is painted.\n afterRenderEffect({\n earlyRead: () => {\n this.entries()\n this.template()\n parent.size()\n\n return this.#measure()\n },\n write: (room) => this.#measured.set(room()),\n })\n\n // And again whenever it changes size on its own, as when a font loads,\n // or an item of your own that changes, padding and border included: then\n // the plot follows a frame later.\n afterNextRender(() => {\n const observer = new ResizeObserver(() =>\n this.#measured.set(this.#measure()),\n )\n\n observer.observe(this.#host, { box: 'border-box' })\n destroyRef.onDestroy(() => observer.disconnect())\n })\n }\n\n // Hides the series, or shows it again.\n protected toggle(series: MiraSeries): void {\n series.hidden.update((hidden) => !hidden)\n }\n\n // The room the legend takes along its edge as laid out, in the svg's px: a\n // transform on the page around the chart scales both alike.\n #measure(): number {\n const { offsetWidth, offsetHeight } = this.#host\n\n return inRows(this.position()) ? offsetHeight : offsetWidth\n }\n}\n\n// What the series is called, or null while it has no `dataKey` yet. Angular\n// binds a series' inputs as it checks the block the series is written in,\n// and a legend in a block it checks before reads the series first: such a\n// series joins the list as soon as its inputs are bound, in the same pass.\nfunction nameOf(series: MiraSeries): string | null {\n try {\n return series.displayName()\n } catch {\n return null\n }\n}\n\n// Whether a legend on this side lists its items in rows, rather than in a\n// column.\nfunction inRows(side: LegendPosition): boolean {\n return side === 'top' || side === 'bottom'\n}\n","import type { Provider, Type } from '@angular/core'\n\nimport { MiraCartesianChart } from './cartesian-chart'\nimport { CartesianContext } from './cartesian-context'\n\n/**\n * The providers of a kind of cartesian chart: under `MiraCartesianChart`, for\n * layers of your own, and under the context the library's layers inject.\n * Every kind of chart lists them, given `forwardRef(() => TheChart)`:\n * providers aren't inherited.\n *\n * @internal\n */\nexport function provideCartesianChart(\n chart: Type<MiraCartesianChart>,\n): Provider[] {\n return [\n { provide: MiraCartesianChart, useExisting: chart },\n { provide: CartesianContext, useExisting: chart },\n ]\n}\n","import { NgTemplateOutlet } from '@angular/common'\nimport {\n ChangeDetectionStrategy,\n Component,\n type TemplateRef,\n input,\n} from '@angular/core'\n\n/**\n * Draws a layer's template in a view of its own. Angular tracks the signals a\n * template reads in the component view it's drawn into: drawn straight into\n * the chart's, a signal that one layer reads runs them all again, and a new\n * active index re-runs the grid and the axes along with the cursor and the\n * series. Here a layer runs again only when a signal it reads changes, or\n * when the layer itself is checked.\n *\n * @internal\n */\n@Component({\n selector: 'g[miraLayerOutlet]',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [NgTemplateOutlet],\n template: `\n <ng-container [ngTemplateOutlet]=\"template()\" />\n `,\n})\nexport class LayerOutlet {\n /** What to draw: a layer's template. */\n readonly template = input<TemplateRef<unknown>>(undefined, {\n alias: 'miraLayerOutlet',\n })\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n forwardRef,\n} from '@angular/core'\n\nimport {\n CARTESIAN_CHART_STYLES,\n CARTESIAN_CHART_TEMPLATE,\n MiraCartesianChart,\n} from '../core/cartesian/cartesian-chart'\nimport { provideCartesianChart } from '../core/cartesian/provide-cartesian-chart'\nimport { LayerOutlet } from '../core/layer-outlet'\nimport { pointPositions } from '../core/utils/scale'\n\n/**\n * A chart of lines over categories, a point per datum. What's in it comes as\n * content, drawn in the order it's written, so the first one ends up at the\n * bottom.\n *\n * @example\n * ```html\n * <mira-line-chart [data]=\"day\">\n * <mira-cartesian-grid />\n * <mira-x-axis dataKey=\"hour\" />\n * <mira-y-axis />\n * <mira-line dataKey=\"solar\" stroke=\"#d97706\" />\n * <mira-line dataKey=\"usage\" stroke=\"#3b82f6\" />\n * </mira-line-chart>\n * ```\n */\n@Component({\n selector: 'mira-line-chart',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LayerOutlet],\n providers: [provideCartesianChart(forwardRef(() => MiraLineChart))],\n template: CARTESIAN_CHART_TEMPLATE,\n styles: CARTESIAN_CHART_STYLES,\n})\nexport class MiraLineChart extends MiraCartesianChart {\n /** A point per datum, from edge to edge of the plot. */\n override readonly xPositions = computed<readonly number[]>(() => {\n const { left, width } = this.plot()\n\n return pointPositions(this.data().length, [left, left + width])\n })\n}\n","/** A point in px within a chart's svg. */\nexport type Point = {\n readonly x: number\n readonly y: number\n}\n\n/**\n * How a line goes from one value to the next: straight, or along a smooth\n * curve that never overshoots the values (`monotone`).\n */\nexport type LineCurve = 'linear' | 'monotone'\n\n/**\n * The svg path of a line through the points. The line breaks where a point is\n * null, and picks up again at the next one.\n *\n * @internal\n */\nexport function linePath(\n points: ReadonlyArray<Point | null>,\n curve: LineCurve,\n): string {\n return runsOf(points)\n .map((run) => (curve === 'monotone' ? monotone(run) : straight(run)))\n .join('')\n}\n\n// The stretches of points between the nulls.\nfunction runsOf(points: ReadonlyArray<Point | null>): Point[][] {\n const runs: Point[][] = [[]]\n\n for (const point of points) {\n if (point) {\n runs[runs.length - 1].push(point)\n } else if (runs[runs.length - 1].length > 0) {\n runs.push([])\n }\n }\n\n return runs.filter((run) => run.length > 0)\n}\n\nfunction straight(points: readonly Point[]): string {\n return points\n .map((point, index) => `${index === 0 ? 'M' : 'L'}${xy(point)}`)\n .join('')\n}\n\n/*\n * A smooth curve through the points that keeps to the data: between two\n * points it goes neither above nor below them, so it makes up no peaks, and\n * it's flat where the data turns. Steffen's method (\"A Simple Method for\n * Monotonic Interpolation in One Dimension\", 1990), as d3-shape's\n * curveMonotoneX draws it: a cubic Bézier per segment, with the tangent at\n * each point at most twice as steep as the gentler segment beside it.\n */\nfunction monotone(points: readonly Point[]): string {\n // Through two points, the curve is a straight line.\n if (points.length < 3) return straight(points)\n\n const last = points.length - 1\n const slopes: number[] = []\n\n for (let i = 0; i < last; i++) {\n const dx = points[i + 1].x - points[i].x\n\n slopes.push(dx === 0 ? 0 : (points[i + 1].y - points[i].y) / dx)\n }\n\n const tangents = new Array<number>(points.length).fill(0)\n\n for (let i = 1; i < last; i++) {\n const h0 = points[i].x - points[i - 1].x\n const h1 = points[i + 1].x - points[i].x\n const s0 = slopes[i - 1]\n const s1 = slopes[i]\n const p = (s0 * h1 + s1 * h0) / (h0 + h1)\n const sign = Math.sign(s0) + Math.sign(s1)\n\n // The sign is zero where the slopes have opposite signs: the curve is\n // flat where the data turns.\n tangents[i] =\n sign * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0\n }\n\n // At the two ends, the tangent that leaves the curve unbent there.\n tangents[0] = (3 * slopes[0] - tangents[1]) / 2\n tangents[last] = (3 * slopes[last - 1] - tangents[last - 1]) / 2\n\n let path = `M${xy(points[0])}`\n\n for (let i = 0; i < last; i++) {\n const a = points[i]\n const b = points[i + 1]\n const dx = (b.x - a.x) / 3\n\n path +=\n `C${xy({ x: a.x + dx, y: a.y + dx * tangents[i] })}` +\n ` ${xy({ x: b.x - dx, y: b.y - dx * tangents[i + 1] })}` +\n ` ${xy(b)}`\n }\n\n return path\n}\n\n// Hundredths of a px are as fine as a screen shows, and keep paths short.\nfunction xy(point: Point): string {\n return `${Math.round(point.x * 100) / 100},${Math.round(point.y * 100) / 100}`\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n type Signal,\n booleanAttribute,\n computed,\n forwardRef,\n inject,\n input,\n} from '@angular/core'\n\nimport { CartesianContext } from '../core/cartesian/cartesian-context'\nimport { MiraChartLayer } from '../core/chart-layer'\nimport { type LegendIcon, MiraSeries } from '../core/series'\nimport { numberAt } from '../core/utils/data'\nimport { type LineCurve, type Point, linePath } from '../core/utils/path'\n\n/**\n * A line through the values under `dataKey`, a point per datum, with a dot on\n * each value and a bigger one, in a halo, on the value under the pointer.\n * Where a datum has no number under the key, the line breaks; a value alone\n * between two gaps shows only as its dot.\n *\n * @example\n * ```html\n * <mira-line dataKey=\"solar\" stroke=\"#d97706\" />\n * ```\n */\n@Component({\n selector: 'mira-line',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n { provide: MiraChartLayer, useExisting: forwardRef(() => MiraLine) },\n { provide: MiraSeries, useExisting: forwardRef(() => MiraLine) },\n ],\n template: `\n <ng-template>\n <svg:g class=\"mira-line\">\n <svg:path\n class=\"mira-line-curve\"\n [attr.d]=\"path()\"\n [attr.stroke]=\"stroke()\"\n />\n @if (dot()) {\n @for (point of dots(); track $index) {\n <svg:circle\n class=\"mira-line-dot\"\n r=\"4\"\n [attr.cx]=\"point.x\"\n [attr.cy]=\"point.y\"\n [attr.fill]=\"stroke()\"\n />\n }\n }\n @if (activePoint(); as point) {\n <svg:circle\n class=\"mira-line-halo\"\n r=\"10\"\n [attr.cx]=\"point.x\"\n [attr.cy]=\"point.y\"\n [attr.fill]=\"stroke()\"\n />\n <svg:circle\n class=\"mira-line-active-dot\"\n r=\"6\"\n [attr.cx]=\"point.x\"\n [attr.cy]=\"point.y\"\n [attr.fill]=\"stroke()\"\n />\n }\n </svg:g>\n </ng-template>\n `,\n styles: `\n .mira-line-curve {\n fill: none;\n stroke-width: 2;\n }\n\n .mira-line-halo {\n fill-opacity: 0.25;\n }\n\n .mira-line-active-dot {\n stroke: var(--_mira-background);\n stroke-width: 2;\n }\n `,\n})\nexport class MiraLine extends MiraSeries {\n /** The color of the line and of its dots, `#3182bd` by default. */\n readonly stroke = input('#3182bd')\n /** How the line goes from one value to the next, `'linear'` by default. */\n readonly curve = input<LineCurve>('linear')\n /** Whether to mark each value with a dot. On by default. */\n readonly dot = input(true, { transform: booleanAttribute })\n\n /**\n * Whether to mark the value under the pointer with a bigger dot, in a halo.\n * On by default.\n */\n readonly activeDot = input(true, { transform: booleanAttribute })\n\n /** The line's color, for the tooltip and the legend. Set it with `stroke`. */\n override readonly color: Signal<string> = this.stroke\n /** A stretch of line marks the line in the legend. */\n override readonly legendIcon: LegendIcon = 'line'\n\n protected readonly path = computed(() =>\n linePath(this.#points(), this.curve()),\n )\n\n protected readonly dots = computed(() =>\n this.#points().filter((point) => point !== null),\n )\n\n // The point under the pointer, if the line has a value there.\n protected readonly activePoint = computed(() => {\n if (!this.activeDot()) return null\n\n const index = this.#chart.activeIndex()\n\n if (index === null) return null\n\n return this.#points()[index] ?? null\n })\n\n readonly #chart = inject(CartesianContext)\n // A point per datum, or null where the datum has no value to plot.\n readonly #points = computed<ReadonlyArray<Point | null>>(() => {\n const key = this.dataKey()\n const xs = this.#chart.xPositions()\n const y = this.#chart.yScale()\n\n return this.#chart.data().map((datum, index) => {\n const value = numberAt(datum, key)\n\n return value === null ? null : { x: xs[index], y: y(value) }\n })\n })\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n forwardRef,\n} from '@angular/core'\n\nimport {\n CARTESIAN_CHART_STYLES,\n CARTESIAN_CHART_TEMPLATE,\n MiraCartesianChart,\n} from '../core/cartesian/cartesian-chart'\nimport type { CartesianContext } from '../core/cartesian/cartesian-context'\nimport { provideCartesianChart } from '../core/cartesian/provide-cartesian-chart'\nimport { LayerOutlet } from '../core/layer-outlet'\nimport { bandPositions } from '../core/utils/scale'\n\n/**\n * A chart of bars over categories, a band per datum. What's in it comes as\n * content, drawn in the order it's written, so the first one ends up at the\n * bottom.\n *\n * @example\n * ```html\n * <mira-bar-chart [data]=\"year\">\n * <mira-cartesian-grid />\n * <mira-x-axis dataKey=\"month\" />\n * <mira-y-axis />\n * <mira-bar dataKey=\"solar\" fill=\"#d97706\" />\n * <mira-bar dataKey=\"usage\" fill=\"#3b82f6\" />\n * </mira-bar-chart>\n * ```\n */\n@Component({\n selector: 'mira-bar-chart',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LayerOutlet],\n providers: [provideCartesianChart(forwardRef(() => MiraBarChart))],\n template: CARTESIAN_CHART_TEMPLATE,\n styles: CARTESIAN_CHART_STYLES,\n})\n// Required, so the compiler checks the bands, which the context only may have.\nexport class MiraBarChart\n extends MiraCartesianChart\n implements Required<CartesianContext>\n{\n /** The middle of each datum's band. */\n override readonly xPositions = computed(() => this.#bands().positions)\n /** The width of each datum's band: the plot's, shared out among the data. */\n readonly xBandwidth = computed(() => this.#bands().bandwidth)\n\n // A band per datum, edge to edge across the plot.\n readonly #bands = computed(() => {\n const { left, width } = this.plot()\n\n return bandPositions(this.data().length, [left, left + width])\n })\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n type Signal,\n computed,\n forwardRef,\n inject,\n input,\n} from '@angular/core'\n\nimport { CartesianContext } from '../core/cartesian/cartesian-context'\nimport { MiraChartLayer } from '../core/chart-layer'\nimport { type LegendIcon, MiraSeries } from '../core/series'\nimport { numberAt } from '../core/utils/data'\n\n// The room the bars leave on each side of their band, as a share of the band.\nconst CATEGORY_GAP = 0.1\n// The room between two bars of a band, in px.\nconst BAR_GAP = 4\n\n// Where a bar goes in its band: its offset from the band's start, and its\n// width, in px.\ntype Slot = {\n readonly offset: number\n readonly width: number\n}\n\n/**\n * A series of bars: a bar for each datum of the chart's data, from zero to\n * the datum's value under `dataKey`, up for a value above zero and down for\n * one below. Write one per key: the bars of several share each band, side by\n * side in the order they're written, and a hidden one leaves its room to the\n * others. A datum with no number under the key has no bar, and leaves its\n * place in the band empty. It goes in a chart with a band per datum, such as\n * `<mira-bar-chart>`.\n *\n * @example\n * ```html\n * <mira-bar dataKey=\"solar\" fill=\"#d97706\" />\n * <mira-bar dataKey=\"usage\" fill=\"#3b82f6\" />\n * ```\n */\n@Component({\n selector: 'mira-bar',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n { provide: MiraChartLayer, useExisting: forwardRef(() => MiraBar) },\n { provide: MiraSeries, useExisting: forwardRef(() => MiraBar) },\n ],\n template: `\n <ng-template>\n <svg:g class=\"mira-bar\" [attr.fill]=\"fill()\">\n @for (bar of bars(); track bar.index) {\n <svg:rect\n [attr.x]=\"bar.x\"\n [attr.y]=\"bar.y\"\n [attr.width]=\"bar.width\"\n [attr.height]=\"bar.height\"\n />\n }\n </svg:g>\n </ng-template>\n `,\n})\nexport class MiraBar extends MiraSeries {\n /** The color of the bars, `#3182bd` by default. */\n readonly fill = input('#3182bd')\n /** The bars' color, for the tooltip and the legend. Set it with `fill`. */\n override readonly color: Signal<string> = this.fill\n /** A square marks the bars in the legend. */\n override readonly legendIcon: LegendIcon = 'square'\n\n // A rect per datum with a value: at the bar's place in the datum's band,\n // and from zero to the value, whichever way that goes.\n protected readonly bars = computed(() => {\n const key = this.dataKey()\n const xs = this.#chart.xPositions()\n const y = this.#chart.yScale()\n const { offset, width } = this.#slot()\n // The bar's left edge, from the middle of its band.\n const fromMiddle = offset - this.#bandwidth() / 2\n const zero = y(0)\n\n return this.#chart.data().flatMap((datum, index) => {\n const value = numberAt(datum, key)\n\n if (value === null) return []\n\n const end = y(value)\n\n return {\n index,\n x: xs[index] + fromMiddle,\n y: Math.min(zero, end),\n width,\n height: Math.abs(end - zero),\n }\n })\n })\n\n // The nearest chart: a bar in a line chart throws, even with a bar chart\n // further out.\n readonly #chart = inject(CartesianContext)\n readonly #bandwidth = bandwidthOf(this.#chart)\n\n // The bar's place in each band: the chart's visible bars share it, side by\n // side in the order they're written.\n readonly #slot = computed(() => {\n const bars = this.#chart.visibleSeries().filter(isBar)\n\n return slotOf(bars.indexOf(this), bars.length, this.#bandwidth())\n })\n}\n\n// Outside the class on purpose: a class that names itself in its own body\n// gets an alias assigned at the top of the built module, which bundlers keep,\n// and then every app ships the bar, with bars or without.\nfunction isBar(series: MiraSeries): series is MiraBar {\n return series instanceof MiraBar\n}\n\n// The width of the chart's bands. A chart of points has none, and a bar there\n// has nowhere to go.\nfunction bandwidthOf(chart: CartesianContext): Signal<number> {\n if (!chart.xBandwidth) {\n throw new Error(\n '<mira-bar> must be inside a chart with bands, such as <mira-bar-chart>.',\n )\n }\n\n return chart.xBandwidth\n}\n\n// Where the bar at `rank`, of `count` side by side, goes in a band: the bars\n// share what the gaps leave. A gap is never wider than a bar, so in a narrow\n// band the two shrink together, and a narrower band never has wider bars.\nfunction slotOf(rank: number, count: number, bandwidth: number): Slot {\n const room = bandwidth * (1 - 2 * CATEGORY_GAP)\n const gap = Math.min(BAR_GAP, room / (2 * count - 1))\n const width = (room - (count - 1) * gap) / count\n\n return { offset: bandwidth * CATEGORY_GAP + rank * (width + gap), width }\n}\n","/*\n * Public API Surface of ngx-mira-charts\n */\n\nexport type { ChartDatum, ChartMargin, ChartSize } from './lib/core/types'\nexport type { LineCurve, Point } from './lib/core/utils/path'\nexport type {\n ActiveDatum,\n PlotArea,\n Tick,\n} from './lib/core/cartesian/cartesian-context'\nexport { MiraCartesianChart } from './lib/core/cartesian/cartesian-chart'\nexport { MiraChartLayer } from './lib/core/chart-layer'\nexport type { LegendIcon } from './lib/core/series'\nexport { MiraSeries } from './lib/core/series'\nexport { MiraCartesianGrid } from './lib/core/cartesian/cartesian-grid'\nexport { MiraCursor } from './lib/core/cartesian/cursor'\nexport type { TooltipContext, TooltipItem } from './lib/core/cartesian/tooltip'\nexport { MiraTooltip, MiraTooltipContent } from './lib/core/cartesian/tooltip'\nexport type {\n LegendItem,\n LegendItemContext,\n LegendPosition,\n} from './lib/core/cartesian/legend'\nexport { MiraLegend, MiraLegendItemContent } from './lib/core/cartesian/legend'\nexport { MiraXAxis } from './lib/core/cartesian/x-axis'\nexport { MiraYAxis } from './lib/core/cartesian/y-axis'\nexport { MiraLineChart } from './lib/line-chart/line-chart'\nexport { MiraLine } from './lib/line-chart/line'\nexport { MiraBarChart } from './lib/bar-chart/bar-chart'\nexport { MiraBar } from './lib/bar-chart/bar'\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCG;MAEmB,cAAc,CAAA;;AAEzB,IAAA,QAAQ,GAAG,SAAS,CAAC,WAAW,oDAAC;wGAFtB,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAd,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,cAAc,wFAEJ,WAAW,EAAA,WAAA,EAAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;4FAFrB,cAAc,EAAA,UAAA,EAAA,CAAA;kBADnC;0FAG+B,WAAW,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AClC3C;;;;;;;;AAQG;AAEG,MAAgB,UAAW,SAAQ,cAAc,CAAA;;AAE5C,IAAA,OAAO,GAAG,KAAK,CAAC,QAAQ,kDAAU;AAE3C;;;AAGG;IACM,IAAI,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAU;AAE/B;;;;;;;;;AASG;AACM,IAAA,MAAM,GAAG,KAAK,CAAC,KAAK,kDAAC;;AAGrB,IAAA,WAAW,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC,OAAO,EAAE,uDAAC;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AAI,CAAC,KAAK,CAAC,UAAU,EAAE;AACrB,QAAA,MAAM,IAAI,KAAK,CACb,yEAAyE,CAC1E;IACH;IAEA,OAAO,KAAK,CAAC,UAAU;AACzB;AAEA;AACA;AACA;AACA,SAAS,MAAM,CAAC,IAAY,EAAE,KAAa,EAAE,SAAiB,EAAA;IAC5D,MAAM,IAAI,GAAG,SAAS,IAAI,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC;AAC/C,IAAA,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC;AACrD,IAAA,MAAM,KAAK,GAAG,CAAC,IAAI,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,KAAK;AAEhD,IAAA,OAAO,EAAE,MAAM,EAAE,SAAS,GAAG,YAAY,GAAG,IAAI,IAAI,KAAK,GAAG,GAAG,CAAC,EAAE,KAAK,EAAE;AAC3E;;AC9IA;;AAEG;;ACFH;;AAEG;;"}
1
+ {"version":3,"file":"ngx-mira-charts.mjs","sources":["../../../projects/ngx-mira-charts/src/lib/core/chart-layer.ts","../../../projects/ngx-mira-charts/src/lib/core/series.ts","../../../projects/ngx-mira-charts/src/lib/core/theme.ts","../../../projects/ngx-mira-charts/src/lib/core/utils/data.ts","../../../projects/ngx-mira-charts/src/lib/core/utils/scale.ts","../../../projects/ngx-mira-charts/src/lib/core/cartesian/cartesian-context.ts","../../../projects/ngx-mira-charts/src/lib/core/cartesian/x-axis.ts","../../../projects/ngx-mira-charts/src/lib/core/cartesian/y-axis.ts","../../../projects/ngx-mira-charts/src/lib/core/cartesian/cartesian-chart.ts","../../../projects/ngx-mira-charts/src/lib/core/cartesian/cartesian-grid.ts","../../../projects/ngx-mira-charts/src/lib/core/cartesian/cursor.ts","../../../projects/ngx-mira-charts/src/lib/core/cartesian/tooltip.ts","../../../projects/ngx-mira-charts/src/lib/core/cartesian/legend.ts","../../../projects/ngx-mira-charts/src/lib/core/cartesian/provide-cartesian-chart.ts","../../../projects/ngx-mira-charts/src/lib/core/layer-outlet.ts","../../../projects/ngx-mira-charts/src/lib/line-chart/line-chart.ts","../../../projects/ngx-mira-charts/src/lib/core/utils/path.ts","../../../projects/ngx-mira-charts/src/lib/line-chart/line.ts","../../../projects/ngx-mira-charts/src/lib/bar-chart/bar-chart.ts","../../../projects/ngx-mira-charts/src/lib/bar-chart/bar.ts","../../../projects/ngx-mira-charts/src/public-api.ts","../../../projects/ngx-mira-charts/src/ngx-mira-charts.ts"],"sourcesContent":["import { Directive, TemplateRef, viewChild } from '@angular/core'\n\n/**\n * Something a chart draws in its svg: a line, an axis, the grid, or a layer\n * of your own. A layer is an element of its own in the chart's content and\n * renders nothing where it's written: the chart renders the layer's\n * `<ng-template>` into its svg, in the order the layers are written, so the\n * first one ends up at the bottom.\n *\n * To draw a layer of your own, extend this class, provide your component\n * under it, and put what it draws in an `<ng-template>`, as `svg:` elements.\n * Inject {@link MiraCartesianChart} for the plot area and the scales. The\n * template runs again when a signal it reads changes, or when your component\n * is checked, as on a new input: keep what it reads in signals, or call\n * `markForCheck()` when that changes.\n *\n * @example\n * ```ts\n * @Component({\n * selector: 'app-target',\n * providers: [\n * { provide: MiraChartLayer, useExisting: forwardRef(() => Target) },\n * ],\n * template: `\n * <ng-template>\n * <svg:line [attr.y1]=\"y()\" [attr.y2]=\"y()\" … />\n * </ng-template>\n * `,\n * })\n * export class Target extends MiraChartLayer {\n * readonly value = input.required<number>()\n *\n * protected readonly y = computed(() => this.#chart.yScale()(this.value()))\n *\n * readonly #chart = inject(MiraCartesianChart)\n * }\n * ```\n */\n@Directive()\nexport abstract class MiraChartLayer {\n /** What the layer draws: the first `<ng-template>` in its own template. */\n readonly template = viewChild(TemplateRef)\n}\n","import { Directive, type Signal, computed, input, model } from '@angular/core'\n\nimport { MiraChartLayer } from './chart-layer'\n\n/** The shape that marks a series in the legend, in the series' color. */\nexport type LegendIcon = 'circle' | 'line' | 'square'\n\n/**\n * A layer that plots the values under a key of the chart's data: a line or\n * bars now, areas later. The chart fits its y axis to the values of all its\n * series that aren't hidden, whatever kind they are.\n *\n * A series extends this class, and provides itself under it as well as under\n * {@link MiraChartLayer}. It also implements `color`, the color it's drawn\n * in.\n */\n@Directive()\nexport abstract class MiraSeries extends MiraChartLayer {\n /** The key of the values to plot. */\n readonly dataKey = input.required<string>()\n\n /**\n * What the tooltip and the legend call the series. Unset, they call it by\n * its `dataKey`.\n */\n readonly name = input<string>()\n\n /**\n * Whether the series is hidden: the chart doesn't draw it, fits its y axis\n * to the series that aren't, and leaves it out of the tooltip; the bars of\n * the visible series share its room in the band. Shown by default. A click\n * on its item in a toggleable legend toggles it. Write `[hidden]=\"true\"`,\n * not a bare `hidden`, to start hidden, or `[(hidden)]` to keep the state in\n * your app. An app that sets the state after a click binds it both ways: a\n * one-way binding takes effect only when its own value changes, so setting\n * the value it last set does nothing.\n */\n readonly hidden = model(false)\n\n /** What the series is called: its `name`, or its `dataKey` without one. */\n readonly displayName = computed(() => this.name() ?? this.dataKey())\n\n /**\n * The shape that marks the series in the legend: `'line'` for a line,\n * `'square'` for bars, and `'circle'` by default. A series of your own picks\n * the shape that looks like what it draws by overriding the field:\n * `override readonly legendIcon: LegendIcon = 'square'`.\n */\n readonly legendIcon: LegendIcon = 'circle'\n\n /**\n * The color the series is drawn in: a line's `stroke`, a bar's `fill`. The\n * tooltip marks the series' value with it, and the legend its name.\n */\n abstract readonly color: Signal<string>\n}\n","/**\n * Styles every chart takes: the colors its layers draw with, for a light page\n * and a dark one. The layers read the `--_mira-*` properties set here; an app\n * sets the `--mira-*` ones (see `MiraCartesianChart`).\n *\n * Browsers without `light-dark()` (Chrome before 123, Firefox before 120,\n * Safari before 17.5) take the light colors.\n *\n * @internal\n */\nexport const CHART_THEME = `\n :host {\n --_mira-axis-color: var(--mira-axis-color, #666);\n --_mira-grid-color: var(--mira-grid-color, #ccc);\n --_mira-background: var(--mira-background, #fff);\n --_mira-cursor-color: var(--mira-cursor-color, #999);\n }\n\n @supports (color: light-dark(#000, #fff)) {\n :host {\n --_mira-axis-color: var(--mira-axis-color, light-dark(#666, #999));\n --_mira-grid-color: var(--mira-grid-color, light-dark(#ccc, #333));\n --_mira-background: var(--mira-background, Canvas);\n --_mira-cursor-color: var(--mira-cursor-color, light-dark(#999, #666));\n }\n }\n`\n","import type { ChartDatum } from '../types'\n\n/** @internal */\nexport function valueAt(datum: ChartDatum, key: string): unknown {\n return (datum as Record<string, unknown>)[key]\n}\n\n/**\n * The value under `key` as a number to plot, or null when there's nothing to\n * plot there: no value, null, NaN, or something other than a number.\n *\n * @internal\n */\nexport function numberAt(datum: ChartDatum, key: string): number | null {\n const value = valueAt(datum, key)\n\n return typeof value === 'number' && Number.isFinite(value) ? value : null\n}\n\n/**\n * The smallest and the largest number under the keys, across the data, or\n * null when there's no number at all.\n *\n * @internal\n */\nexport function extentOf(\n data: readonly ChartDatum[],\n keys: readonly string[],\n): [number, number] | null {\n let min = Infinity\n let max = -Infinity\n\n for (const datum of data) {\n for (const key of keys) {\n const value = numberAt(datum, key)\n\n if (value === null) continue\n\n min = Math.min(min, value)\n max = Math.max(max, value)\n }\n }\n\n return min <= max ? [min, max] : null\n}\n","/**\n * Two ends of a stretch of numbers: values for a domain, px for a range.\n *\n * @internal\n */\nexport type Extent = readonly [number, number]\n\n/**\n * Round ticks over a domain, and the domain rounded out to them.\n *\n * @internal\n */\nexport type LinearTicks = {\n readonly domain: Extent\n readonly ticks: readonly number[]\n}\n\n/**\n * Bands of one width side by side: the middle of each, in order, and the\n * width they share.\n *\n * @internal\n */\nexport type Bands = {\n readonly positions: readonly number[]\n readonly bandwidth: number\n}\n\n// Where a raw step moves up to the next round one: 1, 2, 5 or 10 times a\n// power of ten, whichever is closest. The thresholds of d3-array's ticks().\nconst E10 = Math.sqrt(50)\nconst E5 = Math.sqrt(10)\nconst E2 = Math.sqrt(2)\n\n// Rounding the domain out can change the step, which rounds it out again.\n// d3-scale's nice() gives up after as many rounds.\nconst MAX_NICE_ROUNDS = 10\n\n/**\n * Maps a value from the domain onto the range, in a straight line.\n *\n * @internal\n */\nexport function linearScale(\n domain: Extent,\n range: Extent,\n): (value: number) => number {\n const [d0, d1] = domain\n const [r0, r1] = range\n const k = d1 === d0 ? 0 : (r1 - r0) / (d1 - d0)\n\n return (value) => r0 + (value - d0) * k\n}\n\n/**\n * Picks about `count` ticks on round values (1, 2 or 5 times a power of ten\n * apart) and rounds the domain out to them, so the axis starts and ends on a\n * tick. A domain of a single value widens to that value plus one.\n *\n * @internal\n */\nexport function linearTicks([min, max]: Extent, count: number): LinearTicks {\n if (!Number.isFinite(min) || !Number.isFinite(max)) {\n return { domain: [0, 1], ticks: [] }\n }\n\n let domain: Extent = max > min ? [min, max] : [min, min + 1]\n let increment = 0\n\n for (let round = 0; round < MAX_NICE_ROUNDS; round++) {\n const next = tickIncrement(domain, count)\n\n if (next === increment) break\n\n increment = next\n domain = roundOut(domain, increment)\n }\n\n return { domain, ticks: ticksBetween(domain, increment) }\n}\n\n/**\n * Spreads `count` points over the range, the first at its start and the last\n * at its end. A single point sits in the middle.\n *\n * @internal\n */\nexport function pointPositions(count: number, range: Extent): number[] {\n const [start, end] = range\n\n if (count === 1) return [(start + end) / 2]\n\n const step = (end - start) / (count - 1)\n\n return Array.from({ length: count }, (_, index) => start + index * step)\n}\n\n/**\n * Splits the range into `count` bands of one width, edge to edge, from its\n * start to its end: a band per category, for its bars to share. What\n * d3-scale's scaleBand does with no padding: the gaps between the bars are\n * theirs to leave.\n *\n * @internal\n */\nexport function bandPositions(count: number, range: Extent): Bands {\n const [start, end] = range\n const step = count > 0 ? (end - start) / count : 0\n\n return {\n positions: Array.from(\n { length: count },\n (_, index) => start + (index + 0.5) * step,\n ),\n // A range that runs backwards has bands as wide.\n bandwidth: Math.abs(step),\n }\n}\n\n/**\n * The index of the position nearest `x`, the lower one on a tie; null for no\n * positions. The positions go up, as they do from {@link pointPositions} and\n * {@link bandPositions} over a range that runs forward.\n *\n * @internal\n */\nexport function nearestIndex(\n positions: readonly number[],\n x: number,\n): number | null {\n if (positions.length === 0) return null\n\n // The first position at or past x, or the last one.\n let low = 0\n let high = positions.length - 1\n\n while (low < high) {\n const middle = (low + high) >> 1\n\n if (positions[middle] < x) low = middle + 1\n else high = middle\n }\n\n return low > 0 && x - positions[low - 1] <= positions[low] - x ? low - 1 : low\n}\n\n/*\n * The step between round ticks as a whole number: the step itself when it's\n * 1 or more, minus its inverse when it's less (-10 for 0.1). Whole numbers\n * keep the ticks exact: 3 / 10 is 0.3, where 3 * 0.1 is 0.30000000000000004.\n * The same rule as d3-array's tickIncrement().\n */\nfunction tickIncrement([min, max]: Extent, count: number): number {\n const raw = (max - min) / Math.max(1, count || 1)\n const power = Math.floor(Math.log10(raw))\n const error = raw / 10 ** power\n const factor = error >= E10 ? 10 : error >= E5 ? 5 : error >= E2 ? 2 : 1\n\n return power >= 0 ? factor * 10 ** power : -(10 ** -power) / factor\n}\n\nfunction roundOut([min, max]: Extent, increment: number): Extent {\n if (increment > 0) {\n return [\n Math.floor(min / increment) * increment,\n Math.ceil(max / increment) * increment,\n ]\n }\n\n const inverse = -increment\n\n return [\n Math.floor(min * inverse) / inverse,\n Math.ceil(max * inverse) / inverse,\n ]\n}\n\nfunction ticksBetween([min, max]: Extent, increment: number): number[] {\n const ticks: number[] = []\n\n if (increment > 0) {\n for (let i = Math.ceil(min / increment); i * increment <= max; i++) {\n ticks.push(i * increment)\n }\n } else {\n const inverse = -increment\n\n for (let i = Math.ceil(min * inverse); i / inverse <= max; i++) {\n ticks.push(i / inverse)\n }\n }\n\n return ticks\n}\n","import type { Signal } from '@angular/core'\n\nimport type { MiraSeries } from '../series'\nimport type { ChartDatum, ChartSize } from '../types'\nimport type { Point } from '../utils/path'\nimport type { LegendPosition } from './legend'\n\n/**\n * The rectangle the series are drawn in: the chart less its margin and the\n * room its axes and its legend take, in px within the chart's svg.\n */\nexport type PlotArea = {\n readonly left: number\n readonly top: number\n readonly width: number\n readonly height: number\n}\n\n/** A tick on the y axis: its value, and its y in px within the chart's svg. */\nexport type Tick = {\n readonly value: number\n readonly offset: number\n}\n\n/** The datum under the pointer, and where it is. */\nexport type ActiveDatum = {\n /** Its index in the data. */\n readonly index: number\n /** The row itself. */\n readonly datum: ChartDatum\n /** Its x in px within the chart's svg. */\n readonly x: number\n /** Its label along x. */\n readonly label: string\n}\n\n/**\n * About how many ticks the y scale aims for, unless the y axis asks for\n * another number.\n *\n * @internal\n */\nexport const DEFAULT_TICK_COUNT = 5\n\n/**\n * What the parts of a chart with an x and a y axis, its layers, its tooltip\n * and its legend, draw by: the data, the series, the size, the plot area, the\n * scales, the labels along x, and the pointer and the datum under it. Every\n * kind of chart provides itself under it, with `provideCartesianChart`, and\n * the library's own parts inject it: they can't import the chart, which\n * imports the axes to leave room for them. The way Angular Material's tabs\n * inject `MAT_TAB_GROUP`.\n *\n * @internal\n */\nexport abstract class CartesianContext {\n /** The rows to plot. */\n abstract readonly data: Signal<readonly ChartDatum[]>\n /** The series, of whatever kind, in the order they're written, hidden too. */\n abstract readonly series: Signal<readonly MiraSeries[]>\n /** The series that aren't hidden, in the order they're written. */\n abstract readonly visibleSeries: Signal<readonly MiraSeries[]>\n /** The size the chart draws at, in px. */\n abstract readonly size: Signal<ChartSize>\n /** Where the series are drawn. */\n abstract readonly plot: Signal<PlotArea>\n /** Maps a value to its y. */\n abstract readonly yScale: Signal<(value: number) => number>\n /** Round values over the y scale, for the y axis and the grid to mark. */\n abstract readonly yTicks: Signal<readonly Tick[]>\n /** The x of each datum, in the order of the data. */\n abstract readonly xPositions: Signal<readonly number[]>\n /** The label of each datum along x, in the order of the data. */\n abstract readonly xLabels: Signal<readonly string[]>\n /**\n * The width of each datum's band along x, centered on its x. Only a chart\n * with a band per datum has it, as the bar chart does: in a line chart, each\n * datum is a point.\n */\n abstract readonly xBandwidth?: Signal<number>\n /** Where the pointer last moved over the svg, in its px, or null. */\n abstract readonly pointer: Signal<Point | null>\n /** The index of the datum under the pointer, or null. */\n abstract readonly activeIndex: Signal<number | null>\n /** The datum under the pointer and where it is, or null. */\n abstract readonly active: Signal<ActiveDatum | null>\n}\n\n/**\n * The legend as the chart sees it: the edge it sits along, and the room it\n * takes there. The legend provides itself under it, so the chart finds it\n * without importing it, and an app without a legend doesn't ship one.\n *\n * @internal\n */\nexport abstract class ChartLegend {\n /** The edge of the chart the legend sits along. */\n abstract readonly position: Signal<LegendPosition>\n /** The room it takes from the chart along that edge, in px. */\n abstract readonly room: Signal<number>\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n forwardRef,\n inject,\n input,\n numberAttribute,\n} from '@angular/core'\n\nimport { MiraChartLayer } from '../chart-layer'\nimport { CartesianContext } from './cartesian-context'\n\n/**\n * The category axis under the plot: a tick per datum, labelled with the\n * datum's value under `dataKey`. Its line runs at zero, where values rise and\n * fall from; the ticks and labels stay under the plot, clear of values below\n * zero.\n *\n * @example\n * ```html\n * <mira-x-axis dataKey=\"month\" />\n * ```\n */\n@Component({\n selector: 'mira-x-axis',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n { provide: MiraChartLayer, useExisting: forwardRef(() => MiraXAxis) },\n ],\n template: `\n <ng-template>\n <svg:g class=\"mira-x-axis\">\n <svg:line\n [attr.x1]=\"chart.plot().left\"\n [attr.x2]=\"chart.plot().left + chart.plot().width\"\n [attr.y1]=\"baseline()\"\n [attr.y2]=\"baseline()\"\n />\n @for (tick of ticks(); track $index) {\n <svg:g\n [attr.transform]=\"'translate(' + tick.offset + ',' + bottom() + ')'\"\n >\n <svg:line y2=\"6\" />\n <svg:text y=\"9\" dy=\"0.71em\" text-anchor=\"middle\">\n {{ tick.label }}\n </svg:text>\n </svg:g>\n }\n </svg:g>\n </ng-template>\n `,\n styles: `\n .mira-x-axis {\n font-size: 12px;\n }\n\n line {\n stroke: var(--_mira-axis-color);\n }\n\n text {\n fill: var(--_mira-axis-color);\n }\n `,\n})\nexport class MiraXAxis extends MiraChartLayer {\n /** The key of each datum's category. Without one, the ticks show indexes. */\n readonly dataKey = input<string>()\n /** The room the axis takes under the plot, in px: 30 by default. */\n readonly height = input(30, { transform: numberAttribute })\n\n protected readonly chart = inject(CartesianContext)\n // Where the ticks and labels hang from: the bottom of the plot.\n protected readonly bottom = computed(\n () => this.chart.plot().top + this.chart.plot().height,\n )\n\n // Where the axis line runs: at zero, kept on the plot.\n protected readonly baseline = computed(() => {\n const zero = this.chart.yScale()(0)\n\n return Math.min(this.bottom(), Math.max(this.chart.plot().top, zero))\n })\n\n // A tick at each datum, with its label: the chart makes the labels from\n // the `dataKey` of its x axis.\n protected readonly ticks = computed(() => {\n const xs = this.chart.xPositions()\n\n return this.chart\n .xLabels()\n .map((label, index) => ({ offset: xs[index], label }))\n })\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n LOCALE_ID,\n computed,\n forwardRef,\n inject,\n input,\n numberAttribute,\n} from '@angular/core'\n\nimport { MiraChartLayer } from '../chart-layer'\nimport {\n CartesianContext,\n DEFAULT_TICK_COUNT,\n type Tick,\n} from './cartesian-context'\n\n/**\n * The value axis left of the plot. It fits the values of every series in the\n * chart that isn't hidden, and zero, rounded out to round ticks. The ticks\n * read as numbers in the app's locale (`LOCALE_ID`).\n *\n * @example\n * ```html\n * <mira-y-axis [tickCount]=\"4\" />\n * ```\n */\n@Component({\n selector: 'mira-y-axis',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n { provide: MiraChartLayer, useExisting: forwardRef(() => MiraYAxis) },\n ],\n template: `\n <ng-template>\n <svg:g class=\"mira-y-axis\">\n <svg:line\n [attr.x1]=\"x()\"\n [attr.x2]=\"x()\"\n [attr.y1]=\"chart.plot().top\"\n [attr.y2]=\"chart.plot().top + chart.plot().height\"\n />\n @for (tick of ticks(); track tick.value) {\n <svg:g\n [attr.transform]=\"'translate(' + x() + ',' + tick.offset + ')'\"\n >\n <svg:line x2=\"-6\" />\n <svg:text x=\"-9\" dy=\"0.32em\" text-anchor=\"end\">\n {{ tick.label }}\n </svg:text>\n </svg:g>\n }\n </svg:g>\n </ng-template>\n `,\n styles: `\n .mira-y-axis {\n font-size: 12px;\n }\n\n line {\n stroke: var(--_mira-axis-color);\n }\n\n text {\n fill: var(--_mira-axis-color);\n }\n `,\n})\nexport class MiraYAxis extends MiraChartLayer {\n /** The room the axis takes left of the plot, in px: 60 by default. */\n readonly width = input(60, { transform: numberAttribute })\n\n /**\n * About how many ticks to show, 5 by default. The axis keeps its ticks 1, 2\n * or 5 times a power of ten apart, so it may show a few more or a few fewer.\n */\n readonly tickCount = input(DEFAULT_TICK_COUNT, {\n transform: numberAttribute,\n })\n\n protected readonly chart = inject(CartesianContext)\n protected readonly x = computed(() => this.chart.plot().left)\n protected readonly ticks = computed(() => {\n const ticks = this.chart.yTicks()\n const format = this.#format(ticks)\n\n return ticks.map((tick) => ({ ...tick, label: format(tick.value) }))\n })\n\n readonly #locale = inject(LOCALE_ID)\n\n // As many decimals as the step between the ticks has: 2,000 but 0.5.\n #format(ticks: readonly Tick[]): (value: number) => string {\n const step =\n ticks.length > 1 ? Math.abs(ticks[1].value - ticks[0].value) : 1\n const digits = Math.max(0, -Math.floor(Math.log10(step)))\n const format = new Intl.NumberFormat(this.#locale, {\n maximumFractionDigits: digits,\n })\n\n return (value) => format.format(value)\n }\n}\n","import {\n DestroyRef,\n Directive,\n ElementRef,\n type Signal,\n afterNextRender,\n computed,\n contentChild,\n contentChildren,\n inject,\n input,\n numberAttribute,\n signal,\n viewChild,\n} from '@angular/core'\n\nimport { MiraChartLayer } from '../chart-layer'\nimport { MiraSeries } from '../series'\nimport { CHART_THEME } from '../theme'\nimport type { ChartDatum, ChartMargin, ChartSize } from '../types'\nimport { extentOf, valueAt } from '../utils/data'\nimport type { Point } from '../utils/path'\nimport { linearScale, linearTicks, nearestIndex } from '../utils/scale'\nimport {\n type ActiveDatum,\n type CartesianContext,\n ChartLegend,\n DEFAULT_TICK_COUNT,\n type PlotArea,\n type Tick,\n} from './cartesian-context'\nimport { MiraXAxis } from './x-axis'\nimport { MiraYAxis } from './y-axis'\n\n/**\n * The template of every chart with an x and a y axis: an svg with the\n * chart's layers in it, less the hidden series, in the order they're\n * written, each in an outlet of its own; and over the svg, the chart's\n * content itself, for what it shows in HTML, such as the tooltip and the\n * legend. A chart that takes it imports `LayerOutlet`.\n *\n * @internal\n */\nexport const CARTESIAN_CHART_TEMPLATE = `\n <div class=\"mira-chart\">\n <svg\n #svg\n role=\"img\"\n [attr.width]=\"size().width\"\n [attr.height]=\"size().height\"\n [attr.viewBox]=\"viewBox()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n >\n @for (layer of drawnLayers(); track layer) {\n <svg:g [miraLayerOutlet]=\"layer.template()\" />\n }\n </svg>\n <div class=\"mira-chart-overlay\">\n <ng-content />\n </div>\n </div>\n`\n\n/**\n * The styles of every chart with an x and a y axis, its theme among them.\n *\n * @internal\n */\nexport const CARTESIAN_CHART_STYLES = [\n CHART_THEME,\n `\n /* The svg and the content laid over it share a cell, which is as big as\n the svg, in a page that runs right to left as well: the content takes\n the svg's px, and the svg itself isn't positioned, so it isn't drawn\n over the positioned parts of the page around it. */\n .mira-chart {\n display: grid;\n width: fit-content;\n }\n\n .mira-chart > * {\n grid-area: 1 / 1;\n }\n\n svg {\n display: block;\n }\n\n /* Positioned, so its HTML can be placed in the svg's px, and clear for\n the pointer, which the svg tracks. Isolated, so what's stacked in it,\n the tooltip over the legend, stays stacked within the chart. */\n .mira-chart-overlay {\n position: relative;\n pointer-events: none;\n isolation: isolate;\n }\n `,\n]\n\nconst DEFAULT_MARGIN: ChartMargin = { top: 10, right: 20, bottom: 10, left: 10 }\n\n// The size a chart draws at where it can't take one from its container: on\n// the server, in the browser's first frame, while it's hidden, and in a\n// container that gives it no height or no width.\nconst FALLBACK_SIZE: ChartSize = { width: 600, height: 300 }\n\n/**\n * What every chart with an x and a y axis has, whatever its series: data, a\n * size, a margin, the plot area they leave, a y scale that fits the values of\n * its visible series, a label for each datum, and the pointer and the datum\n * under it. Nothing about a kind of chart: a line chart extends it with a\n * point per datum along x, and a bar chart with a band per datum.\n *\n * Inject it in a layer of your own ({@link MiraChartLayer}) to draw where the\n * series are, or in a component of your own that shows something in HTML:\n * what isn't a layer in the chart's content is laid over the svg, in the\n * svg's px, and lets the pointer through to it, as `<mira-tooltip>` is.\n *\n * Its colors are CSS custom properties, to set anywhere above the chart:\n *\n * - `--mira-axis-color`: the axes' lines and labels;\n * - `--mira-grid-color`: the grid, and the tooltip's border unless it has one\n * of its own;\n * - `--mira-cursor-color`: the cursor at the datum under the pointer, a line\n * or, in a chart with bands, a band in the same color at 25% opacity;\n * - `--mira-background`: what's behind the chart, for the ring around a dot\n * under the pointer, and the tooltip's box unless it has one of its own.\n * `Canvas` by default, the browser's own background for the scheme: set it\n * wherever what's behind the chart has another color, a card or the page\n * itself.\n *\n * Unset, they suit the `color-scheme` the chart is in: light by default, dark\n * under `color-scheme: dark`, and the system's under `light dark`. A line's\n * own color is its `stroke`, and a bar's its `fill`.\n */\n@Directive({\n host: {\n '[style.display]': '\"block\"',\n // Fills its container's width, even where the container would center it,\n // as a flex column with `align-items: center` does.\n '[style.width]': 'width() === undefined ? \"100%\" : null',\n // Fills a container that has a height. In one without, the chart is as\n // tall as it draws itself.\n '[style.height]': 'height() === undefined ? \"100%\" : null',\n // Without a width, what it draws doesn't count toward its container's\n // width. If it did, the svg would hold a grid column or a flex item at the\n // svg's width, the chart would measure that width again, and never get\n // narrower. With a width, it counts, so a flex row of charts with a width\n // lays out by them.\n '[style.contain]': 'width() === undefined ? \"inline-size\" : null',\n },\n})\nexport abstract class MiraCartesianChart implements CartesianContext {\n /** The rows to plot, a `ChartDatum` each. */\n readonly data = input<readonly ChartDatum[]>([])\n /**\n * The width in px. Without it, the chart is as wide as its container, and\n * doesn't widen it: a container as wide as its content, such as an\n * inline-block or a dialog, needs a width of its own.\n */\n readonly width = input<number | undefined, unknown>(undefined, {\n transform: optionalNumber,\n })\n\n /**\n * The height in px. Without it, the chart is as tall as its container, or\n * 300px in a container without a height.\n */\n readonly height = input<number | undefined, unknown>(undefined, {\n transform: optionalNumber,\n })\n\n /**\n * Overrides some sides of the default margin: 10px, and 20px on the right.\n */\n readonly margin = input<Partial<ChartMargin>>({})\n /** What the chart shows, for screen readers. */\n readonly ariaLabel = input<string>()\n\n /** The size the chart draws at, in px: its inputs, or its container's. */\n readonly size = computed<ChartSize>(\n () => {\n const measured = this.#measured()\n\n // A size of 0 means the chart is hidden, or its container gives it none:\n // it has no height, or it takes its width from its content. Drawing at 0\n // would keep the height at 0 once the chart shows, and hide a chart whose\n // container needs a width, rather than show it past the container.\n return {\n width: this.width() ?? (measured?.width || FALLBACK_SIZE.width),\n height: this.height() ?? (measured?.height || FALLBACK_SIZE.height),\n }\n },\n { equal: sameSize },\n )\n\n /**\n * Where the series are drawn: the chart less its margin, its axes and its\n * legend.\n */\n readonly plot = computed<PlotArea>(() => {\n const { width, height } = this.size()\n const margin = { ...DEFAULT_MARGIN, ...this.margin() }\n const legend = this.legend()\n\n // The legend takes its room at the edge it sits along, outside the margin.\n if (legend) margin[legend.position()] += legend.room()\n\n const left = margin.left + (this.yAxis()?.width() ?? 0)\n const bottom = margin.bottom + (this.xAxis()?.height() ?? 0)\n\n return {\n left,\n top: margin.top,\n width: Math.max(0, width - left - margin.right),\n height: Math.max(0, height - margin.top - bottom),\n }\n })\n\n /** Maps a value to its y. */\n readonly yScale = computed(() => {\n const { top, height } = this.plot()\n\n return linearScale(this.#yNice().domain, [top + height, top])\n })\n\n /** Round values over the y scale, for the y axis and the grid to mark. */\n readonly yTicks = computed<readonly Tick[]>(() => {\n const scale = this.yScale()\n\n return this.#yNice().ticks.map((value) => ({ value, offset: scale(value) }))\n })\n\n /**\n * The label of each datum along x, in the order of the data: its value\n * under the x axis's `dataKey`, or its index without one. The x axis marks\n * its ticks with them, and the tooltip titles its box with one.\n */\n readonly xLabels = computed<readonly string[]>(() => {\n const key = this.xAxis()?.dataKey()\n\n return this.data().map((datum, index) =>\n key === undefined ? String(index) : String(valueAt(datum, key) ?? ''),\n )\n })\n\n /**\n * Where the pointer last moved over the svg, in the svg's px, or null once\n * it's left. It's placed again when the chart resizes under a pointer that\n * stays put, but not when the chart moves under it, as when the page\n * scrolls: then it waits for the pointer to move.\n */\n readonly pointer = computed(() => this.#pointer())\n\n /**\n * The index of the datum nearest the pointer along x, or null while the\n * pointer is off the plot. It follows the data and the size as they change\n * under a pointer that stays put.\n */\n readonly activeIndex = computed(() => {\n const pointer = this.#pointer()\n\n if (!pointer) return null\n\n const { left, top, width, height } = this.plot()\n const onPlot =\n pointer.x >= left &&\n pointer.x <= left + width &&\n pointer.y >= top &&\n pointer.y <= top + height\n\n if (!onPlot) return null\n\n return nearestIndex(this.xPositions(), pointer.x)\n })\n\n /**\n * The datum under the pointer: its index, the row itself, its x and its\n * label; or null while the pointer is off the plot.\n */\n readonly active = computed<ActiveDatum | null>(() => {\n const index = this.activeIndex()\n\n return index === null\n ? null\n : {\n index,\n datum: this.data()[index],\n x: this.xPositions()[index],\n label: this.xLabels()[index],\n }\n })\n\n /** The series, of whatever kind, in the order they're written, hidden too. */\n readonly series = contentChildren(MiraSeries)\n\n /**\n * The series that aren't hidden, in the order they're written: the y axis\n * fits their values, and the tooltip shows them.\n */\n readonly visibleSeries = computed<readonly MiraSeries[]>(() =>\n this.series().filter((series) => !series.hidden()),\n )\n\n /** The x of each datum, in the order of the data: the kind of chart's call. */\n abstract readonly xPositions: Signal<readonly number[]>\n\n /** The chart's layers, in the order they're written. */\n protected readonly layers = contentChildren(MiraChartLayer)\n\n /** What the chart draws: its layers, less the hidden series. */\n protected readonly drawnLayers = computed<readonly MiraChartLayer[]>(() =>\n this.layers().filter(\n (layer) => !(layer instanceof MiraSeries && layer.hidden()),\n ),\n )\n\n /** The chart's axes, if it has them: the plot leaves room for them. */\n protected readonly xAxis = contentChild(MiraXAxis, { descendants: false })\n protected readonly yAxis = contentChild(MiraYAxis, { descendants: false })\n /** The chart's legend, if it has one: the plot leaves room for it too. */\n protected readonly legend = contentChild(ChartLegend, { descendants: false })\n /** The chart's svg, where the pointer is tracked. */\n protected readonly svg = viewChild.required<ElementRef<SVGSVGElement>>('svg')\n\n protected readonly viewBox = computed(() => {\n const { width, height } = this.size()\n\n return `0 0 ${width} ${height}`\n })\n\n // The size of the chart's element, as the browser last laid it out.\n readonly #measured = signal<ChartSize | null>(null, { equal: sameSize })\n // The pointer in the svg's own px, while it's over the svg.\n readonly #pointer = signal<Point | null>(null)\n\n // The values of every visible series, and zero, rounded out to round ticks.\n readonly #yNice = computed(() => {\n const keys = this.visibleSeries().map((series) => series.dataKey())\n const [min, max] = extentOf(this.data(), keys) ?? [0, 0]\n const count = this.yAxis()?.tickCount() ?? DEFAULT_TICK_COUNT\n\n return linearTicks([Math.min(0, min), Math.max(0, max)], count)\n })\n\n /** @internal */\n constructor() {\n const element = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement\n const destroyRef = inject(DestroyRef)\n\n // In the browser only: on the server there's no layout to measure, and no\n // pointer.\n afterNextRender(() => {\n const svg = this.svg().nativeElement\n // The pointer's last place on the page: the svg can resize under a\n // pointer that stays put.\n let client: Point | null = null\n\n const observer = new ResizeObserver(([entry]) => {\n const { width, height } = entry.contentRect\n\n // Whole px, so a fraction of a px can't nudge the layout back and forth.\n this.#measured.set({\n width: Math.floor(width),\n height: Math.floor(height),\n })\n\n if (client) this.#pointer.set(this.#inSvg(client))\n })\n\n // Listened to outside the template, where every event would check the\n // chart again: here, a pointer moving about the same datum re-runs no\n // template, as the active index doesn't change.\n const listening = new AbortController()\n const options = { signal: listening.signal }\n const track = (event: PointerEvent): void => {\n client = { x: event.clientX, y: event.clientY }\n this.#pointer.set(this.#inSvg(client))\n }\n const leave = (): void => {\n client = null\n this.#pointer.set(null)\n }\n\n observer.observe(element)\n svg.addEventListener('pointermove', track, options)\n svg.addEventListener('pointerdown', track, options)\n svg.addEventListener('pointerleave', leave, options)\n\n destroyRef.onDestroy(() => {\n observer.disconnect()\n listening.abort()\n })\n })\n }\n\n // A point on the page, in the svg's own px, whatever scales the svg there.\n #inSvg(client: Point): Point | null {\n const matrix = this.svg().nativeElement.getScreenCTM()\n\n if (!matrix) return null\n\n const { x, y } = new DOMPoint(client.x, client.y).matrixTransform(\n matrix.inverse(),\n )\n\n return { x, y }\n }\n}\n\nfunction sameSize(a: ChartSize | null, b: ChartSize | null): boolean {\n return a?.width === b?.width && a?.height === b?.height\n}\n\n// Takes `width=\"640\"` as well as `[width]=\"640\"`, and no value at all. A value\n// that isn't a number, like `width=\"auto\"`, counts as none.\nfunction optionalNumber(value: unknown): number | undefined {\n if (value == null || value === '') return undefined\n\n const number = numberAttribute(value)\n\n return Number.isNaN(number) ? undefined : number\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n booleanAttribute,\n forwardRef,\n inject,\n input,\n} from '@angular/core'\n\nimport { MiraChartLayer } from '../chart-layer'\nimport { CartesianContext } from './cartesian-context'\n\n/**\n * Grid lines across the plot: across at the ticks of the y scale, and down\n * at each datum. Write it before the series, so they're drawn over it.\n *\n * @example\n * ```html\n * <mira-cartesian-grid strokeDasharray=\"3 3\" [vertical]=\"false\" />\n * ```\n */\n@Component({\n selector: 'mira-cartesian-grid',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: MiraChartLayer,\n useExisting: forwardRef(() => MiraCartesianGrid),\n },\n ],\n template: `\n <ng-template>\n <svg:g\n class=\"mira-cartesian-grid\"\n [attr.stroke-dasharray]=\"strokeDasharray() ?? null\"\n >\n @if (horizontal()) {\n @for (tick of chart.yTicks(); track tick.value) {\n <svg:line\n [attr.x1]=\"chart.plot().left\"\n [attr.x2]=\"chart.plot().left + chart.plot().width\"\n [attr.y1]=\"tick.offset\"\n [attr.y2]=\"tick.offset\"\n />\n }\n }\n @if (vertical()) {\n @for (x of chart.xPositions(); track $index) {\n <svg:line\n [attr.x1]=\"x\"\n [attr.x2]=\"x\"\n [attr.y1]=\"chart.plot().top\"\n [attr.y2]=\"chart.plot().top + chart.plot().height\"\n />\n }\n }\n </svg:g>\n </ng-template>\n `,\n styles: `\n line {\n stroke: var(--_mira-grid-color);\n }\n `,\n})\nexport class MiraCartesianGrid extends MiraChartLayer {\n /** Lines across, at the ticks of the y scale. On by default. */\n readonly horizontal = input(true, { transform: booleanAttribute })\n /** Lines down, at each datum. On by default. */\n readonly vertical = input(true, { transform: booleanAttribute })\n /** Dashes the lines, as the svg attribute does: `\"3 3\"`. */\n readonly strokeDasharray = input<string>()\n\n protected readonly chart = inject(CartesianContext)\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n forwardRef,\n inject,\n} from '@angular/core'\n\nimport { MiraChartLayer } from '../chart-layer'\nimport { CartesianContext } from './cartesian-context'\n\n// What the cursor draws. A type of its own, so the template can't take a\n// field of one shape for the other.\ntype CursorShape =\n | {\n readonly kind: 'line'\n readonly x: number\n readonly top: number\n readonly bottom: number\n }\n | {\n readonly kind: 'band'\n readonly x: number\n readonly y: number\n readonly width: number\n readonly height: number\n }\n\n/**\n * Marks the datum under the pointer across the plot: a vertical line at its\n * x, or its whole band in a chart with bands, such as the bar chart. Write it\n * after the grid and before the series, so it's drawn between them.\n *\n * @example\n * ```html\n * <mira-line-chart [data]=\"day\">\n * <mira-cartesian-grid />\n * <mira-cursor />\n * <mira-line dataKey=\"solar\" />\n * </mira-line-chart>\n * ```\n */\n@Component({\n selector: 'mira-cursor',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n { provide: MiraChartLayer, useExisting: forwardRef(() => MiraCursor) },\n ],\n template: `\n <ng-template>\n @if (shape(); as shape) {\n @if (shape.kind === 'band') {\n <svg:rect\n class=\"mira-cursor-band\"\n [attr.x]=\"shape.x\"\n [attr.y]=\"shape.y\"\n [attr.width]=\"shape.width\"\n [attr.height]=\"shape.height\"\n />\n } @else {\n <svg:line\n class=\"mira-cursor\"\n [attr.x1]=\"shape.x\"\n [attr.x2]=\"shape.x\"\n [attr.y1]=\"shape.top\"\n [attr.y2]=\"shape.bottom\"\n />\n }\n }\n </ng-template>\n `,\n styles: `\n /* The pointer goes through, to whatever is drawn under the cursor. */\n .mira-cursor,\n .mira-cursor-band {\n pointer-events: none;\n }\n\n .mira-cursor {\n stroke: var(--_mira-cursor-color);\n }\n\n /* The line's color, faint: the grid shows through, and it doesn't vie\n with the bars. */\n .mira-cursor-band {\n fill: var(--_mira-cursor-color);\n fill-opacity: 0.25;\n }\n `,\n})\nexport class MiraCursor extends MiraChartLayer {\n // What to draw while the pointer is on the plot: the datum's band where the\n // chart has bands, a line at its x where each datum is a point.\n protected readonly shape = computed<CursorShape | null>(() => {\n const active = this.#chart.active()\n\n if (active === null) return null\n\n const { x } = active\n const { top, height } = this.#chart.plot()\n const bandwidth = this.#chart.xBandwidth?.()\n\n return bandwidth === undefined\n ? { kind: 'line', x, top, bottom: top + height }\n : { kind: 'band', x: x - bandwidth / 2, y: top, width: bandwidth, height }\n })\n\n readonly #chart = inject(CartesianContext)\n}\n","import { NgTemplateOutlet } from '@angular/common'\nimport {\n ChangeDetectionStrategy,\n Component,\n Directive,\n type ElementRef,\n LOCALE_ID,\n TemplateRef,\n afterRenderEffect,\n computed,\n contentChild,\n inject,\n signal,\n viewChild,\n} from '@angular/core'\n\nimport type { ChartDatum } from '../types'\nimport { numberAt } from '../utils/data'\nimport { CartesianContext } from './cartesian-context'\n\n// The room between the box and the datum beside it, and between the box and\n// the pointer, in px: it clears the halo around a line's active dot.\nconst GAP = 12\n\ntype Size = { readonly width: number; readonly height: number }\n\n/** A series' value at the datum under the pointer. */\nexport type TooltipItem = {\n /** What the series is called: its `name`, or its `dataKey` without one. */\n readonly name: string\n /** The key of the series' values. */\n readonly dataKey: string\n /** The value, as it is in the data. */\n readonly value: number\n /** The series' color. */\n readonly color: string\n}\n\n/**\n * What a template of your own for the tooltip gets (`MiraTooltipContent`):\n * the items as `let-items`, then `label`, `datum` and `index`.\n */\nexport type TooltipContext = {\n /**\n * A value for each visible series that has one at the datum, in the order\n * the series are written: the rows of the tooltip's own box. Never empty:\n * where no series has a value, the tooltip doesn't show.\n */\n readonly $implicit: readonly TooltipItem[]\n /** The datum's label along x: the title of the tooltip's own box. */\n readonly label: string\n /**\n * The datum itself, its row of the chart's data. It's typed as any row:\n * read a field of yours as `$any(datum).solar`, or in a method of yours that\n * knows the row's type.\n */\n readonly datum: ChartDatum\n /** The datum's index in the data. */\n readonly index: number\n}\n\n/**\n * Marks a template of your own for `<mira-tooltip>`. It replaces the whole\n * box, border and background too; the tooltip still places it, and shows it\n * while the datum under the pointer has a value in a visible series. Its\n * context is a `TooltipContext`, and typed: `let-items` holds a `TooltipItem`\n * for each visible series with a value at the datum, and `label`, `datum` and\n * `index` describe the datum.\n *\n * @example\n * ```html\n * <mira-tooltip>\n * <ng-template miraTooltipContent let-items let-label=\"label\">\n * <div class=\"my-tooltip\">\n * <b>{{ label }}</b>\n * <ul>@for (item of items; track $index) {\n * <li>{{ item.name }}: {{ item.value }} kW</li>\n * }</ul>\n * </div>\n * </ng-template>\n * </mira-tooltip>\n * ```\n */\n@Directive({ selector: 'ng-template[miraTooltipContent]' })\nexport class MiraTooltipContent {\n /**\n * Types the template's context, for Angular's template checks.\n *\n * @internal\n */\n static ngTemplateContextGuard(\n directive: MiraTooltipContent,\n context: unknown,\n ): context is TooltipContext {\n return true\n }\n}\n\n/**\n * Shows the values at the datum under the pointer, in a box beside it: the\n * datum's label along x, then a row for each visible series with a value\n * there, in the order the series are written. A row has the series' color, its\n * name and the value, as a number in the app's locale (`LOCALE_ID`), with\n * three decimals at most, or three digits of its own below 1: 0.0004 rather\n * than 0. Where no visible series has a value, the tooltip doesn't show.\n *\n * The box goes past the datum, or past the edge of its band in a chart with\n * bands: on its right where it fits, else on its left. It follows the pointer\n * up and down: below it where it fits, else above. Where it fits on neither\n * side, it's pressed onto the plot, over the datum; a box bigger than the\n * plot starts at its edge and runs past it.\n *\n * The box's text takes the chart's `color`. The rest are CSS custom\n * properties, to set anywhere above the tooltip:\n *\n * - `--mira-font-size`: the size of the text, `0.75rem` by default; the room\n * around the text follows it;\n * - `--mira-tooltip-background`: the box, the chart's `--mira-background` by\n * default;\n * - `--mira-tooltip-border-color`: its border, the chart's\n * `--mira-grid-color` by default.\n *\n * For a box of your own, write its template inside, as an `<ng-template\n * miraTooltipContent>`, and import `MiraTooltipContent` along with\n * `MiraTooltip`: without it, the template goes unnoticed, and the tooltip\n * shows its own box.\n *\n * @example\n * ```html\n * <mira-line-chart [data]=\"day\">\n * <mira-x-axis dataKey=\"hour\" />\n * <mira-y-axis />\n * <mira-line dataKey=\"solar\" name=\"Solar\" stroke=\"#d97706\" />\n * <mira-tooltip />\n * </mira-line-chart>\n * ```\n */\n@Component({\n selector: 'mira-tooltip',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [NgTemplateOutlet],\n template: `\n @if (context(); as context) {\n <div\n #frame\n class=\"mira-tooltip-frame\"\n [style.left.px]=\"position()?.left\"\n [style.top.px]=\"position()?.top\"\n >\n @if (template(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"context\"\n />\n } @else {\n <div class=\"mira-tooltip\">\n <div class=\"mira-tooltip-label\">{{ context.label }}</div>\n @for (row of rows(); track $index) {\n <span\n class=\"mira-tooltip-swatch\"\n [style.background]=\"row.color\"\n ></span>\n <span>{{ row.name }}</span>\n <span class=\"mira-tooltip-value\">{{ row.value }}</span>\n }\n </div>\n }\n </div>\n }\n `,\n styles: `\n /* Where the box goes, as big as the box, which is measured there to keep\n it on the plot. Over the legend, wherever either is written: a box\n bigger than the plot runs past it, onto the legend. */\n .mira-tooltip-frame {\n position: absolute;\n z-index: 1;\n width: max-content;\n }\n\n /* A grid, so the values line up from row to row, at its right edge. It\n sets no color of its own: a series in currentColor has the same color\n in its swatch as in the svg, unless a color is set on the tooltip or\n around it. */\n .mira-tooltip {\n display: grid;\n grid-template-columns: auto 1fr auto;\n column-gap: 0.5em;\n align-items: center;\n padding: 0.5em 0.75em;\n border: 1px solid\n var(--mira-tooltip-border-color, var(--_mira-grid-color));\n border-radius: 4px;\n /* What's behind the chart, but Canvas rather than the theme's white\n where light-dark() is missing: the text follows the page's scheme\n there, and the box has to as well. */\n background: var(\n --mira-tooltip-background,\n var(--mira-background, Canvas)\n );\n box-shadow: 0 2px 6px rgb(0 0 0 / 15%);\n font-size: var(--mira-font-size, 0.75rem);\n line-height: 1.6;\n }\n\n .mira-tooltip-label {\n grid-column: 1 / -1;\n }\n\n /* Kept in forced colors and in print, as the series keep theirs in the\n svg. */\n .mira-tooltip-swatch {\n width: 0.75em;\n height: 0.75em;\n border-radius: 50%;\n forced-color-adjust: none;\n print-color-adjust: exact;\n }\n\n .mira-tooltip-value {\n padding-inline-start: 0.75em;\n font-weight: 600;\n font-variant-numeric: tabular-nums;\n text-align: end;\n }\n `,\n})\nexport class MiraTooltip {\n // What the tooltip shows while a datum is under the pointer, as a template\n // of your own gets it; null where it has no value to show.\n protected readonly context = computed<TooltipContext | null>(() => {\n const active = this.#chart.active()\n\n if (active === null) return null\n\n const items = this.#chart.visibleSeries().flatMap((series) => {\n const value = numberAt(active.datum, series.dataKey())\n\n if (value === null) return []\n\n return {\n name: series.displayName(),\n dataKey: series.dataKey(),\n value,\n color: series.color(),\n }\n })\n\n if (items.length === 0) return null\n\n const { label, datum, index } = active\n\n return { $implicit: items, label, datum, index }\n })\n\n // The rows of the tooltip's own box: the items, with their values as text.\n protected readonly rows = computed(() =>\n (this.context()?.$implicit ?? []).map((item) => ({\n ...item,\n value: this.#format(item.value),\n })),\n )\n\n // A template of your own for the box, if there's one.\n protected readonly template = contentChild(MiraTooltipContent, {\n read: TemplateRef,\n })\n\n // Where the box goes, in the svg's px: beside the datum along x, beside the\n // pointer along y.\n protected readonly position = computed(() => {\n const active = this.#chart.active()\n const y = this.#pointerY()\n\n if (active === null || y === null) return null\n\n const { x } = active\n const { left, top, width, height } = this.#chart.plot()\n const size = this.#size()\n // From the datum's x to the edge of its band, where it has one.\n const half = (this.#chart.xBandwidth?.() ?? 0) / 2\n\n return {\n left: beside(x - half - GAP, x + half + GAP, size.width, left, width),\n top: beside(y - GAP, y + GAP, size.height, top, height),\n }\n })\n\n // The box, while it shows, to measure.\n protected readonly frame = viewChild<ElementRef<HTMLElement>>('frame')\n\n readonly #chart = inject(CartesianContext)\n // The box's size, as the browser last laid it out.\n readonly #size = signal<Size>(\n { width: 0, height: 0 },\n { equal: (a, b) => a.width === b.width && a.height === b.height },\n )\n\n readonly #locale = inject(LOCALE_ID)\n // At most three decimals, or, below 1, three digits of the value's own:\n // 0.0004 rather than 0.\n readonly #decimals = new Intl.NumberFormat(this.#locale, {\n maximumFractionDigits: 3,\n })\n\n readonly #digits = new Intl.NumberFormat(this.#locale, {\n maximumSignificantDigits: 3,\n })\n\n // The pointer's height while a datum is under it: a move along x within the\n // datum leaves it as it is, and the box where it is.\n readonly #pointerY = computed(() =>\n this.#chart.active() === null ? null : (this.#chart.pointer()?.y ?? null),\n )\n\n /** @internal */\n constructor() {\n // The box is measured after a render that changes what it shows, and\n // placed again before the page is painted: a new box shows where it fits.\n afterRenderEffect({\n earlyRead: () => {\n this.context()\n this.template()\n\n const frame = this.frame()?.nativeElement\n\n return frame ? sizeOf(frame) : null\n },\n write: (measured) => {\n const size = measured()\n\n if (size) this.#size.set(size)\n },\n })\n\n // And again whenever it changes size on its own, as a box of your own can\n // with an image that loads: then it's placed again a frame later.\n afterRenderEffect((onCleanup) => {\n const frame = this.frame()?.nativeElement\n\n if (!frame) return\n\n const observer = new ResizeObserver(() => this.#size.set(sizeOf(frame)))\n\n observer.observe(frame)\n onCleanup(() => observer.disconnect())\n })\n }\n\n #format(value: number): string {\n return (Math.abs(value) < 1 ? this.#digits : this.#decimals).format(value)\n }\n}\n\n// The box's size as laid out, in the svg's px: a transform on the page around\n// the chart scales both alike.\nfunction sizeOf(element: HTMLElement): Size {\n return { width: element.offsetWidth, height: element.offsetHeight }\n}\n\n// Where a box of `size` starts along one axis of the plot, beside something:\n// `after` is where it starts past that thing, and `before` where it ends\n// short of it. Past it where the box fits on the plot, else short of it,\n// else as near past it as the plot allows.\nfunction beside(\n before: number,\n after: number,\n size: number,\n start: number,\n length: number,\n): number {\n const end = start + length\n\n if (after + size <= end) return after\n if (before - size >= start) return before - size\n\n return Math.max(start, Math.min(after, end - size))\n}\n","import { NgTemplateOutlet } from '@angular/common'\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n Directive,\n ElementRef,\n TemplateRef,\n afterNextRender,\n afterRenderEffect,\n booleanAttribute,\n computed,\n contentChild,\n forwardRef,\n inject,\n input,\n linkedSignal,\n} from '@angular/core'\n\nimport type { LegendIcon, MiraSeries } from '../series'\nimport { CHART_THEME } from '../theme'\nimport type { MiraCartesianChart } from './cartesian-chart'\nimport { CartesianContext, ChartLegend } from './cartesian-context'\n\n/** The edge of the chart that a legend sits along. */\nexport type LegendPosition = 'top' | 'right' | 'bottom' | 'left'\n\n/** A series, as the legend lists it. */\nexport type LegendItem = {\n /** What the series is called: its `name`, or its `dataKey` without one. */\n readonly name: string\n /** The series' color. */\n readonly color: string\n /** The shape that marks the series: its `legendIcon`. */\n readonly icon: LegendIcon\n /** Whether the series is hidden. */\n readonly hidden: boolean\n}\n\n/**\n * What a template of your own for an item of the legend gets\n * (`MiraLegendItemContent`): the item as `let-item`.\n */\nexport type LegendItemContext = {\n /** The series, as the legend lists it. */\n readonly $implicit: LegendItem\n}\n\n/**\n * Marks a template of your own for what each item of `<mira-legend>` shows,\n * in place of its icon and its name. It flows as text inside the item, which\n * stays the legend's: in a toggleable legend, a button, marked `aria-pressed`,\n * that hides or shows the series. A hidden series' item takes a gray color,\n * which your template can keep or set its own from `item.hidden`. Its context\n * is a `LegendItemContext`, and typed: `let-item` holds the series' `name`,\n * `color`, `icon` and `hidden`.\n *\n * Screen readers read the template's text out, as the button's name in a\n * toggleable legend:\n *\n * - keep the series' name in it, the same whether the series is hidden or\n * not, and show the state in the look: the button already tells it;\n * - mark what only decorates, such as a swatch or an emoji,\n * `aria-hidden=\"true\"`;\n * - in a toggleable legend, put no buttons or links in it, as it's inside a\n * button.\n *\n * Forced colors replace the colors you set, and print drops backgrounds by\n * default: give what shows the series' color `forced-color-adjust: none` and\n * `print-color-adjust: exact`, as the legend's own icons have.\n *\n * @example\n * ```html\n * <mira-legend>\n * <ng-template miraLegendItemContent let-item>\n * <span\n * aria-hidden=\"true\"\n * [style.color]=\"item.hidden ? null : item.color\"\n * >●</span>\n * <b>{{ item.name }}</b>\n * </ng-template>\n * </mira-legend>\n * ```\n */\n@Directive({ selector: 'ng-template[miraLegendItemContent]' })\nexport class MiraLegendItemContent {\n /**\n * Types the template's context, for Angular's template checks.\n *\n * @internal\n */\n static ngTemplateContextGuard(\n directive: MiraLegendItemContent,\n context: unknown,\n ): context is LegendItemContext {\n return true\n }\n}\n\n// The height of a legend of one row along the top or the bottom, as its\n// styles lay it out in the browser's default font size, in px: the row and\n// the room beside it for the focus ring. The plot leaves it until the legend\n// is measured, on the server.\nconst ROW_HEIGHT = 22\n\n/**\n * Lists the chart's series along one of its edges, in the order they're\n * written, each with its icon in its color and its name: a stretch of line\n * marks a line, a square marks bars, and a circle any other series (the\n * series' `legendIcon`). A series is called by its `name`, or its `dataKey`\n * without one. The plot leaves room for the legend, as it does for the axes,\n * and the chart stays as big as it is.\n *\n * Along the bottom, by default, or the top, the items go in rows, centered,\n * as many as they take. Up the right or the left side, they go in a column in\n * the middle of the chart's height, at most 40% of its width wide, where a\n * longer name wraps. Left and right are as the svg is drawn, in a page that\n * runs right to left too, where the y axis stays on the left. A legend on a\n * side leaves the plot no room on the server: its width is known only once\n * the browser lays it out.\n *\n * It's a list to read, unless it's `toggleable`: then each item is a button\n * that hides its series, or shows it again, and the chart fits its y axis to\n * the series that are left. The state is the series' own `hidden`, to bind\n * as `[(hidden)]`. A hidden series' item stays, grayed and struck through.\n * In a toggleable legend it's marked `aria-pressed=\"false\"` for screen\n * readers; in a list to read, screen readers and the keyboard skip it, as the\n * chart doesn't draw it.\n *\n * The legend's text takes the `color` around it, the chart's in a chart. The\n * rest are CSS custom properties, to set anywhere above the legend:\n *\n * - `--mira-font-size`: the size of the text, `0.75rem` by default; the room\n * around the text follows it;\n * - `--mira-legend-inactive-color`: a hidden series' item,\n * `--mira-axis-color` by default.\n *\n * For items that show something of your own, write their template inside, as\n * an `<ng-template miraLegendItemContent>`, and import `MiraLegendItemContent`\n * along with `MiraLegend`: without it, the template goes unnoticed, and the\n * legend shows its own icon and name.\n *\n * Anywhere else on the page, name the chart with `for`. There the legend sits\n * where the page puts it, as a block, and the chart leaves it no room; its\n * `position` only picks its layout, rows for the top or the bottom, a column\n * for a side. Its colors come from above it, as in a chart: set the custom\n * properties above both to change them alike.\n *\n * @example\n * ```html\n * <mira-line-chart [data]=\"day\">\n * <mira-x-axis dataKey=\"hour\" />\n * <mira-y-axis />\n * <mira-line dataKey=\"solar\" name=\"Solar\" stroke=\"#d97706\" />\n * <mira-line dataKey=\"usage\" name=\"Usage\" stroke=\"#3b82f6\" />\n * <mira-legend position=\"right\" toggleable />\n * </mira-line-chart>\n * ```\n *\n * ```html\n * <header>\n * <h2>A sunny day</h2>\n * <mira-legend [for]=\"chart\" />\n * </header>\n * <mira-line-chart #chart [data]=\"day\">…</mira-line-chart>\n * ```\n */\n@Component({\n selector: 'mira-legend',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [NgTemplateOutlet],\n providers: [\n { provide: ChartLegend, useExisting: forwardRef(() => MiraLegend) },\n ],\n host: {\n '[attr.data-position]': 'placement()',\n '[attr.data-layout]': 'layout()',\n },\n template: `\n <ul class=\"mira-legend\" role=\"list\">\n @for (entry of entries(); track entry.series) {\n <li\n [attr.data-hidden]=\"entry.item.hidden || null\"\n [attr.inert]=\"entry.item.hidden && !toggleable() ? '' : null\"\n >\n @if (toggleable()) {\n <button\n type=\"button\"\n class=\"mira-legend-item\"\n [attr.aria-pressed]=\"!entry.item.hidden\"\n (click)=\"toggle(entry.series)\"\n >\n <ng-container\n [ngTemplateOutlet]=\"template() ?? own\"\n [ngTemplateOutletContext]=\"{ $implicit: entry.item }\"\n />\n </button>\n } @else {\n <ng-container\n [ngTemplateOutlet]=\"template() ?? own\"\n [ngTemplateOutletContext]=\"{ $implicit: entry.item }\"\n />\n }\n </li>\n }\n </ul>\n\n <ng-template #own let-item>\n <span class=\"mira-legend-label\">\n <span\n class=\"mira-legend-icon\"\n [attr.data-icon]=\"item.icon\"\n [style.color]=\"item.hidden ? null : item.color\"\n ></span>\n <span class=\"mira-legend-name\">{{ item.name }}</span>\n </span>\n </ng-template>\n `,\n styles: [\n CHART_THEME,\n `\n /* Out of a chart, where the page puts it. */\n :host {\n display: block;\n }\n\n /* In a chart, at an edge of its svg: along the top or the bottom, as\n wide as the svg; or up a side, as tall as the svg, with the list in its\n middle, from its top where the list is taller, and no more than 40% of\n the svg's width. */\n :host([data-position]) {\n position: absolute;\n }\n\n :host([data-position='top']) {\n inset: 0 0 auto;\n }\n\n :host([data-position='bottom']) {\n inset: auto 0 0;\n }\n\n :host([data-position='left']) {\n inset: 0 auto 0 0;\n }\n\n :host([data-position='right']) {\n inset: 0 0 0 auto;\n }\n\n :host([data-position='left']),\n :host([data-position='right']) {\n display: flex;\n align-items: center;\n align-items: safe center;\n max-width: 40%;\n }\n\n /* In rows, centered; what can't wrap and is wider than the chart runs\n off its end rather than off both sides. A name too long for the room\n wraps, inside a word where it has to. The list keeps its role in\n Safari, which drops it from a list without bullets. Rows are 24px\n apart at least, center to center, whatever the font, so a button never\n touches the next. */\n .mira-legend {\n display: flex;\n flex-wrap: wrap;\n justify-content: center;\n justify-content: safe center;\n gap: max(0.5em, 24px - 1.5em) 1.25em;\n margin: 0;\n padding: 0 0.75em;\n list-style: none;\n font-size: var(--mira-font-size, 0.75rem);\n line-height: 1.5;\n overflow-wrap: anywhere;\n }\n\n /* Room for the focus ring at the chart's edge, in a container that\n clips. */\n :host([data-position='top']) .mira-legend {\n padding-top: 4px;\n }\n\n :host([data-position='bottom']) .mira-legend {\n padding-bottom: 4px;\n }\n\n :host([data-layout='column']) .mira-legend {\n flex-direction: column;\n align-items: flex-start;\n }\n\n /* In a chart, an item takes the pointer that the chart's overlay lets\n through: a button, or a link in a template of your own. */\n :host([data-position]) li {\n pointer-events: auto;\n }\n\n /* In a toggleable legend, a button that looks just like the text of a\n list to read. */\n .mira-legend-item {\n all: unset;\n display: block;\n cursor: pointer;\n }\n\n /* The browser's own focus ring, clear of the text. */\n .mira-legend-item:focus-visible {\n outline: revert;\n outline-offset: 2px;\n }\n\n /* A hidden series' item is gray, and its own name struck through. */\n li[data-hidden] {\n color: var(--mira-legend-inactive-color, var(--_mira-axis-color));\n }\n\n li[data-hidden] .mira-legend-name {\n text-decoration: line-through;\n }\n\n @media (forced-colors: active) {\n li[data-hidden] {\n color: GrayText;\n }\n }\n\n /* The legend's own item: the icon beside the name, by the first line of\n a name that wraps. */\n .mira-legend-label {\n display: flex;\n gap: 0.5em;\n }\n\n /* The series' icon, in its color, set on it; or, for a hidden series, in\n the item's. Kept in forced colors and in print as well, which drops\n backgrounds by default, as the series keep their colors in the svg:\n it's what tells them apart. As wide as the widest icon, so the names\n line up in a column, and as tall as a line. */\n .mira-legend-icon {\n display: grid;\n flex: none;\n place-items: center;\n width: 1em;\n height: 1.5em;\n forced-color-adjust: none;\n print-color-adjust: exact;\n }\n\n /* A circle, for a series that sets no icon. */\n .mira-legend-icon::before {\n content: '';\n width: 0.75em;\n height: 0.75em;\n border-radius: 50%;\n background: currentColor;\n }\n\n /* A square, for bars. */\n .mira-legend-icon[data-icon='square']::before {\n border-radius: 0.125em;\n }\n\n /* A stretch of line, as thick as a line is drawn by default. */\n .mira-legend-icon[data-icon='line']::before {\n width: 100%;\n height: 2px;\n border-radius: 0;\n }\n `,\n ],\n})\nexport class MiraLegend implements ChartLegend {\n /** The edge of the chart the legend sits along: `'bottom'` by default. */\n readonly position = input<LegendPosition>('bottom')\n\n /**\n * Whether a click on an item, or Enter or Space on it, hides its series or\n * shows it again. Off by default: the legend is then a list to read.\n */\n readonly toggleable = input(false, { transform: booleanAttribute })\n\n /**\n * The chart whose series the legend lists, for a legend out of it: give\n * the chart a reference, `<mira-line-chart #chart>`, and name it,\n * `<mira-legend [for]=\"chart\" />`. Unset, the chart the legend is in. With\n * no chart, as while a chart named through a query is in an `@if` that's\n * off, the legend lists nothing.\n */\n readonly for = input<MiraCartesianChart>()\n\n /**\n * The room the legend takes from the chart along its edge, in px: its\n * height along the top or the bottom, its width up a side, as the browser\n * last laid it out there. Until then, a row's height along the top or the\n * bottom, and none on a side.\n *\n * @internal\n */\n readonly room = computed(\n () => this.#measured() ?? (inRows(this.position()) ? ROW_HEIGHT : 0),\n )\n\n // Where the legend sits: at an edge of the chart it's in. Out of a chart,\n // where the page puts it.\n protected readonly placement = computed(() =>\n this.#parent ? this.position() : null,\n )\n\n // How it lays out its items: in rows, or in a column.\n protected readonly layout = computed(() =>\n inRows(this.position()) ? 'rows' : 'column',\n )\n\n // What the legend lists: each series of the chart it names, or of the one\n // it's in, hidden ones too.\n protected readonly entries = computed(() => {\n const all = (this.for() ?? this.#parent)?.series() ?? []\n\n return all.flatMap((series) => {\n const name = nameOf(series)\n\n if (name === null) return []\n\n const item: LegendItem = {\n name,\n color: series.color(),\n icon: series.legendIcon,\n hidden: series.hidden(),\n }\n\n return { series, item }\n })\n })\n\n // A template of your own for the items, if there's one.\n protected readonly template = contentChild(MiraLegendItemContent, {\n read: TemplateRef,\n })\n\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement\n // The chart the legend is in, if it's in one.\n readonly #parent = inject(CartesianContext, { optional: true })\n // The room the legend took, as the browser last laid it out: none yet on a\n // side it has just moved to, which the old room says nothing about.\n readonly #measured = linkedSignal<LegendPosition, number | null>({\n source: this.position,\n computation: () => null,\n })\n\n /** @internal */\n constructor() {\n const parent = this.#parent\n const destroyRef = inject(DestroyRef)\n\n // Out of a chart, there's no room to leave the legend, and nothing to\n // measure.\n if (!parent) return\n\n // The legend is measured after a render that changes what it lists, how\n // it shows it, its side, or the chart's size, which can wrap it onto more\n // rows or fewer; and the plot leaves it room before the page is painted.\n afterRenderEffect({\n earlyRead: () => {\n this.entries()\n this.template()\n parent.size()\n\n return this.#measure()\n },\n write: (room) => this.#measured.set(room()),\n })\n\n // And again whenever it changes size on its own, as when a font loads,\n // or an item of your own that changes, padding and border included: then\n // the plot follows a frame later.\n afterNextRender(() => {\n const observer = new ResizeObserver(() =>\n this.#measured.set(this.#measure()),\n )\n\n observer.observe(this.#host, { box: 'border-box' })\n destroyRef.onDestroy(() => observer.disconnect())\n })\n }\n\n // Hides the series, or shows it again.\n protected toggle(series: MiraSeries): void {\n series.hidden.update((hidden) => !hidden)\n }\n\n // The room the legend takes along its edge as laid out, in the svg's px: a\n // transform on the page around the chart scales both alike.\n #measure(): number {\n const { offsetWidth, offsetHeight } = this.#host\n\n return inRows(this.position()) ? offsetHeight : offsetWidth\n }\n}\n\n// What the series is called, or null while it has no `dataKey` yet. Angular\n// binds a series' inputs as it checks the block the series is written in,\n// and a legend in a block it checks before reads the series first: such a\n// series joins the list as soon as its inputs are bound, in the same pass.\nfunction nameOf(series: MiraSeries): string | null {\n try {\n return series.displayName()\n } catch {\n return null\n }\n}\n\n// Whether a legend on this side lists its items in rows, rather than in a\n// column.\nfunction inRows(side: LegendPosition): boolean {\n return side === 'top' || side === 'bottom'\n}\n","import type { Provider, Type } from '@angular/core'\n\nimport { MiraCartesianChart } from './cartesian-chart'\nimport { CartesianContext } from './cartesian-context'\n\n/**\n * The providers of a kind of cartesian chart: under `MiraCartesianChart`, for\n * layers of your own, and under the context the library's layers inject.\n * Every kind of chart lists them, given `forwardRef(() => TheChart)`:\n * providers aren't inherited.\n *\n * @internal\n */\nexport function provideCartesianChart(\n chart: Type<MiraCartesianChart>,\n): Provider[] {\n return [\n { provide: MiraCartesianChart, useExisting: chart },\n { provide: CartesianContext, useExisting: chart },\n ]\n}\n","import { NgTemplateOutlet } from '@angular/common'\nimport {\n ChangeDetectionStrategy,\n Component,\n type TemplateRef,\n input,\n} from '@angular/core'\n\n/**\n * Draws a layer's template in a view of its own. Angular tracks the signals a\n * template reads in the component view it's drawn into: drawn straight into\n * the chart's, a signal that one layer reads runs them all again, and a new\n * active index re-runs the grid and the axes along with the cursor and the\n * series. Here a layer runs again only when a signal it reads changes, or\n * when the layer itself is checked.\n *\n * @internal\n */\n@Component({\n selector: 'g[miraLayerOutlet]',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [NgTemplateOutlet],\n template: `\n <ng-container [ngTemplateOutlet]=\"template()\" />\n `,\n})\nexport class LayerOutlet {\n /** What to draw: a layer's template. */\n readonly template = input<TemplateRef<unknown>>(undefined, {\n alias: 'miraLayerOutlet',\n })\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n forwardRef,\n} from '@angular/core'\n\nimport {\n CARTESIAN_CHART_STYLES,\n CARTESIAN_CHART_TEMPLATE,\n MiraCartesianChart,\n} from '../core/cartesian/cartesian-chart'\nimport { provideCartesianChart } from '../core/cartesian/provide-cartesian-chart'\nimport { LayerOutlet } from '../core/layer-outlet'\nimport { pointPositions } from '../core/utils/scale'\n\n/**\n * A chart of lines over categories, a point per datum. What's in it comes as\n * content, drawn in the order it's written, so the first one ends up at the\n * bottom.\n *\n * @example\n * ```html\n * <mira-line-chart [data]=\"day\">\n * <mira-cartesian-grid />\n * <mira-x-axis dataKey=\"hour\" />\n * <mira-y-axis />\n * <mira-line dataKey=\"solar\" stroke=\"#d97706\" />\n * <mira-line dataKey=\"usage\" stroke=\"#3b82f6\" />\n * </mira-line-chart>\n * ```\n */\n@Component({\n selector: 'mira-line-chart',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LayerOutlet],\n providers: [provideCartesianChart(forwardRef(() => MiraLineChart))],\n template: CARTESIAN_CHART_TEMPLATE,\n styles: CARTESIAN_CHART_STYLES,\n})\nexport class MiraLineChart extends MiraCartesianChart {\n /** A point per datum, from edge to edge of the plot. */\n override readonly xPositions = computed<readonly number[]>(() => {\n const { left, width } = this.plot()\n\n return pointPositions(this.data().length, [left, left + width])\n })\n}\n","/** A point in px within a chart's svg. */\nexport type Point = {\n readonly x: number\n readonly y: number\n}\n\n/**\n * How a line goes from one value to the next: straight, or along a smooth\n * curve that never overshoots the values (`monotone`).\n */\nexport type LineCurve = 'linear' | 'monotone'\n\n/**\n * The svg path of a line through the points. The line breaks where a point is\n * null, and picks up again at the next one.\n *\n * @internal\n */\nexport function linePath(\n points: ReadonlyArray<Point | null>,\n curve: LineCurve,\n): string {\n return runsOf(points)\n .map((run) => (curve === 'monotone' ? monotone(run) : straight(run)))\n .join('')\n}\n\n// The stretches of points between the nulls.\nfunction runsOf(points: ReadonlyArray<Point | null>): Point[][] {\n const runs: Point[][] = [[]]\n\n for (const point of points) {\n if (point) {\n runs[runs.length - 1].push(point)\n } else if (runs[runs.length - 1].length > 0) {\n runs.push([])\n }\n }\n\n return runs.filter((run) => run.length > 0)\n}\n\nfunction straight(points: readonly Point[]): string {\n return points\n .map((point, index) => `${index === 0 ? 'M' : 'L'}${xy(point)}`)\n .join('')\n}\n\n/*\n * A smooth curve through the points that keeps to the data: between two\n * points it goes neither above nor below them, so it makes up no peaks, and\n * it's flat where the data turns. Steffen's method (\"A Simple Method for\n * Monotonic Interpolation in One Dimension\", 1990), as d3-shape's\n * curveMonotoneX draws it: a cubic Bézier per segment, with the tangent at\n * each point at most twice as steep as the gentler segment beside it.\n */\nfunction monotone(points: readonly Point[]): string {\n // Through two points, the curve is a straight line.\n if (points.length < 3) return straight(points)\n\n const last = points.length - 1\n const slopes: number[] = []\n\n for (let i = 0; i < last; i++) {\n const dx = points[i + 1].x - points[i].x\n\n slopes.push(dx === 0 ? 0 : (points[i + 1].y - points[i].y) / dx)\n }\n\n const tangents = new Array<number>(points.length).fill(0)\n\n for (let i = 1; i < last; i++) {\n const h0 = points[i].x - points[i - 1].x\n const h1 = points[i + 1].x - points[i].x\n const s0 = slopes[i - 1]\n const s1 = slopes[i]\n const p = (s0 * h1 + s1 * h0) / (h0 + h1)\n const sign = Math.sign(s0) + Math.sign(s1)\n\n // The sign is zero where the slopes have opposite signs: the curve is\n // flat where the data turns.\n tangents[i] =\n sign * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0\n }\n\n // At the two ends, the tangent that leaves the curve unbent there.\n tangents[0] = (3 * slopes[0] - tangents[1]) / 2\n tangents[last] = (3 * slopes[last - 1] - tangents[last - 1]) / 2\n\n let path = `M${xy(points[0])}`\n\n for (let i = 0; i < last; i++) {\n const a = points[i]\n const b = points[i + 1]\n const dx = (b.x - a.x) / 3\n\n path +=\n `C${xy({ x: a.x + dx, y: a.y + dx * tangents[i] })}` +\n ` ${xy({ x: b.x - dx, y: b.y - dx * tangents[i + 1] })}` +\n ` ${xy(b)}`\n }\n\n return path\n}\n\n// Hundredths of a px are as fine as a screen shows, and keep paths short.\nfunction xy(point: Point): string {\n return `${Math.round(point.x * 100) / 100},${Math.round(point.y * 100) / 100}`\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n type Signal,\n booleanAttribute,\n computed,\n forwardRef,\n inject,\n input,\n} from '@angular/core'\n\nimport { CartesianContext } from '../core/cartesian/cartesian-context'\nimport { MiraChartLayer } from '../core/chart-layer'\nimport { type LegendIcon, MiraSeries } from '../core/series'\nimport { numberAt } from '../core/utils/data'\nimport { type LineCurve, type Point, linePath } from '../core/utils/path'\n\n/**\n * A line through the values under `dataKey`, a point per datum, with a dot on\n * each value and a bigger one, in a halo, on the value under the pointer.\n * Where a datum has no number under the key, the line breaks; a value alone\n * between two gaps shows only as its dot.\n *\n * @example\n * ```html\n * <mira-line dataKey=\"solar\" stroke=\"#d97706\" />\n * ```\n */\n@Component({\n selector: 'mira-line',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n { provide: MiraChartLayer, useExisting: forwardRef(() => MiraLine) },\n { provide: MiraSeries, useExisting: forwardRef(() => MiraLine) },\n ],\n template: `\n <ng-template>\n <svg:g class=\"mira-line\">\n <svg:path\n class=\"mira-line-curve\"\n [attr.d]=\"path()\"\n [attr.stroke]=\"stroke()\"\n />\n @if (dot()) {\n @for (point of dots(); track $index) {\n <svg:circle\n class=\"mira-line-dot\"\n r=\"4\"\n [attr.cx]=\"point.x\"\n [attr.cy]=\"point.y\"\n [attr.fill]=\"stroke()\"\n />\n }\n }\n @if (activePoint(); as point) {\n <svg:circle\n class=\"mira-line-halo\"\n r=\"10\"\n [attr.cx]=\"point.x\"\n [attr.cy]=\"point.y\"\n [attr.fill]=\"stroke()\"\n />\n <svg:circle\n class=\"mira-line-active-dot\"\n r=\"6\"\n [attr.cx]=\"point.x\"\n [attr.cy]=\"point.y\"\n [attr.fill]=\"stroke()\"\n />\n }\n </svg:g>\n </ng-template>\n `,\n styles: `\n .mira-line-curve {\n fill: none;\n stroke-width: 2;\n }\n\n .mira-line-halo {\n fill-opacity: 0.25;\n }\n\n .mira-line-active-dot {\n stroke: var(--_mira-background);\n stroke-width: 2;\n }\n `,\n})\nexport class MiraLine extends MiraSeries {\n /** The color of the line and of its dots, `#3182bd` by default. */\n readonly stroke = input('#3182bd')\n /** How the line goes from one value to the next, `'linear'` by default. */\n readonly curve = input<LineCurve>('linear')\n /** Whether to mark each value with a dot. On by default. */\n readonly dot = input(true, { transform: booleanAttribute })\n\n /**\n * Whether to mark the value under the pointer with a bigger dot, in a halo.\n * On by default.\n */\n readonly activeDot = input(true, { transform: booleanAttribute })\n\n /** The line's color, for the tooltip and the legend. Set it with `stroke`. */\n override readonly color: Signal<string> = this.stroke\n /** A stretch of line marks the line in the legend. */\n override readonly legendIcon: LegendIcon = 'line'\n\n protected readonly path = computed(() =>\n linePath(this.#points(), this.curve()),\n )\n\n protected readonly dots = computed(() =>\n this.#points().filter((point) => point !== null),\n )\n\n // The point under the pointer, if the line has a value there.\n protected readonly activePoint = computed(() => {\n if (!this.activeDot()) return null\n\n const index = this.#chart.activeIndex()\n\n if (index === null) return null\n\n return this.#points()[index] ?? null\n })\n\n readonly #chart = inject(CartesianContext)\n // A point per datum, or null where the datum has no value to plot.\n readonly #points = computed<ReadonlyArray<Point | null>>(() => {\n const key = this.dataKey()\n const xs = this.#chart.xPositions()\n const y = this.#chart.yScale()\n\n return this.#chart.data().map((datum, index) => {\n const value = numberAt(datum, key)\n\n return value === null ? null : { x: xs[index], y: y(value) }\n })\n })\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n forwardRef,\n} from '@angular/core'\n\nimport {\n CARTESIAN_CHART_STYLES,\n CARTESIAN_CHART_TEMPLATE,\n MiraCartesianChart,\n} from '../core/cartesian/cartesian-chart'\nimport type { CartesianContext } from '../core/cartesian/cartesian-context'\nimport { provideCartesianChart } from '../core/cartesian/provide-cartesian-chart'\nimport { LayerOutlet } from '../core/layer-outlet'\nimport { bandPositions } from '../core/utils/scale'\n\n/**\n * A chart of bars over categories, a band per datum. What's in it comes as\n * content, drawn in the order it's written, so the first one ends up at the\n * bottom.\n *\n * @example\n * ```html\n * <mira-bar-chart [data]=\"year\">\n * <mira-cartesian-grid />\n * <mira-x-axis dataKey=\"month\" />\n * <mira-y-axis />\n * <mira-bar dataKey=\"solar\" fill=\"#d97706\" />\n * <mira-bar dataKey=\"usage\" fill=\"#3b82f6\" />\n * </mira-bar-chart>\n * ```\n */\n@Component({\n selector: 'mira-bar-chart',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LayerOutlet],\n providers: [provideCartesianChart(forwardRef(() => MiraBarChart))],\n template: CARTESIAN_CHART_TEMPLATE,\n styles: CARTESIAN_CHART_STYLES,\n})\n// Required, so the compiler checks the bands, which the context only may have.\nexport class MiraBarChart\n extends MiraCartesianChart\n implements Required<CartesianContext>\n{\n /** The middle of each datum's band. */\n override readonly xPositions = computed(() => this.#bands().positions)\n /** The width of each datum's band: the plot's, shared out among the data. */\n readonly xBandwidth = computed(() => this.#bands().bandwidth)\n\n // A band per datum, edge to edge across the plot.\n readonly #bands = computed(() => {\n const { left, width } = this.plot()\n\n return bandPositions(this.data().length, [left, left + width])\n })\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n type Signal,\n computed,\n forwardRef,\n inject,\n input,\n} from '@angular/core'\n\nimport { CartesianContext } from '../core/cartesian/cartesian-context'\nimport { MiraChartLayer } from '../core/chart-layer'\nimport { type LegendIcon, MiraSeries } from '../core/series'\nimport { numberAt } from '../core/utils/data'\n\n// The room the bars leave on each side of their band, as a share of the band.\nconst CATEGORY_GAP = 0.1\n// The room between two bars of a band, in px.\nconst BAR_GAP = 4\n\n// Where a bar goes in its band: its offset from the band's start, and its\n// width, in px.\ntype Slot = {\n readonly offset: number\n readonly width: number\n}\n\n/**\n * A series of bars: a bar for each datum of the chart's data, from zero to\n * the datum's value under `dataKey`, up for a value above zero and down for\n * one below. Write one per key: the bars of several share each band, side by\n * side in the order they're written, and a hidden one leaves its room to the\n * others. A datum with no number under the key has no bar, and leaves its\n * place in the band empty. It goes in a chart with a band per datum, such as\n * `<mira-bar-chart>`.\n *\n * @example\n * ```html\n * <mira-bar dataKey=\"solar\" fill=\"#d97706\" />\n * <mira-bar dataKey=\"usage\" fill=\"#3b82f6\" />\n * ```\n */\n@Component({\n selector: 'mira-bar',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n { provide: MiraChartLayer, useExisting: forwardRef(() => MiraBar) },\n { provide: MiraSeries, useExisting: forwardRef(() => MiraBar) },\n ],\n template: `\n <ng-template>\n <svg:g class=\"mira-bar\" [attr.fill]=\"fill()\">\n @for (bar of bars(); track bar.index) {\n <svg:rect\n [attr.x]=\"bar.x\"\n [attr.y]=\"bar.y\"\n [attr.width]=\"bar.width\"\n [attr.height]=\"bar.height\"\n />\n }\n </svg:g>\n </ng-template>\n `,\n})\nexport class MiraBar extends MiraSeries {\n /** The color of the bars, `#3182bd` by default. */\n readonly fill = input('#3182bd')\n /** The bars' color, for the tooltip and the legend. Set it with `fill`. */\n override readonly color: Signal<string> = this.fill\n /** A square marks the bars in the legend. */\n override readonly legendIcon: LegendIcon = 'square'\n\n // A rect per datum with a value: at the bar's place in the datum's band,\n // and from zero to the value, whichever way that goes.\n protected readonly bars = computed(() => {\n const key = this.dataKey()\n const xs = this.#chart.xPositions()\n const y = this.#chart.yScale()\n const { offset, width } = this.#slot()\n // The bar's left edge, from the middle of its band.\n const fromMiddle = offset - this.#bandwidth() / 2\n const zero = y(0)\n\n return this.#chart.data().flatMap((datum, index) => {\n const value = numberAt(datum, key)\n\n if (value === null) return []\n\n const end = y(value)\n\n return {\n index,\n x: xs[index] + fromMiddle,\n y: Math.min(zero, end),\n width,\n height: Math.abs(end - zero),\n }\n })\n })\n\n // The nearest chart: a bar in a line chart throws, even with a bar chart\n // further out.\n readonly #chart = inject(CartesianContext)\n readonly #bandwidth = bandwidthOf(this.#chart)\n\n // The bar's place in each band: the chart's visible bars share it, side by\n // side in the order they're written.\n readonly #slot = computed(() => {\n const bars = this.#chart.visibleSeries().filter(isBar)\n\n return slotOf(bars.indexOf(this), bars.length, this.#bandwidth())\n })\n}\n\n// Outside the class on purpose: a class that names itself in its own body\n// gets an alias assigned at the top of the built module, which bundlers keep,\n// and then every app ships the bar, with bars or without.\nfunction isBar(series: MiraSeries): series is MiraBar {\n return series instanceof MiraBar\n}\n\n// The width of the chart's bands. A chart of points has none, and a bar there\n// has nowhere to go.\nfunction bandwidthOf(chart: CartesianContext): Signal<number> {\n if (!chart.xBandwidth) {\n throw new Error(\n '<mira-bar> must be inside a chart with bands, such as <mira-bar-chart>.',\n )\n }\n\n return chart.xBandwidth\n}\n\n// Where the bar at `rank`, of `count` side by side, goes in a band: the bars\n// share what the gaps leave. A gap is never wider than a bar, so in a narrow\n// band the two shrink together, and a narrower band never has wider bars.\nfunction slotOf(rank: number, count: number, bandwidth: number): Slot {\n const room = bandwidth * (1 - 2 * CATEGORY_GAP)\n const gap = Math.min(BAR_GAP, room / (2 * count - 1))\n const width = (room - (count - 1) * gap) / count\n\n return { offset: bandwidth * CATEGORY_GAP + rank * (width + gap), width }\n}\n","/*\n * Public API Surface of ngx-mira-charts\n */\n\nexport type { ChartDatum, ChartMargin, ChartSize } from './lib/core/types'\nexport type { LineCurve, Point } from './lib/core/utils/path'\nexport type {\n ActiveDatum,\n PlotArea,\n Tick,\n} from './lib/core/cartesian/cartesian-context'\nexport { MiraCartesianChart } from './lib/core/cartesian/cartesian-chart'\nexport { MiraChartLayer } from './lib/core/chart-layer'\nexport type { LegendIcon } from './lib/core/series'\nexport { MiraSeries } from './lib/core/series'\nexport { MiraCartesianGrid } from './lib/core/cartesian/cartesian-grid'\nexport { MiraCursor } from './lib/core/cartesian/cursor'\nexport type { TooltipContext, TooltipItem } from './lib/core/cartesian/tooltip'\nexport { MiraTooltip, MiraTooltipContent } from './lib/core/cartesian/tooltip'\nexport type {\n LegendItem,\n LegendItemContext,\n LegendPosition,\n} from './lib/core/cartesian/legend'\nexport { MiraLegend, MiraLegendItemContent } from './lib/core/cartesian/legend'\nexport { MiraXAxis } from './lib/core/cartesian/x-axis'\nexport { MiraYAxis } from './lib/core/cartesian/y-axis'\nexport { MiraLineChart } from './lib/line-chart/line-chart'\nexport { MiraLine } from './lib/line-chart/line'\nexport { MiraBarChart } from './lib/bar-chart/bar-chart'\nexport { MiraBar } from './lib/bar-chart/bar'\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCG;MAEmB,cAAc,CAAA;;AAEzB,IAAA,QAAQ,GAAG,SAAS,CAAC,WAAW,oDAAC;wGAFtB,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAd,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,cAAc,wFAEJ,WAAW,EAAA,WAAA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K,GAAG,CAAC,IAAI,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,KAAK;AAEhD,IAAA,OAAO,EAAE,MAAM,EAAE,SAAS,GAAG,YAAY,GAAG,IAAI,IAAI,KAAK,GAAG,GAAG,CAAC,EAAE,KAAK,EAAE;AAC3E;;AC9IA;;AAEG;;ACFH;;AAEG;;"}
package/index.d.ts CHANGED
@@ -214,7 +214,11 @@ declare abstract class MiraCartesianChart implements CartesianContext {
214
214
  #private;
215
215
  /** The rows to plot, a `ChartDatum` each. */
216
216
  readonly data: _angular_core.InputSignal<readonly object[]>;
217
- /** The width in px. Without it, the chart is as wide as its container. */
217
+ /**
218
+ * The width in px. Without it, the chart is as wide as its container, and
219
+ * doesn't widen it: a container as wide as its content, such as an
220
+ * inline-block or a dialog, needs a width of its own.
221
+ */
218
222
  readonly width: _angular_core.InputSignalWithTransform<number | undefined, unknown>;
219
223
  /**
220
224
  * The height in px. Without it, the chart is as tall as its container, or
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-mira-charts",
3
- "version": "0.2.1-dev.1",
3
+ "version": "0.2.1-dev.2",
4
4
  "description": "Composable SVG charts for Angular, built on signals: the grid, the axes and each series are components written inside the chart.",
5
5
  "keywords": [
6
6
  "angular",