@acorex/charts 21.0.1-next.82 → 21.0.1-next.83

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.
@@ -10,6 +10,7 @@ interface AXFunnelData {
10
10
  id?: string | number;
11
11
  name: string;
12
12
  value: number;
13
+ /** Any CSS `<color>` resolvable in the chart container, e.g. `rgb(var(--ax-sys-color-primary-950))`. */
13
14
  color?: string;
14
15
  }
15
16
  interface AXFunnelChartMessages {
@@ -28,10 +29,21 @@ interface AXFunnelChartOption {
28
29
  /** The ratio of the bottom width compared to the top width for the last segment (0 to 1). Default: 0.3 */
29
30
  neckWidth?: number;
30
31
  colors?: string[];
31
- /** Color used for the minimum value when `colors` is not provided. */
32
- startColor?: string;
33
- /** Color used for the maximum value when `colors` is not provided. */
34
- endColor?: string;
32
+ /**
33
+ * Base color when `colors` is not provided: any CSS `<color>` (hex, `rgb()`, `hsl()`,
34
+ * `rgb(var(--token))`, `color-mix()`, …) resolved against the chart container’s cascade.
35
+ * Intensity follows the value position in `valueRange` (or data min–max if `valueRange` is omitted).
36
+ */
37
+ color?: string;
38
+ /**
39
+ * Inclusive numeric range used to map values to color intensity (0–100% of the base color).
40
+ * If `valueRange` is omitted, or a bound is missing, that bound uses the dataset’s min or max
41
+ * value (after sorting: largest slice → max, smallest → min).
42
+ */
43
+ valueRange?: {
44
+ min: number;
45
+ max: number;
46
+ };
35
47
  showLabels?: boolean;
36
48
  /** Label offset from the slice edge (px). */
37
49
  labelOffset?: number;
@@ -76,8 +88,11 @@ declare class AXFunnelChartComponent extends AXChartComponent implements OnDestr
76
88
  height?: number;
77
89
  neckWidth?: number;
78
90
  colors?: string[];
79
- startColor?: string;
80
- endColor?: string;
91
+ color?: string;
92
+ valueRange?: {
93
+ min: number;
94
+ max: number;
95
+ };
81
96
  showLabels?: boolean;
82
97
  labelOffset?: number;
83
98
  showTooltip?: boolean;
@@ -90,6 +105,8 @@ declare class AXFunnelChartComponent extends AXChartComponent implements OnDestr
90
105
  protected loadD3(): Promise<void>;
91
106
  createChart(): void;
92
107
  private resolveSliceColor;
108
+ /** `resolvedRgb` must be a computed `rgb()` / `rgba()` string (e.g. from {@link resolveCssColor}). */
109
+ private applyIntensityToResolvedRgb;
93
110
  private hashStringToUint32;
94
111
  private resolveCssColor;
95
112
  updateChart(): void;
@@ -27,13 +27,25 @@ interface AXHeatmapChartOption {
27
27
  };
28
28
  /**
29
29
  * Discrete palette. If provided (non-empty), a (stable) random color is chosen per cell.
30
- * If omitted/empty, colors are computed from `startColor` `endColor` based on the cell value.
30
+ * Entries may use any CSS `<color>` (including `rgb(var(--token))`) resolved against the chart container.
31
+ * If omitted/empty, the base `color` is shown with intensity from the cell value vs `valueRange`
32
+ * (or data min–max if `valueRange` is omitted).
31
33
  */
32
34
  colors?: string[];
33
- /** Color used for the minimum value when `colors` is not provided. */
34
- startColor?: string;
35
- /** Color used for the maximum value when `colors` is not provided. */
36
- endColor?: string;
35
+ /**
36
+ * Base color when `colors` is not provided: any CSS `<color>` resolved against the chart container
37
+ * (hex, `rgb()`, `rgb(var(--token))`, `color-mix()`, …).
38
+ */
39
+ color?: string;
40
+ /**
41
+ * Inclusive numeric range for mapping cell values to color intensity.
42
+ * If `valueRange` is omitted, or a bound is missing, that bound uses the min or max value
43
+ * among all cells in the current dataset.
44
+ */
45
+ valueRange?: {
46
+ min: number;
47
+ max: number;
48
+ };
37
49
  cellPadding?: number;
38
50
  borderRadius?: number;
39
51
  showXAxis?: boolean;
@@ -76,8 +88,11 @@ declare class AXHeatmapChartComponent extends AXChartComponent implements OnDest
76
88
  left: number;
77
89
  };
78
90
  colors?: string[];
79
- startColor?: string;
80
- endColor?: string;
91
+ color?: string;
92
+ valueRange?: {
93
+ min: number;
94
+ max: number;
95
+ };
81
96
  cellPadding?: number;
82
97
  borderRadius?: number;
83
98
  showXAxis?: boolean;
@@ -93,7 +108,8 @@ declare class AXHeatmapChartComponent extends AXChartComponent implements OnDest
93
108
  private init;
94
109
  private renderChart;
95
110
  private hashStringToUint32;
96
- private resolveCssColor;
111
+ /** `resolvedRgb` must be a computed `rgb()` / `rgba()` string (e.g. from {@link resolveCssColorInContext}). */
112
+ private applyIntensityToResolvedRgb;
97
113
  private drawAxis;
98
114
  private showTooltip;
99
115
  private updateTooltipPos;
@@ -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 };