@pioneer-code/pioneer-charts 22.2.14 → 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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pioneer-code/pioneer-charts",
3
3
  "description": "Pioneer Charts, a library of data visualization charts built on top of Angular and D3.",
4
- "homepage": "https://charts.pioneercode.com",
4
+ "homepage": "https://pioneercharts.com",
5
5
  "bugs": {
6
6
  "url": "https://github.com/PioneerCode/pioneer-charts/issues"
7
7
  },
@@ -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.14",
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.
@@ -0,0 +1,6 @@
1
+ .pcac-pie-donut-chart {
2
+ svg {
3
+ width: 100%;
4
+ display: block;
5
+ }
6
+ }
@@ -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)}
@@ -7,10 +7,10 @@ import { TemplateRef, ElementRef } from '@angular/core';
7
7
  * INewChart extends IChart
8
8
  */
9
9
  declare class PcacChartConfig {
10
+ data: PcacData[];
10
11
  /**
11
12
  * Height in pixels
12
13
  */
13
- data: PcacData[];
14
14
  height: number;
15
15
  /**
16
16
  * When true, `height` becomes a *minimum* height: if the container the chart is placed in is
@@ -392,6 +392,19 @@ declare class PcacColorService {
392
392
  private orange;
393
393
  private blue;
394
394
  private alert;
395
+ /**
396
+ * Bumped by every setter, and read by the getters, so anything reading colors inside a reactive
397
+ * context tracks palette changes: the legend's `colorScale` computed recomputes, and every chart
398
+ * (whose build runs in an `effect`) redraws - together, rather than the legend keeping the old
399
+ * swatches while newly built charts took the new palette.
400
+ */
401
+ private readonly version;
402
+ /**
403
+ * Bumps `version` from a setter. `untracked`, because Angular forbids writing a signal inside a
404
+ * `computed` - and a consumer deriving its theme reactively (`computed(() => { setScale(...);
405
+ * ... })`) called these setters there without error before they were reactive.
406
+ */
407
+ private changed;
395
408
  /** A consumer's own scale from `setScale()`; replaces the default palette while set. */
396
409
  private customScale;
397
410
  /**
@@ -628,16 +641,51 @@ declare class PcacAreaChart {
628
641
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<PcacAreaChart, "pcac-area-chart", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, { "dotClicked": "dotClicked"; }, ["tooltipTemplate"], never, true, never>;
629
642
  }
630
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
+ }
631
649
  /**
632
- * Turns the pie into a donut: slices drawn as a ring around an empty center, which can hold a
633
- * 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`.
634
653
  */
635
- declare class PcacPieDonutConfig {
654
+ declare class PcacPieDonutChartConfig extends PcacChartConfig {
636
655
  /**
637
- * Radius of the hole as a fraction of the pie's radius, from 0 (a plain pie) to 0.9. Values
638
- * 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`.
639
659
  */
640
- 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;
641
689
  /**
642
690
  * Large text centered in the hole, e.g. `'67'`. Sized to the hole and shrunk to fit across it;
643
691
  * left out if it would have to go below 8px. Not drawn when not set.
@@ -647,42 +695,26 @@ declare class PcacPieDonutConfig {
647
695
  subLabel?: string;
648
696
  /**
649
697
  * `label` color, any CSS color; theme default `$gray-800`. Applied as
650
- * `--pcac-pie-center-label-color` on the chart's `.pcac-pie-center` group, so a stylesheet can
651
- * 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).
652
700
  */
653
701
  labelColor?: string;
654
- /** `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`. */
655
703
  subLabelColor?: string;
656
704
  }
657
- declare class PcacPieChartConfig extends PcacChartConfig {
658
- /**
659
- * Draw the pie as a donut. Off when not set; `{}` turns it on with every `PcacPieDonutConfig`
660
- * default. Slices, hover and `sliceClicked` behave the same either way.
661
- */
662
- donut?: Partial<PcacPieDonutConfig>;
663
- /**
664
- * Slice colors, any CSS color, in data order - the first slice takes the first color - in place
665
- * of the theme palette. Repeated when there are more slices than colors. Omitted or empty, the
666
- * theme palette is used. Match a `<pcac-legend>` to it with each item's `colorOverride`.
667
- */
668
- colorOverride?: string[];
669
- }
670
705
 
671
- declare class PcacPieChartComponent {
672
- private chartBuilder;
673
- readonly config: _angular_core.InputSignal<PcacPieChartConfig>;
674
- readonly chartElm: _angular_core.Signal<ElementRef<any>>;
675
- 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>;
676
710
  /**
677
- * Optional consumer `<ng-template pcacTooltip>` projected into this element; replaces the
678
- * 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).
679
713
  */
680
714
  readonly tooltipTemplate: _angular_core.Signal<PcacTooltipDirective | undefined>;
681
- constructor();
682
- buildChart(): void;
683
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<PcacPieChartComponent, never>;
684
- 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>;
685
717
  }
686
718
 
687
- 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 };
688
720
  export type { PcacTooltipCoincident, PcacTooltipContext };
@@ -1,10 +0,0 @@
1
- .pcac-pie-chart {
2
- svg {
3
- width: 100%;
4
- display: block;
5
- }
6
- .dot {
7
- fill: none;
8
- stroke-width: 1px;
9
- }
10
- }