@acorex/charts 19.15.0-next.8 → 20.0.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.
- package/bar-chart/index.d.ts +211 -3
- package/chart-legend/index.d.ts +104 -0
- package/chart-tooltip/index.d.ts +54 -2
- package/donut-chart/index.d.ts +251 -3
- package/fesm2022/acorex-charts-bar-chart.mjs +229 -39
- package/fesm2022/acorex-charts-bar-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts-chart-legend.mjs +109 -0
- package/fesm2022/acorex-charts-chart-legend.mjs.map +1 -0
- package/fesm2022/acorex-charts-chart-tooltip.mjs +8 -9
- package/fesm2022/acorex-charts-chart-tooltip.mjs.map +1 -1
- package/fesm2022/acorex-charts-donut-chart.mjs +179 -70
- package/fesm2022/acorex-charts-donut-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts-gauge-chart.mjs +4 -5
- package/fesm2022/acorex-charts-gauge-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts-hierarchy-chart.mjs +4 -5
- package/fesm2022/acorex-charts-hierarchy-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts-line-chart.mjs +221 -106
- package/fesm2022/acorex-charts-line-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts.mjs.map +1 -1
- package/gauge-chart/index.d.ts +218 -3
- package/hierarchy-chart/index.d.ts +366 -3
- package/index.d.ts +14 -2
- package/line-chart/index.d.ts +184 -3
- package/package.json +11 -7
- package/bar-chart/lib/bar-chart.component.d.ts +0 -117
- package/bar-chart/lib/bar-chart.config.d.ts +0 -6
- package/bar-chart/lib/bar-chart.type.d.ts +0 -53
- package/chart-tooltip/lib/chart-tooltip.component.d.ts +0 -43
- package/chart-tooltip/lib/chart-tooltip.type.d.ts +0 -7
- package/donut-chart/lib/donut-chart.component.d.ts +0 -146
- package/donut-chart/lib/donut-chart.config.d.ts +0 -6
- package/donut-chart/lib/donut-chart.type.d.ts +0 -90
- package/gauge-chart/lib/gauge-chart.component.d.ts +0 -138
- package/gauge-chart/lib/gauge-chart.config.d.ts +0 -6
- package/gauge-chart/lib/gauge-chart.type.d.ts +0 -69
- package/hierarchy-chart/lib/hierarchy-chart.component.d.ts +0 -101
- package/hierarchy-chart/lib/hierarchy-chart.config.d.ts +0 -6
- package/hierarchy-chart/lib/hierarchy-chart.type.d.ts +0 -256
- package/lib/chart-colors.d.ts +0 -9
- package/line-chart/lib/line-chart.component.d.ts +0 -94
- package/line-chart/lib/line-chart.config.d.ts +0 -6
- package/line-chart/lib/line-chart.type.d.ts +0 -75
package/bar-chart/index.d.ts
CHANGED
|
@@ -1,3 +1,211 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as _acorex_cdk_common from '@acorex/cdk/common';
|
|
2
|
+
import { AXAnimationEasing, NXNativeEvent, NXComponent } from '@acorex/cdk/common';
|
|
3
|
+
import * as d3 from 'd3';
|
|
4
|
+
import * as _angular_core from '@angular/core';
|
|
5
|
+
import { OnDestroy, InjectionToken } from '@angular/core';
|
|
6
|
+
import { AXChartLegendCompatible, AXChartLegendItem } from '@acorex/charts/chart-legend';
|
|
7
|
+
import { AXChartTooltipData } from '@acorex/charts/chart-tooltip';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Bar chart data item interface
|
|
11
|
+
*/
|
|
12
|
+
interface AXBarChartData {
|
|
13
|
+
id: string;
|
|
14
|
+
label: string;
|
|
15
|
+
value: number;
|
|
16
|
+
tooltipLabel?: string;
|
|
17
|
+
color?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Bar chart click event interface
|
|
21
|
+
*/
|
|
22
|
+
interface AXBarChartClickEvent {
|
|
23
|
+
item: AXBarChartData;
|
|
24
|
+
event: NXNativeEvent;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Bar chart options interface
|
|
28
|
+
*
|
|
29
|
+
* Component supports the following CSS custom properties (design tokens):
|
|
30
|
+
* - `--ax-comp-bar-chart-labels-color`: Color for axis labels in option (X/Y axis titles).
|
|
31
|
+
* Default: `--ax-sys-color-on-lightest-surface` (applied with 0.7 opacity where needed)
|
|
32
|
+
* - `--ax-comp-bar-chart-data-labels-color`: Color for data labels.
|
|
33
|
+
* Default: `--ax-sys-color-on-lightest-surface`
|
|
34
|
+
* - `--ax-comp-bar-chart-axis-color`: Color for X/Y axis lines.
|
|
35
|
+
* Default: `--ax-sys-color-on-lightest-surface`
|
|
36
|
+
* - `--ax-comp-bar-chart-grid-lines-color`: Color for grid lines.
|
|
37
|
+
* Default: `--ax-sys-color-on-lightest-surface` (applied with 0.2 opacity)
|
|
38
|
+
* - `--ax-comp-bar-chart-bg-color`: Background color for the chart.
|
|
39
|
+
* Default: `--ax-sys-color-lightest-surface`
|
|
40
|
+
*/
|
|
41
|
+
interface AXBarChartOption {
|
|
42
|
+
width?: number;
|
|
43
|
+
height?: number;
|
|
44
|
+
showXAxis?: boolean;
|
|
45
|
+
showYAxis?: boolean;
|
|
46
|
+
showGrid?: boolean;
|
|
47
|
+
showDataLabels?: boolean;
|
|
48
|
+
xAxisLabel?: string;
|
|
49
|
+
yAxisLabel?: string;
|
|
50
|
+
showTooltip?: boolean;
|
|
51
|
+
barWidth?: number;
|
|
52
|
+
cornerRadius?: number;
|
|
53
|
+
animationDuration?: number;
|
|
54
|
+
animationEasing?: AXAnimationEasing;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Bar chart data type returned by getValue()
|
|
58
|
+
* Represents an array of bar chart data items
|
|
59
|
+
*/
|
|
60
|
+
type AXBarChartValue = AXBarChartData[];
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Bar Chart Component
|
|
64
|
+
* Renders data as vertical bars with interactive hover effects and animations
|
|
65
|
+
*/
|
|
66
|
+
declare class AXBarChartComponent extends NXComponent implements OnDestroy, AXChartLegendCompatible {
|
|
67
|
+
/** Chart data input */
|
|
68
|
+
data: _angular_core.InputSignal<AXBarChartData[]>;
|
|
69
|
+
/** Chart options input */
|
|
70
|
+
options: _angular_core.InputSignal<AXBarChartOption>;
|
|
71
|
+
/** Emitted when a bar is clicked */
|
|
72
|
+
barClick: _angular_core.OutputEmitterRef<AXBarChartClickEvent>;
|
|
73
|
+
private readonly chartContainerEl;
|
|
74
|
+
protected d3: typeof d3;
|
|
75
|
+
private svg;
|
|
76
|
+
private chart;
|
|
77
|
+
private xScale;
|
|
78
|
+
private yScale;
|
|
79
|
+
private xAxis;
|
|
80
|
+
private yAxis;
|
|
81
|
+
private width;
|
|
82
|
+
private height;
|
|
83
|
+
private margin;
|
|
84
|
+
private _initialAnimationComplete;
|
|
85
|
+
private _tooltipVisible;
|
|
86
|
+
private _tooltipPosition;
|
|
87
|
+
private _tooltipData;
|
|
88
|
+
private _initialized;
|
|
89
|
+
private _rendered;
|
|
90
|
+
protected tooltipVisible: _angular_core.Signal<boolean>;
|
|
91
|
+
protected tooltipPosition: _angular_core.Signal<{
|
|
92
|
+
x: number;
|
|
93
|
+
y: number;
|
|
94
|
+
}>;
|
|
95
|
+
protected tooltipData: _angular_core.Signal<AXChartTooltipData>;
|
|
96
|
+
private configToken;
|
|
97
|
+
private chartColors;
|
|
98
|
+
private platform;
|
|
99
|
+
protected effectiveOptions: _angular_core.Signal<{
|
|
100
|
+
width?: number;
|
|
101
|
+
height?: number;
|
|
102
|
+
showXAxis?: boolean;
|
|
103
|
+
showYAxis?: boolean;
|
|
104
|
+
showGrid?: boolean;
|
|
105
|
+
showDataLabels?: boolean;
|
|
106
|
+
xAxisLabel?: string;
|
|
107
|
+
yAxisLabel?: string;
|
|
108
|
+
showTooltip?: boolean;
|
|
109
|
+
barWidth?: number;
|
|
110
|
+
cornerRadius?: number;
|
|
111
|
+
animationDuration?: number;
|
|
112
|
+
animationEasing?: _acorex_cdk_common.AXAnimationEasing;
|
|
113
|
+
}>;
|
|
114
|
+
private hiddenBars;
|
|
115
|
+
constructor();
|
|
116
|
+
ngOnDestroy(): void;
|
|
117
|
+
/**
|
|
118
|
+
* Loads D3.js dynamically
|
|
119
|
+
*/
|
|
120
|
+
protected loadD3(): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Creates the bar chart SVG and renders all elements
|
|
123
|
+
*/
|
|
124
|
+
protected createChart(): void;
|
|
125
|
+
/**
|
|
126
|
+
* Updates the chart when inputs change
|
|
127
|
+
*/
|
|
128
|
+
protected updateChart(): void;
|
|
129
|
+
/**
|
|
130
|
+
* Cleans up chart resources
|
|
131
|
+
*/
|
|
132
|
+
protected cleanupChart(): void;
|
|
133
|
+
/**
|
|
134
|
+
* Sets up chart dimensions and creates SVG with responsive attributes
|
|
135
|
+
*/
|
|
136
|
+
private setupDimensions;
|
|
137
|
+
/**
|
|
138
|
+
* Calculates chart margins based on options
|
|
139
|
+
*/
|
|
140
|
+
private calculateMargins;
|
|
141
|
+
/**
|
|
142
|
+
* Creates x and y scales for the chart
|
|
143
|
+
*/
|
|
144
|
+
private setupScales;
|
|
145
|
+
/**
|
|
146
|
+
* Creates x and y axes with grid lines
|
|
147
|
+
*/
|
|
148
|
+
private createAxes;
|
|
149
|
+
/**
|
|
150
|
+
* Renders the bars with animations
|
|
151
|
+
*/
|
|
152
|
+
private renderBars;
|
|
153
|
+
/**
|
|
154
|
+
* Gets the appropriate D3 easing function based on the option string
|
|
155
|
+
*/
|
|
156
|
+
private getEasingFunction;
|
|
157
|
+
/**
|
|
158
|
+
* Handles bar hover event and shows tooltip
|
|
159
|
+
*/
|
|
160
|
+
private handleBarHover;
|
|
161
|
+
/**
|
|
162
|
+
* Updates tooltip position based on mouse coordinates
|
|
163
|
+
*/
|
|
164
|
+
private updateTooltipPosition;
|
|
165
|
+
/**
|
|
166
|
+
* Handles bar click event
|
|
167
|
+
*/
|
|
168
|
+
private handleBarClick;
|
|
169
|
+
/**
|
|
170
|
+
* Shows a message when no data is available
|
|
171
|
+
*/
|
|
172
|
+
private showNoDataMessage;
|
|
173
|
+
/**
|
|
174
|
+
* Shows a message when all bars are hidden
|
|
175
|
+
*/
|
|
176
|
+
private showAllBarsHiddenMessage;
|
|
177
|
+
/**
|
|
178
|
+
* Gets the color for a bar based on its index
|
|
179
|
+
*/
|
|
180
|
+
protected getColor(index: number): string;
|
|
181
|
+
/**
|
|
182
|
+
* Checks if a bar is hidden
|
|
183
|
+
*/
|
|
184
|
+
protected isBarHidden(id: string): boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Implementation of AXChartLegendCompatible interface
|
|
187
|
+
* Returns legend items based on the chart data
|
|
188
|
+
*/
|
|
189
|
+
getLegendItems(): AXChartLegendItem[];
|
|
190
|
+
/**
|
|
191
|
+
* Implementation of AXChartLegendCompatible interface
|
|
192
|
+
* Highlights a specific bar by ID
|
|
193
|
+
*/
|
|
194
|
+
highlightSegment(id: string | null): void;
|
|
195
|
+
/**
|
|
196
|
+
* Implementation of AXChartLegendCompatible interface
|
|
197
|
+
* Toggles visibility of a bar by ID
|
|
198
|
+
* @returns New visibility state (true = visible, false = hidden)
|
|
199
|
+
*/
|
|
200
|
+
toggleSegment(id: string): boolean;
|
|
201
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXBarChartComponent, never>;
|
|
202
|
+
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
|
+
}
|
|
204
|
+
|
|
205
|
+
declare const AXBarChartDefaultConfig: AXBarChartOption;
|
|
206
|
+
declare const AX_BAR_CHART_CONFIG: InjectionToken<AXBarChartOption>;
|
|
207
|
+
type PartialBarChartConfig = Partial<AXBarChartOption>;
|
|
208
|
+
declare function barChartConfig(config?: PartialBarChartConfig): AXBarChartOption;
|
|
209
|
+
|
|
210
|
+
export { AXBarChartComponent, AXBarChartDefaultConfig, AX_BAR_CHART_CONFIG, barChartConfig };
|
|
211
|
+
export type { AXBarChartClickEvent, AXBarChartData, AXBarChartOption, AXBarChartValue, PartialBarChartConfig };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { ElementRef } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Defines a legend item
|
|
6
|
+
*/
|
|
7
|
+
interface AXChartLegendItem {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
value: number | string;
|
|
11
|
+
percentage?: number;
|
|
12
|
+
color?: string;
|
|
13
|
+
hidden?: boolean;
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Interface that chart components should implement to work with the legend
|
|
18
|
+
*/
|
|
19
|
+
interface AXChartLegendCompatible {
|
|
20
|
+
/**
|
|
21
|
+
* Returns the data items for the legend
|
|
22
|
+
*/
|
|
23
|
+
getLegendItems(): AXChartLegendItem[];
|
|
24
|
+
/**
|
|
25
|
+
* Highlights a specific segment by ID
|
|
26
|
+
*/
|
|
27
|
+
highlightSegment(id: string | null): void;
|
|
28
|
+
/**
|
|
29
|
+
* Toggles visibility of a segment by ID
|
|
30
|
+
* @returns New visibility state (true = visible, false = hidden)
|
|
31
|
+
*/
|
|
32
|
+
toggleSegment(id: string): boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Legend configuration options
|
|
36
|
+
*/
|
|
37
|
+
interface AXChartLegendOptions {
|
|
38
|
+
showValues?: boolean;
|
|
39
|
+
showPercentage?: boolean;
|
|
40
|
+
className?: string;
|
|
41
|
+
interactive?: boolean;
|
|
42
|
+
mode?: 'vertical' | 'horizontal';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
declare class AXChartLegendComponent {
|
|
46
|
+
/**
|
|
47
|
+
* Chart component instance
|
|
48
|
+
* Must implement AXChartLegendCompatible interface
|
|
49
|
+
*/
|
|
50
|
+
chart: _angular_core.InputSignal<AXChartLegendCompatible>;
|
|
51
|
+
/**
|
|
52
|
+
* Configuration options for the legend
|
|
53
|
+
*/
|
|
54
|
+
options: _angular_core.InputSignal<AXChartLegendOptions>;
|
|
55
|
+
/**
|
|
56
|
+
* Event emitted when a legend item is clicked
|
|
57
|
+
* Returns the item that was clicked
|
|
58
|
+
*/
|
|
59
|
+
itemClick: _angular_core.OutputEmitterRef<AXChartLegendItem>;
|
|
60
|
+
/**
|
|
61
|
+
* Event emitted when the mouse enters a legend item
|
|
62
|
+
*/
|
|
63
|
+
itemMouseEnter: _angular_core.OutputEmitterRef<AXChartLegendItem>;
|
|
64
|
+
/**
|
|
65
|
+
* Event emitted when the mouse leaves a legend item
|
|
66
|
+
*/
|
|
67
|
+
itemMouseLeave: _angular_core.OutputEmitterRef<AXChartLegendItem>;
|
|
68
|
+
/**
|
|
69
|
+
* Reference to legend container for measuring dimensions
|
|
70
|
+
*/
|
|
71
|
+
legendContainer?: ElementRef<HTMLDivElement>;
|
|
72
|
+
protected showValues: _angular_core.Signal<boolean>;
|
|
73
|
+
protected showPercentage: _angular_core.Signal<boolean>;
|
|
74
|
+
protected containerClass: _angular_core.Signal<{
|
|
75
|
+
[x: string]: boolean;
|
|
76
|
+
'ax-chart-legend': boolean;
|
|
77
|
+
}>;
|
|
78
|
+
protected isInteractive: _angular_core.Signal<boolean>;
|
|
79
|
+
protected displayItems: _angular_core.Signal<AXChartLegendItem[]>;
|
|
80
|
+
/**
|
|
81
|
+
* Handle clicks on legend items
|
|
82
|
+
*/
|
|
83
|
+
protected onItemClick(item: AXChartLegendItem): void;
|
|
84
|
+
/**
|
|
85
|
+
* Handle mouse enter on legend items
|
|
86
|
+
*/
|
|
87
|
+
protected onItemMouseEnter(item: AXChartLegendItem): void;
|
|
88
|
+
/**
|
|
89
|
+
* Handle mouse leave on legend items
|
|
90
|
+
*/
|
|
91
|
+
protected onItemMouseLeave(item: AXChartLegendItem): void;
|
|
92
|
+
/**
|
|
93
|
+
* Get legend container dimensions
|
|
94
|
+
*/
|
|
95
|
+
getDimensions(): {
|
|
96
|
+
width: number;
|
|
97
|
+
height: number;
|
|
98
|
+
};
|
|
99
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXChartLegendComponent, never>;
|
|
100
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AXChartLegendComponent, "ax-chart-legend", never, { "chart": { "alias": "chart"; "required": true; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; }, { "itemClick": "itemClick"; "itemMouseEnter": "itemMouseEnter"; "itemMouseLeave": "itemMouseLeave"; }, never, never, true, never>;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export { AXChartLegendComponent };
|
|
104
|
+
export type { AXChartLegendCompatible, AXChartLegendItem, AXChartLegendOptions };
|
package/chart-tooltip/index.d.ts
CHANGED
|
@@ -1,2 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { ElementRef } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
interface AXChartTooltipData {
|
|
5
|
+
title: string;
|
|
6
|
+
value: number | string;
|
|
7
|
+
percentage?: string;
|
|
8
|
+
color?: string;
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare class AXChartTooltipComponent {
|
|
13
|
+
private ngZone;
|
|
14
|
+
data: _angular_core.InputSignal<AXChartTooltipData>;
|
|
15
|
+
position: _angular_core.InputSignal<{
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
}>;
|
|
19
|
+
visible: _angular_core.InputSignal<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* Whether to show the tooltip's percentage badge
|
|
22
|
+
*/
|
|
23
|
+
showPercentage: _angular_core.InputSignal<boolean>;
|
|
24
|
+
/**
|
|
25
|
+
* Optional custom styling for the tooltip
|
|
26
|
+
*/
|
|
27
|
+
style: _angular_core.InputSignal<{
|
|
28
|
+
[key: string]: string;
|
|
29
|
+
}>;
|
|
30
|
+
/**
|
|
31
|
+
* Reference to tooltip container for measuring dimensions
|
|
32
|
+
*/
|
|
33
|
+
tooltipContainer?: ElementRef<HTMLDivElement>;
|
|
34
|
+
protected tooltipWidth: number;
|
|
35
|
+
protected tooltipHeight: number;
|
|
36
|
+
constructor();
|
|
37
|
+
/**
|
|
38
|
+
* Updates tooltip dimensions after it's rendered
|
|
39
|
+
*/
|
|
40
|
+
protected updateTooltipDimensions(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Get adjusted tooltip position
|
|
43
|
+
* Exposes properties for parent components to query tooltip dimensions
|
|
44
|
+
*/
|
|
45
|
+
getDimensions(): {
|
|
46
|
+
width: number;
|
|
47
|
+
height: number;
|
|
48
|
+
};
|
|
49
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXChartTooltipComponent, never>;
|
|
50
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AXChartTooltipComponent, "ax-chart-tooltip", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "position": { "alias": "position"; "required": false; "isSignal": true; }; "visible": { "alias": "visible"; "required": false; "isSignal": true; }; "showPercentage": { "alias": "showPercentage"; "required": false; "isSignal": true; }; "style": { "alias": "style"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { AXChartTooltipComponent };
|
|
54
|
+
export type { AXChartTooltipData };
|
package/donut-chart/index.d.ts
CHANGED
|
@@ -1,3 +1,251 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as _acorex_cdk_common from '@acorex/cdk/common';
|
|
2
|
+
import { AXAnimationEasing } from '@acorex/cdk/common';
|
|
3
|
+
import * as d3 from 'd3';
|
|
4
|
+
import * as _angular_core from '@angular/core';
|
|
5
|
+
import { OnDestroy, InjectionToken } from '@angular/core';
|
|
6
|
+
import { AXChartLegendCompatible, AXChartLegendItem } from '@acorex/charts/chart-legend';
|
|
7
|
+
import { AXChartTooltipData } from '@acorex/charts/chart-tooltip';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Represents a single segment in the donut chart
|
|
11
|
+
*/
|
|
12
|
+
interface AXDonutChartData {
|
|
13
|
+
id: string;
|
|
14
|
+
value: number;
|
|
15
|
+
color?: string;
|
|
16
|
+
tooltipLabel?: string;
|
|
17
|
+
label?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Configuration options for the donut chart
|
|
21
|
+
*
|
|
22
|
+
* ## Design Tokens
|
|
23
|
+
* The component supports the following CSS custom properties:
|
|
24
|
+
*
|
|
25
|
+
* ### `--ax-comp-donut-chart-bg-color`
|
|
26
|
+
* Background color for the chart area and separator lines between segments.
|
|
27
|
+
* Default: `var(--ax-sys-color-lightest-surface)`
|
|
28
|
+
* Usage: `rgb(var(--ax-comp-donut-chart-bg-color))`
|
|
29
|
+
*
|
|
30
|
+
* ### `--ax-comp-donut-chart-text-color`
|
|
31
|
+
* Text color for all labels, values, total count, and percentage indicators.
|
|
32
|
+
* Default: `var(--ax-sys-color-on-lightest-surface)`
|
|
33
|
+
* Usage: `rgb(var(--ax-comp-donut-chart-text-color))`
|
|
34
|
+
*
|
|
35
|
+
* ## Usage
|
|
36
|
+
* Override these tokens in your CSS to customize the chart's appearance:
|
|
37
|
+
* ```css
|
|
38
|
+
* ax-donut-chart {
|
|
39
|
+
* --ax-comp-donut-chart-bg-color: var(--your-custom-background);
|
|
40
|
+
* --ax-comp-donut-chart-text-color: var(--your-custom-text-color);
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
interface AXDonutChartOption {
|
|
45
|
+
/**
|
|
46
|
+
* Width of the chart in pixels
|
|
47
|
+
* If not provided, will use container width
|
|
48
|
+
*/
|
|
49
|
+
width?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Height of the chart in pixels
|
|
52
|
+
* If not provided, will use container height
|
|
53
|
+
*/
|
|
54
|
+
height?: number;
|
|
55
|
+
/**
|
|
56
|
+
* Label for the total value
|
|
57
|
+
* Default: 'Total'
|
|
58
|
+
*/
|
|
59
|
+
totalLabel?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Whether to show tooltips on hover
|
|
62
|
+
* Default: true
|
|
63
|
+
*/
|
|
64
|
+
showTooltip?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Whether to show percentage labels inside chart segments
|
|
67
|
+
* Labels will only appear on segments large enough to fit text
|
|
68
|
+
* Default: true
|
|
69
|
+
*/
|
|
70
|
+
showDataLabels?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Width of the donut ring as a percentage (10-90)
|
|
73
|
+
* Higher values create a thicker ring
|
|
74
|
+
* Default: 35
|
|
75
|
+
*/
|
|
76
|
+
donutWidth?: number;
|
|
77
|
+
/**
|
|
78
|
+
* Radius for rounded corners on segments in pixels
|
|
79
|
+
* Default: 4
|
|
80
|
+
*/
|
|
81
|
+
cornerRadius?: number;
|
|
82
|
+
/**
|
|
83
|
+
* Duration of animations in milliseconds
|
|
84
|
+
* Default: 800
|
|
85
|
+
*/
|
|
86
|
+
animationDuration?: number;
|
|
87
|
+
/**
|
|
88
|
+
* Type of easing function for animations
|
|
89
|
+
* Default: 'cubic-out'
|
|
90
|
+
*/
|
|
91
|
+
animationEasing?: AXAnimationEasing;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Data structure provided to the chart component
|
|
95
|
+
* Can be an array of AXPDonutChartData directly
|
|
96
|
+
*/
|
|
97
|
+
type AXDonutChartValue = AXDonutChartData[];
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Donut Chart Component
|
|
101
|
+
* Displays data in a circular donut chart with interactive segments
|
|
102
|
+
*/
|
|
103
|
+
declare class AXDonutChartComponent implements OnDestroy, AXChartLegendCompatible {
|
|
104
|
+
#private;
|
|
105
|
+
private cdr;
|
|
106
|
+
/** Chart data input */
|
|
107
|
+
data: _angular_core.InputSignal<AXDonutChartValue>;
|
|
108
|
+
/** Chart options input */
|
|
109
|
+
options: _angular_core.InputSignal<AXDonutChartOption>;
|
|
110
|
+
/** Emitted when a segment is clicked */
|
|
111
|
+
segmentClick: _angular_core.OutputEmitterRef<AXDonutChartData>;
|
|
112
|
+
/** Emitted when a segment has mouse hover
|
|
113
|
+
* Can be used by external elements to highlight this segment
|
|
114
|
+
*/
|
|
115
|
+
segmentHover: _angular_core.OutputEmitterRef<AXDonutChartData>;
|
|
116
|
+
private readonly chartContainerEl;
|
|
117
|
+
protected d3: typeof d3;
|
|
118
|
+
private svg;
|
|
119
|
+
private pieData;
|
|
120
|
+
private hiddenSegments;
|
|
121
|
+
private _initialized;
|
|
122
|
+
private _rendered;
|
|
123
|
+
private _isInitialAnimating;
|
|
124
|
+
private _tooltipVisible;
|
|
125
|
+
private _tooltipPosition;
|
|
126
|
+
private _tooltipData;
|
|
127
|
+
protected tooltipVisible: _angular_core.Signal<boolean>;
|
|
128
|
+
protected tooltipPosition: _angular_core.Signal<{
|
|
129
|
+
x: number;
|
|
130
|
+
y: number;
|
|
131
|
+
}>;
|
|
132
|
+
protected tooltipData: _angular_core.Signal<AXChartTooltipData>;
|
|
133
|
+
private configToken;
|
|
134
|
+
private chartColors;
|
|
135
|
+
protected effectiveOptions: _angular_core.Signal<{
|
|
136
|
+
width?: number;
|
|
137
|
+
height?: number;
|
|
138
|
+
totalLabel?: string;
|
|
139
|
+
showTooltip?: boolean;
|
|
140
|
+
showDataLabels?: boolean;
|
|
141
|
+
donutWidth?: number;
|
|
142
|
+
cornerRadius?: number;
|
|
143
|
+
animationDuration?: number;
|
|
144
|
+
animationEasing?: _acorex_cdk_common.AXAnimationEasing;
|
|
145
|
+
}>;
|
|
146
|
+
protected chartDataArray: _angular_core.Signal<AXDonutChartData[]>;
|
|
147
|
+
protected getColor(index: number): string;
|
|
148
|
+
protected isSegmentHidden(id: string): boolean;
|
|
149
|
+
constructor();
|
|
150
|
+
/**
|
|
151
|
+
* Highlights a specific segment by ID
|
|
152
|
+
* @param id The segment ID to highlight, or null to clear highlight
|
|
153
|
+
*/
|
|
154
|
+
highlightSegment(id: string | null): void;
|
|
155
|
+
/**
|
|
156
|
+
* Toggles visibility of a segment by ID
|
|
157
|
+
* @param id Segment ID to toggle
|
|
158
|
+
* @returns New visibility state (true = visible, false = hidden)
|
|
159
|
+
*/
|
|
160
|
+
toggleSegment(id: string): boolean;
|
|
161
|
+
ngOnDestroy(): void;
|
|
162
|
+
/**
|
|
163
|
+
* Loads D3.js dynamically
|
|
164
|
+
*/
|
|
165
|
+
protected loadD3(): Promise<void>;
|
|
166
|
+
protected onSegmentClick(item: AXDonutChartData): void;
|
|
167
|
+
/**
|
|
168
|
+
* Creates the donut chart
|
|
169
|
+
*/
|
|
170
|
+
protected createChart(): void;
|
|
171
|
+
/**
|
|
172
|
+
* Updates the chart with new data
|
|
173
|
+
*/
|
|
174
|
+
protected updateChart(): void;
|
|
175
|
+
/**
|
|
176
|
+
* Clears the chart container
|
|
177
|
+
*/
|
|
178
|
+
private clearChart;
|
|
179
|
+
/**
|
|
180
|
+
* Shows a message when no data is available
|
|
181
|
+
*/
|
|
182
|
+
private showNoDataMessage;
|
|
183
|
+
/**
|
|
184
|
+
* Shows a message when all segments are hidden
|
|
185
|
+
*/
|
|
186
|
+
private showAllSegmentsHiddenMessage;
|
|
187
|
+
/**
|
|
188
|
+
* Setups chart dimensions based on container and options
|
|
189
|
+
*/
|
|
190
|
+
private setupDimensions;
|
|
191
|
+
/**
|
|
192
|
+
* Renders the donut chart with visible data
|
|
193
|
+
*/
|
|
194
|
+
private renderDonutChart;
|
|
195
|
+
/**
|
|
196
|
+
* Create SVG element with filter definitions for shadows
|
|
197
|
+
*/
|
|
198
|
+
private createSvgWithFilters;
|
|
199
|
+
/**
|
|
200
|
+
* Create and render the donut segments with animations
|
|
201
|
+
*/
|
|
202
|
+
private createDonutSegments;
|
|
203
|
+
/**
|
|
204
|
+
* Gets the appropriate D3 easing function based on the option string
|
|
205
|
+
*/
|
|
206
|
+
private getEasingFunction;
|
|
207
|
+
/**
|
|
208
|
+
* Handle hover effects on a segment
|
|
209
|
+
*/
|
|
210
|
+
private handleSliceHover;
|
|
211
|
+
/**
|
|
212
|
+
* Handles mouse leave from segments
|
|
213
|
+
*/
|
|
214
|
+
private handleSegmentLeave;
|
|
215
|
+
/**
|
|
216
|
+
* Updates tooltip position
|
|
217
|
+
* Ensures the tooltip is visible by adjusting position when near edges
|
|
218
|
+
*/
|
|
219
|
+
private updateTooltipPosition;
|
|
220
|
+
/**
|
|
221
|
+
* Adds center display with total value
|
|
222
|
+
*/
|
|
223
|
+
private addCenterDisplay;
|
|
224
|
+
/**
|
|
225
|
+
* Handles chart rendering errors
|
|
226
|
+
*/
|
|
227
|
+
private handleChartError;
|
|
228
|
+
/**
|
|
229
|
+
* Cleans up chart resources
|
|
230
|
+
*/
|
|
231
|
+
private cleanupChart;
|
|
232
|
+
/**
|
|
233
|
+
* Gets an accessibility label describing the donut chart for screen readers
|
|
234
|
+
*/
|
|
235
|
+
protected getAccessibilityLabel(): string;
|
|
236
|
+
/**
|
|
237
|
+
* Returns the data items for the legend
|
|
238
|
+
* @implements AXChartLegendCompatible
|
|
239
|
+
*/
|
|
240
|
+
getLegendItems(): AXChartLegendItem[];
|
|
241
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXDonutChartComponent, never>;
|
|
242
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AXDonutChartComponent, "ax-donut-chart", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; }, { "segmentClick": "segmentClick"; "segmentHover": "segmentHover"; }, never, never, true, never>;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
declare const AXDonutChartDefaultConfig: AXDonutChartOption;
|
|
246
|
+
declare const AX_DONUT_CHART_CONFIG: InjectionToken<AXDonutChartOption>;
|
|
247
|
+
type PartialDonutChartConfig = Partial<AXDonutChartOption>;
|
|
248
|
+
declare function donutChartConfig(config?: PartialDonutChartConfig): AXDonutChartOption;
|
|
249
|
+
|
|
250
|
+
export { AXDonutChartComponent, AXDonutChartDefaultConfig, AX_DONUT_CHART_CONFIG, donutChartConfig };
|
|
251
|
+
export type { AXDonutChartData, AXDonutChartOption, AXDonutChartValue, PartialDonutChartConfig };
|