@pioneer-code/pioneer-charts 22.1.5 → 22.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -22,7 +22,7 @@
22
22
  "type": "git",
23
23
  "url": "git+https://github.com/PioneerCode/pioneer-charts.git"
24
24
  },
25
- "version": "22.1.5",
25
+ "version": "22.2.1",
26
26
  "license": "MIT",
27
27
  "peerDependencies": {
28
28
  "@angular/common": "^22.1.0",
@@ -36,4 +36,28 @@
36
36
  line {
37
37
  stroke: none;
38
38
  }
39
+
40
+ // Tick marks and the axis line are hidden by default (above) and always have been, so they
41
+ // only appear on a chart that asks for them - `PcacAxisConfig.tickSize` for the marks,
42
+ // `showLine` for the line - via a class the axis builder adds for that axis. Nothing changes
43
+ // for charts that don't. Both share one color so a mark reads as part of its axis rather than a
44
+ // separate, fainter element.
45
+ &.pcac-axis-tick-marks .tick line,
46
+ &.pcac-axis-line .domain {
47
+ stroke: imports.$gray-900;
48
+ }
49
+
50
+ // The axis `label` (its title). `PcacChart.AXIS_LABEL_SPACE` reserves room for this size plus
51
+ // a gap, so change both together.
52
+ .pcac-axis-label {
53
+ font-size: 12px;
54
+ font-weight: 600;
55
+ fill: imports.$gray-700;
56
+ }
57
+
58
+ // Min / mid / max `subLabels`; `PcacChart.AXIS_SUB_LABEL_SPACE` is sized to this.
59
+ .pcac-axis-sub-label {
60
+ font-size: 11px;
61
+ fill: imports.$gray-600;
62
+ }
39
63
  }
@@ -23,4 +23,20 @@
23
23
  .pcac-y-axis path,
24
24
  .pcac-y-axis line {
25
25
  stroke: none;
26
+ }
27
+ .pcac-x-axis.pcac-axis-tick-marks .tick line, .pcac-x-axis.pcac-axis-line .domain,
28
+ .pcac-y-axis.pcac-axis-tick-marks .tick line,
29
+ .pcac-y-axis.pcac-axis-line .domain {
30
+ stroke: #212529;
31
+ }
32
+ .pcac-x-axis .pcac-axis-label,
33
+ .pcac-y-axis .pcac-axis-label {
34
+ font-size: 12px;
35
+ font-weight: 600;
36
+ fill: #495057;
37
+ }
38
+ .pcac-x-axis .pcac-axis-sub-label,
39
+ .pcac-y-axis .pcac-axis-sub-label {
40
+ font-size: 11px;
41
+ fill: #6c757d;
26
42
  }
@@ -1 +1 @@
1
- .pcac-d3-tooltip{position:absolute;pointer-events:none;display:none;z-index:1000}.pcac-d3-tooltip-default{text-align:center;font-size:14px;padding:.5rem;background-color:rgba(52,58,64,.85);color:#fff;border-radius:2px}.pcac-grid-rule line{stroke:#e9ecef}.pcac-x-axis path,.pcac-x-axis line,.pcac-y-axis path,.pcac-y-axis line{stroke:none}
1
+ .pcac-d3-tooltip{position:absolute;pointer-events:none;display:none;z-index:1000}.pcac-d3-tooltip-default{text-align:center;font-size:14px;padding:.5rem;background-color:rgba(52,58,64,.85);color:#fff;border-radius:2px}.pcac-grid-rule line{stroke:#e9ecef}.pcac-x-axis path,.pcac-x-axis line,.pcac-y-axis path,.pcac-y-axis line{stroke:none}.pcac-x-axis.pcac-axis-tick-marks .tick line,.pcac-x-axis.pcac-axis-line .domain,.pcac-y-axis.pcac-axis-tick-marks .tick line,.pcac-y-axis.pcac-axis-line .domain{stroke:#212529}.pcac-x-axis .pcac-axis-label,.pcac-y-axis .pcac-axis-label{font-size:12px;font-weight:600;fill:#495057}.pcac-x-axis .pcac-axis-sub-label,.pcac-y-axis .pcac-axis-sub-label{font-size:11px;fill:#6c757d}
@@ -32,6 +32,142 @@ declare class PcacChartConfig {
32
32
  */
33
33
  heightFull?: boolean;
34
34
  }
35
+ /**
36
+ * Up to three short labels placed along an axis by position rather than by value: `min` at its
37
+ * start, `mid` at its center, `max` at its end. Any subset can be given.
38
+ */
39
+ declare class PcacAxisSubLabels {
40
+ min?: string;
41
+ mid?: string;
42
+ max?: string;
43
+ }
44
+ /**
45
+ * Everything configurable about one axis. Used twice per chart, as `xAxis` and `yAxis` on
46
+ * `PcacAxisChartConfig`, so the two never drift apart and a new per-axis option lands in one place.
47
+ *
48
+ * Every field is optional so an object-literal / JSON config can give just the ones it cares
49
+ * about (or omit the axis entirely); the initializers apply to anything built with `new`, and
50
+ * `resolveAxisConfig()` fills the rest in for builders.
51
+ */
52
+ declare class PcacAxisConfig {
53
+ /**
54
+ * Don't draw this axis at all (labels, tick marks, line), and give the margins it would have
55
+ * occupied back to the plot area. Hiding the y axis reclaims the left and top margins; hiding
56
+ * the x axis reclaims the bottom and right. The chart's total footprint doesn't change.
57
+ */
58
+ hide?: boolean;
59
+ /**
60
+ * Draw grid lines from this axis's ticks (or, on a category axis, from each category) across
61
+ * the plot: horizontal lines for the y axis, vertical for the x. Left unset, each chart keeps
62
+ * the grid it has always drawn - the y axis's on vertical bar and line/area/plot charts, the
63
+ * x axis's on the horizontal bar chart - and no other; set it to turn either grid on or off
64
+ * explicitly. Deliberately has no initializer, since "unset" is what carries the per-chart
65
+ * default.
66
+ */
67
+ showGrid?: boolean;
68
+ /**
69
+ * Requested number of ticks (D3's `ticks()` hint, so the actual count can differ slightly) -
70
+ * also the number of grid lines for this axis. Ignored by a category (band) axis, which has one
71
+ * tick per category. Default 5.
72
+ */
73
+ ticks?: number;
74
+ /**
75
+ * Length in pixels of the small tick marks. Tick marks are not drawn at all unless this is set
76
+ * (the theme hides them, as it always has), so setting a size is also what turns them on; D3's
77
+ * default 6px is a sensible first value. `0` keeps them off but still pulls the labels in to
78
+ * the axis. Labels follow the marks (D3 places them at tick length + 3px), and the chart's
79
+ * margins grow or shrink by the same amount so the plot area makes room for them - a longer
80
+ * tick means a slightly smaller plot, never labels pushed off the edge. Only the per-tick marks
81
+ * change; the axis line's two end-caps keep their default length. Color comes from the theme
82
+ * (`.pcac-axis-tick-marks .tick line`, `$gray-900`, the same as the axis line).
83
+ */
84
+ tickSize?: number;
85
+ /**
86
+ * Draw a solid line along the axis itself (the full length of the axis, with D3's short
87
+ * end-caps). Off by default, as the theme has always hidden it. Color comes from the theme
88
+ * (`.pcac-axis-line .domain`, `$gray-900`).
89
+ */
90
+ showLine?: boolean;
91
+ /**
92
+ * A title for the whole axis (e.g. "Revenue ($)"), drawn centered along it just inside the
93
+ * chart's edge: below the tick labels for the x axis, rotated to read bottom-to-top left of
94
+ * them for the y axis. The chart's margin grows by `PcacChart.AXIS_LABEL_SPACE` to make room,
95
+ * shrinking the plot area the same way a longer tick does. Not drawn on a hidden axis. Styled
96
+ * by the theme's `.pcac-axis-label` rule.
97
+ */
98
+ label?: string;
99
+ /**
100
+ * Min / mid / max sub labels (e.g. "Low" / "Medium" / "High") in their own row just outside the
101
+ * tick labels, and inside the `label` if there is one: `min` left-aligned at the axis's start,
102
+ * `mid` centered, `max` right-aligned at its end, so they never spill past the axis. On the
103
+ * y axis they run bottom-to-top like the label, `min` at the bottom. The margin grows by
104
+ * `PcacChart.AXIS_SUB_LABEL_SPACE` when any is set, shrinking the plot area. Not drawn on a
105
+ * hidden axis. Styled by the theme's `.pcac-axis-sub-label` rule.
106
+ */
107
+ subLabels?: PcacAxisSubLabels;
108
+ /**
109
+ * How the values along this axis are interpreted and shown - the tick labels, and the value
110
+ * (`yAxis`) or key (`xAxis`) in the default tooltip. On the line/area/plot charts the x axis's
111
+ * format is also what decides how a point's `key` maps to an x position (by index for the
112
+ * default, `Decimal` and `DateTime` by the key's own value on a linear/time scale - see
113
+ * `PcacLineAreaChartConfig`); a bar chart's category axis ignores it. Default `None`, which
114
+ * on those charts behaves as `DatasetLength`.
115
+ */
116
+ format?: PcacFormatEnum;
117
+ /**
118
+ * The value axis's domain: it runs from `domainMin` to `domainMax`, ignoring the data. Defaults
119
+ * 0 and 100. Only the type of axis that has a domain to set reads them - a bar chart's category
120
+ * axis ignores both, its value axis reads `domainMax` only (bars always grow from 0), and a
121
+ * line/area/plot chart's x axis reads them only under the `Decimal` (numbers) and `DateTime`
122
+ * (anything `new Date()` accepts, and required) formats - the index-based formats size the
123
+ * axis from the data.
124
+ */
125
+ domainMin?: number | string;
126
+ domainMax?: number | string;
127
+ }
128
+ /**
129
+ * The `PcacChartMargin` type lives here rather than in chart.ts so the axis builder can take
130
+ * one without importing the class module that imports it back.
131
+ */
132
+ interface PcacChartMargin {
133
+ top: number;
134
+ right: number;
135
+ bottom: number;
136
+ left: number;
137
+ }
138
+ /**
139
+ * `PcacAxisConfig` with every default applied - what builders work with, so they never have to
140
+ * null-check. `tickSize`, `label` and `subLabels` stay optional: "not set" is itself the meaningful
141
+ * default (no marks, no labels).
142
+ */
143
+ type PcacResolvedAxisConfig = Required<Omit<PcacAxisConfig, 'tickSize' | 'label' | 'subLabels'>> & Pick<PcacAxisConfig, 'tickSize' | 'label' | 'subLabels'>;
144
+ /** True if `axis` has at least one sub label to draw (an empty `subLabels` object counts as none). */
145
+ declare function hasAxisSubLabels(axis: PcacAxisConfig | undefined): boolean;
146
+ /**
147
+ * Room reserved in a margin for an axis `label`: the theme's 12px label plus a gap from the tick
148
+ * labels. Reserved on the side the label sits on (`bottom` for x, `left` for y), and taken out
149
+ * of the plot area, the same way a longer tick is. Change together with `.pcac-axis-label`.
150
+ */
151
+ declare const PCAC_AXIS_LABEL_SPACE = 18;
152
+ /** Likewise for a row of `subLabels`: the theme's 11px text plus a gap (`.pcac-axis-sub-label`). */
153
+ declare const PCAC_AXIS_SUB_LABEL_SPACE = 16;
154
+ /**
155
+ * Total margin an axis's `label` and `subLabels` take on its side. `PcacChart` reserves it and
156
+ * the axis builder places the text by it, so the two stay in step.
157
+ */
158
+ declare function axisLabelSpace(axis: PcacAxisConfig | undefined): number;
159
+ /**
160
+ * @param showGridDefault what `showGrid` resolves to when the consumer left it unset - each chart
161
+ * passes `true` for the axis whose grid it has always drawn and `false` for the other.
162
+ */
163
+ declare function resolveAxisConfig(axis?: PcacAxisConfig, showGridDefault?: boolean): PcacResolvedAxisConfig;
164
+ /**
165
+ * Base configuration for every chart that has an x and y axis (bar, line, area, plot - not pie).
166
+ */
167
+ declare class PcacAxisChartConfig extends PcacChartConfig {
168
+ xAxis?: PcacAxisConfig;
169
+ yAxis?: PcacAxisConfig;
170
+ }
35
171
  declare class PcacData {
36
172
  key: string | number | null;
37
173
  value: string | number | null;
@@ -64,14 +200,9 @@ declare enum PcacFormatEnum {
64
200
  OneDayHours = "oneDayHours"
65
201
  }
66
202
 
67
- declare class PcacBarHorizontalChartConfig extends PcacChartConfig {
68
- domainMax: number;
69
- numberOfTicks: number;
203
+ declare class PcacBarHorizontalChartConfig extends PcacAxisChartConfig {
70
204
  isStacked: boolean;
71
205
  thresholds: PcacData[];
72
- tickFormat: PcacFormatEnum;
73
- hideGrid: boolean;
74
- hideAxis: boolean;
75
206
  spreadColorsPerGroup: boolean;
76
207
  colorOverride: PcacBarHorizontalChartColorOverrideConfig;
77
208
  }
@@ -87,19 +218,52 @@ declare class PcacBarHorizontalChartColorOverrideConfig {
87
218
  */
88
219
  interface IPcacAxisBuilderConfig<XDomain extends AxisDomain = AxisDomain, YDomain extends AxisDomain = AxisDomain> {
89
220
  svg: Selection<SVGGElement, unknown, BaseType, unknown>;
221
+ /** Plot area size - the axes' own lengths - and the chart's margins, which position a `label`. */
222
+ width: number;
90
223
  height: number;
224
+ margin: PcacChartMargin;
91
225
  xScale: AxisScale<XDomain>;
92
226
  yScale: AxisScale<YDomain>;
93
- numberOfTicks: number;
94
- yFormat?: PcacFormatEnum;
95
- xFormat?: PcacFormatEnum;
96
- hideYAxis?: boolean;
97
- hideXAxis?: boolean;
227
+ /**
228
+ * The chart's per-axis settings, defaults already applied (`resolveAxisConfig()`). `hide` skips
229
+ * the axis entirely. `tickSize` is D3's `tickSizeInner`; left undefined, D3's default of 6
230
+ * applies to the geometry - but the theme hides tick marks unless the axis group carries
231
+ * `pcac-axis-tick-marks`, which is added exactly when a size is given, so an undefined size
232
+ * means "no visible marks, labels where they've always been". `0` is a legitimate value (no
233
+ * marks, labels hugging the axis), hence the `!== undefined` checks below. `showLine` adds
234
+ * `pcac-axis-line`, which un-hides D3's `.domain` path the same way. The domain path keeps
235
+ * D3's default 6px outer end-caps (`tickSizeOuter`), so it reads as a bracket rather than a
236
+ * bare rule; that's D3's standard look and is left as-is. `label` and `subLabels` are drawn
237
+ * inside the axis group (so they're raised and non-interactive along with it) - see `drawLabels`.
238
+ * `format` picks the tick label format; `None` leaves D3's default.
239
+ */
240
+ xAxis: PcacResolvedAxisConfig;
241
+ yAxis: PcacResolvedAxisConfig;
98
242
  }
99
243
  declare class PcacAxisBuilder {
100
244
  drawAxis<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacAxisBuilderConfig<XDomain, YDomain>): void;
245
+ /**
246
+ * Moves both axis groups to the end of the chart's `<g>`, so they paint over everything drawn
247
+ * since `drawAxis()`. Axes are drawn first (so scales and margins are settled before content),
248
+ * which leaves anything sitting at x = 0 - a line chart's first segment and dot, an area's fill,
249
+ * a horizontal bar chart's bars - painting over the y axis line. Builders call this after the
250
+ * content that should sit *under* the axes, and draw anything that should stay on top (the
251
+ * line/area/plot charts' dots) afterwards. Safe to sit above the hover/zoom overlay rects too,
252
+ * because the groups are `pointer-events: none` (set where each group is appended).
253
+ */
254
+ raiseAxes(svg: Selection<SVGGElement, unknown, BaseType, unknown>): void;
101
255
  drawYAxis<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacAxisBuilderConfig<XDomain, YDomain>): void;
102
256
  drawXAxis<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacAxisBuilderConfig<XDomain, YDomain>): void;
257
+ /**
258
+ * The axis `label` and `subLabels`. Both are placed by two distances: along the axis (0 at its
259
+ * start, `length` at its end - for the y axis, 0 is the bottom) and out from it, toward the
260
+ * chart's edge. The label goes at the very edge (`outer`, i.e. the margin), the sub-label row
261
+ * `PCAC_AXIS_LABEL_SPACE` inside that when there's a label. For the y axis the text is rotated
262
+ * to read bottom-to-top, which swaps the two: after `rotate(-90)` x runs up the axis (so the
263
+ * bottom is x = -length) and y runs left. `fill` is set explicitly because d3-axis puts
264
+ * `fill="none"` on the group; its own tick text does the same.
265
+ */
266
+ private drawLabels;
103
267
  static ɵfac: i0.ɵɵFactoryDeclaration<PcacAxisBuilder, never>;
104
268
  static ɵprov: i0.ɵɵInjectableDeclaration<any>;
105
269
  }
@@ -119,10 +283,22 @@ interface IPcacGridBuilderConfig<XDomain extends AxisDomain = AxisDomain, YDomai
119
283
  height: number;
120
284
  xScale: AxisScale<XDomain>;
121
285
  yScale: AxisScale<YDomain>;
286
+ /**
287
+ * Tick count hint for a continuous scale (D3's `ticks(n)`); a category (band) scale ignores it
288
+ * and gets one line per category.
289
+ */
122
290
  numberOfTicks: number;
123
291
  }
124
292
  declare class PcacGridBuilder {
293
+ /**
294
+ * Vertical lines, one per x-axis tick (or category), running the plot's full height. The group
295
+ * is classed `pcac-grid-vertical` so a chart can find and redraw just this grid - the
296
+ * line/area/plot charts do on zoom, when the x ticks move.
297
+ */
125
298
  drawVerticalGrid<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacGridBuilderConfig<XDomain, YDomain>): void;
299
+ /**
300
+ * Horizontal lines, one per y-axis tick (or category), running the plot's full width.
301
+ */
126
302
  drawHorizontalGrid<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacGridBuilderConfig<XDomain, YDomain>): void;
127
303
  static ɵfac: i0.ɵɵFactoryDeclaration<PcacGridBuilder, never>;
128
304
  static ɵprov: i0.ɵɵInjectableDeclaration<any>;
@@ -297,20 +473,26 @@ interface PcacTooltipOptions {
297
473
  valueFormat?: PcacFormatEnum;
298
474
  keyFormat?: PcacFormatEnum;
299
475
  }
300
- interface PcacChartMargin {
301
- top: number;
302
- right: number;
303
- bottom: number;
304
- left: number;
305
- }
306
476
  declare class PcacChart {
307
477
  axisBuilder: PcacAxisBuilder;
308
478
  gridBuilder: PcacGridBuilder;
309
479
  transitionService: PcacTransitionService;
310
480
  tooltipBuilder: PcacTooltipBuilder;
311
481
  colorService: PcacColorService;
482
+ /** D3's own `tickSizeInner` default, which the default `margin` below is sized around. */
483
+ static readonly DEFAULT_TICK_SIZE = 6;
484
+ /** See `PCAC_AXIS_LABEL_SPACE` / `PCAC_AXIS_SUB_LABEL_SPACE` in chart.model.ts. */
485
+ static readonly AXIS_LABEL_SPACE = 18;
486
+ static readonly AXIS_SUB_LABEL_SPACE = 16;
312
487
  margin: PcacChartMargin;
313
488
  private readonly defaultMargin;
489
+ /**
490
+ * The current build's per-axis settings with defaults applied, set by `initializeAxisState()`.
491
+ * Builders read these (not the raw `config.xAxis`) everywhere: drawing the axes, choosing
492
+ * whether to draw a grid, how many grid lines, and so on. Pie has no axes and never sets them.
493
+ */
494
+ xAxis: PcacResolvedAxisConfig;
495
+ yAxis: PcacResolvedAxisConfig;
314
496
  svg: Selection<SVGGElement, unknown, BaseType, unknown>;
315
497
  width: number;
316
498
  height: number;
@@ -332,6 +514,14 @@ declare class PcacChart {
332
514
  */
333
515
  private lastContainerHeight;
334
516
  private lastHeightFull;
517
+ /**
518
+ * How much the vertical margins have grown this build beyond their defaults - for tick marks
519
+ * and axis labels (`initializeAxisState()`; negative when a short tick took some away) and for
520
+ * content that hangs past the plot's edge (`reserveEdgeSpace()`). `resolveHeight()` subtracts
521
+ * it from the plot height so the SVG's total height doesn't change with any of them. Reset
522
+ * alongside the margins.
523
+ */
524
+ private reservedHeight;
335
525
  /**
336
526
  * Resolves the consumer's projected `<ng-template pcacTooltip>`, if any. Each chart component
337
527
  * points this at its own `contentChild(PcacTooltipDirective)` query. It's a getter rather than
@@ -341,13 +531,89 @@ declare class PcacChart {
341
531
  */
342
532
  tooltipTemplate: () => TemplateRef<PcacTooltipContext> | undefined;
343
533
  /**
344
- * Puts `margin` back to its defaults. Builders must call this at the top of `buildChart()`,
345
- * before any per-build adjustment (`hideAxis` zeroing sides, label widths measured into
346
- * `margin.left`): `margin` lives on this per-chart instance and so persists between builds,
347
- * and without a reset an adjustment made for one config silently carries into the next -
348
- * e.g. axes drawn with no room after `hideAxis` flips back to false.
534
+ * Puts `margin` back to its defaults. `initializeAxisState()` calls this first thing, before any
535
+ * per-build adjustment (hidden axes giving sides back, tick sizes growing them, label widths
536
+ * measured into `margin.left`): `margin` lives on this per-chart instance and so persists
537
+ * between builds, and without a reset an adjustment made for one config silently carries into
538
+ * the next - e.g. axes drawn with no room after `hide` flips back to false.
349
539
  */
350
540
  resetMargin(): void;
541
+ /**
542
+ * Resolves the config's `xAxis`/`yAxis` onto this chart and sets the margins up for them. Axis
543
+ * charts call this at the top of `buildChart()`, on their own copy of the config (it rewrites
544
+ * `config.height` for hidden axes), before `initializeChartState()` measures the plot area.
545
+ * In order:
546
+ *
547
+ * 1. `resetMargin()`.
548
+ * 2. Tick marks: room for a non-default `tickSize` is reserved on each axis that will actually
549
+ * be drawn (`reserveTickSizeMargins`).
550
+ * 3. Labels: `AXIS_LABEL_SPACE` is added to `bottom` / `left` for an axis with a `label`, and
551
+ * `AXIS_SUB_LABEL_SPACE` for one with any `subLabels` (see `axisLabelSpace`), again only if
552
+ * the axis will be drawn.
553
+ * 4. Hidden axes: an axis with `hide` gives its margins back to the plot. The y axis owns
554
+ * `left` and `top` (the top margin is only there so the topmost y label isn't clipped), the
555
+ * x axis `bottom` and `right` (likewise for the rightmost x label). Each reclaimed vertical
556
+ * margin is added onto `config.height` so the SVG's total height stays what the consumer
557
+ * configured; horizontally `initializeChartState()` picks the change up on its own.
558
+ *
559
+ * @param defaultGrid the axis whose grid this chart draws when the consumer hasn't said
560
+ * (`PcacAxisConfig.showGrid`): `'y'` for horizontal lines, `'x'` for vertical.
561
+ * @param hiddenAxisMargin what a hidden axis's sides shrink to, rather than 0. The
562
+ * line/area/plot charts keep 8px so a dot on the edge of the plot isn't clipped by the SVG.
563
+ */
564
+ initializeAxisState(config: PcacAxisChartConfig, defaultGrid: 'x' | 'y', hiddenAxisMargin?: number): void;
565
+ /**
566
+ * The `PcacAxisBuilder` config for this chart's current state - everything but the scales is
567
+ * already on the instance. Builders pass the result to `drawAxis()` (or `drawXAxis()` with a
568
+ * rescaled x, on zoom).
569
+ */
570
+ axisBuilderConfig<XDomain extends AxisDomain, YDomain extends AxisDomain>(xScale: AxisScale<XDomain>, yScale: AxisScale<YDomain>): IPcacAxisBuilderConfig<XDomain, YDomain>;
571
+ /**
572
+ * Draws whichever grids the resolved axes ask for: vertical lines from the x axis's ticks,
573
+ * horizontal from the y's (`PcacAxisConfig.showGrid`). `which` restricts it to one axis - the
574
+ * line/area/plot charts redraw just the x grid against the rescaled x on zoom.
575
+ */
576
+ drawGrids<XDomain extends AxisDomain, YDomain extends AxisDomain>(xScale: AxisScale<XDomain>, yScale: AxisScale<YDomain>, which?: 'x' | 'y' | 'both'): void;
577
+ /**
578
+ * Makes room in the margins for tick marks longer (or shorter) than D3's default. The default
579
+ * margins are sized around that default (`DEFAULT_TICK_SIZE`), and D3 places each tick label at
580
+ * tick length + padding, so a longer tick pushes its labels outward by exactly the difference -
581
+ * into space the margin doesn't have unless it grows by the same amount. Growing the margin here,
582
+ * *before* `initializeChartState()` measures the plot area, is what makes the chart shrink to fit
583
+ * its labels rather than pushing them off the edge of the SVG. A shorter tick hands the
584
+ * difference back to the plot area the same way.
585
+ *
586
+ * Horizontally that happens on its own: `initializeChartState()` derives `width` from the
587
+ * container minus the margins. Vertically it doesn't - `config.height` is the plot area, and
588
+ * the SVG is that plus the margins - so a taller bottom margin would grow the SVG instead. The
589
+ * delta is therefore also remembered in `reservedHeight` and taken back out of the plot
590
+ * height by `resolveHeight()`, keeping the chart's total footprint where the consumer put it.
591
+ *
592
+ * Called by `initializeAxisState()` right after `resetMargin()`, for the axes that will be
593
+ * drawn. Only the axis a tick size is given for is affected; `undefined` leaves that margin
594
+ * alone.
595
+ * @param xTickSize `tickSizeInner` for the bottom (x) axis, which lives in `margin.bottom`
596
+ * @param yTickSize `tickSizeInner` for the left (y) axis, which lives in `margin.left`
597
+ */
598
+ reserveTickSizeMargins(xTickSize?: number, yTickSize?: number): void;
599
+ /**
600
+ * Makes sure each given margin is at least that big, for content drawn at the very edge of the
601
+ * plot area that reaches past it - a point image on the line/area/plot charts, say, whose box
602
+ * is centered on a point at the top of the y domain and so hangs half of itself above the plot.
603
+ * Those charts already widen their clip-path to let such a point through; this is what stops
604
+ * the `<svg>` itself from cutting it off, the SVG being only the plot area plus the margins.
605
+ *
606
+ * "At least", not "add": the default margins, and any tick / label room already reserved in
607
+ * them, may well cover it already (`margin.left` is 40 by default), and adding on top of that
608
+ * would give up plot area for nothing. Vertical growth is taken out of the plot height the same
609
+ * way `reserveTickSizeMargins()`'s is, so the SVG's total height stays what the consumer
610
+ * configured; horizontally `initializeChartState()` picks the change up on its own. A side
611
+ * left `undefined` is untouched.
612
+ *
613
+ * Call after `initializeAxisState()` (which resets the margins) and before
614
+ * `initializeChartState()` (which measures the plot area against them).
615
+ */
616
+ reserveEdgeSpace(space: Partial<PcacChartMargin>): void;
351
617
  /**
352
618
  * Shows the tooltip for a hovered datum, through the chart's `pcacTooltip` template when one is
353
619
  * projected and the default key/value content otherwise. Every builder's hover handler should
@@ -409,11 +675,15 @@ declare class PcacChart {
409
675
  * In some cases, that state needs to be calculated based on the content that resides in that margin.
410
676
  * For example, labels on a horizontal bar chart are dynamic and such the margin needs to be calculated ahead of
411
677
  * chart axis construction.
678
+ *
679
+ * Measures with the y axis's own `tickSize` (the measured box spans the tick line as well as
680
+ * the label, so measuring at a different length would put the labels off by the difference)
681
+ * and adds its `axisLabelSpace()` back on top, since the measurement replaces whatever
682
+ * `initializeAxisState()` reserved for the label / sub labels.
412
683
  * @param chartElm Reference to SVG on dom
413
- * @param data Generic multi-dimensional PcacData structure
414
684
  * @param yScale D3 scale transformation object (d3.ScaleBand)
415
685
  */
416
- setHorizontalMarginsBasedOnContent<Domain extends AxisDomain>(chartElm: ElementRef, data: PcacData[], yScale: AxisScale<Domain>): void;
686
+ setHorizontalMarginsBasedOnContent<Domain extends AxisDomain>(chartElm: ElementRef, yScale: AxisScale<Domain>): void;
417
687
  }
418
688
 
419
689
  /**
@@ -430,7 +700,6 @@ declare class BarHorizontalChartBuilder extends PcacChart {
430
700
  private config;
431
701
  barClicked$: rxjs.Observable<PcacData>;
432
702
  buildChart(chartElm: ElementRef, config: PcacBarHorizontalChartConfig): void;
433
- private adjustForHiddenAxis;
434
703
  private buildScales;
435
704
  private drawChart;
436
705
  private addGroups;
@@ -459,14 +728,9 @@ declare class PcacBarHorizontalChartComponent {
459
728
  static ɵcmp: i0.ɵɵComponentDeclaration<PcacBarHorizontalChartComponent, "pcac-bar-horizontal-chart", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, { "barClicked": "barClicked"; }, ["tooltipTemplate"], never, true, never>;
460
729
  }
461
730
 
462
- declare class PcacBarVerticalChartConfig extends PcacChartConfig {
463
- domainMax: number;
464
- numberOfTicks: number;
731
+ declare class PcacBarVerticalChartConfig extends PcacAxisChartConfig {
465
732
  isStacked: boolean;
466
733
  thresholds: PcacData[];
467
- tickFormat: PcacFormatEnum;
468
- hideGrid: boolean;
469
- hideAxis: boolean;
470
734
  spreadColorsPerGroup: boolean;
471
735
  colorOverride: PcacBarVerticalChartColorOverrideConfig;
472
736
  }
@@ -487,8 +751,6 @@ declare class BarVerticalChartBuilder extends PcacChart {
487
751
  private barClickedSource;
488
752
  barClicked$: rxjs.Observable<PcacData>;
489
753
  buildChart(chartElm: ElementRef, config: PcacBarVerticalChartConfig): void;
490
- private adjustForHiddenAxis;
491
- private hasGroupLabel;
492
754
  private buildScales;
493
755
  private drawChart;
494
756
  private addGroups;
@@ -575,18 +837,18 @@ declare class PcacPointImageConfig {
575
837
  maxWidth: number;
576
838
  maxHeight: number;
577
839
  }
578
- declare class PcacLineAreaChartConfig extends PcacChartConfig {
840
+ /**
841
+ * The axes' `format` and `domainMin`/`domainMax` (`PcacAxisConfig`) do more here than on the bar
842
+ * charts. `yAxis.domainMin`/`domainMax` are the y scale's domain (default 0..100). `xAxis.format`
843
+ * decides how each point's `key` becomes an x position: `Decimal` reads it as a number on a
844
+ * linear scale from `xAxis.domainMin` to `domainMax`, `DateTime` parses it with `new Date()` on
845
+ * a time scale between the two (both required), and every other format - including the default -
846
+ * places points by their index within their series, sizing the axis from the first series'
847
+ * length and ignoring the domain fields.
848
+ */
849
+ declare class PcacLineAreaChartConfig extends PcacAxisChartConfig {
579
850
  enableEffects: boolean;
580
851
  enableZoom: boolean;
581
- numberOfTicks: number;
582
- hideGrid: boolean;
583
- hideAxis: boolean;
584
- yFormat: PcacFormatEnum;
585
- xFormat: PcacFormatEnum;
586
- yDomainMax: number | string;
587
- yDomainMin: number | string;
588
- xDomainMin: number | string;
589
- xDomainMax: number | string;
590
852
  /**
591
853
  * Hex color codes to override the default colors
592
854
  */
@@ -648,7 +910,6 @@ declare class PcacAreaChart {
648
910
  }
649
911
 
650
912
  declare class PcacPieChartConfig extends PcacChartConfig {
651
- numberOfTicks: number;
652
913
  }
653
914
 
654
915
  /**
@@ -688,5 +949,5 @@ declare class PcacPieChartComponent {
688
949
  static ɵcmp: i0.ɵɵComponentDeclaration<PcacPieChartComponent, "pcac-pie-chart", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, { "sliceClicked": "sliceClicked"; }, ["tooltipTemplate"], never, true, never>;
689
950
  }
690
951
 
691
- export { BarHorizontalChartBuilder, BarVerticalChartBuilder, PcacAreaChart, PcacAreaChartConfig, PcacAxisBuilder, PcacBarHorizontalChartColorOverrideConfig, PcacBarHorizontalChartComponent, PcacBarHorizontalChartConfig, PcacBarVerticalChartColorOverrideConfig, PcacBarVerticalChartComponent, PcacBarVerticalChartConfig, PcacChart, PcacChartConfig, PcacChartResizeService, PcacColorService, PcacData, PcacFormatEnum, PcacGridBuilder, PcacLegend, PcacLegendConfig, PcacLegendConfigItem, PcacLineChart, PcacLineChartConfig, PcacPieChartComponent, PcacPieChartConfig, PcacPlotChart, PcacPlotChartConfig, PcacPointImageConfig, PcacTooltipBuilder, PcacTooltipDirective, PcacTransitionService, PieChartBuilder };
692
- export type { IPcacAxisBuilderConfig, IPcacGridBuilderConfig, PcacChartMargin, PcacTooltipContext, PcacTooltipOptions };
952
+ export { BarHorizontalChartBuilder, BarVerticalChartBuilder, PCAC_AXIS_LABEL_SPACE, PCAC_AXIS_SUB_LABEL_SPACE, PcacAreaChart, PcacAreaChartConfig, PcacAxisBuilder, PcacAxisChartConfig, PcacAxisConfig, PcacAxisSubLabels, PcacBarHorizontalChartColorOverrideConfig, PcacBarHorizontalChartComponent, PcacBarHorizontalChartConfig, PcacBarVerticalChartColorOverrideConfig, PcacBarVerticalChartComponent, PcacBarVerticalChartConfig, PcacChart, PcacChartConfig, PcacChartResizeService, PcacColorService, PcacData, PcacFormatEnum, PcacGridBuilder, PcacLegend, PcacLegendConfig, PcacLegendConfigItem, PcacLineChart, PcacLineChartConfig, PcacPieChartComponent, PcacPieChartConfig, PcacPlotChart, PcacPlotChartConfig, PcacPointImageConfig, PcacTooltipBuilder, PcacTooltipDirective, PcacTransitionService, PieChartBuilder, axisLabelSpace, hasAxisSubLabels, resolveAxisConfig };
953
+ export type { IPcacAxisBuilderConfig, IPcacGridBuilderConfig, PcacChartMargin, PcacResolvedAxisConfig, PcacTooltipContext, PcacTooltipOptions };