@pioneer-code/pioneer-charts 22.2.15 → 22.2.17
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/README.md +2 -2
- package/fesm2022/pioneer-code-pioneer-charts.mjs +668 -205
- package/fesm2022/pioneer-code-pioneer-charts.mjs.map +1 -1
- package/package.json +10 -2
- package/scss/legend/legend.component.scss +7 -5
- package/scss/{pie-chart/pie-chart.component.scss → pie-donut-chart/pie-donut-chart.component.scss} +1 -1
- package/scss/pioneer-charts.scss +27 -6
- package/themes/pioneer-charts.css +19 -4
- package/themes/pioneer-charts.min.css +1 -1
- package/types/pioneer-code-pioneer-charts.d.ts +69 -46
package/package.json
CHANGED
|
@@ -16,13 +16,21 @@
|
|
|
16
16
|
"data visualization",
|
|
17
17
|
"charts",
|
|
18
18
|
"d3",
|
|
19
|
-
"angular"
|
|
19
|
+
"angular",
|
|
20
|
+
"angular charts",
|
|
21
|
+
"bar chart",
|
|
22
|
+
"line chart",
|
|
23
|
+
"area chart",
|
|
24
|
+
"scatter plot",
|
|
25
|
+
"pie chart",
|
|
26
|
+
"donut chart",
|
|
27
|
+
"legend"
|
|
20
28
|
],
|
|
21
29
|
"repository": {
|
|
22
30
|
"type": "git",
|
|
23
31
|
"url": "git+https://github.com/PioneerCode/pioneer-charts.git"
|
|
24
32
|
},
|
|
25
|
-
"version": "22.2.
|
|
33
|
+
"version": "22.2.17",
|
|
26
34
|
"license": "MIT",
|
|
27
35
|
"peerDependencies": {
|
|
28
36
|
"@angular/common": "^22.1.0",
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
:host {
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
|
+
// Items wrap onto another line when the legend is narrower than them - on a phone, say - rather
|
|
5
|
+
// than running off its side (which also widened the page they were on).
|
|
6
|
+
flex-wrap: wrap;
|
|
7
|
+
column-gap: 8px;
|
|
4
8
|
}
|
|
5
9
|
|
|
6
10
|
.pcac-legend-label {
|
|
7
|
-
margin-right: 8px;
|
|
8
11
|
margin-bottom: 2.5px;
|
|
9
12
|
}
|
|
10
13
|
|
|
@@ -12,7 +15,9 @@
|
|
|
12
15
|
cursor: pointer;
|
|
13
16
|
display: flex;
|
|
14
17
|
align-items: center;
|
|
15
|
-
|
|
18
|
+
// At least 24px tall, the minimum size for something to tap (WCAG 2.5.8): the text line alone
|
|
19
|
+
// was about 19px.
|
|
20
|
+
min-height: 24px;
|
|
16
21
|
|
|
17
22
|
&:hover {
|
|
18
23
|
.pcac-legend-circle {
|
|
@@ -35,9 +40,6 @@
|
|
|
35
40
|
opacity: 0.5;
|
|
36
41
|
}
|
|
37
42
|
|
|
38
|
-
.pcac-legend-item-last {
|
|
39
|
-
margin-right: 0;
|
|
40
|
-
}
|
|
41
43
|
// Legend items are keyboard-operable (role="switch" + tabindex), so they need a visible focus
|
|
42
44
|
// ring - the default outline is drawn against the host app's background, not ours, so it's left
|
|
43
45
|
// as the browser's own rather than themed.
|
package/scss/pioneer-charts.scss
CHANGED
|
@@ -25,23 +25,44 @@
|
|
|
25
25
|
border-radius: 2px;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
// A bar, slice or point with keyboard focus (see core/marks.ts). Focus already does what hover does -
|
|
29
|
+
// highlights the mark and shows its tooltip - and the ring marks which one has it on top of that,
|
|
30
|
+
// so it can't be mistaken for a mark the pointer happens to be over. Only for focus from the
|
|
31
|
+
// keyboard: pressing the pointer on a mark doesn't focus it.
|
|
32
|
+
[data-pcac-mark]:focus {
|
|
33
|
+
outline: none;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
[data-pcac-mark]:focus-visible {
|
|
37
|
+
outline: 2px solid imports.$gray-800;
|
|
38
|
+
outline-offset: 2px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// A slice is traced along its own edge instead: an outline is always a rectangle - the slice's
|
|
42
|
+
// bounding box - which, around a wedge, frames half its neighbors too.
|
|
43
|
+
.pcac-arc path[data-pcac-mark]:focus-visible {
|
|
44
|
+
outline: none;
|
|
45
|
+
stroke: imports.$gray-800;
|
|
46
|
+
stroke-width: 2px;
|
|
47
|
+
}
|
|
48
|
+
|
|
28
49
|
// Each color below is `var(--pcac-*-color, <theme color>)`. A builder sets the property on a
|
|
29
50
|
// part's group only when the chart's config gives that color (`PcacAxisConfig`'s `*Color` fields,
|
|
30
|
-
// `PcacPointFanOutConfig.spokeColor` / `anchorColor`, `
|
|
51
|
+
// `PcacPointFanOutConfig.spokeColor` / `anchorColor`, `PcacDonutChartConfig.labelColor` /
|
|
31
52
|
// `subLabelColor`), so a chart without one looks as before. A
|
|
32
53
|
// stylesheet can set the same property on any ancestor; a config value, on the group itself, wins.
|
|
33
54
|
.pcac-grid-rule line {
|
|
34
55
|
stroke: var(--pcac-grid-color, #{imports.$gray-200});
|
|
35
56
|
}
|
|
36
57
|
|
|
37
|
-
// The donut's center text (`
|
|
38
|
-
.pcac-
|
|
39
|
-
fill: var(--pcac-
|
|
58
|
+
// The donut's center text (`PcacDonutChartConfig.labelColor` / `subLabelColor`).
|
|
59
|
+
.pcac-donut-center-label {
|
|
60
|
+
fill: var(--pcac-donut-center-label-color, #{imports.$gray-800});
|
|
40
61
|
font-weight: 500;
|
|
41
62
|
}
|
|
42
63
|
|
|
43
|
-
.pcac-
|
|
44
|
-
fill: var(--pcac-
|
|
64
|
+
.pcac-donut-center-sub-label {
|
|
65
|
+
fill: var(--pcac-donut-center-sub-label-color, #{imports.$gray-600});
|
|
45
66
|
}
|
|
46
67
|
|
|
47
68
|
.pcac-x-axis,
|
|
@@ -14,17 +14,32 @@
|
|
|
14
14
|
border-radius: 2px;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
[data-pcac-mark]:focus {
|
|
18
|
+
outline: none;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
[data-pcac-mark]:focus-visible {
|
|
22
|
+
outline: 2px solid #343a40;
|
|
23
|
+
outline-offset: 2px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.pcac-arc path[data-pcac-mark]:focus-visible {
|
|
27
|
+
outline: none;
|
|
28
|
+
stroke: #343a40;
|
|
29
|
+
stroke-width: 2px;
|
|
30
|
+
}
|
|
31
|
+
|
|
17
32
|
.pcac-grid-rule line {
|
|
18
33
|
stroke: var(--pcac-grid-color, #e9ecef);
|
|
19
34
|
}
|
|
20
35
|
|
|
21
|
-
.pcac-
|
|
22
|
-
fill: var(--pcac-
|
|
36
|
+
.pcac-donut-center-label {
|
|
37
|
+
fill: var(--pcac-donut-center-label-color, #343a40);
|
|
23
38
|
font-weight: 500;
|
|
24
39
|
}
|
|
25
40
|
|
|
26
|
-
.pcac-
|
|
27
|
-
fill: var(--pcac-
|
|
41
|
+
.pcac-donut-center-sub-label {
|
|
42
|
+
fill: var(--pcac-donut-center-sub-label-color, #6c757d);
|
|
28
43
|
}
|
|
29
44
|
|
|
30
45
|
.pcac-x-axis path,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.pcac-d3-tooltip{position:absolute;pointer-events:none;display:none;z-index:1000}.pcac-d3-tooltip-default{text-align:center;font-size:14px;padding:.5rem;background-color:rgba(52,58,64,.85);color:#fff;border-radius:2px}.pcac-grid-rule line{stroke:var(--pcac-grid-color, #e9ecef)}.pcac-
|
|
1
|
+
.pcac-d3-tooltip{position:absolute;pointer-events:none;display:none;z-index:1000}.pcac-d3-tooltip-default{text-align:center;font-size:14px;padding:.5rem;background-color:rgba(52,58,64,.85);color:#fff;border-radius:2px}[data-pcac-mark]:focus{outline:none}[data-pcac-mark]:focus-visible{outline:2px solid #343a40;outline-offset:2px}.pcac-arc path[data-pcac-mark]:focus-visible{outline:none;stroke:#343a40;stroke-width:2px}.pcac-grid-rule line{stroke:var(--pcac-grid-color, #e9ecef)}.pcac-donut-center-label{fill:var(--pcac-donut-center-label-color, #343a40);font-weight:500}.pcac-donut-center-sub-label{fill:var(--pcac-donut-center-sub-label-color, #6c757d)}.pcac-x-axis path,.pcac-x-axis line,.pcac-y-axis path,.pcac-y-axis line{stroke:none}.pcac-x-axis.pcac-axis-tick-marks .tick line,.pcac-y-axis.pcac-axis-tick-marks .tick line{stroke:var(--pcac-axis-tick-color, #212529)}.pcac-x-axis.pcac-axis-line .domain,.pcac-y-axis.pcac-axis-line .domain{stroke:var(--pcac-axis-line-color, #212529)}.pcac-x-axis .pcac-axis-label,.pcac-y-axis .pcac-axis-label{font-size:12px;font-weight:600;fill:var(--pcac-axis-label-color, #495057)}.pcac-x-axis .pcac-axis-sub-label,.pcac-y-axis .pcac-axis-sub-label{font-size:11px;fill:var(--pcac-axis-sub-label-color, #6c757d)}:where(.pcac-x-axis,.pcac-y-axis) :where(.tick) text{fill:var(--pcac-axis-tick-label-color, currentColor)}
|
|
@@ -231,10 +231,12 @@ declare class PcacBarHorizontalChartConfig extends PcacAxisChartConfig {
|
|
|
231
231
|
isStacked: boolean;
|
|
232
232
|
thresholds: PcacData[];
|
|
233
233
|
spreadColorsPerGroup: boolean;
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
234
|
+
/**
|
|
235
|
+
* Bar colors, any CSS color, in place of the theme palette - by series, or by group with
|
|
236
|
+
* `spreadColorsPerGroup`. Repeated when there are more series (or groups) than colors. Empty,
|
|
237
|
+
* the theme palette is used.
|
|
238
|
+
*/
|
|
239
|
+
colorOverride: string[];
|
|
238
240
|
}
|
|
239
241
|
|
|
240
242
|
/**
|
|
@@ -361,10 +363,12 @@ declare class PcacBarVerticalChartConfig extends PcacAxisChartConfig {
|
|
|
361
363
|
isStacked: boolean;
|
|
362
364
|
thresholds: PcacData[];
|
|
363
365
|
spreadColorsPerGroup: boolean;
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
366
|
+
/**
|
|
367
|
+
* Bar colors, any CSS color, in place of the theme palette - by series, or by group with
|
|
368
|
+
* `spreadColorsPerGroup`. Repeated when there are more series (or groups) than colors. Empty,
|
|
369
|
+
* the theme palette is used.
|
|
370
|
+
*/
|
|
371
|
+
colorOverride: string[];
|
|
368
372
|
}
|
|
369
373
|
|
|
370
374
|
declare class PcacBarVerticalChartComponent {
|
|
@@ -384,7 +388,6 @@ declare class PcacBarVerticalChartComponent {
|
|
|
384
388
|
}
|
|
385
389
|
|
|
386
390
|
declare class PcacColorService {
|
|
387
|
-
private primary;
|
|
388
391
|
private primaryLight;
|
|
389
392
|
private success;
|
|
390
393
|
private danger;
|
|
@@ -426,8 +429,6 @@ declare class PcacColorService {
|
|
|
426
429
|
* @param colors A collection of hex values
|
|
427
430
|
*/
|
|
428
431
|
setScale(colors: string[]): void;
|
|
429
|
-
/** @deprecated No chart reads the primary color; it isn't part of the palette. */
|
|
430
|
-
setPrimary(color: string): void;
|
|
431
432
|
setPrimaryLight(color: string): void;
|
|
432
433
|
setSuccess(color: string): void;
|
|
433
434
|
setDanger(color: string): void;
|
|
@@ -449,6 +450,7 @@ declare class PcacLegendConfig {
|
|
|
449
450
|
items: PcacLegendConfigItem[];
|
|
450
451
|
}
|
|
451
452
|
declare class PcacLegend {
|
|
453
|
+
readonly headingId: string;
|
|
452
454
|
readonly colorService: PcacColorService;
|
|
453
455
|
config: _angular_core.ModelSignal<PcacLegendConfig>;
|
|
454
456
|
itemClicked: _angular_core.OutputEmitterRef<PcacLegendConfigItem[]>;
|
|
@@ -525,7 +527,9 @@ declare class PcacLineAreaChartConfig extends PcacAxisChartConfig {
|
|
|
525
527
|
/**
|
|
526
528
|
* Zoom and pan along the x / y axis (scroll / pinch to zoom 1x-10x, drag to pan, never leaving
|
|
527
529
|
* the original domain). Either, or both, can be on. A gesture is always two-dimensional, so with
|
|
528
|
-
* only one enabled the other axis simply stays put. Both off by default.
|
|
530
|
+
* only one enabled the other axis simply stays put. Both off by default. The zoom is kept when
|
|
531
|
+
* the chart redraws - a new config, a series toggled in a legend, a resize (which keeps the same
|
|
532
|
+
* part of the domain in view) - and dropped when zoom is turned off or the zoomable axes change.
|
|
529
533
|
*/
|
|
530
534
|
enableZoomX: boolean;
|
|
531
535
|
enableZoomY: boolean;
|
|
@@ -641,16 +645,51 @@ declare class PcacAreaChart {
|
|
|
641
645
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<PcacAreaChart, "pcac-area-chart", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, { "dotClicked": "dotClicked"; }, ["tooltipTemplate"], never, true, never>;
|
|
642
646
|
}
|
|
643
647
|
|
|
648
|
+
/** Which chart the shared `<pcac-pie-donut-chart>` draws; each wrapper binds its own. */
|
|
649
|
+
declare enum PcacPieDonutChartType {
|
|
650
|
+
Pie = "pie",
|
|
651
|
+
Donut = "donut"
|
|
652
|
+
}
|
|
644
653
|
/**
|
|
645
|
-
*
|
|
646
|
-
*
|
|
654
|
+
* What the pie and donut charts share. Internal: consumers configure `PcacPieChartConfig` or
|
|
655
|
+
* `PcacDonutChartConfig`, the same way the line, area and plot charts share
|
|
656
|
+
* `PcacLineAreaChartConfig`.
|
|
647
657
|
*/
|
|
648
|
-
declare class
|
|
658
|
+
declare class PcacPieDonutChartConfig extends PcacChartConfig {
|
|
649
659
|
/**
|
|
650
|
-
*
|
|
651
|
-
*
|
|
660
|
+
* Slice colors, any CSS color, in data order - the first slice takes the first color - in place
|
|
661
|
+
* of the theme palette. Repeated when there are more slices than colors. Omitted or empty, the
|
|
662
|
+
* theme palette is used. Match a `<pcac-legend>` to it with each item's `colorOverride`.
|
|
652
663
|
*/
|
|
653
|
-
|
|
664
|
+
colorOverride?: string[];
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
declare class PcacPieChartConfig extends PcacPieDonutChartConfig {
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
declare class PcacPieChart {
|
|
671
|
+
readonly config: _angular_core.InputSignal<PcacPieChartConfig>;
|
|
672
|
+
readonly types: typeof PcacPieDonutChartType;
|
|
673
|
+
readonly sliceClicked: _angular_core.OutputEmitterRef<PcacData>;
|
|
674
|
+
/**
|
|
675
|
+
* Optional consumer `<ng-template pcacTooltip>` projected into this element, forwarded to the
|
|
676
|
+
* inner chart (see PcacPieDonutChartComponent.tooltipTemplate).
|
|
677
|
+
*/
|
|
678
|
+
readonly tooltipTemplate: _angular_core.Signal<PcacTooltipDirective | undefined>;
|
|
679
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<PcacPieChart, never>;
|
|
680
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<PcacPieChart, "pcac-pie-chart", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, { "sliceClicked": "sliceClicked"; }, ["tooltipTemplate"], never, true, never>;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* A pie with its slices drawn as a ring around an empty center, which can hold a short label -
|
|
685
|
+
* typically the total the slices add up to.
|
|
686
|
+
*/
|
|
687
|
+
declare class PcacDonutChartConfig extends PcacPieDonutChartConfig {
|
|
688
|
+
/**
|
|
689
|
+
* Radius of the hole as a fraction of the chart's radius, from 0 (no hole - a pie) to 0.9.
|
|
690
|
+
* Values outside that range are clamped.
|
|
691
|
+
*/
|
|
692
|
+
innerRadius?: number;
|
|
654
693
|
/**
|
|
655
694
|
* Large text centered in the hole, e.g. `'67'`. Sized to the hole and shrunk to fit across it;
|
|
656
695
|
* left out if it would have to go below 8px. Not drawn when not set.
|
|
@@ -660,42 +699,26 @@ declare class PcacPieDonutConfig {
|
|
|
660
699
|
subLabel?: string;
|
|
661
700
|
/**
|
|
662
701
|
* `label` color, any CSS color; theme default `$gray-800`. Applied as
|
|
663
|
-
* `--pcac-
|
|
664
|
-
* set it on an ancestor instead (a config value wins).
|
|
702
|
+
* `--pcac-donut-center-label-color` on the chart's `.pcac-donut-center` group, so a stylesheet
|
|
703
|
+
* can set it on an ancestor instead (a config value wins).
|
|
665
704
|
*/
|
|
666
705
|
labelColor?: string;
|
|
667
|
-
/** `subLabel` color, likewise (`--pcac-
|
|
706
|
+
/** `subLabel` color, likewise (`--pcac-donut-center-sub-label-color`); theme default `$gray-600`. */
|
|
668
707
|
subLabelColor?: string;
|
|
669
708
|
}
|
|
670
|
-
declare class PcacPieChartConfig extends PcacChartConfig {
|
|
671
|
-
/**
|
|
672
|
-
* Draw the pie as a donut. Off when not set; `{}` turns it on with every `PcacPieDonutConfig`
|
|
673
|
-
* default. Slices, hover and `sliceClicked` behave the same either way.
|
|
674
|
-
*/
|
|
675
|
-
donut?: Partial<PcacPieDonutConfig>;
|
|
676
|
-
/**
|
|
677
|
-
* Slice colors, any CSS color, in data order - the first slice takes the first color - in place
|
|
678
|
-
* of the theme palette. Repeated when there are more slices than colors. Omitted or empty, the
|
|
679
|
-
* theme palette is used. Match a `<pcac-legend>` to it with each item's `colorOverride`.
|
|
680
|
-
*/
|
|
681
|
-
colorOverride?: string[];
|
|
682
|
-
}
|
|
683
709
|
|
|
684
|
-
declare class
|
|
685
|
-
|
|
686
|
-
readonly
|
|
687
|
-
readonly
|
|
688
|
-
readonly sliceClicked: _angular_core.OutputRef<_pioneer_code_pioneer_charts.PcacData>;
|
|
710
|
+
declare class PcacDonutChart {
|
|
711
|
+
readonly config: _angular_core.InputSignal<PcacDonutChartConfig>;
|
|
712
|
+
readonly types: typeof PcacPieDonutChartType;
|
|
713
|
+
readonly sliceClicked: _angular_core.OutputEmitterRef<PcacData>;
|
|
689
714
|
/**
|
|
690
|
-
* Optional consumer `<ng-template pcacTooltip>` projected into this element
|
|
691
|
-
*
|
|
715
|
+
* Optional consumer `<ng-template pcacTooltip>` projected into this element, forwarded to the
|
|
716
|
+
* inner chart (see PcacPieDonutChartComponent.tooltipTemplate).
|
|
692
717
|
*/
|
|
693
718
|
readonly tooltipTemplate: _angular_core.Signal<PcacTooltipDirective | undefined>;
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<PcacPieChartComponent, never>;
|
|
697
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<PcacPieChartComponent, "pcac-pie-chart", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, { "sliceClicked": "sliceClicked"; }, ["tooltipTemplate"], never, true, never>;
|
|
719
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<PcacDonutChart, never>;
|
|
720
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<PcacDonutChart, "pcac-donut-chart", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, { "sliceClicked": "sliceClicked"; }, ["tooltipTemplate"], never, true, never>;
|
|
698
721
|
}
|
|
699
722
|
|
|
700
|
-
export { PcacAreaChart, PcacAreaChartConfig, PcacAxisChartConfig, PcacAxisConfig, PcacAxisSubLabels,
|
|
723
|
+
export { PcacAreaChart, PcacAreaChartConfig, PcacAxisChartConfig, PcacAxisConfig, PcacAxisSubLabels, PcacBarHorizontalChartComponent, PcacBarHorizontalChartConfig, PcacBarVerticalChartComponent, PcacBarVerticalChartConfig, PcacChartConfig, PcacColorService, PcacData, PcacDataRange, PcacDonutChart, PcacDonutChartConfig, PcacFormatEnum, PcacLegend, PcacLegendConfig, PcacLegendConfigItem, PcacLineChart, PcacLineChartConfig, PcacPieChart, PcacPieChartConfig, PcacPlotChart, PcacPlotChartConfig, PcacPointFanOutConfig, PcacPointImageConfig, PcacPointRangeConfig, PcacPointRangeShow, PcacPointRangeStyle, PcacRangeBounds, PcacTooltipDirective };
|
|
701
724
|
export type { PcacTooltipCoincident, PcacTooltipContext };
|