@acorex/charts 19.13.2
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/README.md +72 -0
- package/bar-chart/README.md +3 -0
- package/bar-chart/index.d.ts +3 -0
- package/bar-chart/lib/bar-chart.component.d.ts +123 -0
- package/bar-chart/lib/bar-chart.config.d.ts +6 -0
- package/bar-chart/lib/bar-chart.type.d.ts +44 -0
- package/chart-tooltip/README.md +3 -0
- package/chart-tooltip/index.d.ts +2 -0
- package/chart-tooltip/lib/chart-tooltip.component.d.ts +43 -0
- package/chart-tooltip/lib/chart-tooltip.type.d.ts +7 -0
- package/donut-chart/README.md +3 -0
- package/donut-chart/index.d.ts +3 -0
- package/donut-chart/lib/donut-chart.component.d.ts +143 -0
- package/donut-chart/lib/donut-chart.config.d.ts +6 -0
- package/donut-chart/lib/donut-chart.type.d.ts +25 -0
- package/fesm2022/acorex-charts-bar-chart.mjs +563 -0
- package/fesm2022/acorex-charts-bar-chart.mjs.map +1 -0
- package/fesm2022/acorex-charts-chart-tooltip.mjs +75 -0
- package/fesm2022/acorex-charts-chart-tooltip.mjs.map +1 -0
- package/fesm2022/acorex-charts-donut-chart.mjs +616 -0
- package/fesm2022/acorex-charts-donut-chart.mjs.map +1 -0
- package/fesm2022/acorex-charts-gauge-chart.mjs +548 -0
- package/fesm2022/acorex-charts-gauge-chart.mjs.map +1 -0
- package/fesm2022/acorex-charts-hierarchy-chart.mjs +652 -0
- package/fesm2022/acorex-charts-hierarchy-chart.mjs.map +1 -0
- package/fesm2022/acorex-charts-line-chart.mjs +738 -0
- package/fesm2022/acorex-charts-line-chart.mjs.map +1 -0
- package/fesm2022/acorex-charts.mjs +8 -0
- package/fesm2022/acorex-charts.mjs.map +1 -0
- package/gauge-chart/README.md +3 -0
- package/gauge-chart/index.d.ts +3 -0
- package/gauge-chart/lib/gauge-chart.component.d.ts +110 -0
- package/gauge-chart/lib/gauge-chart.config.d.ts +6 -0
- package/gauge-chart/lib/gauge-chart.type.d.ts +37 -0
- package/hierarchy-chart/README.md +61 -0
- package/hierarchy-chart/index.d.ts +3 -0
- package/hierarchy-chart/lib/hierarchy-chart.component.d.ts +99 -0
- package/hierarchy-chart/lib/hierarchy-chart.config.d.ts +6 -0
- package/hierarchy-chart/lib/hierarchy-chart.type.d.ts +227 -0
- package/index.d.ts +1 -0
- package/line-chart/README.md +3 -0
- package/line-chart/index.d.ts +3 -0
- package/line-chart/lib/line-chart.component.d.ts +96 -0
- package/line-chart/lib/line-chart.config.d.ts +6 -0
- package/line-chart/lib/line-chart.type.d.ts +61 -0
- package/package.json +48 -0
package/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# AcoreX Charts Library
|
|
2
|
+
|
|
3
|
+
A collection of Angular chart components powered by D3.js.
|
|
4
|
+
|
|
5
|
+
## Available Charts
|
|
6
|
+
|
|
7
|
+
- Bar Chart
|
|
8
|
+
- Line Chart
|
|
9
|
+
- Donut Chart
|
|
10
|
+
- Gauge Chart
|
|
11
|
+
- Hierarchy Chart
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @acorex/charts
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
Import specific chart components in your Angular module:
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { AXBarChartComponent } from '@acorex/charts/bar-chart';
|
|
25
|
+
import { AXLineChartComponent } from '@acorex/charts/line-chart';
|
|
26
|
+
import { AXDonutChartComponent } from '@acorex/charts/donut-chart';
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Add the components to your templates:
|
|
30
|
+
|
|
31
|
+
```html
|
|
32
|
+
<ax-bar-chart [data]="barData" [options]="barOptions"></ax-bar-chart>
|
|
33
|
+
<ax-line-chart [data]="lineData" [options]="lineOptions"></ax-line-chart>
|
|
34
|
+
<ax-donut-chart [data]="donutData" [options]="donutOptions"></ax-donut-chart>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Documentation
|
|
38
|
+
|
|
39
|
+
For detailed documentation and examples, see the individual chart component README files.
|
|
40
|
+
|
|
41
|
+
# ACoreX
|
|
42
|
+
|
|
43
|
+
ACoreX is an UI framework based on angular. With over 50+ beautiful fully responsive and accessible components for everyone.
|
|
44
|
+
|
|
45
|
+
[]()
|
|
46
|
+
|
|
47
|
+
A few links to help you get started:
|
|
48
|
+
|
|
49
|
+
- [ACoreX: Documentation, Guides](https://acorexui.com)
|
|
50
|
+
|
|
51
|
+
<picture>
|
|
52
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://acorexui.com/public/acorex-slang-dark.svg">
|
|
53
|
+
<img alt="Acorex - Design System, UI Framework, App Builder" src="https://acorexui.com/public/acorex-slang-dark.svg" width="100%">
|
|
54
|
+
</picture>
|
|
55
|
+
|
|
56
|
+
## Team Leads
|
|
57
|
+
|
|
58
|
+
| Arash Oshnoudi | Ali Safari |
|
|
59
|
+
| ------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------- |
|
|
60
|
+
|  |  |
|
|
61
|
+
|
|
62
|
+
## Develop Team
|
|
63
|
+
|
|
64
|
+
| Reza Safari | Matin Givi | Shahin Kahrizi | Mohammad Parsaeifard | Mojtaba Erfan Rad |
|
|
65
|
+
| --------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
66
|
+
|  |  |  |  |  |
|
|
67
|
+
|
|
68
|
+
## Design Team
|
|
69
|
+
|
|
70
|
+
| Mohammad Hasanzade | Meysa Aghili |
|
|
71
|
+
| -------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
72
|
+
|  |  |
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { AXChartTooltipData } from '@acorex/charts/chart-tooltip';
|
|
2
|
+
import { OnDestroy } from '@angular/core';
|
|
3
|
+
import { AXBarChartClickEvent, AXPBarChartData, AXPBarChartOption } from './bar-chart.type';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare const AXBarChartColors: {
|
|
6
|
+
defaultColors: string[];
|
|
7
|
+
getColor: (index: number, customPalette?: string[]) => string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Bar Chart Component
|
|
11
|
+
* Renders data as vertical bars with interactive hover effects and animations
|
|
12
|
+
*/
|
|
13
|
+
export declare class AXBarChartComponent implements OnDestroy {
|
|
14
|
+
/** Chart data input */
|
|
15
|
+
data: import("@angular/core").InputSignal<AXPBarChartData[]>;
|
|
16
|
+
/** Chart options input */
|
|
17
|
+
options: import("@angular/core").InputSignal<AXPBarChartOption>;
|
|
18
|
+
/** Emitted when a bar is clicked */
|
|
19
|
+
barClick: import("@angular/core").OutputEmitterRef<AXBarChartClickEvent>;
|
|
20
|
+
private readonly chartContainerEl;
|
|
21
|
+
protected d3: typeof import('d3');
|
|
22
|
+
private svg;
|
|
23
|
+
private chart;
|
|
24
|
+
private xScale;
|
|
25
|
+
private yScale;
|
|
26
|
+
private xAxis;
|
|
27
|
+
private yAxis;
|
|
28
|
+
private width;
|
|
29
|
+
private height;
|
|
30
|
+
private margin;
|
|
31
|
+
private _tooltipVisible;
|
|
32
|
+
private _tooltipPosition;
|
|
33
|
+
private _tooltipData;
|
|
34
|
+
private _initialized;
|
|
35
|
+
private _rendered;
|
|
36
|
+
protected tooltipVisible: import("@angular/core").Signal<boolean>;
|
|
37
|
+
protected tooltipPosition: import("@angular/core").Signal<{
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
}>;
|
|
41
|
+
protected tooltipData: import("@angular/core").Signal<AXChartTooltipData>;
|
|
42
|
+
private configToken;
|
|
43
|
+
protected effectiveOptions: import("@angular/core").Signal<{
|
|
44
|
+
width?: number;
|
|
45
|
+
height?: number;
|
|
46
|
+
margin?: {
|
|
47
|
+
top: number;
|
|
48
|
+
right: number;
|
|
49
|
+
bottom: number;
|
|
50
|
+
left: number;
|
|
51
|
+
};
|
|
52
|
+
showXAxis?: boolean;
|
|
53
|
+
showYAxis?: boolean;
|
|
54
|
+
showGrid?: boolean;
|
|
55
|
+
xAxisLabel?: string;
|
|
56
|
+
yAxisLabel?: string;
|
|
57
|
+
showTooltip?: boolean;
|
|
58
|
+
barWidth?: number;
|
|
59
|
+
cornerRadius?: number;
|
|
60
|
+
animationDuration?: number;
|
|
61
|
+
animationEasing?: "linear" | "ease" | "ease-in" | "ease-out" | "ease-in-out" | "cubic" | "cubic-in" | "cubic-out" | "cubic-in-out";
|
|
62
|
+
}>;
|
|
63
|
+
constructor();
|
|
64
|
+
ngOnDestroy(): void;
|
|
65
|
+
/**
|
|
66
|
+
* Loads D3.js dynamically
|
|
67
|
+
*/
|
|
68
|
+
protected loadD3(): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Creates the bar chart SVG and renders all elements
|
|
71
|
+
*/
|
|
72
|
+
protected createChart(): void;
|
|
73
|
+
/**
|
|
74
|
+
* Updates the chart when inputs change
|
|
75
|
+
*/
|
|
76
|
+
protected updateChart(): void;
|
|
77
|
+
/**
|
|
78
|
+
* Cleans up chart resources
|
|
79
|
+
*/
|
|
80
|
+
protected cleanupChart(): void;
|
|
81
|
+
/**
|
|
82
|
+
* Sets up chart dimensions and creates SVG with responsive attributes
|
|
83
|
+
*/
|
|
84
|
+
private setupDimensions;
|
|
85
|
+
/**
|
|
86
|
+
* Calculates chart margins based on options
|
|
87
|
+
*/
|
|
88
|
+
private calculateMargins;
|
|
89
|
+
/**
|
|
90
|
+
* Creates x and y scales for the chart
|
|
91
|
+
*/
|
|
92
|
+
private setupScales;
|
|
93
|
+
/**
|
|
94
|
+
* Creates x and y axes with grid lines
|
|
95
|
+
*/
|
|
96
|
+
private createAxes;
|
|
97
|
+
/**
|
|
98
|
+
* Renders the bars with animations
|
|
99
|
+
*/
|
|
100
|
+
private renderBars;
|
|
101
|
+
/**
|
|
102
|
+
* Gets the appropriate D3 easing function based on the option string
|
|
103
|
+
*/
|
|
104
|
+
private getEasingFunction;
|
|
105
|
+
/**
|
|
106
|
+
* Handles bar hover event and shows tooltip
|
|
107
|
+
*/
|
|
108
|
+
private handleBarHover;
|
|
109
|
+
/**
|
|
110
|
+
* Updates tooltip position based on mouse coordinates
|
|
111
|
+
*/
|
|
112
|
+
private updateTooltipPosition;
|
|
113
|
+
/**
|
|
114
|
+
* Handles bar click event
|
|
115
|
+
*/
|
|
116
|
+
private handleBarClick;
|
|
117
|
+
/**
|
|
118
|
+
* Shows a message when no data is available
|
|
119
|
+
*/
|
|
120
|
+
private showNoDataMessage;
|
|
121
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXBarChartComponent, never>;
|
|
122
|
+
static ɵcmp: i0.ɵɵ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>;
|
|
123
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
import { AXPBarChartOption } from './bar-chart.type';
|
|
3
|
+
export declare const AXBarChartDefaultConfig: AXPBarChartOption;
|
|
4
|
+
export declare const AX_BAR_CHART_CONFIG: InjectionToken<AXPBarChartOption>;
|
|
5
|
+
export type PartialBarChartConfig = Partial<AXPBarChartOption>;
|
|
6
|
+
export declare function barChartConfig(config?: PartialBarChartConfig): AXPBarChartOption;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bar chart data item interface
|
|
3
|
+
*/
|
|
4
|
+
export interface AXPBarChartData {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
value: number;
|
|
8
|
+
color?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Bar chart click event interface
|
|
12
|
+
*/
|
|
13
|
+
export interface AXBarChartClickEvent {
|
|
14
|
+
item: AXPBarChartData;
|
|
15
|
+
event: MouseEvent;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Bar chart options interface
|
|
19
|
+
*/
|
|
20
|
+
export interface AXPBarChartOption {
|
|
21
|
+
width?: number;
|
|
22
|
+
height?: number;
|
|
23
|
+
margin?: {
|
|
24
|
+
top: number;
|
|
25
|
+
right: number;
|
|
26
|
+
bottom: number;
|
|
27
|
+
left: number;
|
|
28
|
+
};
|
|
29
|
+
showXAxis?: boolean;
|
|
30
|
+
showYAxis?: boolean;
|
|
31
|
+
showGrid?: boolean;
|
|
32
|
+
xAxisLabel?: string;
|
|
33
|
+
yAxisLabel?: string;
|
|
34
|
+
showTooltip?: boolean;
|
|
35
|
+
barWidth?: number;
|
|
36
|
+
cornerRadius?: number;
|
|
37
|
+
animationDuration?: number;
|
|
38
|
+
animationEasing?: 'linear' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'cubic' | 'cubic-in' | 'cubic-out' | 'cubic-in-out';
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Bar chart data type returned by getValue()
|
|
42
|
+
* Represents an array of bar chart data items
|
|
43
|
+
*/
|
|
44
|
+
export type AXPBarChartValue = AXPBarChartData[];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ElementRef, NgZone } from '@angular/core';
|
|
2
|
+
import { AXChartTooltipData } from './chart-tooltip.type';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class AXChartTooltipComponent {
|
|
5
|
+
private ngZone;
|
|
6
|
+
data: import("@angular/core").InputSignal<AXChartTooltipData>;
|
|
7
|
+
position: import("@angular/core").InputSignal<{
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
}>;
|
|
11
|
+
visible: import("@angular/core").InputSignal<boolean>;
|
|
12
|
+
/**
|
|
13
|
+
* Whether to show the tooltip's percentage badge
|
|
14
|
+
*/
|
|
15
|
+
showPercentage: import("@angular/core").InputSignal<boolean>;
|
|
16
|
+
/**
|
|
17
|
+
* Optional custom styling for the tooltip
|
|
18
|
+
*/
|
|
19
|
+
style: import("@angular/core").InputSignal<{
|
|
20
|
+
[key: string]: string;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Reference to tooltip container for measuring dimensions
|
|
24
|
+
*/
|
|
25
|
+
tooltipContainer?: ElementRef<HTMLDivElement>;
|
|
26
|
+
protected tooltipWidth: number;
|
|
27
|
+
protected tooltipHeight: number;
|
|
28
|
+
constructor(ngZone: NgZone);
|
|
29
|
+
/**
|
|
30
|
+
* Updates tooltip dimensions after it's rendered
|
|
31
|
+
*/
|
|
32
|
+
protected updateTooltipDimensions(): void;
|
|
33
|
+
/**
|
|
34
|
+
* Get adjusted tooltip position
|
|
35
|
+
* Exposes properties for parent components to query tooltip dimensions
|
|
36
|
+
*/
|
|
37
|
+
getDimensions(): {
|
|
38
|
+
width: number;
|
|
39
|
+
height: number;
|
|
40
|
+
};
|
|
41
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXChartTooltipComponent, never>;
|
|
42
|
+
static ɵcmp: i0.ɵɵ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>;
|
|
43
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { AXChartTooltipData } from '@acorex/charts/chart-tooltip';
|
|
2
|
+
import { OnDestroy } from '@angular/core';
|
|
3
|
+
import { AXPDonutChartData, AXPDonutChartOption, AXPDonutChartValue } from './donut-chart.type';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare const AXDonutChartColors: {
|
|
6
|
+
defaultColors: string[];
|
|
7
|
+
getColor: (index: number, customPalette?: string[]) => string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Donut Chart Component
|
|
11
|
+
* Displays data in a circular donut chart with interactive segments
|
|
12
|
+
*/
|
|
13
|
+
export declare class AXDonutChartComponent implements OnDestroy {
|
|
14
|
+
private cdr;
|
|
15
|
+
/** Chart data input */
|
|
16
|
+
data: import("@angular/core").InputSignal<AXPDonutChartValue>;
|
|
17
|
+
/** Chart options input */
|
|
18
|
+
options: import("@angular/core").InputSignal<AXPDonutChartOption>;
|
|
19
|
+
/** Emitted when a segment is clicked */
|
|
20
|
+
segmentClick: import("@angular/core").OutputEmitterRef<AXPDonutChartData>;
|
|
21
|
+
/** Emitted when a segment has mouse hover
|
|
22
|
+
* Can be used by external elements to highlight this segment
|
|
23
|
+
*/
|
|
24
|
+
segmentHover: import("@angular/core").OutputEmitterRef<AXPDonutChartData>;
|
|
25
|
+
private readonly chartContainerEl;
|
|
26
|
+
protected d3: typeof import('d3');
|
|
27
|
+
private svg;
|
|
28
|
+
private pieData;
|
|
29
|
+
private hiddenSegments;
|
|
30
|
+
private _initialized;
|
|
31
|
+
private _rendered;
|
|
32
|
+
private _tooltipVisible;
|
|
33
|
+
private _tooltipPosition;
|
|
34
|
+
private _tooltipData;
|
|
35
|
+
protected tooltipVisible: import("@angular/core").Signal<boolean>;
|
|
36
|
+
protected tooltipPosition: import("@angular/core").Signal<{
|
|
37
|
+
x: number;
|
|
38
|
+
y: number;
|
|
39
|
+
}>;
|
|
40
|
+
protected tooltipData: import("@angular/core").Signal<AXChartTooltipData>;
|
|
41
|
+
private configToken;
|
|
42
|
+
protected effectiveOptions: import("@angular/core").Signal<{
|
|
43
|
+
width?: number;
|
|
44
|
+
height?: number;
|
|
45
|
+
showTooltip?: boolean;
|
|
46
|
+
donutWidth?: number;
|
|
47
|
+
cornerRadius?: number;
|
|
48
|
+
animationDuration?: number;
|
|
49
|
+
animationEasing?: "linear" | "ease" | "ease-in" | "ease-out" | "ease-in-out" | "cubic" | "cubic-in" | "cubic-out" | "cubic-in-out";
|
|
50
|
+
}>;
|
|
51
|
+
protected chartDataArray: import("@angular/core").Signal<AXPDonutChartData[]>;
|
|
52
|
+
protected getColor(index: number): string;
|
|
53
|
+
protected isSegmentHidden(id: string): boolean;
|
|
54
|
+
constructor();
|
|
55
|
+
/**
|
|
56
|
+
* Highlights a specific segment by ID
|
|
57
|
+
* @param id The segment ID to highlight, or null to clear highlight
|
|
58
|
+
*/
|
|
59
|
+
highlightSegment(id: string | null): void;
|
|
60
|
+
/**
|
|
61
|
+
* Toggles visibility of a segment by ID
|
|
62
|
+
* @param id Segment ID to toggle
|
|
63
|
+
* @returns New visibility state (true = visible, false = hidden)
|
|
64
|
+
*/
|
|
65
|
+
toggleSegment(id: string): boolean;
|
|
66
|
+
ngOnDestroy(): void;
|
|
67
|
+
/**
|
|
68
|
+
* Loads D3.js dynamically
|
|
69
|
+
*/
|
|
70
|
+
protected loadD3(): Promise<void>;
|
|
71
|
+
protected onSegmentClick(item: AXPDonutChartData): void;
|
|
72
|
+
/**
|
|
73
|
+
* Creates the donut chart
|
|
74
|
+
*/
|
|
75
|
+
protected createChart(): void;
|
|
76
|
+
/**
|
|
77
|
+
* Updates the chart with new data
|
|
78
|
+
*/
|
|
79
|
+
protected updateChart(): void;
|
|
80
|
+
/**
|
|
81
|
+
* Clears the chart container
|
|
82
|
+
*/
|
|
83
|
+
private clearChart;
|
|
84
|
+
/**
|
|
85
|
+
* Shows a message when no data is available
|
|
86
|
+
*/
|
|
87
|
+
private showNoDataMessage;
|
|
88
|
+
/**
|
|
89
|
+
* Shows a message when all segments are hidden
|
|
90
|
+
*/
|
|
91
|
+
private showAllSegmentsHiddenMessage;
|
|
92
|
+
/**
|
|
93
|
+
* Setups chart dimensions based on container and options
|
|
94
|
+
*/
|
|
95
|
+
private setupDimensions;
|
|
96
|
+
/**
|
|
97
|
+
* Renders the donut chart with visible data
|
|
98
|
+
*/
|
|
99
|
+
private renderDonutChart;
|
|
100
|
+
/**
|
|
101
|
+
* Create SVG element with filter definitions for shadows
|
|
102
|
+
*/
|
|
103
|
+
private createSvgWithFilters;
|
|
104
|
+
/**
|
|
105
|
+
* Create and render the donut segments with animations
|
|
106
|
+
*/
|
|
107
|
+
private createDonutSegments;
|
|
108
|
+
/**
|
|
109
|
+
* Gets the appropriate D3 easing function based on the option string
|
|
110
|
+
*/
|
|
111
|
+
private getEasingFunction;
|
|
112
|
+
/**
|
|
113
|
+
* Handle hover effects on a segment
|
|
114
|
+
*/
|
|
115
|
+
private handleSegmentHover;
|
|
116
|
+
/**
|
|
117
|
+
* Handles mouse leave from segments
|
|
118
|
+
*/
|
|
119
|
+
private handleSegmentLeave;
|
|
120
|
+
/**
|
|
121
|
+
* Updates tooltip position
|
|
122
|
+
* Ensures the tooltip is visible by adjusting position when near edges
|
|
123
|
+
*/
|
|
124
|
+
private updateTooltipPosition;
|
|
125
|
+
/**
|
|
126
|
+
* Toggles the visibility of a segment
|
|
127
|
+
*/
|
|
128
|
+
private toggleSegmentVisibility;
|
|
129
|
+
/**
|
|
130
|
+
* Adds center display with total value
|
|
131
|
+
*/
|
|
132
|
+
private addCenterDisplay;
|
|
133
|
+
/**
|
|
134
|
+
* Handles chart rendering errors
|
|
135
|
+
*/
|
|
136
|
+
private handleChartError;
|
|
137
|
+
/**
|
|
138
|
+
* Cleans up chart resources
|
|
139
|
+
*/
|
|
140
|
+
private cleanupChart;
|
|
141
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXDonutChartComponent, never>;
|
|
142
|
+
static ɵcmp: i0.ɵɵ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>;
|
|
143
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
import { AXPDonutChartOption } from './donut-chart.type';
|
|
3
|
+
export declare const AXDonutChartDefaultConfig: AXPDonutChartOption;
|
|
4
|
+
export declare const AX_DONUT_CHART_CONFIG: InjectionToken<AXPDonutChartOption>;
|
|
5
|
+
export type PartialDonutChartConfig = Partial<AXPDonutChartOption>;
|
|
6
|
+
export declare function donutChartConfig(config?: PartialDonutChartConfig): AXPDonutChartOption;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a single segment in the donut chart
|
|
3
|
+
*/
|
|
4
|
+
export interface AXPDonutChartData {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
value: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Configuration options for the donut chart
|
|
11
|
+
*/
|
|
12
|
+
export interface AXPDonutChartOption {
|
|
13
|
+
width?: number;
|
|
14
|
+
height?: number;
|
|
15
|
+
showTooltip?: boolean;
|
|
16
|
+
donutWidth?: number;
|
|
17
|
+
cornerRadius?: number;
|
|
18
|
+
animationDuration?: number;
|
|
19
|
+
animationEasing?: 'linear' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'cubic' | 'cubic-in' | 'cubic-out' | 'cubic-in-out';
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Data structure provided to the chart component
|
|
23
|
+
* Can be an array of AXPDonutChartData directly
|
|
24
|
+
*/
|
|
25
|
+
export type AXPDonutChartValue = AXPDonutChartData[];
|