@acorex/charts 0.0.1
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 +211 -0
- package/chart-legend/index.d.ts +104 -0
- package/chart-tooltip/README.md +3 -0
- package/chart-tooltip/index.d.ts +54 -0
- package/donut-chart/README.md +3 -0
- package/donut-chart/index.d.ts +251 -0
- package/fesm2022/acorex-charts-bar-chart.mjs +772 -0
- package/fesm2022/acorex-charts-bar-chart.mjs.map +1 -0
- 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 +74 -0
- package/fesm2022/acorex-charts-chart-tooltip.mjs.map +1 -0
- package/fesm2022/acorex-charts-donut-chart.mjs +758 -0
- package/fesm2022/acorex-charts-donut-chart.mjs.map +1 -0
- package/fesm2022/acorex-charts-gauge-chart.mjs +686 -0
- package/fesm2022/acorex-charts-gauge-chart.mjs.map +1 -0
- package/fesm2022/acorex-charts-hierarchy-chart.mjs +700 -0
- package/fesm2022/acorex-charts-hierarchy-chart.mjs.map +1 -0
- package/fesm2022/acorex-charts-line-chart.mjs +995 -0
- package/fesm2022/acorex-charts-line-chart.mjs.map +1 -0
- package/fesm2022/acorex-charts.mjs +41 -0
- package/fesm2022/acorex-charts.mjs.map +1 -0
- package/gauge-chart/README.md +3 -0
- package/gauge-chart/index.d.ts +218 -0
- package/hierarchy-chart/README.md +61 -0
- package/hierarchy-chart/index.d.ts +368 -0
- package/index.d.ts +14 -0
- package/line-chart/README.md +3 -0
- package/line-chart/index.d.ts +184 -0
- package/package.json +52 -0
|
@@ -0,0 +1,218 @@
|
|
|
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 { AXChartTooltipData } from '@acorex/charts/chart-tooltip';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Gauge chart data item interface
|
|
10
|
+
*/
|
|
11
|
+
interface AXGaugeChartData {
|
|
12
|
+
id: string;
|
|
13
|
+
value: number;
|
|
14
|
+
color?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Gauge chart options interface
|
|
18
|
+
*
|
|
19
|
+
* ## Design Tokens
|
|
20
|
+
* The component supports the following CSS custom properties:
|
|
21
|
+
*
|
|
22
|
+
* ### `--ax-comp-gauge-chart-bg-color`
|
|
23
|
+
* Background color for the chart area.
|
|
24
|
+
* Default: `var(--ax-sys-color-lightest-surface)`
|
|
25
|
+
* Usage: `rgb(var(--ax-comp-gauge-chart-bg-color))`
|
|
26
|
+
*
|
|
27
|
+
* ### `--ax-comp-gauge-chart-text-color`
|
|
28
|
+
* Text color for all labels, values, and indicators.
|
|
29
|
+
* Default: `var(--ax-sys-color-on-lightest-surface)`
|
|
30
|
+
* Usage: `rgb(var(--ax-comp-gauge-chart-text-color))`
|
|
31
|
+
*
|
|
32
|
+
* ### `--ax-comp-gauge-chart-track-color`
|
|
33
|
+
* Color for the gauge track (background arc).
|
|
34
|
+
* Default: `var(--ax-sys-color-gray-200)`
|
|
35
|
+
* Usage: `rgb(var(--ax-comp-gauge-chart-track-color))`
|
|
36
|
+
*
|
|
37
|
+
* ### `--ax-comp-gauge-chart-needle-color`
|
|
38
|
+
* Color for the gauge needle indicator.
|
|
39
|
+
* Default: `var(--ax-sys-color-primary-500)`
|
|
40
|
+
* Usage: `rgb(var(--ax-comp-gauge-chart-needle-color))`
|
|
41
|
+
*
|
|
42
|
+
* ## Usage
|
|
43
|
+
* Override these tokens in your CSS to customize the chart's appearance:
|
|
44
|
+
* ```css
|
|
45
|
+
* ax-gauge-chart {
|
|
46
|
+
* --ax-comp-gauge-chart-bg-color: var(--your-custom-background);
|
|
47
|
+
* --ax-comp-gauge-chart-text-color: var(--your-custom-text-color);
|
|
48
|
+
* --ax-comp-gauge-chart-track-color: var(--your-custom-track-color);
|
|
49
|
+
* --ax-comp-gauge-chart-needle-color: var(--your-custom-needle-color);
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
interface AXGaugeChartOption {
|
|
54
|
+
minValue?: number;
|
|
55
|
+
maxValue?: number;
|
|
56
|
+
width?: number;
|
|
57
|
+
height?: number;
|
|
58
|
+
gaugeWidth?: number;
|
|
59
|
+
cornerRadius?: number;
|
|
60
|
+
showValue?: boolean;
|
|
61
|
+
showTooltip?: boolean;
|
|
62
|
+
thresholds?: {
|
|
63
|
+
value: number;
|
|
64
|
+
color: string;
|
|
65
|
+
label?: string;
|
|
66
|
+
}[];
|
|
67
|
+
label?: string;
|
|
68
|
+
animationDuration?: number;
|
|
69
|
+
animationEasing?: AXAnimationEasing;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Gauge chart data type
|
|
73
|
+
* Represents a single gauge value
|
|
74
|
+
*/
|
|
75
|
+
type AXGaugeChartValue = number;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Gauge Chart Component
|
|
79
|
+
* Renders a semi-circular gauge chart with animated needle and thresholds
|
|
80
|
+
*/
|
|
81
|
+
declare class AXGaugeChartComponent implements OnDestroy {
|
|
82
|
+
private cdr;
|
|
83
|
+
/** Chart value input */
|
|
84
|
+
value: _angular_core.InputSignal<number>;
|
|
85
|
+
/** Chart options input */
|
|
86
|
+
options: _angular_core.InputSignal<AXGaugeChartOption>;
|
|
87
|
+
private readonly chartContainerEl;
|
|
88
|
+
private svgElement;
|
|
89
|
+
protected d3: typeof d3;
|
|
90
|
+
private _initialized;
|
|
91
|
+
private _rendered;
|
|
92
|
+
private _prevValue;
|
|
93
|
+
private _prevOptionsString;
|
|
94
|
+
private _tooltipVisible;
|
|
95
|
+
private _tooltipPosition;
|
|
96
|
+
private _tooltipData;
|
|
97
|
+
protected tooltipVisible: _angular_core.Signal<boolean>;
|
|
98
|
+
protected tooltipPosition: _angular_core.Signal<{
|
|
99
|
+
x: number;
|
|
100
|
+
y: number;
|
|
101
|
+
}>;
|
|
102
|
+
protected tooltipData: _angular_core.Signal<AXChartTooltipData>;
|
|
103
|
+
private configToken;
|
|
104
|
+
protected effectiveOptions: _angular_core.Signal<{
|
|
105
|
+
minValue?: number;
|
|
106
|
+
maxValue?: number;
|
|
107
|
+
width?: number;
|
|
108
|
+
height?: number;
|
|
109
|
+
gaugeWidth?: number;
|
|
110
|
+
cornerRadius?: number;
|
|
111
|
+
showValue?: boolean;
|
|
112
|
+
showTooltip?: boolean;
|
|
113
|
+
thresholds?: {
|
|
114
|
+
value: number;
|
|
115
|
+
color: string;
|
|
116
|
+
label?: string;
|
|
117
|
+
}[];
|
|
118
|
+
label?: string;
|
|
119
|
+
animationDuration?: number;
|
|
120
|
+
animationEasing?: _acorex_cdk_common.AXAnimationEasing;
|
|
121
|
+
}>;
|
|
122
|
+
constructor();
|
|
123
|
+
ngOnDestroy(): void;
|
|
124
|
+
/**
|
|
125
|
+
* Loads D3.js dynamically
|
|
126
|
+
*/
|
|
127
|
+
protected loadD3(): Promise<void>;
|
|
128
|
+
/**
|
|
129
|
+
* Creates the gauge chart with all elements
|
|
130
|
+
*/
|
|
131
|
+
protected createChart(): void;
|
|
132
|
+
/**
|
|
133
|
+
* Updates the chart when options change
|
|
134
|
+
*/
|
|
135
|
+
protected updateChart(): void;
|
|
136
|
+
/**
|
|
137
|
+
* Updates only the value display and dial position without recreating the chart
|
|
138
|
+
*/
|
|
139
|
+
protected updateValueAndDial(value: number): void;
|
|
140
|
+
/**
|
|
141
|
+
* Draw the background arc
|
|
142
|
+
*/
|
|
143
|
+
private drawBackgroundArc;
|
|
144
|
+
/**
|
|
145
|
+
* Draw the thresholds arcs
|
|
146
|
+
*/
|
|
147
|
+
private drawThresholds;
|
|
148
|
+
/**
|
|
149
|
+
* Shows tooltip for a threshold arc
|
|
150
|
+
*/
|
|
151
|
+
private showThresholdTooltip;
|
|
152
|
+
/**
|
|
153
|
+
* Shows tooltip for the entire range when no thresholds are defined
|
|
154
|
+
*/
|
|
155
|
+
private showSingleRangeTooltip;
|
|
156
|
+
/**
|
|
157
|
+
* Updates the tooltip position based on the mouse event
|
|
158
|
+
*/
|
|
159
|
+
private updateTooltipPosition;
|
|
160
|
+
/**
|
|
161
|
+
* Hides the tooltip
|
|
162
|
+
*/
|
|
163
|
+
private hideTooltip;
|
|
164
|
+
/**
|
|
165
|
+
* Cleans up chart resources
|
|
166
|
+
*/
|
|
167
|
+
protected cleanupChart(): void;
|
|
168
|
+
/**
|
|
169
|
+
* Creates gradient definitions for thresholds
|
|
170
|
+
*/
|
|
171
|
+
private createGradients;
|
|
172
|
+
/**
|
|
173
|
+
* Draws tick marks and labels around the gauge
|
|
174
|
+
*/
|
|
175
|
+
private drawTicks;
|
|
176
|
+
/**
|
|
177
|
+
* Draws the value and label text in the center
|
|
178
|
+
*/
|
|
179
|
+
private drawValueDisplay;
|
|
180
|
+
/**
|
|
181
|
+
* Draws the dial/needle pointing to the current value with animation
|
|
182
|
+
*/
|
|
183
|
+
private drawDial;
|
|
184
|
+
/**
|
|
185
|
+
* Gets the appropriate D3 easing function based on the option string
|
|
186
|
+
*/
|
|
187
|
+
private getEasingFunction;
|
|
188
|
+
/**
|
|
189
|
+
* Creates a path string for the needle
|
|
190
|
+
*/
|
|
191
|
+
private createNeedlePath;
|
|
192
|
+
/**
|
|
193
|
+
* Scales a value to an angle (in radians)
|
|
194
|
+
*/
|
|
195
|
+
private scaleValueToAngle;
|
|
196
|
+
/**
|
|
197
|
+
* Scales a value to an angle for color arcs (in radians)
|
|
198
|
+
*/
|
|
199
|
+
private scaleValueToColorAngle;
|
|
200
|
+
/**
|
|
201
|
+
* Converts an angle back to a value
|
|
202
|
+
*/
|
|
203
|
+
private angleToValue;
|
|
204
|
+
/**
|
|
205
|
+
* Converts radians to degrees
|
|
206
|
+
*/
|
|
207
|
+
private radiansToDegrees;
|
|
208
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXGaugeChartComponent, never>;
|
|
209
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AXGaugeChartComponent, "ax-gauge-chart", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
declare const AXGaugeChartDefaultConfig: AXGaugeChartOption;
|
|
213
|
+
declare const AX_GAUGE_CHART_CONFIG: InjectionToken<AXGaugeChartOption>;
|
|
214
|
+
type PartialGaugeChartConfig = Partial<AXGaugeChartOption>;
|
|
215
|
+
declare function gaugeChartConfig(config?: PartialGaugeChartConfig): AXGaugeChartOption;
|
|
216
|
+
|
|
217
|
+
export { AXGaugeChartComponent, AXGaugeChartDefaultConfig, AX_GAUGE_CHART_CONFIG, gaugeChartConfig };
|
|
218
|
+
export type { AXGaugeChartData, AXGaugeChartOption, AXGaugeChartValue, PartialGaugeChartConfig };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Acorex Hierarchy Tree Chart
|
|
2
|
+
|
|
3
|
+
A responsive, interactive tree chart component for visualizing hierarchical data structures.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Vertical or horizontal orientation
|
|
8
|
+
- Collapsible nodes
|
|
9
|
+
- Customizable styling
|
|
10
|
+
- Interactive tooltips
|
|
11
|
+
- Zoom and pan support
|
|
12
|
+
- Multiple link styles (curved, straight, elbow)
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
// Component template
|
|
18
|
+
<ax-hierarchy-chart
|
|
19
|
+
[data]="treeData()"
|
|
20
|
+
[options]="chartOptions()"
|
|
21
|
+
(nodeClick)="handleNodeClick($event)"
|
|
22
|
+
(nodeCollapse)="handleNodeCollapse($event)"
|
|
23
|
+
></ax-hierarchy-chart>
|
|
24
|
+
|
|
25
|
+
// Component class
|
|
26
|
+
import { AXHierarchyTreeData, AXHierarchyTreeOption } from '@acorex/chart/hierarchy-chart';
|
|
27
|
+
|
|
28
|
+
treeData = signal<AXHierarchyTreeData>({
|
|
29
|
+
rootNodes: [
|
|
30
|
+
{
|
|
31
|
+
id: 'root',
|
|
32
|
+
label: 'Root',
|
|
33
|
+
children: [
|
|
34
|
+
{
|
|
35
|
+
id: 'child1',
|
|
36
|
+
label: 'Child 1',
|
|
37
|
+
children: [
|
|
38
|
+
{ id: 'child1-1', label: 'Child 1.1' },
|
|
39
|
+
{ id: 'child1-2', label: 'Child 1.2' }
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: 'child2',
|
|
44
|
+
label: 'Child 2',
|
|
45
|
+
children: [
|
|
46
|
+
{ id: 'child2-1', label: 'Child 2.1' }
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
chartOptions = signal<AXHierarchyTreeOption>({
|
|
55
|
+
orientation: 'vertical',
|
|
56
|
+
linkStyle: 'curved',
|
|
57
|
+
showTooltip: true,
|
|
58
|
+
expandOnClick: true,
|
|
59
|
+
enableZoom: true
|
|
60
|
+
});
|
|
61
|
+
```
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
import * as _acorex_cdk_common from '@acorex/cdk/common';
|
|
2
|
+
import { AXAnimationEasing, NXNativeEvent, NXComponent } from '@acorex/cdk/common';
|
|
3
|
+
import * as _angular_core from '@angular/core';
|
|
4
|
+
import { TemplateRef, InjectionToken } from '@angular/core';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents a node in the hierarchy chart.
|
|
8
|
+
*/
|
|
9
|
+
interface AXHierarchyChartNode {
|
|
10
|
+
/**
|
|
11
|
+
* Unique identifier for the node
|
|
12
|
+
*/
|
|
13
|
+
id: string;
|
|
14
|
+
/**
|
|
15
|
+
* Display name for the node
|
|
16
|
+
*/
|
|
17
|
+
name?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Display label for the node (alternative to name)
|
|
20
|
+
*/
|
|
21
|
+
label?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Value associated with the node (used for calculations if needed)
|
|
24
|
+
*/
|
|
25
|
+
value?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Optional tooltip text to display on hover
|
|
28
|
+
*/
|
|
29
|
+
tooltip?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Optional subtitle text to be displayed
|
|
32
|
+
*/
|
|
33
|
+
subtitle?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Optional description or additional information
|
|
36
|
+
*/
|
|
37
|
+
description?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Optional icon to be displayed with the node
|
|
40
|
+
*/
|
|
41
|
+
icon?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Optional type category for the node
|
|
44
|
+
*/
|
|
45
|
+
type?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Optional color to apply to the node
|
|
48
|
+
*/
|
|
49
|
+
color?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the node is initially expanded (if it has children)
|
|
52
|
+
*/
|
|
53
|
+
isExpanded?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Child nodes
|
|
56
|
+
*/
|
|
57
|
+
children?: AXHierarchyChartNode[];
|
|
58
|
+
/**
|
|
59
|
+
* Reference to parent node ID
|
|
60
|
+
*/
|
|
61
|
+
parentId?: string | null;
|
|
62
|
+
/**
|
|
63
|
+
* Additional metadata (can be used for custom rendering or logic)
|
|
64
|
+
*/
|
|
65
|
+
metadata?: Record<string, any>;
|
|
66
|
+
/**
|
|
67
|
+
* Current expanded state (set by component during rendering)
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
70
|
+
expanded?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Function to toggle the expanded state of this node (set by component during rendering)
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
toggleExpanded?: () => void;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Hierarchy chart data type
|
|
79
|
+
*/
|
|
80
|
+
type AXHierarchyChartData = AXHierarchyChartNode;
|
|
81
|
+
/**
|
|
82
|
+
* Margin configuration for the chart
|
|
83
|
+
*/
|
|
84
|
+
interface AXHierarchyChartMargin {
|
|
85
|
+
top: number;
|
|
86
|
+
right: number;
|
|
87
|
+
bottom: number;
|
|
88
|
+
left: number;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Configuration options for the hierarchy chart
|
|
92
|
+
*
|
|
93
|
+
* ## Design Tokens
|
|
94
|
+
* The component supports the following CSS custom properties:
|
|
95
|
+
*
|
|
96
|
+
* ### `--ax-comp-hierarchy-chart-node-color`
|
|
97
|
+
* Fill color for nodes when no custom template is used.
|
|
98
|
+
* Default: `var(--ax-sys-color-primary-500)`
|
|
99
|
+
* Usage: `rgb(var(--ax-comp-hierarchy-chart-node-color))`
|
|
100
|
+
*
|
|
101
|
+
* ### `--ax-comp-hierarchy-chart-node-stroke-color`
|
|
102
|
+
* Stroke color for node outlines when no custom template is used.
|
|
103
|
+
* Default: `var(--ax-sys-color-primary-400)`
|
|
104
|
+
* Usage: `rgb(var(--ax-comp-hierarchy-chart-node-stroke-color))`
|
|
105
|
+
*
|
|
106
|
+
* ### `--ax-comp-hierarchy-chart-link-color`
|
|
107
|
+
* Color for the connection lines between nodes.
|
|
108
|
+
* Default: `var(--ax-sys-color-primary-400)`
|
|
109
|
+
* Usage: `rgb(var(--ax-comp-hierarchy-chart-link-color))`
|
|
110
|
+
*
|
|
111
|
+
* ### `--ax-comp-hierarchy-chart-text-color`
|
|
112
|
+
* Text color for labels and other text content.
|
|
113
|
+
* Default: `var(--ax-sys-color-on-lightest-surface)`
|
|
114
|
+
* Usage: `rgb(var(--ax-comp-hierarchy-chart-text-color))`
|
|
115
|
+
*
|
|
116
|
+
* ### `--ax-comp-hierarchy-chart-bg-color`
|
|
117
|
+
* Background color for the chart area.
|
|
118
|
+
* Default: `var(--ax-sys-color-lightest-surface)`
|
|
119
|
+
* Usage: `rgb(var(--ax-comp-hierarchy-chart-bg-color))`
|
|
120
|
+
*
|
|
121
|
+
* ## Usage
|
|
122
|
+
* Override these tokens in your CSS to customize the chart's appearance:
|
|
123
|
+
* ```css
|
|
124
|
+
* ax-hierarchy-chart {
|
|
125
|
+
* --ax-comp-hierarchy-chart-node-color: var(--your-custom-color);
|
|
126
|
+
* --ax-comp-hierarchy-chart-node-stroke-color: var(--your-custom-stroke);
|
|
127
|
+
* --ax-comp-hierarchy-chart-link-color: var(--your-custom-link-color);
|
|
128
|
+
* --ax-comp-hierarchy-chart-text-color: var(--your-custom-text-color);
|
|
129
|
+
* --ax-comp-hierarchy-chart-bg-color: var(--your-custom-bg-color);
|
|
130
|
+
* }
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
interface AXHierarchyChartOption {
|
|
134
|
+
/**
|
|
135
|
+
* Fixed width for the chart (px). If not provided, container width is used.
|
|
136
|
+
*/
|
|
137
|
+
width?: number;
|
|
138
|
+
/**
|
|
139
|
+
* Fixed height for the chart (px). If not provided, container height is used.
|
|
140
|
+
*/
|
|
141
|
+
height?: number;
|
|
142
|
+
/**
|
|
143
|
+
* Margins around the chart content
|
|
144
|
+
*/
|
|
145
|
+
margin?: AXHierarchyChartMargin;
|
|
146
|
+
/**
|
|
147
|
+
* Node radius in pixels (used when no custom node template is provided)
|
|
148
|
+
*/
|
|
149
|
+
nodeRadius?: number;
|
|
150
|
+
/**
|
|
151
|
+
* Node stroke width (used when no custom node template is provided)
|
|
152
|
+
*/
|
|
153
|
+
nodeStrokeWidth?: number;
|
|
154
|
+
/**
|
|
155
|
+
* Link (connection) width
|
|
156
|
+
*/
|
|
157
|
+
linkWidth?: number;
|
|
158
|
+
/**
|
|
159
|
+
* Style of the links between nodes
|
|
160
|
+
* 'straight': Direct straight lines between parent and child
|
|
161
|
+
* 'curved': Default curved lines
|
|
162
|
+
* 'rounded': Curved lines with rounded corners
|
|
163
|
+
* 'step': L-shaped stepped lines
|
|
164
|
+
*/
|
|
165
|
+
linkStyle?: 'straight' | 'curved' | 'rounded' | 'step';
|
|
166
|
+
/**
|
|
167
|
+
* Whether to show tooltips on hover
|
|
168
|
+
*/
|
|
169
|
+
showTooltip?: boolean;
|
|
170
|
+
/**
|
|
171
|
+
* Direction of the hierarchy chart layout
|
|
172
|
+
* 'vertical': top-to-bottom flow
|
|
173
|
+
* 'horizontal': left-to-right flow
|
|
174
|
+
*/
|
|
175
|
+
direction?: 'vertical' | 'horizontal';
|
|
176
|
+
/**
|
|
177
|
+
* Fixed node dimensions when using custom node templates
|
|
178
|
+
*/
|
|
179
|
+
nodeWidth?: number;
|
|
180
|
+
nodeHeight?: number;
|
|
181
|
+
/**
|
|
182
|
+
* Spacing between nodes
|
|
183
|
+
*/
|
|
184
|
+
nodeSpacingX?: number;
|
|
185
|
+
nodeSpacingY?: number;
|
|
186
|
+
/**
|
|
187
|
+
* Whether to allow node expansion/collapse
|
|
188
|
+
*/
|
|
189
|
+
collapsible?: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Whether to initially expand all nodes
|
|
192
|
+
*/
|
|
193
|
+
expandAll?: boolean;
|
|
194
|
+
/**
|
|
195
|
+
* Custom CSS class to apply to the chart container
|
|
196
|
+
*/
|
|
197
|
+
className?: string;
|
|
198
|
+
/**
|
|
199
|
+
* Duration of the animation in milliseconds
|
|
200
|
+
*/
|
|
201
|
+
animationDuration?: number;
|
|
202
|
+
/**
|
|
203
|
+
* Type of easing function to use for animations
|
|
204
|
+
*/
|
|
205
|
+
animationEasing?: AXAnimationEasing;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Context data for node template rendering.
|
|
209
|
+
* This object is passed to the custom node template.
|
|
210
|
+
* The node with expanded state and toggle function is passed as $implicit.
|
|
211
|
+
*
|
|
212
|
+
* @example
|
|
213
|
+
* ```html
|
|
214
|
+
* <ng-template #nodeTemplate let-node>
|
|
215
|
+
* <div>{{ node.name }}</div>
|
|
216
|
+
* @if (node.children?.length) {
|
|
217
|
+
* <button (click)="node.toggleExpanded()">
|
|
218
|
+
* {{ node.expanded ? 'Collapse' : 'Expand' }}
|
|
219
|
+
* </button>
|
|
220
|
+
* }
|
|
221
|
+
* </ng-template>
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
interface AXHierarchyChartNodeContext {
|
|
225
|
+
/**
|
|
226
|
+
* The node data with expanded state and toggle function (passed as $implicit parameter)
|
|
227
|
+
*/
|
|
228
|
+
$implicit: AXHierarchyChartNode & {
|
|
229
|
+
expanded: boolean;
|
|
230
|
+
toggleExpanded: () => void;
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Event data for node click events
|
|
235
|
+
*/
|
|
236
|
+
interface AXHierarchyChartClickEvent {
|
|
237
|
+
/**
|
|
238
|
+
* The original DOM event
|
|
239
|
+
*/
|
|
240
|
+
event: NXNativeEvent;
|
|
241
|
+
/**
|
|
242
|
+
* The data item that was clicked
|
|
243
|
+
*/
|
|
244
|
+
item: AXHierarchyChartNode;
|
|
245
|
+
/**
|
|
246
|
+
* The DOM element that was clicked
|
|
247
|
+
*/
|
|
248
|
+
element: HTMLElement;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Event data for node expansion/collapse events
|
|
252
|
+
*/
|
|
253
|
+
interface AXHierarchyChartToggleEvent {
|
|
254
|
+
/**
|
|
255
|
+
* The node that was toggled
|
|
256
|
+
*/
|
|
257
|
+
node: AXHierarchyChartNode;
|
|
258
|
+
/**
|
|
259
|
+
* The new expansion state
|
|
260
|
+
*/
|
|
261
|
+
expanded: boolean;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* A highly customizable hierarchical visualization component that can be used for:
|
|
266
|
+
* - Organization charts
|
|
267
|
+
* - Tree diagrams
|
|
268
|
+
* - Dependency visualizations
|
|
269
|
+
* - Process flows
|
|
270
|
+
*
|
|
271
|
+
* Supports both default node styling and custom node templates.
|
|
272
|
+
*/
|
|
273
|
+
declare class AXHierarchyChartComponent extends NXComponent {
|
|
274
|
+
private chartContainer;
|
|
275
|
+
customNodeTemplate: _angular_core.Signal<TemplateRef<AXHierarchyChartNodeContext>>;
|
|
276
|
+
private ngZone;
|
|
277
|
+
private viewContainerRef;
|
|
278
|
+
private configToken;
|
|
279
|
+
private d3;
|
|
280
|
+
private _expandedNodes;
|
|
281
|
+
private _initialized;
|
|
282
|
+
private _rendered;
|
|
283
|
+
private _dimensions;
|
|
284
|
+
private _nodeElements;
|
|
285
|
+
private _chartData;
|
|
286
|
+
data: _angular_core.InputSignal<AXHierarchyChartNode | AXHierarchyChartNode[]>;
|
|
287
|
+
options: _angular_core.InputSignal<AXHierarchyChartOption>;
|
|
288
|
+
nodeTemplate: _angular_core.InputSignal<TemplateRef<AXHierarchyChartNodeContext>>;
|
|
289
|
+
itemClick: _angular_core.OutputEmitterRef<AXHierarchyChartClickEvent>;
|
|
290
|
+
nodeToggle: _angular_core.OutputEmitterRef<AXHierarchyChartToggleEvent>;
|
|
291
|
+
protected processedData: _angular_core.Signal<AXHierarchyChartNode>;
|
|
292
|
+
protected hasCustomTemplate: _angular_core.Signal<boolean>;
|
|
293
|
+
protected effectiveOptions: _angular_core.Signal<{
|
|
294
|
+
width?: number;
|
|
295
|
+
height?: number;
|
|
296
|
+
margin?: AXHierarchyChartMargin;
|
|
297
|
+
nodeRadius?: number;
|
|
298
|
+
nodeStrokeWidth?: number;
|
|
299
|
+
linkWidth?: number;
|
|
300
|
+
linkStyle?: "straight" | "curved" | "rounded" | "step";
|
|
301
|
+
showTooltip?: boolean;
|
|
302
|
+
direction?: "vertical" | "horizontal";
|
|
303
|
+
nodeWidth?: number;
|
|
304
|
+
nodeHeight?: number;
|
|
305
|
+
nodeSpacingX?: number;
|
|
306
|
+
nodeSpacingY?: number;
|
|
307
|
+
collapsible?: boolean;
|
|
308
|
+
expandAll?: boolean;
|
|
309
|
+
className?: string;
|
|
310
|
+
animationDuration?: number;
|
|
311
|
+
animationEasing?: _acorex_cdk_common.AXAnimationEasing;
|
|
312
|
+
}>;
|
|
313
|
+
constructor();
|
|
314
|
+
/**
|
|
315
|
+
* Initialize the expanded state for all nodes
|
|
316
|
+
*/
|
|
317
|
+
private initializeExpandedState;
|
|
318
|
+
/**
|
|
319
|
+
* Dynamically load D3.js to reduce initial bundle size
|
|
320
|
+
*/
|
|
321
|
+
protected loadD3(): Promise<void>;
|
|
322
|
+
/**
|
|
323
|
+
* Update dimensions based on container size
|
|
324
|
+
*/
|
|
325
|
+
private updateDimensions;
|
|
326
|
+
/**
|
|
327
|
+
* Create and render the hierarchy chart
|
|
328
|
+
*/
|
|
329
|
+
private createChart;
|
|
330
|
+
/**
|
|
331
|
+
* Toggle node expansion state
|
|
332
|
+
*/
|
|
333
|
+
toggleNode(nodeId: string): void;
|
|
334
|
+
/**
|
|
335
|
+
* Update just the toggle indicator without redrawing the chart
|
|
336
|
+
*/
|
|
337
|
+
private updateToggleIndicator;
|
|
338
|
+
/**
|
|
339
|
+
* Find a node by ID
|
|
340
|
+
*/
|
|
341
|
+
private findNodeById;
|
|
342
|
+
/**
|
|
343
|
+
* Handle node click events
|
|
344
|
+
*/
|
|
345
|
+
private handleNodeClick;
|
|
346
|
+
/**
|
|
347
|
+
* Clear existing chart
|
|
348
|
+
*/
|
|
349
|
+
private clearChart;
|
|
350
|
+
/**
|
|
351
|
+
* Get D3 easing function from string name
|
|
352
|
+
*/
|
|
353
|
+
private getEasingFunction;
|
|
354
|
+
/**
|
|
355
|
+
* Shows a message when no data is available
|
|
356
|
+
*/
|
|
357
|
+
private showNoDataMessage;
|
|
358
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXHierarchyChartComponent, never>;
|
|
359
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AXHierarchyChartComponent, "ax-hierarchy-chart", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "nodeTemplate": { "alias": "nodeTemplate"; "required": false; "isSignal": true; }; }, { "itemClick": "itemClick"; "nodeToggle": "nodeToggle"; }, ["customNodeTemplate"], never, true, never>;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
declare const AXHierarchyChartDefaultConfig: AXHierarchyChartOption;
|
|
363
|
+
declare const AX_HIERARCHY_CHART_CONFIG: InjectionToken<AXHierarchyChartOption>;
|
|
364
|
+
type PartialHierarchyChartConfig = Partial<AXHierarchyChartOption>;
|
|
365
|
+
declare function hierarchyChartConfig(config?: PartialHierarchyChartConfig): AXHierarchyChartOption;
|
|
366
|
+
|
|
367
|
+
export { AXHierarchyChartComponent, AXHierarchyChartDefaultConfig, AX_HIERARCHY_CHART_CONFIG, hierarchyChartConfig };
|
|
368
|
+
export type { AXHierarchyChartClickEvent, AXHierarchyChartData, AXHierarchyChartMargin, AXHierarchyChartNode, AXHierarchyChartNodeContext, AXHierarchyChartOption, AXHierarchyChartToggleEvent, PartialHierarchyChartConfig };
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
declare const AX_CHART_COLOR_PALETTE: InjectionToken<string[]>;
|
|
4
|
+
/**
|
|
5
|
+
* Helper function to get a color from the palette by index
|
|
6
|
+
* @param index The index of the color to get
|
|
7
|
+
* @param palette The color palette to use
|
|
8
|
+
* @returns The color at the specified index
|
|
9
|
+
*/
|
|
10
|
+
declare function getChartColor(index: number, palette: string[]): string;
|
|
11
|
+
|
|
12
|
+
declare const AX_CHARTS = "ACOREX_CHARTS";
|
|
13
|
+
|
|
14
|
+
export { AX_CHARTS, AX_CHART_COLOR_PALETTE, getChartColor };
|