@pioneer-code/pioneer-charts 22.2.15 → 22.2.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -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.15",
33
+ "version": "22.2.16",
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
- margin-right: 8px;
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.
@@ -1,4 +1,4 @@
1
- .pcac-pie-chart {
1
+ .pcac-pie-donut-chart {
2
2
  svg {
3
3
  width: 100%;
4
4
  display: block;
@@ -27,21 +27,21 @@
27
27
 
28
28
  // Each color below is `var(--pcac-*-color, <theme color>)`. A builder sets the property on a
29
29
  // part's group only when the chart's config gives that color (`PcacAxisConfig`'s `*Color` fields,
30
- // `PcacPointFanOutConfig.spokeColor` / `anchorColor`, `PcacPieDonutConfig.labelColor` /
30
+ // `PcacPointFanOutConfig.spokeColor` / `anchorColor`, `PcacDonutChartConfig.labelColor` /
31
31
  // `subLabelColor`), so a chart without one looks as before. A
32
32
  // stylesheet can set the same property on any ancestor; a config value, on the group itself, wins.
33
33
  .pcac-grid-rule line {
34
34
  stroke: var(--pcac-grid-color, #{imports.$gray-200});
35
35
  }
36
36
 
37
- // The donut's center text (`PcacPieDonutConfig.labelColor` / `subLabelColor`).
38
- .pcac-pie-center-label {
39
- fill: var(--pcac-pie-center-label-color, #{imports.$gray-800});
37
+ // The donut's center text (`PcacDonutChartConfig.labelColor` / `subLabelColor`).
38
+ .pcac-donut-center-label {
39
+ fill: var(--pcac-donut-center-label-color, #{imports.$gray-800});
40
40
  font-weight: 500;
41
41
  }
42
42
 
43
- .pcac-pie-center-sub-label {
44
- fill: var(--pcac-pie-center-sub-label-color, #{imports.$gray-600});
43
+ .pcac-donut-center-sub-label {
44
+ fill: var(--pcac-donut-center-sub-label-color, #{imports.$gray-600});
45
45
  }
46
46
 
47
47
  .pcac-x-axis,
@@ -18,13 +18,13 @@
18
18
  stroke: var(--pcac-grid-color, #e9ecef);
19
19
  }
20
20
 
21
- .pcac-pie-center-label {
22
- fill: var(--pcac-pie-center-label-color, #343a40);
21
+ .pcac-donut-center-label {
22
+ fill: var(--pcac-donut-center-label-color, #343a40);
23
23
  font-weight: 500;
24
24
  }
25
25
 
26
- .pcac-pie-center-sub-label {
27
- fill: var(--pcac-pie-center-sub-label-color, #6c757d);
26
+ .pcac-donut-center-sub-label {
27
+ fill: var(--pcac-donut-center-sub-label-color, #6c757d);
28
28
  }
29
29
 
30
30
  .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-pie-center-label{fill:var(--pcac-pie-center-label-color, #343a40);font-weight:500}.pcac-pie-center-sub-label{fill:var(--pcac-pie-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)}
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-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)}
@@ -641,16 +641,51 @@ declare class PcacAreaChart {
641
641
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<PcacAreaChart, "pcac-area-chart", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, { "dotClicked": "dotClicked"; }, ["tooltipTemplate"], never, true, never>;
642
642
  }
643
643
 
644
+ /** Which chart the shared `<pcac-pie-donut-chart>` draws; each wrapper binds its own. */
645
+ declare enum PcacPieDonutChartType {
646
+ Pie = "pie",
647
+ Donut = "donut"
648
+ }
644
649
  /**
645
- * Turns the pie into a donut: slices drawn as a ring around an empty center, which can hold a
646
- * short label - typically the total the slices add up to.
650
+ * What the pie and donut charts share. Internal: consumers configure `PcacPieChartConfig` or
651
+ * `PcacDonutChartConfig`, the same way the line, area and plot charts share
652
+ * `PcacLineAreaChartConfig`.
647
653
  */
648
- declare class PcacPieDonutConfig {
654
+ declare class PcacPieDonutChartConfig extends PcacChartConfig {
649
655
  /**
650
- * Radius of the hole as a fraction of the pie's radius, from 0 (a plain pie) to 0.9. Values
651
- * outside that range are clamped.
656
+ * Slice colors, any CSS color, in data order - the first slice takes the first color - in place
657
+ * of the theme palette. Repeated when there are more slices than colors. Omitted or empty, the
658
+ * theme palette is used. Match a `<pcac-legend>` to it with each item's `colorOverride`.
652
659
  */
653
- innerRadius: number;
660
+ colorOverride?: string[];
661
+ }
662
+
663
+ declare class PcacPieChartConfig extends PcacPieDonutChartConfig {
664
+ }
665
+
666
+ declare class PcacPieChart {
667
+ readonly config: _angular_core.InputSignal<PcacPieChartConfig>;
668
+ readonly types: typeof PcacPieDonutChartType;
669
+ readonly sliceClicked: _angular_core.OutputEmitterRef<PcacData>;
670
+ /**
671
+ * Optional consumer `<ng-template pcacTooltip>` projected into this element, forwarded to the
672
+ * inner chart (see PcacPieDonutChartComponent.tooltipTemplate).
673
+ */
674
+ readonly tooltipTemplate: _angular_core.Signal<PcacTooltipDirective | undefined>;
675
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<PcacPieChart, never>;
676
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<PcacPieChart, "pcac-pie-chart", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, { "sliceClicked": "sliceClicked"; }, ["tooltipTemplate"], never, true, never>;
677
+ }
678
+
679
+ /**
680
+ * A pie with its slices drawn as a ring around an empty center, which can hold a short label -
681
+ * typically the total the slices add up to.
682
+ */
683
+ declare class PcacDonutChartConfig extends PcacPieDonutChartConfig {
684
+ /**
685
+ * Radius of the hole as a fraction of the chart's radius, from 0 (no hole - a pie) to 0.9.
686
+ * Values outside that range are clamped.
687
+ */
688
+ innerRadius?: number;
654
689
  /**
655
690
  * Large text centered in the hole, e.g. `'67'`. Sized to the hole and shrunk to fit across it;
656
691
  * left out if it would have to go below 8px. Not drawn when not set.
@@ -660,42 +695,26 @@ declare class PcacPieDonutConfig {
660
695
  subLabel?: string;
661
696
  /**
662
697
  * `label` color, any CSS color; theme default `$gray-800`. Applied as
663
- * `--pcac-pie-center-label-color` on the chart's `.pcac-pie-center` group, so a stylesheet can
664
- * set it on an ancestor instead (a config value wins).
698
+ * `--pcac-donut-center-label-color` on the chart's `.pcac-donut-center` group, so a stylesheet
699
+ * can set it on an ancestor instead (a config value wins).
665
700
  */
666
701
  labelColor?: string;
667
- /** `subLabel` color, likewise (`--pcac-pie-center-sub-label-color`); theme default `$gray-600`. */
702
+ /** `subLabel` color, likewise (`--pcac-donut-center-sub-label-color`); theme default `$gray-600`. */
668
703
  subLabelColor?: string;
669
704
  }
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
705
 
684
- declare class PcacPieChartComponent {
685
- private chartBuilder;
686
- readonly config: _angular_core.InputSignal<PcacPieChartConfig>;
687
- readonly chartElm: _angular_core.Signal<ElementRef<any>>;
688
- readonly sliceClicked: _angular_core.OutputRef<_pioneer_code_pioneer_charts.PcacData>;
706
+ declare class PcacDonutChart {
707
+ readonly config: _angular_core.InputSignal<PcacDonutChartConfig>;
708
+ readonly types: typeof PcacPieDonutChartType;
709
+ readonly sliceClicked: _angular_core.OutputEmitterRef<PcacData>;
689
710
  /**
690
- * Optional consumer `<ng-template pcacTooltip>` projected into this element; replaces the
691
- * default tooltip when present (see PcacTooltipDirective).
711
+ * Optional consumer `<ng-template pcacTooltip>` projected into this element, forwarded to the
712
+ * inner chart (see PcacPieDonutChartComponent.tooltipTemplate).
692
713
  */
693
714
  readonly tooltipTemplate: _angular_core.Signal<PcacTooltipDirective | undefined>;
694
- constructor();
695
- buildChart(): void;
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>;
715
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<PcacDonutChart, never>;
716
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<PcacDonutChart, "pcac-donut-chart", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, { "sliceClicked": "sliceClicked"; }, ["tooltipTemplate"], never, true, never>;
698
717
  }
699
718
 
700
- export { PcacAreaChart, PcacAreaChartConfig, PcacAxisChartConfig, PcacAxisConfig, PcacAxisSubLabels, PcacBarHorizontalChartColorOverrideConfig, PcacBarHorizontalChartComponent, PcacBarHorizontalChartConfig, PcacBarVerticalChartColorOverrideConfig, PcacBarVerticalChartComponent, PcacBarVerticalChartConfig, PcacChartConfig, PcacColorService, PcacData, PcacDataRange, PcacFormatEnum, PcacLegend, PcacLegendConfig, PcacLegendConfigItem, PcacLineChart, PcacLineChartConfig, PcacPieChartComponent, PcacPieChartConfig, PcacPieDonutConfig, PcacPlotChart, PcacPlotChartConfig, PcacPointFanOutConfig, PcacPointImageConfig, PcacPointRangeConfig, PcacPointRangeShow, PcacPointRangeStyle, PcacRangeBounds, PcacTooltipDirective };
719
+ export { PcacAreaChart, PcacAreaChartConfig, PcacAxisChartConfig, PcacAxisConfig, PcacAxisSubLabels, PcacBarHorizontalChartColorOverrideConfig, PcacBarHorizontalChartComponent, PcacBarHorizontalChartConfig, PcacBarVerticalChartColorOverrideConfig, 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
720
  export type { PcacTooltipCoincident, PcacTooltipContext };