@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/fesm2022/pioneer-code-pioneer-charts.mjs +166 -101
- package/fesm2022/pioneer-code-pioneer-charts.mjs.map +1 -1
- package/package.json +3 -3
- package/scss/bar-chart/bar-horizontal-chart/bar-horizontal-chart.component.scss +13 -0
- package/scss/bar-chart/bar-vertical-chart/bar-vertical-chart.component.scss +13 -0
- package/scss/legend/legend.component.scss +8 -1
- package/scss/plot-line-area-chart/plot-line-area-chart.component.scss +18 -0
- package/types/pioneer-code-pioneer-charts.d.ts +49 -10
|
@@ -9,10 +9,10 @@ import { format } from 'd3-format';
|
|
|
9
9
|
import { select, scaleTime, zoom } from 'd3';
|
|
10
10
|
import { takeUntilDestroyed, outputFromObservable } from '@angular/core/rxjs-interop';
|
|
11
11
|
import { debounceTime } from 'rxjs/operators';
|
|
12
|
+
import { transition } from 'd3-transition';
|
|
12
13
|
import { range } from 'd3-array';
|
|
13
14
|
import { line, area, arc, pie } from 'd3-shape';
|
|
14
15
|
import { interpolate } from 'd3-interpolate';
|
|
15
|
-
import { transition } from 'd3-transition';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Base configuration for all charts.
|
|
@@ -24,6 +24,21 @@ class PcacChartConfig {
|
|
|
24
24
|
*/
|
|
25
25
|
data = [];
|
|
26
26
|
height = 200;
|
|
27
|
+
/**
|
|
28
|
+
* When true, `height` becomes a *minimum* height: if the container the chart is placed in is
|
|
29
|
+
* taller than `height`, the chart grows to fill it instead.
|
|
30
|
+
*
|
|
31
|
+
* The chart fills its own host element (`<pcac-bar-vertical-chart>` etc.), which it stretches
|
|
32
|
+
* to `height: 100%` while this is on - so the consumer just needs to give the element wrapping
|
|
33
|
+
* the chart a definite height (an explicit height, or a flex/grid track that resolves to one).
|
|
34
|
+
* If that wrapper turns out to be auto-height, there's nothing definite to fill and the chart
|
|
35
|
+
* falls back to `height`.
|
|
36
|
+
*
|
|
37
|
+
* Optional (rather than defaulted like the properties above) so that adding it doesn't force
|
|
38
|
+
* every existing consumer that builds a config as an object literal to declare it; the `= false`
|
|
39
|
+
* initializer still applies to anything constructed via `new`.
|
|
40
|
+
*/
|
|
41
|
+
heightFull = false;
|
|
27
42
|
}
|
|
28
43
|
class PcacData {
|
|
29
44
|
key = null;
|
|
@@ -91,7 +106,7 @@ class PcacAxisBuilder {
|
|
|
91
106
|
xAxis.tickFormat((d) => d + 'f');
|
|
92
107
|
break;
|
|
93
108
|
case PcacFormatEnum.OneDayHours:
|
|
94
|
-
xAxis.tickFormat((d
|
|
109
|
+
xAxis.tickFormat((d) => {
|
|
95
110
|
const h = d;
|
|
96
111
|
const hour = h % 12 === 0 ? 12 : h % 12;
|
|
97
112
|
const period = h < 12 ? 'am' : 'pm';
|
|
@@ -108,10 +123,10 @@ class PcacAxisBuilder {
|
|
|
108
123
|
.attr('transform', 'translate(0,' + config.height + ')')
|
|
109
124
|
.call(xAxis);
|
|
110
125
|
}
|
|
111
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
112
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.
|
|
126
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacAxisBuilder, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
127
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacAxisBuilder, providedIn: 'root' });
|
|
113
128
|
}
|
|
114
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
129
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacAxisBuilder, decorators: [{
|
|
115
130
|
type: Injectable,
|
|
116
131
|
args: [{
|
|
117
132
|
providedIn: 'root',
|
|
@@ -148,10 +163,10 @@ class PcacGridBuilder {
|
|
|
148
163
|
.attr('x2', config.width)
|
|
149
164
|
.attr('class', (_, i) => (i === 0 ? 'pcac-grid-rule-last' : ''));
|
|
150
165
|
}
|
|
151
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
152
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.
|
|
166
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacGridBuilder, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
167
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacGridBuilder, providedIn: 'root' });
|
|
153
168
|
}
|
|
154
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
169
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacGridBuilder, decorators: [{
|
|
155
170
|
type: Injectable,
|
|
156
171
|
args: [{
|
|
157
172
|
providedIn: 'root',
|
|
@@ -218,10 +233,10 @@ class PcacColorService {
|
|
|
218
233
|
setAlert(color) {
|
|
219
234
|
this.alert = color;
|
|
220
235
|
}
|
|
221
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
222
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.
|
|
236
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacColorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
237
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacColorService, providedIn: 'root' });
|
|
223
238
|
}
|
|
224
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
239
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacColorService, decorators: [{
|
|
225
240
|
type: Injectable,
|
|
226
241
|
args: [{
|
|
227
242
|
providedIn: 'root',
|
|
@@ -233,10 +248,10 @@ class PcacTransitionService {
|
|
|
233
248
|
getTransitionDuration() {
|
|
234
249
|
return this.transitionDuration;
|
|
235
250
|
}
|
|
236
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
237
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.
|
|
251
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacTransitionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
252
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacTransitionService, providedIn: 'root' });
|
|
238
253
|
}
|
|
239
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
254
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacTransitionService, decorators: [{
|
|
240
255
|
type: Injectable,
|
|
241
256
|
args: [{
|
|
242
257
|
providedIn: 'root',
|
|
@@ -283,13 +298,13 @@ class PcacTooltipBuilder {
|
|
|
283
298
|
break;
|
|
284
299
|
}
|
|
285
300
|
}
|
|
286
|
-
|
|
301
|
+
const finalValue = value ? value.toString() : value;
|
|
287
302
|
return key ? key + '</br>' + finalValue : `${finalValue}`;
|
|
288
303
|
}
|
|
289
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
290
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.
|
|
304
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacTooltipBuilder, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
305
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacTooltipBuilder, providedIn: 'root' });
|
|
291
306
|
}
|
|
292
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
307
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacTooltipBuilder, decorators: [{
|
|
293
308
|
type: Injectable,
|
|
294
309
|
args: [{
|
|
295
310
|
providedIn: 'root',
|
|
@@ -316,6 +331,14 @@ class PcacChart {
|
|
|
316
331
|
* stable basis for "did the container itself resize" — the raw container measurement is.
|
|
317
332
|
*/
|
|
318
333
|
lastContainerWidth = null;
|
|
334
|
+
/**
|
|
335
|
+
* Raw container height measured by the last successful `initializeChartState()` call, and
|
|
336
|
+
* whether that build was running with `heightFull` on. Only consulted by `containerSizeChanged`
|
|
337
|
+
* when it was: without `heightFull` the container's height is driven *by* the chart's own SVG
|
|
338
|
+
* height, so comparing it would report "changed" every time the chart itself grew or shrank.
|
|
339
|
+
*/
|
|
340
|
+
lastContainerHeight = null;
|
|
341
|
+
lastHeightFull = false;
|
|
319
342
|
/**
|
|
320
343
|
* Prior to building a chart, we need to initialize the state of the chart.
|
|
321
344
|
*
|
|
@@ -330,20 +353,44 @@ class PcacChart {
|
|
|
330
353
|
*/
|
|
331
354
|
initializeChartState(chartElm, config) {
|
|
332
355
|
select$1(chartElm.nativeElement).select('g').remove();
|
|
333
|
-
const
|
|
356
|
+
const container = chartElm.nativeElement.parentNode;
|
|
357
|
+
const containerWidth = container.clientWidth;
|
|
334
358
|
const measuredWidth = containerWidth - this.margin.left - this.margin.right;
|
|
335
359
|
if (measuredWidth <= 0) {
|
|
336
360
|
return false;
|
|
337
361
|
}
|
|
338
362
|
this.width = measuredWidth;
|
|
339
|
-
this.height = config
|
|
363
|
+
this.height = this.resolveHeight(container, config);
|
|
340
364
|
this.colors = this.colorService.getColorScale(Math.max(config.data.length, config.data[0]?.data ? config.data[0].data.length : 0));
|
|
341
365
|
this.lastContainerWidth = containerWidth;
|
|
366
|
+
this.lastContainerHeight = container.clientHeight;
|
|
367
|
+
this.lastHeightFull = config.heightFull === true;
|
|
342
368
|
return true;
|
|
343
369
|
}
|
|
370
|
+
/**
|
|
371
|
+
* `config.height` normally *is* the height of the drawing area. With `config.heightFull` on it
|
|
372
|
+
* becomes a floor instead: the chart fills its container, and only falls back to `config.height`
|
|
373
|
+
* when the container is shorter than that (or has no definite height of its own to fill - see
|
|
374
|
+
* `PcacChartConfig.heightFull`, where an auto-height container measures ~0 here and the
|
|
375
|
+
* `Math.max` keeps the configured height).
|
|
376
|
+
*
|
|
377
|
+
* Note this deliberately subtracts the margins, so it's the *total* SVG that ends up matching
|
|
378
|
+
* the container: `buildContainer()` adds `margin.top`/`margin.bottom` back on top of `height`
|
|
379
|
+
* when sizing the `<svg>`, so filling without this would overflow the container by exactly the
|
|
380
|
+
* vertical margins.
|
|
381
|
+
* @param container The chart's container element (the `<svg>`'s parent)
|
|
382
|
+
* @param config Chart specific configuration
|
|
383
|
+
*/
|
|
384
|
+
resolveHeight(container, config) {
|
|
385
|
+
if (!config.heightFull) {
|
|
386
|
+
return config.height;
|
|
387
|
+
}
|
|
388
|
+
return Math.max(config.height, container.clientHeight - this.margin.top - this.margin.bottom);
|
|
389
|
+
}
|
|
344
390
|
/**
|
|
345
391
|
* True if the container's current raw layout width differs from the one measured by the last
|
|
346
|
-
* successful build, or if no successful build has happened yet.
|
|
392
|
+
* successful build, or if no successful build has happened yet. For a `heightFull` chart, a
|
|
393
|
+
* change in the container's height counts too - that's the whole size the chart is tracking.
|
|
347
394
|
*
|
|
348
395
|
* `PcacChartResizeService`'s `ResizeObserver` is guaranteed to fire once as soon as it starts
|
|
349
396
|
* observing — that's what lets a chart recover from the 0-width race described on
|
|
@@ -357,8 +404,19 @@ class PcacChart {
|
|
|
357
404
|
if (this.lastContainerWidth === null) {
|
|
358
405
|
return true;
|
|
359
406
|
}
|
|
360
|
-
const
|
|
361
|
-
|
|
407
|
+
const container = chartElm.nativeElement.parentNode;
|
|
408
|
+
const containerWidth = container.clientWidth;
|
|
409
|
+
if (containerWidth > 0 && containerWidth !== this.lastContainerWidth) {
|
|
410
|
+
return true;
|
|
411
|
+
}
|
|
412
|
+
if (!this.lastHeightFull) {
|
|
413
|
+
return false;
|
|
414
|
+
}
|
|
415
|
+
// Height only matters for a `heightFull` chart, and only there is it safe to compare: the
|
|
416
|
+
// container's height is definite (see `resolveHeight`), so it changes when the *layout*
|
|
417
|
+
// changes, not in response to the height this chart just drew itself at.
|
|
418
|
+
const containerHeight = container.clientHeight;
|
|
419
|
+
return containerHeight > 0 && containerHeight !== this.lastContainerHeight;
|
|
362
420
|
}
|
|
363
421
|
/**
|
|
364
422
|
* 1) Set the width and height of the SVG
|
|
@@ -404,7 +462,6 @@ class PcacChart {
|
|
|
404
462
|
})
|
|
405
463
|
.remove();
|
|
406
464
|
this.margin.left = max;
|
|
407
|
-
this.margin.bottom = this.margin.bottom;
|
|
408
465
|
this.width = this.width - this.margin.left;
|
|
409
466
|
}
|
|
410
467
|
}
|
|
@@ -531,7 +588,7 @@ class BarHorizontalChartBuilder extends PcacChart {
|
|
|
531
588
|
.attr('class', 'pcac-bar')
|
|
532
589
|
.attr('x', 0)
|
|
533
590
|
.attr('y', (d) => {
|
|
534
|
-
|
|
591
|
+
const value = !config.isStacked ? this.yScaleGrouped(d.key) : this.yScaleStacked(d.key);
|
|
535
592
|
return value ? value : 0;
|
|
536
593
|
})
|
|
537
594
|
.attr('data-group-bar-id', (_, i) => {
|
|
@@ -546,7 +603,7 @@ class BarHorizontalChartBuilder extends PcacChart {
|
|
|
546
603
|
return this.colors[i];
|
|
547
604
|
})
|
|
548
605
|
.attr('width', 0)
|
|
549
|
-
.on('mouseover', function (
|
|
606
|
+
.on('mouseover', function () {
|
|
550
607
|
select$1(this)
|
|
551
608
|
.transition()
|
|
552
609
|
.duration(self.transitionService.getTransitionDuration() / 7.5)
|
|
@@ -566,7 +623,7 @@ class BarHorizontalChartBuilder extends PcacChart {
|
|
|
566
623
|
.on('mousemove', (event, d) => {
|
|
567
624
|
self.tooltipBuilder.showBarTooltip(event, d, config.tickFormat || PcacFormatEnum.None);
|
|
568
625
|
})
|
|
569
|
-
.on('mouseout', function (
|
|
626
|
+
.on('mouseout', function () {
|
|
570
627
|
self.tooltipBuilder.hideTooltip();
|
|
571
628
|
select$1(this)
|
|
572
629
|
.transition()
|
|
@@ -590,7 +647,7 @@ class BarHorizontalChartBuilder extends PcacChart {
|
|
|
590
647
|
});
|
|
591
648
|
}
|
|
592
649
|
drawThresholdAcrossChart(config) {
|
|
593
|
-
this.applyPreTransitionThresholdStyles(this.svg.select('.pcac-bars').append('rect')
|
|
650
|
+
this.applyPreTransitionThresholdStyles(this.svg.select('.pcac-bars').append('rect'))
|
|
594
651
|
.attr('height', this.height)
|
|
595
652
|
.attr('data-group-threshold-id', (_, i) => {
|
|
596
653
|
return i;
|
|
@@ -606,7 +663,7 @@ class BarHorizontalChartBuilder extends PcacChart {
|
|
|
606
663
|
}
|
|
607
664
|
drawThresholdsPerGroup(group, config) {
|
|
608
665
|
const self = this;
|
|
609
|
-
this.applyPreTransitionThresholdStyles(this.svg.selectAll('.pcac-bar-group').append('rect')
|
|
666
|
+
this.applyPreTransitionThresholdStyles(this.svg.selectAll('.pcac-bar-group').append('rect'))
|
|
610
667
|
.attr('height', this.yScaleStacked.bandwidth())
|
|
611
668
|
.attr('data-group-threshold-id', (_, i) => {
|
|
612
669
|
return i;
|
|
@@ -625,7 +682,7 @@ class BarHorizontalChartBuilder extends PcacChart {
|
|
|
625
682
|
}
|
|
626
683
|
drawThresholdsPerBarInGroup(group, config) {
|
|
627
684
|
const self = this;
|
|
628
|
-
this.applyPreTransitionThresholdStyles(group.enter().append('rect')
|
|
685
|
+
this.applyPreTransitionThresholdStyles(group.enter().append('rect'))
|
|
629
686
|
.attr('data-group-threshold-id', (_, i) => {
|
|
630
687
|
return i;
|
|
631
688
|
})
|
|
@@ -645,7 +702,7 @@ class BarHorizontalChartBuilder extends PcacChart {
|
|
|
645
702
|
return this.xScale(config.thresholds[n[0].parentElement.dataset['groupId']].data[i].value);
|
|
646
703
|
});
|
|
647
704
|
}
|
|
648
|
-
applyPreTransitionThresholdStyles(elm
|
|
705
|
+
applyPreTransitionThresholdStyles(elm) {
|
|
649
706
|
return elm.attr('class', 'pcac-threshold')
|
|
650
707
|
.style('fill', () => {
|
|
651
708
|
return this.colorService.getAlert();
|
|
@@ -661,10 +718,10 @@ class BarHorizontalChartBuilder extends PcacChart {
|
|
|
661
718
|
this.tooltipBuilder.hideTooltip();
|
|
662
719
|
});
|
|
663
720
|
}
|
|
664
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
665
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.
|
|
721
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: BarHorizontalChartBuilder, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
722
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: BarHorizontalChartBuilder });
|
|
666
723
|
}
|
|
667
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
724
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: BarHorizontalChartBuilder, decorators: [{
|
|
668
725
|
type: Injectable
|
|
669
726
|
}] });
|
|
670
727
|
|
|
@@ -717,10 +774,10 @@ class PcacChartResizeService {
|
|
|
717
774
|
destroyRef.onDestroy(() => observer.disconnect());
|
|
718
775
|
});
|
|
719
776
|
}
|
|
720
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
721
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.
|
|
777
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacChartResizeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
778
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacChartResizeService, providedIn: 'root' });
|
|
722
779
|
}
|
|
723
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
780
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacChartResizeService, decorators: [{
|
|
724
781
|
type: Injectable,
|
|
725
782
|
args: [{ providedIn: 'root' }]
|
|
726
783
|
}] });
|
|
@@ -729,7 +786,8 @@ class PcacBarHorizontalChartComponent {
|
|
|
729
786
|
chartBuilder = inject(BarHorizontalChartBuilder);
|
|
730
787
|
config = input.required(/* @ts-ignore */
|
|
731
788
|
...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
732
|
-
chartElm = viewChild.required('chart'
|
|
789
|
+
chartElm = viewChild.required('chart', /* @ts-ignore */
|
|
790
|
+
...(ngDevMode ? [{ debugName: "chartElm" }] : /* istanbul ignore next */ []));
|
|
733
791
|
barClicked = outputFromObservable(this.chartBuilder.barClicked$);
|
|
734
792
|
constructor() {
|
|
735
793
|
// Reacts to config() the same way ngOnChanges used to — reading it here (rather than a
|
|
@@ -751,12 +809,12 @@ class PcacBarHorizontalChartComponent {
|
|
|
751
809
|
this.chartBuilder.buildChart(this.chartElm(), config);
|
|
752
810
|
}
|
|
753
811
|
}
|
|
754
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
755
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.
|
|
812
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacBarHorizontalChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
813
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.6", type: PcacBarHorizontalChartComponent, isStandalone: true, selector: "pcac-bar-horizontal-chart", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { barClicked: "barClicked" }, host: { properties: { "class.pcac-height-full": "config().heightFull" } }, providers: [BarHorizontalChartBuilder], viewQueries: [{ propertyName: "chartElm", first: true, predicate: ["chart"], descendants: true, isSignal: true }], ngImport: i0, template: "<section class=\"pcac-bar-horizontal-chart\">\n <svg #chart></svg>\n</section>\n", styles: [".pcac-bar-horizontal-chart{display:block}.pcac-bar-horizontal-chart svg{width:100%;display:block}.pcac-d3-tooltip{position:absolute;text-align:center;font-size:14px;padding:.5rem;pointer-events:none;display:none;background-color:#000000bf;color:#fff;border-radius:5px}pcac-bar-horizontal-chart.pcac-height-full{display:block;height:100%}pcac-bar-horizontal-chart.pcac-height-full .pcac-bar-horizontal-chart{height:100%}\n"], encapsulation: i0.ViewEncapsulation.None });
|
|
756
814
|
}
|
|
757
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
815
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacBarHorizontalChartComponent, decorators: [{
|
|
758
816
|
type: Component,
|
|
759
|
-
args: [{ selector: 'pcac-bar-horizontal-chart', encapsulation: ViewEncapsulation.None, providers: [BarHorizontalChartBuilder], template: "<section class=\"pcac-bar-horizontal-chart\">\n <svg #chart></svg>\n</section>\n", styles: [".pcac-bar-horizontal-chart{display:block}.pcac-bar-horizontal-chart svg{width:100%;display:block}.pcac-d3-tooltip{position:absolute;text-align:center;font-size:14px;padding:.5rem;pointer-events:none;display:none;background-color:#000000bf;color:#fff;border-radius:5px}\n"] }]
|
|
817
|
+
args: [{ selector: 'pcac-bar-horizontal-chart', host: { '[class.pcac-height-full]': 'config().heightFull' }, encapsulation: ViewEncapsulation.None, providers: [BarHorizontalChartBuilder], template: "<section class=\"pcac-bar-horizontal-chart\">\n <svg #chart></svg>\n</section>\n", styles: [".pcac-bar-horizontal-chart{display:block}.pcac-bar-horizontal-chart svg{width:100%;display:block}.pcac-d3-tooltip{position:absolute;text-align:center;font-size:14px;padding:.5rem;pointer-events:none;display:none;background-color:#000000bf;color:#fff;border-radius:5px}pcac-bar-horizontal-chart.pcac-height-full{display:block;height:100%}pcac-bar-horizontal-chart.pcac-height-full .pcac-bar-horizontal-chart{height:100%}\n"] }]
|
|
760
818
|
}], ctorParameters: () => [], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], chartElm: [{ type: i0.ViewChild, args: ['chart', { isSignal: true }] }], barClicked: [{ type: i0.Output, args: ["barClicked"] }] } });
|
|
761
819
|
|
|
762
820
|
class PcacBarHorizontalChartConfig extends PcacChartConfig {
|
|
@@ -872,11 +930,11 @@ class BarVerticalChartBuilder extends PcacChart {
|
|
|
872
930
|
.attr('data-group-id', (d, i) => {
|
|
873
931
|
return i;
|
|
874
932
|
})
|
|
875
|
-
.attr('transform', (d
|
|
933
|
+
.attr('transform', (d) => {
|
|
876
934
|
return 'translate(' + this.xScaleStacked(d.key) + ',0)';
|
|
877
935
|
});
|
|
878
936
|
const group = groupsContainer.selectAll('rect')
|
|
879
|
-
.data((d
|
|
937
|
+
.data((d) => {
|
|
880
938
|
return d.data;
|
|
881
939
|
});
|
|
882
940
|
this.drawBarsPerGroup(group, config);
|
|
@@ -901,8 +959,8 @@ class BarVerticalChartBuilder extends PcacChart {
|
|
|
901
959
|
const self = this;
|
|
902
960
|
group.enter().append('rect')
|
|
903
961
|
.attr('class', 'pcac-bar')
|
|
904
|
-
.attr('x', (d
|
|
905
|
-
|
|
962
|
+
.attr('x', (d) => {
|
|
963
|
+
const value = !config.isStacked ? this.xScaleGrouped(d.key) : this.xScaleStacked(d.key);
|
|
906
964
|
return value ? value : 0;
|
|
907
965
|
})
|
|
908
966
|
.attr('data-group-bar-id', (_, i) => {
|
|
@@ -919,7 +977,7 @@ class BarVerticalChartBuilder extends PcacChart {
|
|
|
919
977
|
return this.height;
|
|
920
978
|
})
|
|
921
979
|
.attr('height', 0)
|
|
922
|
-
.on('mouseover', function (
|
|
980
|
+
.on('mouseover', function () {
|
|
923
981
|
select$1(this)
|
|
924
982
|
.transition()
|
|
925
983
|
.duration(self.transitionService.getTransitionDuration() / 5)
|
|
@@ -939,7 +997,7 @@ class BarVerticalChartBuilder extends PcacChart {
|
|
|
939
997
|
.on('mousemove', (event, d) => {
|
|
940
998
|
self.tooltipBuilder.showBarTooltip(event, d, config.tickFormat || PcacFormatEnum.None);
|
|
941
999
|
})
|
|
942
|
-
.on('mouseout', function (
|
|
1000
|
+
.on('mouseout', function () {
|
|
943
1001
|
self.tooltipBuilder.hideTooltip();
|
|
944
1002
|
select$1(this)
|
|
945
1003
|
.transition()
|
|
@@ -970,7 +1028,7 @@ class BarVerticalChartBuilder extends PcacChart {
|
|
|
970
1028
|
});
|
|
971
1029
|
}
|
|
972
1030
|
drawThresholdAcrossChart(config) {
|
|
973
|
-
this.applyPreTransitionThresholdStyles(this.svg.select('.pcac-bars').append('rect')
|
|
1031
|
+
this.applyPreTransitionThresholdStyles(this.svg.select('.pcac-bars').append('rect'))
|
|
974
1032
|
.attr('width', this.width)
|
|
975
1033
|
.attr('data-group-threshold-id', (_, i) => {
|
|
976
1034
|
return i;
|
|
@@ -986,7 +1044,7 @@ class BarVerticalChartBuilder extends PcacChart {
|
|
|
986
1044
|
}
|
|
987
1045
|
drawThresholdsPerGroup(group, config) {
|
|
988
1046
|
const self = this;
|
|
989
|
-
this.applyPreTransitionThresholdStyles(this.svg.selectAll('.pcac-bar-group').append('rect')
|
|
1047
|
+
this.applyPreTransitionThresholdStyles(this.svg.selectAll('.pcac-bar-group').append('rect'))
|
|
990
1048
|
.attr('width', this.xScaleStacked.bandwidth())
|
|
991
1049
|
.attr('data-group-threshold-id', (_, i) => {
|
|
992
1050
|
return i;
|
|
@@ -1005,7 +1063,7 @@ class BarVerticalChartBuilder extends PcacChart {
|
|
|
1005
1063
|
}
|
|
1006
1064
|
drawThresholdsPerBarInGroup(group, config) {
|
|
1007
1065
|
const self = this;
|
|
1008
|
-
this.applyPreTransitionThresholdStyles(group.enter().append('rect')
|
|
1066
|
+
this.applyPreTransitionThresholdStyles(group.enter().append('rect'))
|
|
1009
1067
|
.attr('data-group-threshold-id', (_, i) => {
|
|
1010
1068
|
return i;
|
|
1011
1069
|
})
|
|
@@ -1021,7 +1079,7 @@ class BarVerticalChartBuilder extends PcacChart {
|
|
|
1021
1079
|
return this.yScale(config.thresholds[n[0].parentElement.dataset['groupId']].data[i].value);
|
|
1022
1080
|
});
|
|
1023
1081
|
}
|
|
1024
|
-
applyPreTransitionThresholdStyles(elm
|
|
1082
|
+
applyPreTransitionThresholdStyles(elm) {
|
|
1025
1083
|
return elm.attr('class', 'pcac-threshold')
|
|
1026
1084
|
.attr('x', (d) => {
|
|
1027
1085
|
// Not every caller's selection has a per-item PcacData bound (the whole-chart threshold
|
|
@@ -1050,10 +1108,10 @@ class BarVerticalChartBuilder extends PcacChart {
|
|
|
1050
1108
|
return '3px';
|
|
1051
1109
|
});
|
|
1052
1110
|
}
|
|
1053
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
1054
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.
|
|
1111
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: BarVerticalChartBuilder, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1112
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: BarVerticalChartBuilder });
|
|
1055
1113
|
}
|
|
1056
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
1114
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: BarVerticalChartBuilder, decorators: [{
|
|
1057
1115
|
type: Injectable
|
|
1058
1116
|
}] });
|
|
1059
1117
|
|
|
@@ -1061,7 +1119,8 @@ class PcacBarVerticalChartComponent {
|
|
|
1061
1119
|
chartBuilder = inject(BarVerticalChartBuilder);
|
|
1062
1120
|
config = input.required(/* @ts-ignore */
|
|
1063
1121
|
...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
1064
|
-
chartElm = viewChild.required('chart'
|
|
1122
|
+
chartElm = viewChild.required('chart', /* @ts-ignore */
|
|
1123
|
+
...(ngDevMode ? [{ debugName: "chartElm" }] : /* istanbul ignore next */ []));
|
|
1065
1124
|
barClicked = outputFromObservable(this.chartBuilder.barClicked$);
|
|
1066
1125
|
constructor() {
|
|
1067
1126
|
// Reacts to config() the same way ngOnChanges used to — reading it here (rather than a
|
|
@@ -1083,12 +1142,12 @@ class PcacBarVerticalChartComponent {
|
|
|
1083
1142
|
this.chartBuilder.buildChart(this.chartElm(), config);
|
|
1084
1143
|
}
|
|
1085
1144
|
}
|
|
1086
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
1087
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.
|
|
1145
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacBarVerticalChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1146
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.6", type: PcacBarVerticalChartComponent, isStandalone: true, selector: "pcac-bar-vertical-chart", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { barClicked: "barClicked" }, host: { properties: { "class.pcac-height-full": "config().heightFull" } }, providers: [BarVerticalChartBuilder], viewQueries: [{ propertyName: "chartElm", first: true, predicate: ["chart"], descendants: true, isSignal: true }], ngImport: i0, template: "<section class=\"pcac-bar-vertical-chart\">\n <svg #chart></svg>\n</section>\n", styles: [".pcac-bar-vertical-chart svg{width:100%;display:block}pcac-bar-vertical-chart.pcac-height-full{display:block;height:100%}pcac-bar-vertical-chart.pcac-height-full .pcac-bar-vertical-chart{height:100%}\n"], encapsulation: i0.ViewEncapsulation.None });
|
|
1088
1147
|
}
|
|
1089
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
1148
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacBarVerticalChartComponent, decorators: [{
|
|
1090
1149
|
type: Component,
|
|
1091
|
-
args: [{ selector: 'pcac-bar-vertical-chart', encapsulation: ViewEncapsulation.None, providers: [BarVerticalChartBuilder], template: "<section class=\"pcac-bar-vertical-chart\">\n <svg #chart></svg>\n</section>\n", styles: [".pcac-bar-vertical-chart svg{width:100%;display:block}\n"] }]
|
|
1150
|
+
args: [{ selector: 'pcac-bar-vertical-chart', host: { '[class.pcac-height-full]': 'config().heightFull' }, encapsulation: ViewEncapsulation.None, providers: [BarVerticalChartBuilder], template: "<section class=\"pcac-bar-vertical-chart\">\n <svg #chart></svg>\n</section>\n", styles: [".pcac-bar-vertical-chart svg{width:100%;display:block}pcac-bar-vertical-chart.pcac-height-full{display:block;height:100%}pcac-bar-vertical-chart.pcac-height-full .pcac-bar-vertical-chart{height:100%}\n"] }]
|
|
1092
1151
|
}], ctorParameters: () => [], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], chartElm: [{ type: i0.ViewChild, args: ['chart', { isSignal: true }] }], barClicked: [{ type: i0.Output, args: ["barClicked"] }] } });
|
|
1093
1152
|
|
|
1094
1153
|
class PcacBarVerticalChartConfig extends PcacChartConfig {
|
|
@@ -1127,12 +1186,12 @@ class PcacLegend {
|
|
|
1127
1186
|
this.config.set({ ...this.config(), items });
|
|
1128
1187
|
this.itemClicked.emit(items);
|
|
1129
1188
|
}
|
|
1130
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
1131
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.
|
|
1189
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacLegend, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1190
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.6", type: PcacLegend, isStandalone: true, selector: "pcac-legend", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { config: "configChange", itemClicked: "itemClicked" }, ngImport: i0, template: "<div class=\"pcac-legend-label\"><small>{{config().heading}}</small></div>\n@for(item of config().items; track item; let i = $index; let first = $first; let last = $last;) {\n<div class=\"pcac-legend-item\" [class.pcac-legend-item-last]=\"last\" [class.pcac-legend-unchecked]=\"!item.checked\"\n role=\"switch\" [attr.aria-checked]=\"item.checked\" tabindex=\"0\" (click)=\"onItemClicked(i)\"\n (keydown.enter)=\"onItemClicked(i)\" (keydown.space)=\"onItemClicked(i); $event.preventDefault()\">\n @let color = item.colorOverride ? item.colorOverride : colorScale()[i];\n <div class=\"pcac-legend-circle\" [style.backgroundColor]=\"color\"></div>\n <small>{{ item.label }}</small>\n</div>\n}\n", styles: [":host{display:flex;align-items:center}.pcac-legend-label{margin-right:8px;margin-bottom:2.5px}.pcac-legend-item{cursor:pointer;display:flex;align-items:center;margin-right:8px}.pcac-legend-item:hover .pcac-legend-circle{box-shadow:0 0 6px #0000004d;transform:scale(1.2)}.pcac-legend-circle{display:inline-block;width:12px;height:12px;border-radius:50%;margin-right:4px;transition:box-shadow .3s ease,transform .3s ease}.pcac-legend-unchecked{opacity:.5}.pcac-legend-item-last{margin-right:0}.pcac-legend-item:focus-visible{outline:2px solid currentColor;outline-offset:2px}\n"] });
|
|
1132
1191
|
}
|
|
1133
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
1192
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacLegend, decorators: [{
|
|
1134
1193
|
type: Component,
|
|
1135
|
-
args: [{ selector: 'pcac-legend', template: "<
|
|
1194
|
+
args: [{ selector: 'pcac-legend', template: "<div class=\"pcac-legend-label\"><small>{{config().heading}}</small></div>\n@for(item of config().items; track item; let i = $index; let first = $first; let last = $last;) {\n<div class=\"pcac-legend-item\" [class.pcac-legend-item-last]=\"last\" [class.pcac-legend-unchecked]=\"!item.checked\"\n role=\"switch\" [attr.aria-checked]=\"item.checked\" tabindex=\"0\" (click)=\"onItemClicked(i)\"\n (keydown.enter)=\"onItemClicked(i)\" (keydown.space)=\"onItemClicked(i); $event.preventDefault()\">\n @let color = item.colorOverride ? item.colorOverride : colorScale()[i];\n <div class=\"pcac-legend-circle\" [style.backgroundColor]=\"color\"></div>\n <small>{{ item.label }}</small>\n</div>\n}\n", styles: [":host{display:flex;align-items:center}.pcac-legend-label{margin-right:8px;margin-bottom:2.5px}.pcac-legend-item{cursor:pointer;display:flex;align-items:center;margin-right:8px}.pcac-legend-item:hover .pcac-legend-circle{box-shadow:0 0 6px #0000004d;transform:scale(1.2)}.pcac-legend-circle{display:inline-block;width:12px;height:12px;border-radius:50%;margin-right:4px;transition:box-shadow .3s ease,transform .3s ease}.pcac-legend-unchecked{opacity:.5}.pcac-legend-item-last{margin-right:0}.pcac-legend-item:focus-visible{outline:2px solid currentColor;outline-offset:2px}\n"] }]
|
|
1136
1195
|
}], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }, { type: i0.Output, args: ["configChange"] }], itemClicked: [{ type: i0.Output, args: ["itemClicked"] }] } });
|
|
1137
1196
|
|
|
1138
1197
|
/**
|
|
@@ -1243,10 +1302,9 @@ class PlaChartEffectsBuilder {
|
|
|
1243
1302
|
}
|
|
1244
1303
|
let beginning = 0;
|
|
1245
1304
|
let end = line.getTotalLength();
|
|
1246
|
-
let target = 0;
|
|
1247
1305
|
let pos;
|
|
1248
1306
|
while (true) {
|
|
1249
|
-
target = Math.floor((beginning + end) / 2);
|
|
1307
|
+
const target = Math.floor((beginning + end) / 2);
|
|
1250
1308
|
pos = line.getPointAtLength(target);
|
|
1251
1309
|
if ((target === end || target === beginning) && pos.x !== mousePos[0]) {
|
|
1252
1310
|
break;
|
|
@@ -1261,16 +1319,16 @@ class PlaChartEffectsBuilder {
|
|
|
1261
1319
|
break;
|
|
1262
1320
|
}
|
|
1263
1321
|
}
|
|
1264
|
-
|
|
1322
|
+
const textTarget = this.config.y.invert(pos.y);
|
|
1265
1323
|
select$1(nodes[index]).select('text')
|
|
1266
1324
|
.text(textTarget.toFixed(0));
|
|
1267
1325
|
return 'translate(' + mousePos[0] + ',' + pos.y + ')';
|
|
1268
1326
|
});
|
|
1269
1327
|
}
|
|
1270
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
1271
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.
|
|
1328
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PlaChartEffectsBuilder, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1329
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PlaChartEffectsBuilder });
|
|
1272
1330
|
}
|
|
1273
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
1331
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PlaChartEffectsBuilder, decorators: [{
|
|
1274
1332
|
type: Injectable
|
|
1275
1333
|
}] });
|
|
1276
1334
|
|
|
@@ -1304,7 +1362,7 @@ class PlaChartScales {
|
|
|
1304
1362
|
}
|
|
1305
1363
|
class PlaChartScalesBuilder {
|
|
1306
1364
|
build(config, chartWidth, chartHeight) {
|
|
1307
|
-
|
|
1365
|
+
const resp = new PlaChartScales();
|
|
1308
1366
|
resp.x = this.buildXScale(config, chartWidth);
|
|
1309
1367
|
resp.y = this.buildYScale(config, chartHeight);
|
|
1310
1368
|
return resp;
|
|
@@ -1619,10 +1677,10 @@ class PlaChartBuilder extends PcacChart {
|
|
|
1619
1677
|
.attr('style', () => config.data[index].hide ? 'display: none' : null);
|
|
1620
1678
|
}
|
|
1621
1679
|
}
|
|
1622
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
1623
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.
|
|
1680
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PlaChartBuilder, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1681
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PlaChartBuilder });
|
|
1624
1682
|
}
|
|
1625
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
1683
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PlaChartBuilder, decorators: [{
|
|
1626
1684
|
type: Injectable
|
|
1627
1685
|
}] });
|
|
1628
1686
|
|
|
@@ -1632,7 +1690,8 @@ class PcacLineAreaChartComponent {
|
|
|
1632
1690
|
...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
1633
1691
|
type = input.required(/* @ts-ignore */
|
|
1634
1692
|
...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
1635
|
-
chartElm = viewChild.required('chart'
|
|
1693
|
+
chartElm = viewChild.required('chart', /* @ts-ignore */
|
|
1694
|
+
...(ngDevMode ? [{ debugName: "chartElm" }] : /* istanbul ignore next */ []));
|
|
1636
1695
|
dotClicked = outputFromObservable(this.chartBuilder.dotClicked$);
|
|
1637
1696
|
constructor() {
|
|
1638
1697
|
// Reacts to config()/type() the same way ngOnChanges used to — reading them here (rather
|
|
@@ -1657,12 +1716,12 @@ class PcacLineAreaChartComponent {
|
|
|
1657
1716
|
this.chartBuilder.buildChart(this.chartElm(), config, this.type());
|
|
1658
1717
|
}
|
|
1659
1718
|
}
|
|
1660
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
1661
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.
|
|
1719
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacLineAreaChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1720
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.6", type: PcacLineAreaChartComponent, isStandalone: true, selector: "pcac-line-area-chart", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { dotClicked: "dotClicked" }, host: { properties: { "class.pcac-height-full": "config().heightFull" } }, providers: [PlaChartBuilder, PlaChartEffectsBuilder], viewQueries: [{ propertyName: "chartElm", first: true, predicate: ["chart"], descendants: true, isSignal: true }], ngImport: i0, template: "<section class=\"pcac-line-area-chart\">\n <svg #chart></svg>\n</section>\n\n", styles: [".pcac-line-area-chart svg{width:100%;display:block}.pcac-line-area-chart .dot{stroke-width:2px}.pcac-line-area-chart .effects-canvas{fill:none}.pcac-line-area-chart .effect-line{stroke:#ced4da;stroke-width:1px;opacity:0}.pcac-line-area-chart .effect-circle{stroke-width:1px;fill:none;opacity:0}.pcac-line-area-chart .effect-text{font-size:11px;font-weight:700;fill:#343a40}.pcac-d3-tooltip{position:absolute;text-align:center;font-size:14px;padding:.5rem;pointer-events:none;display:none;background-color:#000000bf;color:#fff;border-radius:5px}pcac-line-chart.pcac-height-full,pcac-area-chart.pcac-height-full,pcac-plot-chart.pcac-height-full,pcac-line-area-chart.pcac-height-full{display:block;height:100%}pcac-line-area-chart.pcac-height-full .pcac-line-area-chart{height:100%}\n"], encapsulation: i0.ViewEncapsulation.None });
|
|
1662
1721
|
}
|
|
1663
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
1722
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacLineAreaChartComponent, decorators: [{
|
|
1664
1723
|
type: Component,
|
|
1665
|
-
args: [{ selector: 'pcac-line-area-chart', encapsulation: ViewEncapsulation.None, providers: [PlaChartBuilder, PlaChartEffectsBuilder], template: "<section class=\"pcac-line-area-chart\">\n <svg #chart></svg>\n</section>\n\n", styles: [".pcac-line-area-chart svg{width:100%;display:block}.pcac-line-area-chart .dot{stroke-width:2px}.pcac-line-area-chart .effects-canvas{fill:none}.pcac-line-area-chart .effect-line{stroke:#ced4da;stroke-width:1px;opacity:0}.pcac-line-area-chart .effect-circle{stroke-width:1px;fill:none;opacity:0}.pcac-line-area-chart .effect-text{font-size:11px;font-weight:700;fill:#343a40}.pcac-d3-tooltip{position:absolute;text-align:center;font-size:14px;padding:.5rem;pointer-events:none;display:none;background-color:#000000bf;color:#fff;border-radius:5px}\n"] }]
|
|
1724
|
+
args: [{ selector: 'pcac-line-area-chart', host: { '[class.pcac-height-full]': 'config().heightFull' }, encapsulation: ViewEncapsulation.None, providers: [PlaChartBuilder, PlaChartEffectsBuilder], template: "<section class=\"pcac-line-area-chart\">\n <svg #chart></svg>\n</section>\n\n", styles: [".pcac-line-area-chart svg{width:100%;display:block}.pcac-line-area-chart .dot{stroke-width:2px}.pcac-line-area-chart .effects-canvas{fill:none}.pcac-line-area-chart .effect-line{stroke:#ced4da;stroke-width:1px;opacity:0}.pcac-line-area-chart .effect-circle{stroke-width:1px;fill:none;opacity:0}.pcac-line-area-chart .effect-text{font-size:11px;font-weight:700;fill:#343a40}.pcac-d3-tooltip{position:absolute;text-align:center;font-size:14px;padding:.5rem;pointer-events:none;display:none;background-color:#000000bf;color:#fff;border-radius:5px}pcac-line-chart.pcac-height-full,pcac-area-chart.pcac-height-full,pcac-plot-chart.pcac-height-full,pcac-line-area-chart.pcac-height-full{display:block;height:100%}pcac-line-area-chart.pcac-height-full .pcac-line-area-chart{height:100%}\n"] }]
|
|
1666
1725
|
}], ctorParameters: () => [], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: true }] }], chartElm: [{ type: i0.ViewChild, args: ['chart', { isSignal: true }] }], dotClicked: [{ type: i0.Output, args: ["dotClicked"] }] } });
|
|
1667
1726
|
|
|
1668
1727
|
class PcacPlotChart {
|
|
@@ -1670,12 +1729,12 @@ class PcacPlotChart {
|
|
|
1670
1729
|
...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
1671
1730
|
types = PcacLineAreaPlotChartConfigType;
|
|
1672
1731
|
dotClicked = output();
|
|
1673
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
1674
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.
|
|
1732
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacPlotChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1733
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.6", type: PcacPlotChart, isStandalone: true, selector: "pcac-plot-chart", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { dotClicked: "dotClicked" }, host: { properties: { "class.pcac-height-full": "config().heightFull" } }, ngImport: i0, template: "<pcac-line-area-chart [config]=\"config()\" [type]=\"types.Plot\" (dotClicked)=\"dotClicked.emit($event)\"/>", dependencies: [{ kind: "component", type: PcacLineAreaChartComponent, selector: "pcac-line-area-chart", inputs: ["config", "type"], outputs: ["dotClicked"] }] });
|
|
1675
1734
|
}
|
|
1676
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
1735
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacPlotChart, decorators: [{
|
|
1677
1736
|
type: Component,
|
|
1678
|
-
args: [{ selector: 'pcac-plot-chart', imports: [PcacLineAreaChartComponent], template: "<pcac-line-area-chart [config]=\"config()\" [type]=\"types.Plot\" (dotClicked)=\"dotClicked.emit($event)\"/>" }]
|
|
1737
|
+
args: [{ selector: 'pcac-plot-chart', host: { '[class.pcac-height-full]': 'config().heightFull' }, imports: [PcacLineAreaChartComponent], template: "<pcac-line-area-chart [config]=\"config()\" [type]=\"types.Plot\" (dotClicked)=\"dotClicked.emit($event)\"/>" }]
|
|
1679
1738
|
}], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], dotClicked: [{ type: i0.Output, args: ["dotClicked"] }] } });
|
|
1680
1739
|
|
|
1681
1740
|
class PcacPlotChartConfig extends PcacLineAreaChartConfig {
|
|
@@ -1686,12 +1745,12 @@ class PcacLineChart {
|
|
|
1686
1745
|
...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
1687
1746
|
types = PcacLineAreaPlotChartConfigType;
|
|
1688
1747
|
dotClicked = output();
|
|
1689
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
1690
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.
|
|
1748
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacLineChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1749
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.6", type: PcacLineChart, isStandalone: true, selector: "pcac-line-chart", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { dotClicked: "dotClicked" }, host: { properties: { "class.pcac-height-full": "config().heightFull" } }, ngImport: i0, template: "<pcac-line-area-chart [config]=\"config()\" [type]=\"types.Line\" />", dependencies: [{ kind: "component", type: PcacLineAreaChartComponent, selector: "pcac-line-area-chart", inputs: ["config", "type"], outputs: ["dotClicked"] }] });
|
|
1691
1750
|
}
|
|
1692
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
1751
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacLineChart, decorators: [{
|
|
1693
1752
|
type: Component,
|
|
1694
|
-
args: [{ selector: 'pcac-line-chart', imports: [PcacLineAreaChartComponent], template: "<pcac-line-area-chart [config]=\"config()\" [type]=\"types.Line\" />" }]
|
|
1753
|
+
args: [{ selector: 'pcac-line-chart', host: { '[class.pcac-height-full]': 'config().heightFull' }, imports: [PcacLineAreaChartComponent], template: "<pcac-line-area-chart [config]=\"config()\" [type]=\"types.Line\" />" }]
|
|
1695
1754
|
}], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], dotClicked: [{ type: i0.Output, args: ["dotClicked"] }] } });
|
|
1696
1755
|
|
|
1697
1756
|
class PcacLineChartConfig extends PcacLineAreaChartConfig {
|
|
@@ -1702,12 +1761,12 @@ class PcacAreaChart {
|
|
|
1702
1761
|
...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
1703
1762
|
types = PcacLineAreaPlotChartConfigType;
|
|
1704
1763
|
dotClicked = output();
|
|
1705
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
1706
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.
|
|
1764
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacAreaChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1765
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.6", type: PcacAreaChart, isStandalone: true, selector: "pcac-area-chart", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { dotClicked: "dotClicked" }, host: { properties: { "class.pcac-height-full": "config().heightFull" } }, ngImport: i0, template: "<pcac-line-area-chart [config]=\"config()\" [type]=\"types.Area\" />", dependencies: [{ kind: "component", type: PcacLineAreaChartComponent, selector: "pcac-line-area-chart", inputs: ["config", "type"], outputs: ["dotClicked"] }] });
|
|
1707
1766
|
}
|
|
1708
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
1767
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacAreaChart, decorators: [{
|
|
1709
1768
|
type: Component,
|
|
1710
|
-
args: [{ selector: 'pcac-area-chart', imports: [PcacLineAreaChartComponent], template: "<pcac-line-area-chart [config]=\"config()\" [type]=\"types.Area\" />" }]
|
|
1769
|
+
args: [{ selector: 'pcac-area-chart', host: { '[class.pcac-height-full]': 'config().heightFull' }, imports: [PcacLineAreaChartComponent], template: "<pcac-line-area-chart [config]=\"config()\" [type]=\"types.Area\" />" }]
|
|
1711
1770
|
}], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], dotClicked: [{ type: i0.Output, args: ["dotClicked"] }] } });
|
|
1712
1771
|
|
|
1713
1772
|
class PcacAreaChartConfig extends PcacLineAreaChartConfig {
|
|
@@ -1734,14 +1793,19 @@ class PieChartBuilder extends PcacChart {
|
|
|
1734
1793
|
if (!config?.data?.length) {
|
|
1735
1794
|
return;
|
|
1736
1795
|
}
|
|
1737
|
-
|
|
1796
|
+
// The pie deliberately opts out of `heightFull`: `height` here feeds the radius rather than a
|
|
1797
|
+
// drawing area, so growing into a tall container would silently change the size of the pie
|
|
1798
|
+
// itself. `PcacPieChartConfig` inherits the property from PcacChartConfig, so it's neutralized
|
|
1799
|
+
// here rather than being absent from the type. (`<pcac-pie-chart>` also never gets the
|
|
1800
|
+
// `pcac-height-full` class the other charts use to stretch their host.)
|
|
1801
|
+
if (!this.initializeChartState(chartElm, { ...config, heightFull: false })) {
|
|
1738
1802
|
return;
|
|
1739
1803
|
}
|
|
1740
1804
|
this.radius = Math.min(Math.min(this.height, this.width), Math.min(this.height, this.width)) / 2;
|
|
1741
|
-
this.buildShapes(
|
|
1805
|
+
this.buildShapes();
|
|
1742
1806
|
this.drawChart(chartElm, config);
|
|
1743
1807
|
}
|
|
1744
|
-
buildShapes(
|
|
1808
|
+
buildShapes() {
|
|
1745
1809
|
const radiusOffset = 10;
|
|
1746
1810
|
this.arcShape = arc()
|
|
1747
1811
|
.innerRadius(0)
|
|
@@ -1799,10 +1863,10 @@ class PieChartBuilder extends PcacChart {
|
|
|
1799
1863
|
const i = interpolate({ startAngle: 0, endAngle: 0 }, b);
|
|
1800
1864
|
return (t) => this.arcShape(i(t)) ?? '';
|
|
1801
1865
|
}
|
|
1802
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
1803
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.
|
|
1866
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PieChartBuilder, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1867
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PieChartBuilder });
|
|
1804
1868
|
}
|
|
1805
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
1869
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PieChartBuilder, decorators: [{
|
|
1806
1870
|
type: Injectable
|
|
1807
1871
|
}] });
|
|
1808
1872
|
|
|
@@ -1810,7 +1874,8 @@ class PcacPieChartComponent {
|
|
|
1810
1874
|
chartBuilder = inject(PieChartBuilder);
|
|
1811
1875
|
config = input.required(/* @ts-ignore */
|
|
1812
1876
|
...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
1813
|
-
chartElm = viewChild.required('chart'
|
|
1877
|
+
chartElm = viewChild.required('chart', /* @ts-ignore */
|
|
1878
|
+
...(ngDevMode ? [{ debugName: "chartElm" }] : /* istanbul ignore next */ []));
|
|
1814
1879
|
sliceClicked = outputFromObservable(this.chartBuilder.sliceClicked$);
|
|
1815
1880
|
constructor() {
|
|
1816
1881
|
// Reacts to config() the same way ngOnChanges used to — reading it here (rather than a
|
|
@@ -1832,10 +1897,10 @@ class PcacPieChartComponent {
|
|
|
1832
1897
|
this.chartBuilder.buildChart(this.chartElm(), config);
|
|
1833
1898
|
}
|
|
1834
1899
|
}
|
|
1835
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
1836
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.
|
|
1900
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacPieChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1901
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.6", type: PcacPieChartComponent, isStandalone: true, selector: "pcac-pie-chart", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { sliceClicked: "sliceClicked" }, providers: [PieChartBuilder], viewQueries: [{ propertyName: "chartElm", first: true, predicate: ["chart"], descendants: true, isSignal: true }], ngImport: i0, template: "<section class=\"pcac-pie-chart\">\n <svg #chart></svg>\n</section>\n\n", styles: [".pcac-pie-chart svg{width:100%;display:block}.pcac-pie-chart .dot{fill:none;stroke-width:1px}\n"], encapsulation: i0.ViewEncapsulation.None });
|
|
1837
1902
|
}
|
|
1838
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
1903
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: PcacPieChartComponent, decorators: [{
|
|
1839
1904
|
type: Component,
|
|
1840
1905
|
args: [{ selector: 'pcac-pie-chart', encapsulation: ViewEncapsulation.None, providers: [PieChartBuilder], template: "<section class=\"pcac-pie-chart\">\n <svg #chart></svg>\n</section>\n\n", styles: [".pcac-pie-chart svg{width:100%;display:block}.pcac-pie-chart .dot{fill:none;stroke-width:1px}\n"] }]
|
|
1841
1906
|
}], ctorParameters: () => [], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], chartElm: [{ type: i0.ViewChild, args: ['chart', { isSignal: true }] }], sliceClicked: [{ type: i0.Output, args: ["sliceClicked"] }] } });
|