@acorex/charts 20.2.0-next.8 → 20.2.0

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.
@@ -3,6 +3,7 @@ import { AXAnimationEasing, NXNativeEvent, NXComponent } from '@acorex/cdk/commo
3
3
  import * as d3 from 'd3';
4
4
  import * as _angular_core from '@angular/core';
5
5
  import { OnDestroy, InjectionToken } from '@angular/core';
6
+ import { AXChartComponentBase } from '@acorex/charts';
6
7
  import { AXChartLegendCompatible, AXChartLegendItem } from '@acorex/charts/chart-legend';
7
8
  import { AXChartTooltipData } from '@acorex/charts/chart-tooltip';
8
9
 
@@ -16,6 +17,11 @@ interface AXBarChartData {
16
17
  tooltipLabel?: string;
17
18
  color?: string;
18
19
  }
20
+ interface AXBarChartClusteredData {
21
+ id: string;
22
+ label: string;
23
+ chartData: AXBarChartData[];
24
+ }
19
25
  /**
20
26
  * Bar chart click event interface
21
27
  */
@@ -38,6 +44,23 @@ interface AXBarChartClickEvent {
38
44
  * - `--ax-comp-bar-chart-bg-color`: Background color for the chart.
39
45
  * Default: `--ax-sys-color-lightest-surface`
40
46
  */
47
+ /**
48
+ * Messages configuration for bar chart empty states
49
+ */
50
+ interface AXBarChartMessages {
51
+ /** Message shown when no data is available */
52
+ noData?: string;
53
+ /** Help text shown when no data is available */
54
+ noDataHelp?: string;
55
+ /** Message shown when all bars are hidden */
56
+ allHidden?: string;
57
+ /** Help text shown when all bars are hidden */
58
+ allHiddenHelp?: string;
59
+ /** Icon for no data state */
60
+ noDataIcon?: string;
61
+ /** Icon for all hidden state */
62
+ allHiddenIcon?: string;
63
+ }
41
64
  interface AXBarChartOption {
42
65
  width?: number;
43
66
  height?: number;
@@ -47,25 +70,27 @@ interface AXBarChartOption {
47
70
  showDataLabels?: boolean;
48
71
  xAxisLabel?: string;
49
72
  yAxisLabel?: string;
73
+ rotateXAxisLabels?: boolean | 'auto';
50
74
  showTooltip?: boolean;
51
75
  barWidth?: number;
52
76
  cornerRadius?: number;
53
77
  animationDuration?: number;
54
78
  animationEasing?: AXAnimationEasing;
79
+ messages?: AXBarChartMessages;
55
80
  }
56
81
  /**
57
82
  * Bar chart data type returned by getValue()
58
83
  * Represents an array of bar chart data items
59
84
  */
60
- type AXBarChartValue = AXBarChartData[];
85
+ type AXBarChartValue = AXBarChartData[] | AXBarChartClusteredData[];
61
86
 
62
87
  /**
63
88
  * Bar Chart Component
64
89
  * Renders data as vertical bars with interactive hover effects and animations
65
90
  */
66
- declare class AXBarChartComponent extends NXComponent implements OnDestroy, AXChartLegendCompatible {
91
+ declare class AXBarChartComponent extends NXComponent implements OnDestroy, AXChartLegendCompatible, AXChartComponentBase {
67
92
  /** Chart data input */
68
- data: _angular_core.InputSignal<AXBarChartData[]>;
93
+ data: _angular_core.InputSignal<AXBarChartValue>;
69
94
  /** Chart options input */
70
95
  options: _angular_core.InputSignal<AXBarChartOption>;
71
96
  /** Emitted when a bar is clicked */
@@ -76,11 +101,14 @@ declare class AXBarChartComponent extends NXComponent implements OnDestroy, AXCh
76
101
  private chart;
77
102
  private xScale;
78
103
  private yScale;
104
+ private xSubScale;
79
105
  private xAxis;
80
106
  private yAxis;
81
107
  private width;
82
108
  private height;
83
109
  private margin;
110
+ private readonly CHAR_WIDTH_RATIO;
111
+ private readonly TOOLTIP_GAP;
84
112
  private _initialAnimationComplete;
85
113
  private _tooltipVisible;
86
114
  private _tooltipPosition;
@@ -95,7 +123,6 @@ declare class AXBarChartComponent extends NXComponent implements OnDestroy, AXCh
95
123
  protected tooltipData: _angular_core.Signal<AXChartTooltipData>;
96
124
  private configToken;
97
125
  private chartColors;
98
- private platform;
99
126
  protected effectiveOptions: _angular_core.Signal<{
100
127
  width?: number;
101
128
  height?: number;
@@ -105,13 +132,26 @@ declare class AXBarChartComponent extends NXComponent implements OnDestroy, AXCh
105
132
  showDataLabels?: boolean;
106
133
  xAxisLabel?: string;
107
134
  yAxisLabel?: string;
135
+ rotateXAxisLabels?: boolean | "auto";
108
136
  showTooltip?: boolean;
109
137
  barWidth?: number;
110
138
  cornerRadius?: number;
111
139
  animationDuration?: number;
112
140
  animationEasing?: _acorex_cdk_common.AXAnimationEasing;
141
+ messages?: AXBarChartMessages;
142
+ }>;
143
+ protected effectiveMessages: _angular_core.Signal<{
144
+ noData: string;
145
+ noDataHelp: string;
146
+ allHidden: string;
147
+ allHiddenHelp: string;
148
+ noDataIcon: string;
149
+ allHiddenIcon: string;
113
150
  }>;
114
151
  private hiddenBars;
152
+ private hiddenSeries;
153
+ private isClusteredData;
154
+ private getClusterSeriesLabels;
115
155
  constructor();
116
156
  ngOnDestroy(): void;
117
157
  /**
@@ -121,39 +161,54 @@ declare class AXBarChartComponent extends NXComponent implements OnDestroy, AXCh
121
161
  /**
122
162
  * Creates the bar chart SVG and renders all elements
123
163
  */
124
- protected createChart(): void;
164
+ createChart(): void;
125
165
  /**
126
166
  * Updates the chart when inputs change
127
167
  */
128
- protected updateChart(): void;
168
+ updateChart(): void;
129
169
  /**
130
170
  * Cleans up chart resources
131
171
  */
132
- protected cleanupChart(): void;
172
+ cleanupChart(): void;
133
173
  /**
134
174
  * Sets up chart dimensions and creates SVG with responsive attributes
135
175
  */
136
176
  private setupDimensions;
137
- /**
138
- * Calculates chart margins based on options
139
- */
140
- private calculateMargins;
141
177
  /**
142
178
  * Creates x and y scales for the chart
143
179
  */
144
180
  private setupScales;
181
+ /**
182
+ * Creates x and y scales for clustered charts
183
+ */
184
+ private setupScalesClustered;
145
185
  /**
146
186
  * Creates x and y axes with grid lines
147
187
  */
148
188
  private createAxes;
189
+ private createXAxis;
190
+ private createYAxis;
191
+ private shouldRotateXAxisLabels;
192
+ private createXAxisTitle;
193
+ private createYAxisTitle;
194
+ private calculateMaxYAxisTickLabelWidth;
195
+ private createGridLines;
196
+ /**
197
+ * Creates axes for clustered charts
198
+ */
199
+ private createAxesClustered;
200
+ private createXAxisClustered;
149
201
  /**
150
202
  * Renders the bars with animations
151
203
  */
152
204
  private renderBars;
205
+ /**
206
+ * Renders bars for clustered charts
207
+ */
208
+ private renderBarsClustered;
153
209
  /**
154
210
  * Gets the appropriate D3 easing function based on the option string
155
211
  */
156
- private getEasingFunction;
157
212
  /**
158
213
  * Handles bar hover event and shows tooltip
159
214
  */
@@ -198,6 +253,12 @@ declare class AXBarChartComponent extends NXComponent implements OnDestroy, AXCh
198
253
  * @returns New visibility state (true = visible, false = hidden)
199
254
  */
200
255
  toggleSegment(id: string): boolean;
256
+ private getContainerElement;
257
+ private clearChartArea;
258
+ private getXAxisTickFontSizeBasedOnWidth;
259
+ private getYAxisTickFontSizeBasedOnHeight;
260
+ private buildXAxisCommon;
261
+ private showMessage;
201
262
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXBarChartComponent, never>;
202
263
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<AXBarChartComponent, "ax-bar-chart", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; }, { "barClick": "barClick"; }, never, never, true, never>;
203
264
  }
@@ -208,4 +269,4 @@ type PartialBarChartConfig = Partial<AXBarChartOption>;
208
269
  declare function barChartConfig(config?: PartialBarChartConfig): AXBarChartOption;
209
270
 
210
271
  export { AXBarChartComponent, AXBarChartDefaultConfig, AX_BAR_CHART_CONFIG, barChartConfig };
211
- export type { AXBarChartClickEvent, AXBarChartData, AXBarChartOption, AXBarChartValue, PartialBarChartConfig };
272
+ export type { AXBarChartClickEvent, AXBarChartClusteredData, AXBarChartData, AXBarChartMessages, AXBarChartOption, AXBarChartValue, PartialBarChartConfig };
@@ -68,7 +68,7 @@ declare class AXChartLegendComponent {
68
68
  /**
69
69
  * Reference to legend container for measuring dimensions
70
70
  */
71
- legendContainer?: ElementRef<HTMLDivElement>;
71
+ legendContainer: _angular_core.Signal<ElementRef<HTMLDivElement>>;
72
72
  protected showValues: _angular_core.Signal<boolean>;
73
73
  protected showPercentage: _angular_core.Signal<boolean>;
74
74
  protected containerClass: _angular_core.Signal<{
@@ -2,11 +2,12 @@ import * as _angular_core from '@angular/core';
2
2
  import { ElementRef } from '@angular/core';
3
3
 
4
4
  interface AXChartTooltipData {
5
- title: string;
5
+ title: string | string[];
6
6
  value: number | string;
7
7
  percentage?: string;
8
- color?: string;
9
- [key: string]: any;
8
+ color?: string | string[];
9
+ tooltipColor?: string;
10
+ tooltipBgColor?: string;
10
11
  }
11
12
 
12
13
  declare class AXChartTooltipComponent {
@@ -30,10 +31,16 @@ declare class AXChartTooltipComponent {
30
31
  /**
31
32
  * Reference to tooltip container for measuring dimensions
32
33
  */
33
- tooltipContainer?: ElementRef<HTMLDivElement>;
34
+ tooltipContainer: _angular_core.Signal<ElementRef<HTMLDivElement>>;
34
35
  protected tooltipWidth: number;
35
36
  protected tooltipHeight: number;
36
37
  constructor();
38
+ protected isColorArray(): boolean;
39
+ protected colorList(): string[];
40
+ protected singleColor(): string | null;
41
+ protected isTitleArray(): boolean;
42
+ protected titleList(): string[];
43
+ protected colorAt(index: number): string | null;
37
44
  /**
38
45
  * Updates tooltip dimensions after it's rendered
39
46
  */
@@ -3,6 +3,7 @@ import { AXAnimationEasing } from '@acorex/cdk/common';
3
3
  import * as d3 from 'd3';
4
4
  import * as _angular_core from '@angular/core';
5
5
  import { OnDestroy, InjectionToken } from '@angular/core';
6
+ import { AXChartComponentBase } from '@acorex/charts';
6
7
  import { AXChartLegendCompatible, AXChartLegendItem } from '@acorex/charts/chart-legend';
7
8
  import { AXChartTooltipData } from '@acorex/charts/chart-tooltip';
8
9
 
@@ -41,6 +42,23 @@ interface AXDonutChartData {
41
42
  * }
42
43
  * ```
43
44
  */
45
+ /**
46
+ * Messages configuration for donut chart empty states
47
+ */
48
+ interface AXDonutChartMessages {
49
+ /** Message shown when no data is available */
50
+ noData?: string;
51
+ /** Help text shown when no data is available */
52
+ noDataHelp?: string;
53
+ /** Message shown when all segments are hidden */
54
+ allHidden?: string;
55
+ /** Help text shown when all segments are hidden */
56
+ allHiddenHelp?: string;
57
+ /** Icon for no data state */
58
+ noDataIcon?: string;
59
+ /** Icon for all hidden state */
60
+ allHiddenIcon?: string;
61
+ }
44
62
  interface AXDonutChartOption {
45
63
  /**
46
64
  * Width of the chart in pixels
@@ -89,6 +107,10 @@ interface AXDonutChartOption {
89
107
  * Default: 'cubic-out'
90
108
  */
91
109
  animationEasing?: AXAnimationEasing;
110
+ /**
111
+ * Customizable messages for empty states
112
+ */
113
+ messages?: AXDonutChartMessages;
92
114
  }
93
115
  /**
94
116
  * Data structure provided to the chart component
@@ -100,7 +122,7 @@ type AXDonutChartValue = AXDonutChartData[];
100
122
  * Donut Chart Component
101
123
  * Displays data in a circular donut chart with interactive segments
102
124
  */
103
- declare class AXDonutChartComponent implements OnDestroy, AXChartLegendCompatible {
125
+ declare class AXDonutChartComponent implements OnDestroy, AXChartLegendCompatible, AXChartComponentBase {
104
126
  #private;
105
127
  private cdr;
106
128
  /** Chart data input */
@@ -121,6 +143,7 @@ declare class AXDonutChartComponent implements OnDestroy, AXChartLegendCompatibl
121
143
  private _initialized;
122
144
  private _rendered;
123
145
  private _isInitialAnimating;
146
+ private _currentlyHighlightedSegment;
124
147
  private _tooltipVisible;
125
148
  private _tooltipPosition;
126
149
  private _tooltipData;
@@ -142,6 +165,16 @@ declare class AXDonutChartComponent implements OnDestroy, AXChartLegendCompatibl
142
165
  cornerRadius?: number;
143
166
  animationDuration?: number;
144
167
  animationEasing?: _acorex_cdk_common.AXAnimationEasing;
168
+ messages?: AXDonutChartMessages;
169
+ }>;
170
+ private readonly TOOLTIP_GAP;
171
+ protected effectiveMessages: _angular_core.Signal<{
172
+ noData: string;
173
+ noDataHelp: string;
174
+ allHidden: string;
175
+ allHiddenHelp: string;
176
+ noDataIcon: string;
177
+ allHiddenIcon: string;
145
178
  }>;
146
179
  protected chartDataArray: _angular_core.Signal<AXDonutChartData[]>;
147
180
  protected getColor(index: number): string;
@@ -167,11 +200,11 @@ declare class AXDonutChartComponent implements OnDestroy, AXChartLegendCompatibl
167
200
  /**
168
201
  * Creates the donut chart
169
202
  */
170
- protected createChart(): void;
203
+ createChart(): void;
171
204
  /**
172
205
  * Updates the chart with new data
173
206
  */
174
- protected updateChart(): void;
207
+ updateChart(): void;
175
208
  /**
176
209
  * Clears the chart container
177
210
  */
@@ -203,7 +236,6 @@ declare class AXDonutChartComponent implements OnDestroy, AXChartLegendCompatibl
203
236
  /**
204
237
  * Gets the appropriate D3 easing function based on the option string
205
238
  */
206
- private getEasingFunction;
207
239
  /**
208
240
  * Handle hover effects on a segment
209
241
  */
@@ -228,7 +260,8 @@ declare class AXDonutChartComponent implements OnDestroy, AXChartLegendCompatibl
228
260
  /**
229
261
  * Cleans up chart resources
230
262
  */
231
- private cleanupChart;
263
+ cleanupChart(): void;
264
+ private renderMessage;
232
265
  /**
233
266
  * Gets an accessibility label describing the donut chart for screen readers
234
267
  */
@@ -248,4 +281,4 @@ type PartialDonutChartConfig = Partial<AXDonutChartOption>;
248
281
  declare function donutChartConfig(config?: PartialDonutChartConfig): AXDonutChartOption;
249
282
 
250
283
  export { AXDonutChartComponent, AXDonutChartDefaultConfig, AX_DONUT_CHART_CONFIG, donutChartConfig };
251
- export type { AXDonutChartData, AXDonutChartOption, AXDonutChartValue, PartialDonutChartConfig };
284
+ export type { AXDonutChartData, AXDonutChartMessages, AXDonutChartOption, AXDonutChartValue, PartialDonutChartConfig };