@pioneer-code/pioneer-charts 22.2.2 → 22.2.4
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.
|
@@ -232,6 +232,7 @@ class PcacAxisBuilder {
|
|
|
232
232
|
drawYAxis(config) {
|
|
233
233
|
if (config.yAxis.hide)
|
|
234
234
|
return;
|
|
235
|
+
config.svg.selectAll('.pcac-y-axis').remove();
|
|
235
236
|
const yAxis = axisLeft(config.yScale).ticks(config.yAxis.ticks);
|
|
236
237
|
if (config.yAxis.tickSize !== undefined) {
|
|
237
238
|
yAxis.tickSizeInner(config.yAxis.tickSize);
|
|
@@ -283,7 +284,7 @@ class PcacAxisBuilder {
|
|
|
283
284
|
});
|
|
284
285
|
break;
|
|
285
286
|
case PcacFormatEnum.Decimal:
|
|
286
|
-
xAxis.tickFormat((
|
|
287
|
+
xAxis.tickFormat(decimalTickFormat(config.xScale, config.xAxis.ticks));
|
|
287
288
|
break;
|
|
288
289
|
}
|
|
289
290
|
const group = config.svg.append('g')
|
|
@@ -330,15 +331,29 @@ class PcacAxisBuilder {
|
|
|
330
331
|
text('pcac-axis-sub-label', layout.length, edge, 'end', sub.max);
|
|
331
332
|
}
|
|
332
333
|
}
|
|
333
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
334
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.
|
|
334
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacAxisBuilder, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
335
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacAxisBuilder, providedIn: 'root' });
|
|
335
336
|
}
|
|
336
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
337
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacAxisBuilder, decorators: [{
|
|
337
338
|
type: Injectable,
|
|
338
339
|
args: [{
|
|
339
340
|
providedIn: 'root',
|
|
340
341
|
}]
|
|
341
342
|
}] });
|
|
343
|
+
/**
|
|
344
|
+
* Tick labels for a `Decimal` axis: SI-prefixed (`1.5k`), with the precision taken from the
|
|
345
|
+
* scale's own tick step rather than fixed. A fixed two significant digits (`.2s`) is fine for a
|
|
346
|
+
* whole domain but breaks down once zoom narrows it to a few units - ticks at 10.5, 11, 11.5, 12
|
|
347
|
+
* all rounded to `10 11 12 12`. `~` trims trailing zeros so a coarse step still reads `5 10 15`,
|
|
348
|
+
* not `5.0 10.0 15.0`. Falls back to the fixed format for a scale without `tickFormat` (a
|
|
349
|
+
* `Decimal` axis is always linear in practice, but the config type only promises `AxisScale`).
|
|
350
|
+
*/
|
|
351
|
+
function decimalTickFormat(scale, ticks) {
|
|
352
|
+
const withTicks = scale;
|
|
353
|
+
const formatTick = withTicks.tickFormat ? withTicks.tickFormat(ticks, '~s') : (d) => format('.2s')(d);
|
|
354
|
+
// The prefix comes from the domain's largest value, which would label the origin `0k`.
|
|
355
|
+
return (d) => (Number(d) === 0 ? '0' : formatTick(d));
|
|
356
|
+
}
|
|
342
357
|
|
|
343
358
|
/** Where along its axis each grid line sits, in pixels. */
|
|
344
359
|
function gridLines(scale, numberOfTicks) {
|
|
@@ -352,8 +367,8 @@ function gridLines(scale, numberOfTicks) {
|
|
|
352
367
|
class PcacGridBuilder {
|
|
353
368
|
/**
|
|
354
369
|
* Vertical lines, one per x-axis tick (or category), running the plot's full height. The group
|
|
355
|
-
* is classed `pcac-grid-vertical` so a chart can
|
|
356
|
-
* line/area/plot charts do on zoom, when
|
|
370
|
+
* is classed `pcac-grid-vertical` (the horizontal one `pcac-grid-horizontal`) so a chart can
|
|
371
|
+
* find and redraw just one grid - the line/area/plot charts do on zoom, when an axis's ticks move.
|
|
357
372
|
*/
|
|
358
373
|
drawVerticalGrid(config) {
|
|
359
374
|
config.svg.append('g')
|
|
@@ -385,10 +400,10 @@ class PcacGridBuilder {
|
|
|
385
400
|
.attr('x2', config.width)
|
|
386
401
|
.attr('class', (_, i) => (i === 0 ? 'pcac-grid-rule-last' : ''));
|
|
387
402
|
}
|
|
388
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
389
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.
|
|
403
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacGridBuilder, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
404
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacGridBuilder, providedIn: 'root' });
|
|
390
405
|
}
|
|
391
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
406
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacGridBuilder, decorators: [{
|
|
392
407
|
type: Injectable,
|
|
393
408
|
args: [{
|
|
394
409
|
providedIn: 'root',
|
|
@@ -455,10 +470,10 @@ class PcacColorService {
|
|
|
455
470
|
setAlert(color) {
|
|
456
471
|
this.alert = color;
|
|
457
472
|
}
|
|
458
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
459
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.
|
|
473
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacColorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
474
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacColorService, providedIn: 'root' });
|
|
460
475
|
}
|
|
461
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
476
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacColorService, decorators: [{
|
|
462
477
|
type: Injectable,
|
|
463
478
|
args: [{
|
|
464
479
|
providedIn: 'root',
|
|
@@ -470,10 +485,10 @@ class PcacTransitionService {
|
|
|
470
485
|
getTransitionDuration() {
|
|
471
486
|
return this.transitionDuration;
|
|
472
487
|
}
|
|
473
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
474
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.
|
|
488
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacTransitionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
489
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacTransitionService, providedIn: 'root' });
|
|
475
490
|
}
|
|
476
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
491
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacTransitionService, decorators: [{
|
|
477
492
|
type: Injectable,
|
|
478
493
|
args: [{
|
|
479
494
|
providedIn: 'root',
|
|
@@ -607,10 +622,10 @@ class PcacTooltipBuilder {
|
|
|
607
622
|
const finalValue = value ? value.toString() : value;
|
|
608
623
|
return key ? key + '<br>' + finalValue : `${finalValue}`;
|
|
609
624
|
}
|
|
610
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
611
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.
|
|
625
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacTooltipBuilder, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
626
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacTooltipBuilder, providedIn: 'root' });
|
|
612
627
|
}
|
|
613
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
628
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacTooltipBuilder, decorators: [{
|
|
614
629
|
type: Injectable,
|
|
615
630
|
args: [{
|
|
616
631
|
providedIn: 'root',
|
|
@@ -752,7 +767,7 @@ class PcacChart {
|
|
|
752
767
|
/**
|
|
753
768
|
* Draws whichever grids the resolved axes ask for: vertical lines from the x axis's ticks,
|
|
754
769
|
* horizontal from the y's (`PcacAxisConfig.showGrid`). `which` restricts it to one axis - the
|
|
755
|
-
* line/area/plot charts redraw just
|
|
770
|
+
* line/area/plot charts redraw just a zoomed axis's grid against its rescaled scale on zoom.
|
|
756
771
|
*/
|
|
757
772
|
drawGrids(xScale, yScale, which = 'both') {
|
|
758
773
|
const base = { svg: this.svg, width: this.width, height: this.height, xScale, yScale };
|
|
@@ -1242,10 +1257,10 @@ class BarHorizontalChartBuilder extends PcacChart {
|
|
|
1242
1257
|
this.hideTooltip();
|
|
1243
1258
|
});
|
|
1244
1259
|
}
|
|
1245
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
1246
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.
|
|
1260
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: BarHorizontalChartBuilder, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1261
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: BarHorizontalChartBuilder });
|
|
1247
1262
|
}
|
|
1248
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
1263
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: BarHorizontalChartBuilder, decorators: [{
|
|
1249
1264
|
type: Injectable
|
|
1250
1265
|
}] });
|
|
1251
1266
|
|
|
@@ -1298,10 +1313,10 @@ class PcacChartResizeService {
|
|
|
1298
1313
|
destroyRef.onDestroy(() => observer.disconnect());
|
|
1299
1314
|
});
|
|
1300
1315
|
}
|
|
1301
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
1302
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.
|
|
1316
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacChartResizeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1317
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacChartResizeService, providedIn: 'root' });
|
|
1303
1318
|
}
|
|
1304
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
1319
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacChartResizeService, decorators: [{
|
|
1305
1320
|
type: Injectable,
|
|
1306
1321
|
args: [{ providedIn: 'root' }]
|
|
1307
1322
|
}] });
|
|
@@ -1351,10 +1366,10 @@ class PcacTooltipDirective {
|
|
|
1351
1366
|
static ngTemplateContextGuard(_dir, _ctx) {
|
|
1352
1367
|
return true;
|
|
1353
1368
|
}
|
|
1354
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
1355
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.
|
|
1369
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacTooltipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1370
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: PcacTooltipDirective, isStandalone: true, selector: "ng-template[pcacTooltip]", ngImport: i0 });
|
|
1356
1371
|
}
|
|
1357
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
1372
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacTooltipDirective, decorators: [{
|
|
1358
1373
|
type: Directive,
|
|
1359
1374
|
args: [{
|
|
1360
1375
|
selector: 'ng-template[pcacTooltip]'
|
|
@@ -1397,10 +1412,10 @@ class PcacBarHorizontalChartComponent {
|
|
|
1397
1412
|
this.chartBuilder.buildChart(this.chartElm(), config);
|
|
1398
1413
|
}
|
|
1399
1414
|
}
|
|
1400
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
1401
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.
|
|
1415
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacBarHorizontalChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1416
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.7", 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], queries: [{ propertyName: "tooltipTemplate", first: true, predicate: PcacTooltipDirective, descendants: true, isSignal: true }], 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-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 });
|
|
1402
1417
|
}
|
|
1403
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
1418
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacBarHorizontalChartComponent, decorators: [{
|
|
1404
1419
|
type: Component,
|
|
1405
1420
|
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-bar-horizontal-chart.pcac-height-full{display:block;height:100%}pcac-bar-horizontal-chart.pcac-height-full .pcac-bar-horizontal-chart{height:100%}\n"] }]
|
|
1406
1421
|
}], 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"] }], tooltipTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PcacTooltipDirective), { isSignal: true }] }] } });
|
|
@@ -1668,10 +1683,10 @@ class BarVerticalChartBuilder extends PcacChart {
|
|
|
1668
1683
|
return '3px';
|
|
1669
1684
|
});
|
|
1670
1685
|
}
|
|
1671
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
1672
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.
|
|
1686
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: BarVerticalChartBuilder, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1687
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: BarVerticalChartBuilder });
|
|
1673
1688
|
}
|
|
1674
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
1689
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: BarVerticalChartBuilder, decorators: [{
|
|
1675
1690
|
type: Injectable
|
|
1676
1691
|
}] });
|
|
1677
1692
|
|
|
@@ -1711,10 +1726,10 @@ class PcacBarVerticalChartComponent {
|
|
|
1711
1726
|
this.chartBuilder.buildChart(this.chartElm(), config);
|
|
1712
1727
|
}
|
|
1713
1728
|
}
|
|
1714
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
1715
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.
|
|
1729
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacBarVerticalChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1730
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.7", 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], queries: [{ propertyName: "tooltipTemplate", first: true, predicate: PcacTooltipDirective, descendants: true, isSignal: true }], 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 });
|
|
1716
1731
|
}
|
|
1717
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
1732
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacBarVerticalChartComponent, decorators: [{
|
|
1718
1733
|
type: Component,
|
|
1719
1734
|
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"] }]
|
|
1720
1735
|
}], 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"] }], tooltipTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PcacTooltipDirective), { isSignal: true }] }] } });
|
|
@@ -1750,10 +1765,10 @@ class PcacLegend {
|
|
|
1750
1765
|
this.config.set({ ...this.config(), items });
|
|
1751
1766
|
this.itemClicked.emit(items);
|
|
1752
1767
|
}
|
|
1753
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
1754
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.
|
|
1768
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacLegend, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1769
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", 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 $index; let i = $index; 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"] });
|
|
1755
1770
|
}
|
|
1756
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
1771
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacLegend, decorators: [{
|
|
1757
1772
|
type: Component,
|
|
1758
1773
|
args: [{ selector: 'pcac-legend', template: "<div class=\"pcac-legend-label\"><small>{{config().heading}}</small></div>\n@for(item of config().items; track $index; let i = $index; 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"] }]
|
|
1759
1774
|
}], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }, { type: i0.Output, args: ["configChange"] }], itemClicked: [{ type: i0.Output, args: ["itemClicked"] }] } });
|
|
@@ -1784,7 +1799,13 @@ class PcacPointImageConfig {
|
|
|
1784
1799
|
*/
|
|
1785
1800
|
class PcacLineAreaChartConfig extends PcacAxisChartConfig {
|
|
1786
1801
|
enableEffects = true;
|
|
1787
|
-
|
|
1802
|
+
/**
|
|
1803
|
+
* Zoom and pan along the x / y axis (scroll / pinch to zoom 1x-10x, drag to pan, never leaving
|
|
1804
|
+
* the original domain). Either, or both, can be on. A gesture is always two-dimensional, so with
|
|
1805
|
+
* only one enabled the other axis simply stays put. Both off by default.
|
|
1806
|
+
*/
|
|
1807
|
+
enableZoomX = false;
|
|
1808
|
+
enableZoomY = false;
|
|
1788
1809
|
/**
|
|
1789
1810
|
* Hex color codes to override the default colors
|
|
1790
1811
|
*/
|
|
@@ -1827,6 +1848,16 @@ class PlaChartEffectsBuilder {
|
|
|
1827
1848
|
this.buildCollection();
|
|
1828
1849
|
this.buildCanvas();
|
|
1829
1850
|
}
|
|
1851
|
+
/**
|
|
1852
|
+
* Swaps in the scales a zoom has rescaled. The crosshair finds its point by walking the line
|
|
1853
|
+
* geometry, which the chart already redraws on zoom, but the value it labels comes from
|
|
1854
|
+
* inverting `y` - so a y-axis zoom has to hand the zoomed scale over here or the label reads
|
|
1855
|
+
* the pixel against the original domain.
|
|
1856
|
+
*/
|
|
1857
|
+
updateScales(x, y) {
|
|
1858
|
+
this.config.x = x;
|
|
1859
|
+
this.config.y = y;
|
|
1860
|
+
}
|
|
1830
1861
|
buildCollection() {
|
|
1831
1862
|
const collection = this.config.svg.append('g')
|
|
1832
1863
|
.attr('class', 'effects');
|
|
@@ -1934,10 +1965,10 @@ class PlaChartEffectsBuilder {
|
|
|
1934
1965
|
return 'translate(' + mousePos[0] + ',' + pos.y + ')';
|
|
1935
1966
|
});
|
|
1936
1967
|
}
|
|
1937
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
1938
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.
|
|
1968
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PlaChartEffectsBuilder, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1969
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PlaChartEffectsBuilder });
|
|
1939
1970
|
}
|
|
1940
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
1971
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PlaChartEffectsBuilder, decorators: [{
|
|
1941
1972
|
type: Injectable
|
|
1942
1973
|
}] });
|
|
1943
1974
|
|
|
@@ -1945,7 +1976,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImpor
|
|
|
1945
1976
|
* How the plot chart spreads out points that share a coordinate (see
|
|
1946
1977
|
* `PcacPlotChartConfig.pointFanOut`). Each group of coincident points is placed evenly around
|
|
1947
1978
|
* a ring centered on the shared coordinate, starting at 12 o'clock and going clockwise in data
|
|
1948
|
-
* order (series order, then point order), so every point stays visible and hoverable.
|
|
1979
|
+
* order (series order, then point order), so every point stays visible and hoverable. A ring at
|
|
1980
|
+
* the edge of the domain is moved back inside the plot area as one, so no member hangs over an
|
|
1981
|
+
* axis by more than half its mark - the same as a lone point there; the anchor stays put.
|
|
1949
1982
|
*/
|
|
1950
1983
|
class PcacPointFanOutConfig {
|
|
1951
1984
|
/**
|
|
@@ -2019,16 +2052,24 @@ class PlaChartScalesBuilder {
|
|
|
2019
2052
|
}
|
|
2020
2053
|
}
|
|
2021
2054
|
|
|
2055
|
+
/**
|
|
2056
|
+
* Whether a point has an x key to position by. An explicit emptiness check, not truthiness: a
|
|
2057
|
+
* Decimal key of `0` is a perfectly good coordinate (the left edge of a `domainMin: 0` axis) and
|
|
2058
|
+
* used to be read as "no key" - drawn at pixel 0 whatever the domain, and pinned there under zoom.
|
|
2059
|
+
*/
|
|
2060
|
+
function hasKey(data) {
|
|
2061
|
+
return data.key !== null && data.key !== undefined && data.key !== '';
|
|
2062
|
+
}
|
|
2022
2063
|
function getXFormat(type, data, index, xScale) {
|
|
2023
2064
|
switch (type) {
|
|
2024
2065
|
case PcacFormatEnum.DateTime:
|
|
2025
|
-
if (data
|
|
2066
|
+
if (hasKey(data)) {
|
|
2026
2067
|
return xScale(new Date(data.key));
|
|
2027
2068
|
}
|
|
2028
2069
|
return 0;
|
|
2029
2070
|
case PcacFormatEnum.Decimal:
|
|
2030
|
-
if (data
|
|
2031
|
-
return xScale(data.key);
|
|
2071
|
+
if (hasKey(data)) {
|
|
2072
|
+
return xScale(Number(data.key));
|
|
2032
2073
|
}
|
|
2033
2074
|
return 0;
|
|
2034
2075
|
default:
|
|
@@ -2109,9 +2150,9 @@ function findCoincidentGroups(series, xFormat) {
|
|
|
2109
2150
|
function xPositionKey(xFormat, data, index) {
|
|
2110
2151
|
switch (xFormat) {
|
|
2111
2152
|
case PcacFormatEnum.DateTime:
|
|
2112
|
-
return data
|
|
2153
|
+
return hasKey(data) ? new Date(data.key).getTime() : 'none';
|
|
2113
2154
|
case PcacFormatEnum.Decimal:
|
|
2114
|
-
return data
|
|
2155
|
+
return hasKey(data) ? Number(data.key) : 'none';
|
|
2115
2156
|
default:
|
|
2116
2157
|
return index;
|
|
2117
2158
|
}
|
|
@@ -2146,6 +2187,40 @@ function fanOutOffsets(groups, radius) {
|
|
|
2146
2187
|
function round(value) {
|
|
2147
2188
|
return Math.round(value * 100) / 100;
|
|
2148
2189
|
}
|
|
2190
|
+
/**
|
|
2191
|
+
* How far to move a whole fanned-out ring so that none of its members' centers leave the plot
|
|
2192
|
+
* area - so a member at the edge of the domain hangs over the axis by at most half its mark,
|
|
2193
|
+
* exactly as a lone point at that coordinate would, rather than by half its mark plus the ring's
|
|
2194
|
+
* radius. The ring moves as one (its members keep their spacing) and the anchor stays put, so the
|
|
2195
|
+
* spokes simply get longer on the side that was pushed back. Per axis: if the ring pokes out past
|
|
2196
|
+
* 0 it comes back by that much, else if it pokes out past the far edge it comes back by that; a
|
|
2197
|
+
* ring too big to fit is kept in at the axis end, where the origin is.
|
|
2198
|
+
*
|
|
2199
|
+
* `anchor` is clamped to the plot area first, so once zoom carries a group's coordinate out of the
|
|
2200
|
+
* domain its members follow it out at the same pace instead of staying pinned to the edge (or
|
|
2201
|
+
* snapping the ring's radius the moment the anchor crosses): at the edge the correction is exactly
|
|
2202
|
+
* the outermost member's offset, and stays so beyond it.
|
|
2203
|
+
*/
|
|
2204
|
+
function fanOutShift(anchor, offsets, plot) {
|
|
2205
|
+
const dxs = offsets.map((o) => o.dx);
|
|
2206
|
+
const dys = offsets.map((o) => o.dy);
|
|
2207
|
+
return {
|
|
2208
|
+
dx: axisShift(clamp(anchor.x, 0, plot.width), Math.min(...dxs), Math.max(...dxs), plot.width),
|
|
2209
|
+
dy: axisShift(clamp(anchor.y, 0, plot.height), Math.min(...dys), Math.max(...dys), plot.height),
|
|
2210
|
+
};
|
|
2211
|
+
}
|
|
2212
|
+
function axisShift(anchor, min, max, size) {
|
|
2213
|
+
if (anchor + min < 0) {
|
|
2214
|
+
return round(-(anchor + min));
|
|
2215
|
+
}
|
|
2216
|
+
if (anchor + max > size) {
|
|
2217
|
+
return round(size - (anchor + max));
|
|
2218
|
+
}
|
|
2219
|
+
return 0;
|
|
2220
|
+
}
|
|
2221
|
+
function clamp(value, min, max) {
|
|
2222
|
+
return Math.min(Math.max(value, min), max);
|
|
2223
|
+
}
|
|
2149
2224
|
|
|
2150
2225
|
/**
|
|
2151
2226
|
* Provided per-component (see PcacLineAreaChartComponent's `providers`), not root-scoped: this
|
|
@@ -2153,6 +2228,8 @@ function round(value) {
|
|
|
2153
2228
|
* height, colors, svg). A root singleton would be shared and clobbered by every
|
|
2154
2229
|
* <pcac-line-area-chart> rendered at once.
|
|
2155
2230
|
*/
|
|
2231
|
+
/** Half the theme's 2px line stroke: how far the lines/areas/fan-outs clip-path reaches past the plot. */
|
|
2232
|
+
const PLOT_CLIP_ALLOWANCE = 1;
|
|
2156
2233
|
class PlaChartBuilder extends PcacChart {
|
|
2157
2234
|
effectsBuilder = inject(PlaChartEffectsBuilder);
|
|
2158
2235
|
scales;
|
|
@@ -2163,26 +2240,34 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2163
2240
|
config;
|
|
2164
2241
|
clipPathId; // <-- added
|
|
2165
2242
|
/**
|
|
2166
|
-
*
|
|
2167
|
-
*
|
|
2168
|
-
*
|
|
2169
|
-
*
|
|
2170
|
-
|
|
2171
|
-
|
|
2243
|
+
* A second clip-path for everything that isn't a point - lines, areas, fan-out anchors and
|
|
2244
|
+
* spokes: the plot area plus `PLOT_CLIP_ALLOWANCE`. These have no business past the axes; the
|
|
2245
|
+
* points' buffer below used to apply to them too, so a line chart with big point images had
|
|
2246
|
+
* its lines run on half an image past the axes once zoomed.
|
|
2247
|
+
*/
|
|
2248
|
+
plotClipPathId;
|
|
2249
|
+
/**
|
|
2250
|
+
* How far the points' clip-path rect extends past the drawable [0, width] x [0, height] area on
|
|
2251
|
+
* every side, so a point sitting exactly on the domain's edge isn't cut in half. 10px
|
|
2252
|
+
* comfortably clears a dot (r = 4, or 6 on hover); a point image can be much bigger than that,
|
|
2253
|
+
* so buildChart() widens this to half the largest image dimension whenever any point has one
|
|
2254
|
+
* (and grows the margins to match - see `reservePointSpace()` - since the clip-path only
|
|
2255
|
+
* matters up to the edge of the SVG). The buffer is only there for points whose center is
|
|
2256
|
+
* inside the plot; one whose center zoom has carried past an edge is hidden outright (see
|
|
2257
|
+
* `pointVisible`), rather than left showing up to a whole half-mark beyond the axis.
|
|
2172
2258
|
*/
|
|
2173
2259
|
clipBuffer = 10;
|
|
2174
2260
|
pointImage;
|
|
2175
2261
|
/**
|
|
2176
2262
|
* Points that share a coordinate, found by `resolvePointLayout()`. `coincidentOf` looks a
|
|
2177
|
-
* point's group up for its tooltip
|
|
2178
|
-
*
|
|
2179
|
-
*
|
|
2263
|
+
* point's group up for its tooltip and for its ring's shift (see `fanOutShift`); `fanOutOffsets`
|
|
2264
|
+
* only matters when `fanOut` is on (plot chart with `pointFanOut`) and is where each member sits
|
|
2265
|
+
* on its ring relative to the shared coordinate, before that shift.
|
|
2180
2266
|
*/
|
|
2181
2267
|
coincidentGroups = [];
|
|
2182
2268
|
coincidentOf = new Map();
|
|
2183
2269
|
fanOut = null;
|
|
2184
2270
|
fanOutOffsets = new Map();
|
|
2185
|
-
fanOutReach = 0;
|
|
2186
2271
|
dotClicked$ = this.dotClickedSource.asObservable();
|
|
2187
2272
|
buildChart(chartElm, config, type) {
|
|
2188
2273
|
if (!config?.data?.length) {
|
|
@@ -2211,18 +2296,32 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2211
2296
|
this.scales = new PlaChartScalesBuilder().build(this.xAxis, this.yAxis, this.config.data, this.width, this.height);
|
|
2212
2297
|
this.lineGenerator = buildLineGenerator(this.xAxis.format, this.scales);
|
|
2213
2298
|
this.areaGenerator = buildAreaGenerator(this.xAxis.format, this.scales, this.height);
|
|
2214
|
-
if (this.
|
|
2299
|
+
if (this.zoomEnabled) {
|
|
2215
2300
|
this.zoomBehavior = buildZoomBehavior(this.width, this.height, (event) => {
|
|
2216
|
-
//
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
this.
|
|
2220
|
-
|
|
2221
|
-
//
|
|
2222
|
-
//
|
|
2223
|
-
//
|
|
2224
|
-
|
|
2225
|
-
|
|
2301
|
+
// A d3 zoom transform is always two-dimensional; only the enabled axes follow it and the
|
|
2302
|
+
// other keeps its original scale, so that component of the gesture is simply ignored.
|
|
2303
|
+
const newX = this.config.enableZoomX ? event.transform.rescaleX(this.scales.x) : this.scales.x;
|
|
2304
|
+
const newY = this.config.enableZoomY ? event.transform.rescaleY(this.scales.y) : this.scales.y;
|
|
2305
|
+
const zoomedScales = { x: newX, y: newY };
|
|
2306
|
+
// Update the zoomed axes, each with its grid: the grid hangs off the axis's ticks, so it
|
|
2307
|
+
// is redrawn against the rescaled scale and dropped back underneath everything (append
|
|
2308
|
+
// puts it on top).
|
|
2309
|
+
if (this.config.enableZoomX) {
|
|
2310
|
+
this.axisBuilder.drawXAxis(this.axisBuilderConfig(newX, newY));
|
|
2311
|
+
this.svg.selectAll('.pcac-grid-vertical').remove();
|
|
2312
|
+
this.drawGrids(newX, newY, 'x');
|
|
2313
|
+
}
|
|
2314
|
+
if (this.config.enableZoomY) {
|
|
2315
|
+
this.axisBuilder.drawYAxis(this.axisBuilderConfig(newX, newY));
|
|
2316
|
+
this.svg.selectAll('.pcac-grid-horizontal').remove();
|
|
2317
|
+
this.drawGrids(newX, newY, 'y');
|
|
2318
|
+
}
|
|
2319
|
+
this.svg.selectAll('.pcac-grid').lower();
|
|
2320
|
+
// Update lines/areas. Fresh generators against the rescaled scales, so they go through
|
|
2321
|
+
// the same getXFormat() as the dots below - positioning by bare index here (which this
|
|
2322
|
+
// used to do, and which also overwrote the original generators' x accessor for good) is
|
|
2323
|
+
// only right for the default DatasetLength format; a DateTime/Decimal chart's lines
|
|
2324
|
+
// drifted away from its dots as soon as it was zoomed.
|
|
2226
2325
|
const zoomedLine = buildLineGenerator(this.xAxis.format, zoomedScales);
|
|
2227
2326
|
const zoomedArea = buildAreaGenerator(this.xAxis.format, zoomedScales, this.height);
|
|
2228
2327
|
this.svg.selectAll('.line').attr('d', (d) => zoomedLine(d));
|
|
@@ -2232,16 +2331,22 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2232
2331
|
// (DatasetLength) positions by index, and a flat selection would number every series'
|
|
2233
2332
|
// points consecutively, shoving the second series' points off to the right on zoom.
|
|
2234
2333
|
this.svg.selectAll('.dots').selectAll('.point')
|
|
2235
|
-
.attr('transform', (d, i) => this.pointTransform(d, i,
|
|
2236
|
-
|
|
2334
|
+
.attr('transform', (d, i) => this.pointTransform(d, i, zoomedScales))
|
|
2335
|
+
.attr('display', (d, i) => this.pointDisplay(d, i, zoomedScales));
|
|
2336
|
+
// A fan-out's anchor is positioned like the points it belongs to, so it moves the same way;
|
|
2337
|
+
// its spokes are re-aimed because the ring's shift back into the plot (`fanOutShift`)
|
|
2338
|
+
// depends on where the anchor now is.
|
|
2237
2339
|
this.svg.selectAll('.fan-out')
|
|
2238
|
-
.attr('transform', (g) => this.fanOutTransform(g,
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2340
|
+
.attr('transform', (g) => this.fanOutTransform(g, zoomedScales))
|
|
2341
|
+
.selectAll('.fan-out-spoke')
|
|
2342
|
+
.attr('x2', (member) => this.spokeEnd(member, zoomedScales).dx)
|
|
2343
|
+
.attr('y2', (member) => this.spokeEnd(member, zoomedScales).dy);
|
|
2344
|
+
// The hover crosshair walks the (already updated) line geometry, but reads its value back
|
|
2345
|
+
// off the y scale - which must be the zoomed one or the label is wrong.
|
|
2346
|
+
if (this.config.enableEffects) {
|
|
2347
|
+
this.effectsBuilder.updateScales(newX, newY);
|
|
2348
|
+
}
|
|
2349
|
+
// Redrawing an axis appends it at the end of the group, above the dots; put them back
|
|
2245
2350
|
// on top so a point on the baseline isn't covered (see drawChart's draw order).
|
|
2246
2351
|
this.svg.selectAll('.fan-outs').raise();
|
|
2247
2352
|
this.svg.selectAll('.dots').raise();
|
|
@@ -2277,8 +2382,7 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2277
2382
|
/**
|
|
2278
2383
|
* Resolves `pointImage`, finds the points that share a coordinate and, on a plot chart with
|
|
2279
2384
|
* `pointFanOut`, works out where to draw each of them instead. Coincidence is found from the
|
|
2280
|
-
* data (see `findCoincidentGroups`) so this can run before the scales exist
|
|
2281
|
-
* `reservePointSpace()` needs the fan-out's reach before the plot area is sized. Line and area
|
|
2385
|
+
* data (see `findCoincidentGroups`) so this can run before the scales exist. Line and area
|
|
2282
2386
|
* charts still get the groups, for the tooltip's `coincident` list, but never an offset.
|
|
2283
2387
|
*/
|
|
2284
2388
|
resolvePointLayout(type) {
|
|
@@ -2291,7 +2395,6 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2291
2395
|
if (!fanOut) {
|
|
2292
2396
|
this.fanOut = null;
|
|
2293
2397
|
this.fanOutOffsets = new Map();
|
|
2294
|
-
this.fanOutReach = 0;
|
|
2295
2398
|
return;
|
|
2296
2399
|
}
|
|
2297
2400
|
this.fanOut = { ...new PcacPointFanOutConfig(), ...fanOut };
|
|
@@ -2301,34 +2404,35 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2301
2404
|
const markSize = (group) => group.members.some((member) => !!member.data.image) ? Math.max(maxWidth, maxHeight) : 12;
|
|
2302
2405
|
const radius = (group) => this.fanOut.radius ?? fanOutRadius(group.members.length, markSize(group), this.fanOut.gap);
|
|
2303
2406
|
this.fanOutOffsets = fanOutOffsets(this.coincidentGroups, radius);
|
|
2304
|
-
this.fanOutReach = Math.ceil(Math.max(0, ...this.coincidentGroups.map(radius)));
|
|
2305
2407
|
}
|
|
2306
2408
|
/**
|
|
2307
|
-
* When any point has an `image`,
|
|
2308
|
-
*
|
|
2309
|
-
*
|
|
2310
|
-
*
|
|
2311
|
-
*
|
|
2312
|
-
*
|
|
2313
|
-
*
|
|
2314
|
-
*
|
|
2409
|
+
* When any point has an `image`, makes room for it at the edge of the domain: the clip-path
|
|
2410
|
+
* buffer grows to half the box so the `.dots` group lets it through, and the margins grow to at
|
|
2411
|
+
* least that same amount so the `<svg>` doesn't cut off what the clip-path let through (an image
|
|
2412
|
+
* box is centered on its point, so at the top of the y domain half of it sits above the plot
|
|
2413
|
+
* area - in `margin.top`, which is only 8px by default). Half the box is all a fan-out needs
|
|
2414
|
+
* too: a fanned-out ring is shifted back inside the plot area (`fanOutShift`), so no member's
|
|
2415
|
+
* center ever sits past the edge either. Must run after `resolvePointLayout()` and between
|
|
2416
|
+
* `initializeAxisState()` and `initializeChartState()`, see `reserveEdgeSpace`.
|
|
2315
2417
|
*/
|
|
2316
2418
|
reservePointSpace() {
|
|
2317
2419
|
const hasImages = this.config.data.some((series) => series.data.some((point) => !!point.image));
|
|
2318
|
-
if (!hasImages
|
|
2420
|
+
if (!hasImages) {
|
|
2319
2421
|
this.clipBuffer = 10;
|
|
2320
2422
|
return;
|
|
2321
2423
|
}
|
|
2322
|
-
const halfWidth =
|
|
2323
|
-
const halfHeight =
|
|
2424
|
+
const halfWidth = Math.ceil(this.pointImage.maxWidth / 2);
|
|
2425
|
+
const halfHeight = Math.ceil(this.pointImage.maxHeight / 2);
|
|
2324
2426
|
this.clipBuffer = Math.max(10, halfWidth, halfHeight);
|
|
2325
2427
|
this.reserveEdgeSpace({ top: halfHeight, bottom: halfHeight, left: halfWidth, right: halfWidth });
|
|
2326
2428
|
}
|
|
2327
2429
|
createReusableClipPath() {
|
|
2328
|
-
|
|
2329
|
-
this.
|
|
2330
|
-
this.
|
|
2331
|
-
|
|
2430
|
+
const stamp = `${Date.now()}-${Math.floor(Math.random() * 10000)}`;
|
|
2431
|
+
this.clipPathId = `pcac-clip-${stamp}`;
|
|
2432
|
+
this.plotClipPathId = `pcac-clip-plot-${stamp}`;
|
|
2433
|
+
this.svg.selectAll(`defs #${this.clipPathId}, defs #${this.plotClipPathId}`).remove();
|
|
2434
|
+
const defs = this.svg.append('defs');
|
|
2435
|
+
defs.append('clipPath')
|
|
2332
2436
|
.attr('id', this.clipPathId)
|
|
2333
2437
|
.append('rect')
|
|
2334
2438
|
// Extend the clip-path past the drawable area on every side so a dot (or point image) at
|
|
@@ -2337,9 +2441,23 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2337
2441
|
.attr('y', -this.clipBuffer)
|
|
2338
2442
|
.attr('width', this.width + this.clipBuffer * 2)
|
|
2339
2443
|
.attr('height', this.height + this.clipBuffer * 2);
|
|
2444
|
+
// Lines, areas and the fan-out anchors and spokes get the plot area itself, give or take a
|
|
2445
|
+
// stroke: a line along the domain's max keeps its full width rather than being halved at
|
|
2446
|
+
// the edge, but nothing runs on into the points' buffer - a spoke to a member that zoom has
|
|
2447
|
+
// carried out of the plot (and hidden, see `pointVisible`) stops at the axis.
|
|
2448
|
+
defs.append('clipPath')
|
|
2449
|
+
.attr('id', this.plotClipPathId)
|
|
2450
|
+
.append('rect')
|
|
2451
|
+
.attr('x', -PLOT_CLIP_ALLOWANCE)
|
|
2452
|
+
.attr('y', -PLOT_CLIP_ALLOWANCE)
|
|
2453
|
+
.attr('width', this.width + PLOT_CLIP_ALLOWANCE * 2)
|
|
2454
|
+
.attr('height', this.height + PLOT_CLIP_ALLOWANCE * 2);
|
|
2455
|
+
}
|
|
2456
|
+
get zoomEnabled() {
|
|
2457
|
+
return !!(this.config.enableZoomX || this.config.enableZoomY);
|
|
2340
2458
|
}
|
|
2341
2459
|
attachZoomBehavior() {
|
|
2342
|
-
if (!this.
|
|
2460
|
+
if (!this.zoomEnabled)
|
|
2343
2461
|
return;
|
|
2344
2462
|
// Add a transparent rect to capture zoom events
|
|
2345
2463
|
//
|
|
@@ -2372,7 +2490,7 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2372
2490
|
drawLine(lineData, index, hide = false) {
|
|
2373
2491
|
this.svg.append('g')
|
|
2374
2492
|
.attr('class', 'lines')
|
|
2375
|
-
.attr('clip-path', `url(#${this.
|
|
2493
|
+
.attr('clip-path', `url(#${this.plotClipPathId})`)
|
|
2376
2494
|
.append('path')
|
|
2377
2495
|
.datum(lineData)
|
|
2378
2496
|
.attr('class', 'line')
|
|
@@ -2389,7 +2507,7 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2389
2507
|
drawArea(lineData, index, hide = false) {
|
|
2390
2508
|
this.svg.append('g')
|
|
2391
2509
|
.attr('class', 'areas')
|
|
2392
|
-
.attr('clip-path', `url(#${this.
|
|
2510
|
+
.attr('clip-path', `url(#${this.plotClipPathId})`)
|
|
2393
2511
|
.append('path')
|
|
2394
2512
|
.datum(lineData)
|
|
2395
2513
|
.attr('class', 'area')
|
|
@@ -2408,34 +2526,34 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2408
2526
|
/**
|
|
2409
2527
|
* Draws one `<g class="fan-outs">` holding a `<g class="fan-out">` per group of coincident
|
|
2410
2528
|
* points: a spoke from the shared coordinate to where each member is drawn, and an anchor dot
|
|
2411
|
-
* on the coordinate itself. Only when the fan-out is on and asks for anchors. The group
|
|
2412
|
-
*
|
|
2413
|
-
*
|
|
2529
|
+
* on the coordinate itself. Only when the fan-out is on and asks for anchors. The group sits on
|
|
2530
|
+
* the true coordinate (unlike a point group, which also carries its ring's shift - see
|
|
2531
|
+
* `pointTransform`), so zoom moves it the same way and everything inside is relative to the
|
|
2532
|
+
* coordinate; each spoke ends where its member is actually drawn, ring offset plus shift. It
|
|
2533
|
+
* fades in over the points' own entry transition.
|
|
2414
2534
|
*/
|
|
2415
2535
|
drawFanOuts() {
|
|
2416
2536
|
if (!this.fanOut?.showAnchor || this.coincidentGroups.length === 0) {
|
|
2417
2537
|
return;
|
|
2418
2538
|
}
|
|
2419
|
-
const y = (group) => this.scales.y(group.members[0].data.value);
|
|
2420
2539
|
const groups = this.svg.append('g')
|
|
2421
2540
|
.attr('class', 'fan-outs')
|
|
2422
|
-
.attr('clip-path', `url(#${this.
|
|
2541
|
+
.attr('clip-path', `url(#${this.plotClipPathId})`)
|
|
2423
2542
|
.selectAll('.fan-out')
|
|
2424
2543
|
.data(this.coincidentGroups)
|
|
2425
2544
|
.enter().append('g')
|
|
2426
2545
|
.attr('class', 'fan-out')
|
|
2427
|
-
.attr('transform', (group) => this.fanOutTransform(group, this.scales
|
|
2546
|
+
.attr('transform', (group) => this.fanOutTransform(group, this.scales));
|
|
2428
2547
|
groups.selectAll('.fan-out-spoke')
|
|
2429
|
-
.data((group) => group.members
|
|
2548
|
+
.data((group) => group.members)
|
|
2430
2549
|
.enter().append('line')
|
|
2431
2550
|
.attr('class', 'fan-out-spoke')
|
|
2432
2551
|
.attr('x1', 0)
|
|
2433
|
-
.attr('y1',
|
|
2434
|
-
.attr('x2', (
|
|
2435
|
-
.attr('y2', (
|
|
2552
|
+
.attr('y1', 0)
|
|
2553
|
+
.attr('x2', (member) => this.spokeEnd(member, this.scales).dx)
|
|
2554
|
+
.attr('y2', (member) => this.spokeEnd(member, this.scales).dy);
|
|
2436
2555
|
groups.append('circle')
|
|
2437
2556
|
.attr('class', 'fan-out-anchor')
|
|
2438
|
-
.attr('cy', y)
|
|
2439
2557
|
.attr('r', 3);
|
|
2440
2558
|
groups.attr('opacity', 0)
|
|
2441
2559
|
.transition()
|
|
@@ -2444,17 +2562,21 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2444
2562
|
}
|
|
2445
2563
|
/**
|
|
2446
2564
|
* Draws one `<g class="dots">` per series holding a `<g class="point">` per data point. The
|
|
2447
|
-
* point group carries the
|
|
2448
|
-
* attribute regardless of what's inside; the child is either the regular
|
|
2449
|
-
* or, when the point has a `PcacData.image`, an `<image class="dot-image">`
|
|
2450
|
-
*
|
|
2451
|
-
*
|
|
2452
|
-
*
|
|
2565
|
+
* point group carries the position (as a translate) so that zoom, on either axis, only has to
|
|
2566
|
+
* touch that one attribute regardless of what's inside; the child is either the regular
|
|
2567
|
+
* `<circle class="dot">` or, when the point has a `PcacData.image`, an `<image class="dot-image">`
|
|
2568
|
+
* in its place, and sits at the group's origin. Both animate in from the baseline the same way
|
|
2569
|
+
* - the start is the baseline expressed relative to the point, since the group is already on
|
|
2570
|
+
* the point - and the tooltip / click handlers sit on the group so they behave identically for
|
|
2571
|
+
* either. A fanned-out point's ring offset is applied to the child, inside the group, so it too
|
|
2572
|
+
* is untouched by zoom; only its ring's shift back into the plot area, which depends on where
|
|
2573
|
+
* the coordinate is, rides along in the group's translate (see `pointTransform`).
|
|
2453
2574
|
*/
|
|
2454
2575
|
drawDots(config) {
|
|
2455
2576
|
const self = this;
|
|
2456
2577
|
const duration = this.transitionService.getTransitionDuration();
|
|
2457
2578
|
const { maxWidth, maxHeight } = this.pointImage;
|
|
2579
|
+
const rise = (d) => this.scales.y(0) - this.scales.y(d.value);
|
|
2458
2580
|
for (let index = 0; index < config.data.length; index++) {
|
|
2459
2581
|
const series = config.data[index];
|
|
2460
2582
|
const points = this.svg.append('g')
|
|
@@ -2465,7 +2587,8 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2465
2587
|
.data(series.data)
|
|
2466
2588
|
.enter().append('g')
|
|
2467
2589
|
.attr('class', 'point')
|
|
2468
|
-
.attr('transform', (d, i) => this.pointTransform(d, i, this.scales
|
|
2590
|
+
.attr('transform', (d, i) => this.pointTransform(d, i, this.scales))
|
|
2591
|
+
.attr('display', (d, i) => this.pointDisplay(d, i, this.scales))
|
|
2469
2592
|
.on('mouseover', function (event, d) {
|
|
2470
2593
|
// `d` is the very element bound from `series.data` above, so identity lookup is exact.
|
|
2471
2594
|
self.showTooltip(event, d, {
|
|
@@ -2499,16 +2622,17 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2499
2622
|
.attr('class', 'dot')
|
|
2500
2623
|
.attr('stroke', this.colors[index])
|
|
2501
2624
|
.attr('cx', (d) => this.offsetOf(d).dx)
|
|
2502
|
-
.attr('cy',
|
|
2625
|
+
.attr('cy', rise)
|
|
2503
2626
|
.attr('fill', '#fff')
|
|
2504
2627
|
.transition()
|
|
2505
2628
|
.duration(duration)
|
|
2506
|
-
.attr('cy', (d) => this.
|
|
2629
|
+
.attr('cy', (d) => this.offsetOf(d).dy)
|
|
2507
2630
|
.attr('r', 4);
|
|
2508
2631
|
// `preserveAspectRatio="xMidYMid meet"` is what does the "resize to fit" - the image is
|
|
2509
2632
|
// scaled uniformly to fit inside the maxWidth x maxHeight box and centered within it, so
|
|
2510
2633
|
// a non-square image still lands centered on the point. x/y offset by half the box so the
|
|
2511
|
-
// box (not its top-left corner) is centered on the
|
|
2634
|
+
// box (not its top-left corner) is centered on the point group's origin, matching where a
|
|
2635
|
+
// dot sits.
|
|
2512
2636
|
points.filter((d) => !!d.image)
|
|
2513
2637
|
.append('image')
|
|
2514
2638
|
.attr('class', 'dot-image')
|
|
@@ -2517,23 +2641,82 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2517
2641
|
.attr('height', maxHeight)
|
|
2518
2642
|
.attr('preserveAspectRatio', 'xMidYMid meet')
|
|
2519
2643
|
.attr('x', (d) => -maxWidth / 2 + this.offsetOf(d).dx)
|
|
2520
|
-
.attr('y',
|
|
2644
|
+
.attr('y', (d) => rise(d) - maxHeight / 2)
|
|
2521
2645
|
.transition()
|
|
2522
2646
|
.duration(duration)
|
|
2523
|
-
.attr('y', (d) =>
|
|
2647
|
+
.attr('y', (d) => -maxHeight / 2 + this.offsetOf(d).dy);
|
|
2524
2648
|
}
|
|
2525
2649
|
}
|
|
2526
|
-
|
|
2527
|
-
|
|
2650
|
+
/**
|
|
2651
|
+
* Where a point's group goes: its true coordinate, plus - for a fanned-out point - however far
|
|
2652
|
+
* its ring had to be shifted to stay inside the plot area at these scales. The shift is on the
|
|
2653
|
+
* group rather than the child because it changes as zoom moves the coordinate (the ring offset,
|
|
2654
|
+
* on the child, doesn't), and this is the one attribute zoom already updates.
|
|
2655
|
+
*/
|
|
2656
|
+
pointTransform(d, i, scales) {
|
|
2657
|
+
const { x, y } = this.pointPlacement(d, i, scales);
|
|
2658
|
+
return `translate(${x}, ${y})`;
|
|
2528
2659
|
}
|
|
2529
|
-
/**
|
|
2530
|
-
|
|
2660
|
+
/**
|
|
2661
|
+
* The `display` of a point's group at these scales: shown while its center is inside the plot
|
|
2662
|
+
* area, `none` once zoom has carried it past an edge. Together with the clip-path's buffer this
|
|
2663
|
+
* is what bounds how far a mark may hang over an axis: a point on the edge is drawn whole, half
|
|
2664
|
+
* of it outside the plot, and that half is the most that ever shows - the alternative, letting
|
|
2665
|
+
* the clip-path's buffer do the work, showed a point up to a whole half-mark beyond the axis
|
|
2666
|
+
* with its center already outside. Also takes it out of hover's reach, as a hidden group
|
|
2667
|
+
* receives no pointer events.
|
|
2668
|
+
*/
|
|
2669
|
+
pointDisplay(d, i, scales) {
|
|
2670
|
+
return this.pointVisible(d, i, scales) ? null : 'none';
|
|
2671
|
+
}
|
|
2672
|
+
pointVisible(d, i, scales) {
|
|
2673
|
+
const { x, y } = this.markCenter(d, i, scales);
|
|
2674
|
+
// A hair of slack, so a point on the domain's edge isn't lost to a rescaled scale landing on
|
|
2675
|
+
// -0.0000001 instead of 0.
|
|
2676
|
+
const slack = 0.5;
|
|
2677
|
+
return x >= -slack && x <= this.width + slack && y >= -slack && y <= this.height + slack;
|
|
2678
|
+
}
|
|
2679
|
+
/** Where the point's group is drawn: its coordinate plus its ring's shift, if it's fanned out. */
|
|
2680
|
+
pointPlacement(d, i, scales) {
|
|
2681
|
+
const { x, y } = this.pointPosition(d, i, scales);
|
|
2682
|
+
const shift = this.shiftOf(d, scales);
|
|
2683
|
+
return { x: x + shift.dx, y: y + shift.dy };
|
|
2684
|
+
}
|
|
2685
|
+
/** Where the mark itself is centered: the group's placement plus the ring offset on the child. */
|
|
2686
|
+
markCenter(d, i, scales) {
|
|
2687
|
+
const { x, y } = this.pointPlacement(d, i, scales);
|
|
2688
|
+
const offset = this.offsetOf(d);
|
|
2689
|
+
return { x: x + offset.dx, y: y + offset.dy };
|
|
2690
|
+
}
|
|
2691
|
+
/** A fan-out sits on its members' true coordinate, unshifted; any member locates it. */
|
|
2692
|
+
fanOutTransform(group, scales) {
|
|
2531
2693
|
const { data, index } = group.members[0];
|
|
2532
|
-
|
|
2694
|
+
const { x, y } = this.pointPosition(data, index, scales);
|
|
2695
|
+
return `translate(${x}, ${y})`;
|
|
2533
2696
|
}
|
|
2697
|
+
pointPosition(d, i, scales) {
|
|
2698
|
+
return { x: getXFormat(this.xAxis.format, d, i, scales.x), y: scales.y(d.value) };
|
|
2699
|
+
}
|
|
2700
|
+
/** A member's ring offset from the shared coordinate, `0` for a point that isn't fanned out. */
|
|
2534
2701
|
offsetOf(d) {
|
|
2535
2702
|
return this.fanOutOffsets.get(d) ?? { dx: 0, dy: 0 };
|
|
2536
2703
|
}
|
|
2704
|
+
/** How far `d`'s ring is moved back into the plot area at these scales (see `fanOutShift`). */
|
|
2705
|
+
shiftOf(d, scales) {
|
|
2706
|
+
const group = this.coincidentOf.get(d);
|
|
2707
|
+
if (!group || !this.fanOutOffsets.has(d)) {
|
|
2708
|
+
return { dx: 0, dy: 0 };
|
|
2709
|
+
}
|
|
2710
|
+
const { data, index } = group.members[0];
|
|
2711
|
+
const offsets = group.members.map((member) => this.offsetOf(member.data));
|
|
2712
|
+
return fanOutShift(this.pointPosition(data, index, scales), offsets, { width: this.width, height: this.height });
|
|
2713
|
+
}
|
|
2714
|
+
/** Where a spoke ends, relative to its anchor: where the member is drawn, ring offset plus shift. */
|
|
2715
|
+
spokeEnd(member, scales) {
|
|
2716
|
+
const offset = this.offsetOf(member.data);
|
|
2717
|
+
const shift = this.shiftOf(member.data, scales);
|
|
2718
|
+
return { dx: offset.dx + shift.dx, dy: offset.dy + shift.dy };
|
|
2719
|
+
}
|
|
2537
2720
|
/** The other points at `d`'s coordinate, for the tooltip context (see `PcacTooltipContext.coincident`). */
|
|
2538
2721
|
coincidentWith(d) {
|
|
2539
2722
|
const group = this.coincidentOf.get(d);
|
|
@@ -2544,10 +2727,10 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2544
2727
|
.filter((member) => member.data !== d)
|
|
2545
2728
|
.map((member) => ({ data: member.data, parent: member.series, index: member.index, parentIndex: member.seriesIndex }));
|
|
2546
2729
|
}
|
|
2547
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
2548
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.
|
|
2730
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PlaChartBuilder, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
2731
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PlaChartBuilder });
|
|
2549
2732
|
}
|
|
2550
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
2733
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PlaChartBuilder, decorators: [{
|
|
2551
2734
|
type: Injectable
|
|
2552
2735
|
}] });
|
|
2553
2736
|
|
|
@@ -2595,10 +2778,10 @@ class PcacLineAreaChartComponent {
|
|
|
2595
2778
|
this.chartBuilder.buildChart(this.chartElm(), config, this.type());
|
|
2596
2779
|
}
|
|
2597
2780
|
}
|
|
2598
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
2599
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.
|
|
2781
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacLineAreaChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2782
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.7", 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 }, tooltipTemplate: { classPropertyName: "tooltipTemplate", publicName: "tooltipTemplate", isSignal: true, isRequired: false, 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 .fan-out-spoke{stroke:#ced4da;stroke-width:1px}.pcac-line-area-chart .fan-out-anchor{fill:#6c757d}.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-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 });
|
|
2600
2783
|
}
|
|
2601
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
2784
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacLineAreaChartComponent, decorators: [{
|
|
2602
2785
|
type: Component,
|
|
2603
2786
|
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 .fan-out-spoke{stroke:#ced4da;stroke-width:1px}.pcac-line-area-chart .fan-out-anchor{fill:#6c757d}.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-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"] }]
|
|
2604
2787
|
}], 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"] }], tooltipTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipTemplate", required: false }] }] } });
|
|
@@ -2614,10 +2797,10 @@ class PcacPlotChart {
|
|
|
2614
2797
|
*/
|
|
2615
2798
|
tooltipTemplate = contentChild(PcacTooltipDirective, /* @ts-ignore */
|
|
2616
2799
|
...(ngDevMode ? [{ debugName: "tooltipTemplate" }] : /* istanbul ignore next */ []));
|
|
2617
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
2618
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.
|
|
2800
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacPlotChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2801
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.7", 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" } }, queries: [{ propertyName: "tooltipTemplate", first: true, predicate: PcacTooltipDirective, descendants: true, isSignal: true }], ngImport: i0, template: "<pcac-line-area-chart [config]=\"config()\" [tooltipTemplate]=\"tooltipTemplate()?.templateRef\" [type]=\"types.Plot\" (dotClicked)=\"dotClicked.emit($event)\"/>", dependencies: [{ kind: "component", type: PcacLineAreaChartComponent, selector: "pcac-line-area-chart", inputs: ["config", "type", "tooltipTemplate"], outputs: ["dotClicked"] }] });
|
|
2619
2802
|
}
|
|
2620
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
2803
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacPlotChart, decorators: [{
|
|
2621
2804
|
type: Component,
|
|
2622
2805
|
args: [{ selector: 'pcac-plot-chart', host: { '[class.pcac-height-full]': 'config().heightFull' }, imports: [PcacLineAreaChartComponent], template: "<pcac-line-area-chart [config]=\"config()\" [tooltipTemplate]=\"tooltipTemplate()?.templateRef\" [type]=\"types.Plot\" (dotClicked)=\"dotClicked.emit($event)\"/>" }]
|
|
2623
2806
|
}], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], dotClicked: [{ type: i0.Output, args: ["dotClicked"] }], tooltipTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PcacTooltipDirective), { isSignal: true }] }] } });
|
|
@@ -2633,10 +2816,10 @@ class PcacLineChart {
|
|
|
2633
2816
|
*/
|
|
2634
2817
|
tooltipTemplate = contentChild(PcacTooltipDirective, /* @ts-ignore */
|
|
2635
2818
|
...(ngDevMode ? [{ debugName: "tooltipTemplate" }] : /* istanbul ignore next */ []));
|
|
2636
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
2637
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.
|
|
2819
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacLineChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2820
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.7", 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" } }, queries: [{ propertyName: "tooltipTemplate", first: true, predicate: PcacTooltipDirective, descendants: true, isSignal: true }], ngImport: i0, template: "<pcac-line-area-chart [config]=\"config()\" [tooltipTemplate]=\"tooltipTemplate()?.templateRef\" [type]=\"types.Line\" (dotClicked)=\"dotClicked.emit($event)\" />", dependencies: [{ kind: "component", type: PcacLineAreaChartComponent, selector: "pcac-line-area-chart", inputs: ["config", "type", "tooltipTemplate"], outputs: ["dotClicked"] }] });
|
|
2638
2821
|
}
|
|
2639
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
2822
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacLineChart, decorators: [{
|
|
2640
2823
|
type: Component,
|
|
2641
2824
|
args: [{ selector: 'pcac-line-chart', host: { '[class.pcac-height-full]': 'config().heightFull' }, imports: [PcacLineAreaChartComponent], template: "<pcac-line-area-chart [config]=\"config()\" [tooltipTemplate]=\"tooltipTemplate()?.templateRef\" [type]=\"types.Line\" (dotClicked)=\"dotClicked.emit($event)\" />" }]
|
|
2642
2825
|
}], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], dotClicked: [{ type: i0.Output, args: ["dotClicked"] }], tooltipTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PcacTooltipDirective), { isSignal: true }] }] } });
|
|
@@ -2655,10 +2838,10 @@ class PcacAreaChart {
|
|
|
2655
2838
|
*/
|
|
2656
2839
|
tooltipTemplate = contentChild(PcacTooltipDirective, /* @ts-ignore */
|
|
2657
2840
|
...(ngDevMode ? [{ debugName: "tooltipTemplate" }] : /* istanbul ignore next */ []));
|
|
2658
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
2659
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.
|
|
2841
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacAreaChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2842
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.7", 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" } }, queries: [{ propertyName: "tooltipTemplate", first: true, predicate: PcacTooltipDirective, descendants: true, isSignal: true }], ngImport: i0, template: "<pcac-line-area-chart [config]=\"config()\" [tooltipTemplate]=\"tooltipTemplate()?.templateRef\" [type]=\"types.Area\" (dotClicked)=\"dotClicked.emit($event)\" />", dependencies: [{ kind: "component", type: PcacLineAreaChartComponent, selector: "pcac-line-area-chart", inputs: ["config", "type", "tooltipTemplate"], outputs: ["dotClicked"] }] });
|
|
2660
2843
|
}
|
|
2661
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
2844
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacAreaChart, decorators: [{
|
|
2662
2845
|
type: Component,
|
|
2663
2846
|
args: [{ selector: 'pcac-area-chart', host: { '[class.pcac-height-full]': 'config().heightFull' }, imports: [PcacLineAreaChartComponent], template: "<pcac-line-area-chart [config]=\"config()\" [tooltipTemplate]=\"tooltipTemplate()?.templateRef\" [type]=\"types.Area\" (dotClicked)=\"dotClicked.emit($event)\" />" }]
|
|
2664
2847
|
}], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], dotClicked: [{ type: i0.Output, args: ["dotClicked"] }], tooltipTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PcacTooltipDirective), { isSignal: true }] }] } });
|
|
@@ -2760,10 +2943,10 @@ class PieChartBuilder extends PcacChart {
|
|
|
2760
2943
|
const i = interpolate({ startAngle: 0, endAngle: 0 }, b);
|
|
2761
2944
|
return (t) => this.arcShape(i(t)) ?? '';
|
|
2762
2945
|
}
|
|
2763
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
2764
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.
|
|
2946
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PieChartBuilder, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
2947
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PieChartBuilder });
|
|
2765
2948
|
}
|
|
2766
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
2949
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PieChartBuilder, decorators: [{
|
|
2767
2950
|
type: Injectable
|
|
2768
2951
|
}] });
|
|
2769
2952
|
|
|
@@ -2803,10 +2986,10 @@ class PcacPieChartComponent {
|
|
|
2803
2986
|
this.chartBuilder.buildChart(this.chartElm(), config);
|
|
2804
2987
|
}
|
|
2805
2988
|
}
|
|
2806
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
2807
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.
|
|
2989
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacPieChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2990
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.7", 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], queries: [{ propertyName: "tooltipTemplate", first: true, predicate: PcacTooltipDirective, descendants: true, isSignal: true }], 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 });
|
|
2808
2991
|
}
|
|
2809
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
2992
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacPieChartComponent, decorators: [{
|
|
2810
2993
|
type: Component,
|
|
2811
2994
|
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"] }]
|
|
2812
2995
|
}], 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"] }], tooltipTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PcacTooltipDirective), { isSignal: true }] }] } });
|