@pioneer-code/pioneer-charts 22.0.4 → 22.1.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,11 +22,11 @@
22
22
  "type": "git",
23
23
  "url": "git+https://github.com/PioneerCode/pioneer-charts.git"
24
24
  },
25
- "version": "22.0.4",
25
+ "version": "22.1.1",
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,12 +16,37 @@ 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;
22
37
  value: string | number | null;
23
38
  hide: boolean;
24
39
  data: PcacData[];
40
+ /**
41
+ * URL (or data URI) of an image to draw at this point *in place of* its dot. Currently honored
42
+ * by the line/area/plot charts only, on the innermost (point-level) `PcacData`; sized by the
43
+ * chart config's `pointImage` (see `PcacLineAreaChartConfig.pointImage`). Points without one
44
+ * keep their regular dot, so the two can be mixed within a single series.
45
+ *
46
+ * Optional (rather than defaulted) for the same reason as `PcacChartConfig.heightFull`: so
47
+ * existing object-literal / JSON data doesn't have to declare it.
48
+ */
49
+ image?: string;
25
50
  }
26
51
  declare enum PcacFormatEnum {
27
52
  None = "none",
@@ -76,7 +101,7 @@ declare class PcacAxisBuilder {
76
101
  drawYAxis<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacAxisBuilderConfig<XDomain, YDomain>): void;
77
102
  drawXAxis<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacAxisBuilderConfig<XDomain, YDomain>): void;
78
103
  static ɵfac: i0.ɵɵFactoryDeclaration<PcacAxisBuilder, never>;
79
- static ɵprov: i0.ɵɵInjectableDeclaration<PcacAxisBuilder>;
104
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
80
105
  }
81
106
 
82
107
  /**
@@ -100,7 +125,7 @@ declare class PcacGridBuilder {
100
125
  drawVerticalGrid<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacGridBuilderConfig<XDomain, YDomain>): void;
101
126
  drawHorizontalGrid<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacGridBuilderConfig<XDomain, YDomain>): void;
102
127
  static ɵfac: i0.ɵɵFactoryDeclaration<PcacGridBuilder, never>;
103
- static ɵprov: i0.ɵɵInjectableDeclaration<PcacGridBuilder>;
128
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
104
129
  }
105
130
 
106
131
  declare class PcacColorService {
@@ -132,7 +157,7 @@ declare class PcacColorService {
132
157
  setBlue(color: string): void;
133
158
  setAlert(color: string): void;
134
159
  static ɵfac: i0.ɵɵFactoryDeclaration<PcacColorService, never>;
135
- static ɵprov: i0.ɵɵInjectableDeclaration<PcacColorService>;
160
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
136
161
  }
137
162
 
138
163
  declare class PcacTooltipBuilder {
@@ -141,14 +166,14 @@ declare class PcacTooltipBuilder {
141
166
  hideTooltip(): void;
142
167
  private getBarTipData;
143
168
  static ɵfac: i0.ɵɵFactoryDeclaration<PcacTooltipBuilder, never>;
144
- static ɵprov: i0.ɵɵInjectableDeclaration<PcacTooltipBuilder>;
169
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
145
170
  }
146
171
 
147
172
  declare class PcacTransitionService {
148
173
  private transitionDuration;
149
174
  getTransitionDuration(): number;
150
175
  static ɵfac: i0.ɵɵFactoryDeclaration<PcacTransitionService, never>;
151
- static ɵprov: i0.ɵɵInjectableDeclaration<PcacTransitionService>;
176
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
152
177
  }
153
178
 
154
179
  /**
@@ -173,7 +198,7 @@ declare class PcacChartResizeService {
173
198
  */
174
199
  observe(chartElm: Signal<ElementRef>, rebuild: () => void): void;
175
200
  static ɵfac: i0.ɵɵFactoryDeclaration<PcacChartResizeService, never>;
176
- static ɵprov: i0.ɵɵInjectableDeclaration<PcacChartResizeService>;
201
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
177
202
  }
178
203
 
179
204
  interface PcacChartMargin {
@@ -202,6 +227,14 @@ declare class PcacChart {
202
227
  * stable basis for "did the container itself resize" — the raw container measurement is.
203
228
  */
204
229
  private lastContainerWidth;
230
+ /**
231
+ * Raw container height measured by the last successful `initializeChartState()` call, and
232
+ * whether that build was running with `heightFull` on. Only consulted by `containerSizeChanged`
233
+ * when it was: without `heightFull` the container's height is driven *by* the chart's own SVG
234
+ * height, so comparing it would report "changed" every time the chart itself grew or shrank.
235
+ */
236
+ private lastContainerHeight;
237
+ private lastHeightFull;
205
238
  /**
206
239
  * Prior to building a chart, we need to initialize the state of the chart.
207
240
  *
@@ -215,9 +248,25 @@ declare class PcacChart {
215
248
  * @param config Chart specific configuration
216
249
  */
217
250
  initializeChartState(chartElm: ElementRef, config: PcacChartConfig): boolean;
251
+ /**
252
+ * `config.height` normally *is* the height of the drawing area. With `config.heightFull` on it
253
+ * becomes a floor instead: the chart fills its container, and only falls back to `config.height`
254
+ * when the container is shorter than that (or has no definite height of its own to fill - see
255
+ * `PcacChartConfig.heightFull`, where an auto-height container measures ~0 here and the
256
+ * `Math.max` keeps the configured height).
257
+ *
258
+ * Note this deliberately subtracts the margins, so it's the *total* SVG that ends up matching
259
+ * the container: `buildContainer()` adds `margin.top`/`margin.bottom` back on top of `height`
260
+ * when sizing the `<svg>`, so filling without this would overflow the container by exactly the
261
+ * vertical margins.
262
+ * @param container The chart's container element (the `<svg>`'s parent)
263
+ * @param config Chart specific configuration
264
+ */
265
+ private resolveHeight;
218
266
  /**
219
267
  * 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.
268
+ * successful build, or if no successful build has happened yet. For a `heightFull` chart, a
269
+ * change in the container's height counts too - that's the whole size the chart is tracking.
221
270
  *
222
271
  * `PcacChartResizeService`'s `ResizeObserver` is guaranteed to fire once as soon as it starts
223
272
  * observing — that's what lets a chart recover from the 0-width race described on
@@ -272,7 +321,7 @@ declare class BarHorizontalChartBuilder extends PcacChart {
272
321
  private drawThresholdsPerBarInGroup;
273
322
  private applyPreTransitionThresholdStyles;
274
323
  static ɵfac: i0.ɵɵFactoryDeclaration<BarHorizontalChartBuilder, never>;
275
- static ɵprov: i0.ɵɵInjectableDeclaration<BarHorizontalChartBuilder>;
324
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
276
325
  }
277
326
 
278
327
  declare class PcacBarHorizontalChartComponent {
@@ -328,7 +377,7 @@ declare class BarVerticalChartBuilder extends PcacChart {
328
377
  private drawThresholdsPerBarInGroup;
329
378
  private applyPreTransitionThresholdStyles;
330
379
  static ɵfac: i0.ɵɵFactoryDeclaration<BarVerticalChartBuilder, never>;
331
- static ɵprov: i0.ɵɵInjectableDeclaration<BarVerticalChartBuilder>;
380
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
332
381
  }
333
382
 
334
383
  declare class PcacBarVerticalChartComponent {
@@ -366,6 +415,15 @@ declare enum PcacLineAreaPlotChartConfigType {
366
415
  Area = "area",
367
416
  Plot = "plot"
368
417
  }
418
+ /**
419
+ * Sizing for the images drawn in place of a point's dot (see `PcacData.image`). An image is
420
+ * scaled uniformly (up or down) to fit inside a `maxWidth` x `maxHeight` box, preserving its
421
+ * aspect ratio, and is centered on the data point exactly where the dot would have been.
422
+ */
423
+ declare class PcacPointImageConfig {
424
+ maxWidth: number;
425
+ maxHeight: number;
426
+ }
369
427
  declare class PcacLineAreaChartConfig extends PcacChartConfig {
370
428
  enableEffects: boolean;
371
429
  enableZoom: boolean;
@@ -382,6 +440,12 @@ declare class PcacLineAreaChartConfig extends PcacChartConfig {
382
440
  * Hex color codes to override the default colors
383
441
  */
384
442
  colorOverride: string[];
443
+ /**
444
+ * Bounding box for any point images (`PcacData.image`) on this chart. Optional; each field falls
445
+ * back to the `PcacPointImageConfig` default when not given, so a consumer only setting `image`
446
+ * on their data still gets a sensibly-sized result.
447
+ */
448
+ pointImage?: Partial<PcacPointImageConfig>;
385
449
  }
386
450
 
387
451
  declare class PcacPlotChartConfig extends PcacLineAreaChartConfig {
@@ -439,7 +503,7 @@ declare class PieChartBuilder extends PcacChart {
439
503
  private drawChart;
440
504
  private tweenChart;
441
505
  static ɵfac: i0.ɵɵFactoryDeclaration<PieChartBuilder, never>;
442
- static ɵprov: i0.ɵɵInjectableDeclaration<PieChartBuilder>;
506
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
443
507
  }
444
508
 
445
509
  declare class PcacPieChartComponent {
@@ -453,5 +517,5 @@ declare class PcacPieChartComponent {
453
517
  static ɵcmp: i0.ɵɵComponentDeclaration<PcacPieChartComponent, "pcac-pie-chart", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, { "sliceClicked": "sliceClicked"; }, never, never, true, never>;
454
518
  }
455
519
 
456
- 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, PcacTooltipBuilder, PcacTransitionService, PieChartBuilder };
520
+ 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, PcacTransitionService, PieChartBuilder };
457
521
  export type { IBarVerticalChartBuilder, IPcacAxisBuilderConfig, IPcacGridBuilderConfig, PcacChartMargin };