@pioneer-code/pioneer-charts 22.0.3 → 22.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -22,11 +22,11 @@
22
22
  "type": "git",
23
23
  "url": "git+https://github.com/PioneerCode/pioneer-charts.git"
24
24
  },
25
- "version": "22.0.3",
25
+ "version": "22.1.0",
26
26
  "license": "MIT",
27
27
  "peerDependencies": {
28
- "@angular/common": "^22.0.0",
29
- "@angular/core": "^22.0.0",
28
+ "@angular/common": "^22.1.0",
29
+ "@angular/core": "^22.1.0",
30
30
  "d3": "^7.9.0",
31
31
  "@types/d3": "^7.4.3"
32
32
  },
@@ -17,3 +17,16 @@
17
17
  color: white;
18
18
  border-radius: 5px;
19
19
  }
20
+
21
+ // `heightFull` support (see PcacChartConfig.heightFull). The host and the container section are
22
+ // what the chart measures to decide how tall to draw, so both need a height handed down from the
23
+ // consumer's wrapper - otherwise the section is sized by the <svg> inside it and measuring it
24
+ // would just report back whatever height the chart already drew.
25
+ pcac-bar-horizontal-chart.pcac-height-full {
26
+ display: block;
27
+ height: 100%;
28
+
29
+ .pcac-bar-horizontal-chart {
30
+ height: 100%;
31
+ }
32
+ }
@@ -4,3 +4,16 @@
4
4
  display: block;
5
5
  }
6
6
  }
7
+
8
+ // `heightFull` support (see PcacChartConfig.heightFull). The host and the container section are
9
+ // what the chart measures to decide how tall to draw, so both need a height handed down from the
10
+ // consumer's wrapper - otherwise the section is sized by the <svg> inside it and measuring it
11
+ // would just report back whatever height the chart already drew.
12
+ pcac-bar-vertical-chart.pcac-height-full {
13
+ display: block;
14
+ height: 100%;
15
+
16
+ .pcac-bar-vertical-chart {
17
+ height: 100%;
18
+ }
19
+ }
@@ -37,4 +37,11 @@
37
37
 
38
38
  .pcac-legend-item-last {
39
39
  margin-right: 0;
40
- }
40
+ }
41
+ // Legend items are keyboard-operable (role="switch" + tabindex), so they need a visible focus
42
+ // ring - the default outline is drawn against the host app's background, not ours, so it's left
43
+ // as the browser's own rather than themed.
44
+ .pcac-legend-item:focus-visible {
45
+ outline: 2px solid currentColor;
46
+ outline-offset: 2px;
47
+ }
@@ -45,3 +45,21 @@
45
45
  border-radius: 5px;
46
46
  }
47
47
 
48
+
49
+ // `heightFull` support (see PcacChartConfig.heightFull). The host and the container section are
50
+ // what the chart measures to decide how tall to draw, so both need a height handed down from the
51
+ // consumer's wrapper - otherwise the section is sized by the <svg> inside it and measuring it
52
+ // would just report back whatever height the chart already drew. The three thin wrappers
53
+ // (pcac-line-chart / pcac-area-chart / pcac-plot-chart) sit between that wrapper and this chart,
54
+ // so they have to pass the height through as well.
55
+ pcac-line-chart.pcac-height-full,
56
+ pcac-area-chart.pcac-height-full,
57
+ pcac-plot-chart.pcac-height-full,
58
+ pcac-line-area-chart.pcac-height-full {
59
+ display: block;
60
+ height: 100%;
61
+ }
62
+
63
+ pcac-line-area-chart.pcac-height-full .pcac-line-area-chart {
64
+ height: 100%;
65
+ }
@@ -16,6 +16,21 @@ declare class PcacChartConfig {
16
16
  */
17
17
  data: PcacData[];
18
18
  height: number;
19
+ /**
20
+ * When true, `height` becomes a *minimum* height: if the container the chart is placed in is
21
+ * taller than `height`, the chart grows to fill it instead.
22
+ *
23
+ * The chart fills its own host element (`<pcac-bar-vertical-chart>` etc.), which it stretches
24
+ * to `height: 100%` while this is on - so the consumer just needs to give the element wrapping
25
+ * the chart a definite height (an explicit height, or a flex/grid track that resolves to one).
26
+ * If that wrapper turns out to be auto-height, there's nothing definite to fill and the chart
27
+ * falls back to `height`.
28
+ *
29
+ * Optional (rather than defaulted like the properties above) so that adding it doesn't force
30
+ * every existing consumer that builds a config as an object literal to declare it; the `= false`
31
+ * initializer still applies to anything constructed via `new`.
32
+ */
33
+ heightFull?: boolean;
19
34
  }
20
35
  declare class PcacData {
21
36
  key: string | number | null;
@@ -76,7 +91,7 @@ declare class PcacAxisBuilder {
76
91
  drawYAxis<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacAxisBuilderConfig<XDomain, YDomain>): void;
77
92
  drawXAxis<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacAxisBuilderConfig<XDomain, YDomain>): void;
78
93
  static ɵfac: i0.ɵɵFactoryDeclaration<PcacAxisBuilder, never>;
79
- static ɵprov: i0.ɵɵInjectableDeclaration<PcacAxisBuilder>;
94
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
80
95
  }
81
96
 
82
97
  /**
@@ -100,7 +115,7 @@ declare class PcacGridBuilder {
100
115
  drawVerticalGrid<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacGridBuilderConfig<XDomain, YDomain>): void;
101
116
  drawHorizontalGrid<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacGridBuilderConfig<XDomain, YDomain>): void;
102
117
  static ɵfac: i0.ɵɵFactoryDeclaration<PcacGridBuilder, never>;
103
- static ɵprov: i0.ɵɵInjectableDeclaration<PcacGridBuilder>;
118
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
104
119
  }
105
120
 
106
121
  declare class PcacColorService {
@@ -132,7 +147,7 @@ declare class PcacColorService {
132
147
  setBlue(color: string): void;
133
148
  setAlert(color: string): void;
134
149
  static ɵfac: i0.ɵɵFactoryDeclaration<PcacColorService, never>;
135
- static ɵprov: i0.ɵɵInjectableDeclaration<PcacColorService>;
150
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
136
151
  }
137
152
 
138
153
  declare class PcacTooltipBuilder {
@@ -141,14 +156,14 @@ declare class PcacTooltipBuilder {
141
156
  hideTooltip(): void;
142
157
  private getBarTipData;
143
158
  static ɵfac: i0.ɵɵFactoryDeclaration<PcacTooltipBuilder, never>;
144
- static ɵprov: i0.ɵɵInjectableDeclaration<PcacTooltipBuilder>;
159
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
145
160
  }
146
161
 
147
162
  declare class PcacTransitionService {
148
163
  private transitionDuration;
149
164
  getTransitionDuration(): number;
150
165
  static ɵfac: i0.ɵɵFactoryDeclaration<PcacTransitionService, never>;
151
- static ɵprov: i0.ɵɵInjectableDeclaration<PcacTransitionService>;
166
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
152
167
  }
153
168
 
154
169
  /**
@@ -173,7 +188,7 @@ declare class PcacChartResizeService {
173
188
  */
174
189
  observe(chartElm: Signal<ElementRef>, rebuild: () => void): void;
175
190
  static ɵfac: i0.ɵɵFactoryDeclaration<PcacChartResizeService, never>;
176
- static ɵprov: i0.ɵɵInjectableDeclaration<PcacChartResizeService>;
191
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
177
192
  }
178
193
 
179
194
  interface PcacChartMargin {
@@ -202,6 +217,14 @@ declare class PcacChart {
202
217
  * stable basis for "did the container itself resize" — the raw container measurement is.
203
218
  */
204
219
  private lastContainerWidth;
220
+ /**
221
+ * Raw container height measured by the last successful `initializeChartState()` call, and
222
+ * whether that build was running with `heightFull` on. Only consulted by `containerSizeChanged`
223
+ * when it was: without `heightFull` the container's height is driven *by* the chart's own SVG
224
+ * height, so comparing it would report "changed" every time the chart itself grew or shrank.
225
+ */
226
+ private lastContainerHeight;
227
+ private lastHeightFull;
205
228
  /**
206
229
  * Prior to building a chart, we need to initialize the state of the chart.
207
230
  *
@@ -215,9 +238,25 @@ declare class PcacChart {
215
238
  * @param config Chart specific configuration
216
239
  */
217
240
  initializeChartState(chartElm: ElementRef, config: PcacChartConfig): boolean;
241
+ /**
242
+ * `config.height` normally *is* the height of the drawing area. With `config.heightFull` on it
243
+ * becomes a floor instead: the chart fills its container, and only falls back to `config.height`
244
+ * when the container is shorter than that (or has no definite height of its own to fill - see
245
+ * `PcacChartConfig.heightFull`, where an auto-height container measures ~0 here and the
246
+ * `Math.max` keeps the configured height).
247
+ *
248
+ * Note this deliberately subtracts the margins, so it's the *total* SVG that ends up matching
249
+ * the container: `buildContainer()` adds `margin.top`/`margin.bottom` back on top of `height`
250
+ * when sizing the `<svg>`, so filling without this would overflow the container by exactly the
251
+ * vertical margins.
252
+ * @param container The chart's container element (the `<svg>`'s parent)
253
+ * @param config Chart specific configuration
254
+ */
255
+ private resolveHeight;
218
256
  /**
219
257
  * True if the container's current raw layout width differs from the one measured by the last
220
- * successful build, or if no successful build has happened yet.
258
+ * successful build, or if no successful build has happened yet. For a `heightFull` chart, a
259
+ * change in the container's height counts too - that's the whole size the chart is tracking.
221
260
  *
222
261
  * `PcacChartResizeService`'s `ResizeObserver` is guaranteed to fire once as soon as it starts
223
262
  * observing — that's what lets a chart recover from the 0-width race described on
@@ -272,7 +311,7 @@ declare class BarHorizontalChartBuilder extends PcacChart {
272
311
  private drawThresholdsPerBarInGroup;
273
312
  private applyPreTransitionThresholdStyles;
274
313
  static ɵfac: i0.ɵɵFactoryDeclaration<BarHorizontalChartBuilder, never>;
275
- static ɵprov: i0.ɵɵInjectableDeclaration<BarHorizontalChartBuilder>;
314
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
276
315
  }
277
316
 
278
317
  declare class PcacBarHorizontalChartComponent {
@@ -328,7 +367,7 @@ declare class BarVerticalChartBuilder extends PcacChart {
328
367
  private drawThresholdsPerBarInGroup;
329
368
  private applyPreTransitionThresholdStyles;
330
369
  static ɵfac: i0.ɵɵFactoryDeclaration<BarVerticalChartBuilder, never>;
331
- static ɵprov: i0.ɵɵInjectableDeclaration<BarVerticalChartBuilder>;
370
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
332
371
  }
333
372
 
334
373
  declare class PcacBarVerticalChartComponent {
@@ -439,7 +478,7 @@ declare class PieChartBuilder extends PcacChart {
439
478
  private drawChart;
440
479
  private tweenChart;
441
480
  static ɵfac: i0.ɵɵFactoryDeclaration<PieChartBuilder, never>;
442
- static ɵprov: i0.ɵɵInjectableDeclaration<PieChartBuilder>;
481
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
443
482
  }
444
483
 
445
484
  declare class PcacPieChartComponent {