@acorex/charts 20.6.30 → 20.6.32

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.
@@ -9,6 +9,7 @@ interface AXFunnelData {
9
9
  id?: string | number;
10
10
  name: string;
11
11
  value: number;
12
+ /** Any CSS `<color>` resolvable in the chart container, e.g. `rgb(var(--ax-sys-color-primary-950))`. */
12
13
  color?: string;
13
14
  }
14
15
  interface AXFunnelChartMessages {
@@ -27,12 +28,29 @@ interface AXFunnelChartOption {
27
28
  /** The ratio of the bottom width compared to the top width for the last segment (0 to 1). Default: 0.3 */
28
29
  neckWidth?: number;
29
30
  colors?: string[];
30
- /** Color used for the minimum value when `colors` is not provided. */
31
- startColor?: string;
32
- /** Color used for the maximum value when `colors` is not provided. */
33
- endColor?: string;
31
+ /**
32
+ * Base color when `colors` is not provided: any CSS `<color>` (hex, `rgb()`, `hsl()`,
33
+ * `rgb(var(--token))`, `color-mix()`, …) resolved against the chart container’s cascade.
34
+ * Intensity follows the value position in `valueRange` (or data min–max if `valueRange` is omitted).
35
+ */
36
+ color?: string;
37
+ /**
38
+ * Inclusive numeric range used to map values to color intensity (0–100% of the base color).
39
+ * If `valueRange` is omitted, or a bound is missing, that bound uses the dataset’s min or max
40
+ * value (after sorting: largest slice → max, smallest → min).
41
+ */
42
+ valueRange?: {
43
+ min: number;
44
+ max: number;
45
+ };
34
46
  showLabels?: boolean;
35
- /** Label offset from the slice edge (px). */
47
+ /**
48
+ * When `showLabels` is true, also render the numeric value on each segment.
49
+ * Values still appear in the tooltip when `showTooltip` is enabled.
50
+ * @default true
51
+ */
52
+ showSegmentValues?: boolean;
53
+ /** @deprecated Labels render inside segments; offset is unused. */
36
54
  labelOffset?: number;
37
55
  showTooltip?: boolean;
38
56
  animationDuration?: number;
@@ -50,9 +68,8 @@ declare class AXFunnelChartComponent extends AXChartComponent implements OnDestr
50
68
  protected d3: typeof d3;
51
69
  private _initialized;
52
70
  private _rendered;
53
- private platformService;
54
- protected isRtl: _angular_core.WritableSignal<boolean>;
55
- private directionSub?;
71
+ private resizeObserver;
72
+ private resizeDebounceId;
56
73
  private _tooltipVisible;
57
74
  private _tooltipPosition;
58
75
  private _tooltipData;
@@ -75,9 +92,13 @@ declare class AXFunnelChartComponent extends AXChartComponent implements OnDestr
75
92
  height?: number;
76
93
  neckWidth?: number;
77
94
  colors?: string[];
78
- startColor?: string;
79
- endColor?: string;
95
+ color?: string;
96
+ valueRange?: {
97
+ min: number;
98
+ max: number;
99
+ };
80
100
  showLabels?: boolean;
101
+ showSegmentValues?: boolean;
81
102
  labelOffset?: number;
82
103
  showTooltip?: boolean;
83
104
  animationDuration?: number;
@@ -86,9 +107,17 @@ declare class AXFunnelChartComponent extends AXChartComponent implements OnDestr
86
107
  }>;
87
108
  constructor();
88
109
  ngOnDestroy(): void;
110
+ private attachResizeObserver;
111
+ private detachResizeObserver;
89
112
  protected loadD3(): Promise<void>;
90
113
  createChart(): void;
114
+ private trapezoidInteriorMetrics;
115
+ private computeSegmentLabelTypography;
116
+ private truncateLabel;
117
+ private pickOnSliceTextColors;
91
118
  private resolveSliceColor;
119
+ /** `resolvedRgb` must be a computed `rgb()` / `rgba()` string (e.g. from {@link resolveCssColor}). */
120
+ private applyIntensityToResolvedRgb;
92
121
  private hashStringToUint32;
93
122
  private resolveCssColor;
94
123
  updateChart(): void;
@@ -26,13 +26,25 @@ interface AXHeatmapChartOption {
26
26
  };
27
27
  /**
28
28
  * Discrete palette. If provided (non-empty), a (stable) random color is chosen per cell.
29
- * If omitted/empty, colors are computed from `startColor` `endColor` based on the cell value.
29
+ * Entries may use any CSS `<color>` (including `rgb(var(--token))`) resolved against the chart container.
30
+ * If omitted/empty, the base `color` is shown with intensity from the cell value vs `valueRange`
31
+ * (or data min–max if `valueRange` is omitted).
30
32
  */
31
33
  colors?: string[];
32
- /** Color used for the minimum value when `colors` is not provided. */
33
- startColor?: string;
34
- /** Color used for the maximum value when `colors` is not provided. */
35
- endColor?: string;
34
+ /**
35
+ * Base color when `colors` is not provided: any CSS `<color>` resolved against the chart container
36
+ * (hex, `rgb()`, `rgb(var(--token))`, `color-mix()`, …).
37
+ */
38
+ color?: string;
39
+ /**
40
+ * Inclusive numeric range for mapping cell values to color intensity.
41
+ * If `valueRange` is omitted, or a bound is missing, that bound uses the min or max value
42
+ * among all cells in the current dataset.
43
+ */
44
+ valueRange?: {
45
+ min: number;
46
+ max: number;
47
+ };
36
48
  cellPadding?: number;
37
49
  borderRadius?: number;
38
50
  showXAxis?: boolean;
@@ -75,8 +87,11 @@ declare class AXHeatmapChartComponent extends AXChartComponent implements OnDest
75
87
  left: number;
76
88
  };
77
89
  colors?: string[];
78
- startColor?: string;
79
- endColor?: string;
90
+ color?: string;
91
+ valueRange?: {
92
+ min: number;
93
+ max: number;
94
+ };
80
95
  cellPadding?: number;
81
96
  borderRadius?: number;
82
97
  showXAxis?: boolean;
@@ -92,7 +107,8 @@ declare class AXHeatmapChartComponent extends AXChartComponent implements OnDest
92
107
  private init;
93
108
  private renderChart;
94
109
  private hashStringToUint32;
95
- private resolveCssColor;
110
+ /** `resolvedRgb` must be a computed `rgb()` / `rgba()` string (e.g. from {@link resolveCssColorInContext}). */
111
+ private applyIntensityToResolvedRgb;
96
112
  private drawAxis;
97
113
  private showTooltip;
98
114
  private updateTooltipPos;
package/index.d.ts CHANGED
@@ -55,6 +55,13 @@ type TooltipPosition = {
55
55
  x: number;
56
56
  y: number;
57
57
  };
58
+ /**
59
+ * Resolves any CSS `<color>` the browser understands — including
60
+ * `rgb(var(--token))`, `hsl(var(--token))`, `color-mix()`, etc. — to a computed
61
+ * `rgb()` / `rgba()` string, using the cascade from `scopeElement` (e.g. the chart
62
+ * container) so design tokens on ancestors apply.
63
+ */
64
+ declare function resolveCssColorInContext(scopeElement: HTMLElement, cssColor: string): string;
58
65
  /**
59
66
  * Compute edge-aware tooltip position with intelligent placement,
60
67
  * considering available space in all directions and preventing overflow.
@@ -77,5 +84,5 @@ declare function getEasingFunction(d3: typeof d3, option?: string): (t: number)
77
84
 
78
85
  declare const AX_CHARTS = "ACOREX_CHARTS";
79
86
 
80
- export { AXChartComponent, AX_CHARTS, AX_CHART_COLOR_PALETTE, computeTooltipPosition, formatLargeNumber, getChartColor, getEasingFunction, mapEasingName };
87
+ export { AXChartComponent, AX_CHARTS, AX_CHART_COLOR_PALETTE, computeTooltipPosition, formatLargeNumber, getChartColor, getEasingFunction, mapEasingName, resolveCssColorInContext };
81
88
  export type { AXAnimationEasing, AXChartComponentBase, D3EasingName, NXNativeEvent, TooltipPosition };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acorex/charts",
3
- "version": "20.6.30",
3
+ "version": "20.6.32",
4
4
  "peerDependencies": {
5
5
  "d3": ">=7.9.0"
6
6
  },
@@ -15,6 +15,10 @@
15
15
  "types": "./index.d.ts",
16
16
  "default": "./fesm2022/acorex-charts.mjs"
17
17
  },
18
+ "./bar-chart": {
19
+ "types": "./bar-chart/index.d.ts",
20
+ "default": "./fesm2022/acorex-charts-bar-chart.mjs"
21
+ },
18
22
  "./chart-legend": {
19
23
  "types": "./chart-legend/index.d.ts",
20
24
  "default": "./fesm2022/acorex-charts-chart-legend.mjs"
@@ -23,18 +27,14 @@
23
27
  "types": "./chart-tooltip/index.d.ts",
24
28
  "default": "./fesm2022/acorex-charts-chart-tooltip.mjs"
25
29
  },
26
- "./bar-chart": {
27
- "types": "./bar-chart/index.d.ts",
28
- "default": "./fesm2022/acorex-charts-bar-chart.mjs"
30
+ "./donut-chart": {
31
+ "types": "./donut-chart/index.d.ts",
32
+ "default": "./fesm2022/acorex-charts-donut-chart.mjs"
29
33
  },
30
34
  "./funnel-chart": {
31
35
  "types": "./funnel-chart/index.d.ts",
32
36
  "default": "./fesm2022/acorex-charts-funnel-chart.mjs"
33
37
  },
34
- "./donut-chart": {
35
- "types": "./donut-chart/index.d.ts",
36
- "default": "./fesm2022/acorex-charts-donut-chart.mjs"
37
- },
38
38
  "./gauge-chart": {
39
39
  "types": "./gauge-chart/index.d.ts",
40
40
  "default": "./fesm2022/acorex-charts-gauge-chart.mjs"