@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.
Files changed (46) hide show
  1. package/README.md +72 -0
  2. package/bar-chart/README.md +3 -0
  3. package/bar-chart/index.d.ts +3 -0
  4. package/bar-chart/lib/bar-chart.component.d.ts +123 -0
  5. package/bar-chart/lib/bar-chart.config.d.ts +6 -0
  6. package/bar-chart/lib/bar-chart.type.d.ts +44 -0
  7. package/chart-tooltip/README.md +3 -0
  8. package/chart-tooltip/index.d.ts +2 -0
  9. package/chart-tooltip/lib/chart-tooltip.component.d.ts +43 -0
  10. package/chart-tooltip/lib/chart-tooltip.type.d.ts +7 -0
  11. package/donut-chart/README.md +3 -0
  12. package/donut-chart/index.d.ts +3 -0
  13. package/donut-chart/lib/donut-chart.component.d.ts +143 -0
  14. package/donut-chart/lib/donut-chart.config.d.ts +6 -0
  15. package/donut-chart/lib/donut-chart.type.d.ts +25 -0
  16. package/fesm2022/acorex-charts-bar-chart.mjs +563 -0
  17. package/fesm2022/acorex-charts-bar-chart.mjs.map +1 -0
  18. package/fesm2022/acorex-charts-chart-tooltip.mjs +75 -0
  19. package/fesm2022/acorex-charts-chart-tooltip.mjs.map +1 -0
  20. package/fesm2022/acorex-charts-donut-chart.mjs +616 -0
  21. package/fesm2022/acorex-charts-donut-chart.mjs.map +1 -0
  22. package/fesm2022/acorex-charts-gauge-chart.mjs +548 -0
  23. package/fesm2022/acorex-charts-gauge-chart.mjs.map +1 -0
  24. package/fesm2022/acorex-charts-hierarchy-chart.mjs +652 -0
  25. package/fesm2022/acorex-charts-hierarchy-chart.mjs.map +1 -0
  26. package/fesm2022/acorex-charts-line-chart.mjs +738 -0
  27. package/fesm2022/acorex-charts-line-chart.mjs.map +1 -0
  28. package/fesm2022/acorex-charts.mjs +8 -0
  29. package/fesm2022/acorex-charts.mjs.map +1 -0
  30. package/gauge-chart/README.md +3 -0
  31. package/gauge-chart/index.d.ts +3 -0
  32. package/gauge-chart/lib/gauge-chart.component.d.ts +110 -0
  33. package/gauge-chart/lib/gauge-chart.config.d.ts +6 -0
  34. package/gauge-chart/lib/gauge-chart.type.d.ts +37 -0
  35. package/hierarchy-chart/README.md +61 -0
  36. package/hierarchy-chart/index.d.ts +3 -0
  37. package/hierarchy-chart/lib/hierarchy-chart.component.d.ts +99 -0
  38. package/hierarchy-chart/lib/hierarchy-chart.config.d.ts +6 -0
  39. package/hierarchy-chart/lib/hierarchy-chart.type.d.ts +227 -0
  40. package/index.d.ts +1 -0
  41. package/line-chart/README.md +3 -0
  42. package/line-chart/index.d.ts +3 -0
  43. package/line-chart/lib/line-chart.component.d.ts +96 -0
  44. package/line-chart/lib/line-chart.config.d.ts +6 -0
  45. package/line-chart/lib/line-chart.type.d.ts +61 -0
  46. package/package.json +48 -0
@@ -0,0 +1,227 @@
1
+ /**
2
+ * Represents a node in the hierarchy chart.
3
+ */
4
+ export interface AXHierarchyChartNode {
5
+ /**
6
+ * Unique identifier for the node
7
+ */
8
+ id: string;
9
+ /**
10
+ * Display name for the node
11
+ */
12
+ name?: string;
13
+ /**
14
+ * Display label for the node (alternative to name)
15
+ */
16
+ label?: string;
17
+ /**
18
+ * Value associated with the node (used for calculations if needed)
19
+ */
20
+ value?: number;
21
+ /**
22
+ * Optional tooltip text to display on hover
23
+ */
24
+ tooltip?: string;
25
+ /**
26
+ * Optional subtitle text to be displayed
27
+ */
28
+ subtitle?: string;
29
+ /**
30
+ * Optional description or additional information
31
+ */
32
+ description?: string;
33
+ /**
34
+ * Optional icon to be displayed with the node
35
+ */
36
+ icon?: string;
37
+ /**
38
+ * Optional type category for the node
39
+ */
40
+ type?: string;
41
+ /**
42
+ * Optional color to apply to the node
43
+ */
44
+ color?: string;
45
+ /**
46
+ * Whether the node is initially expanded (if it has children)
47
+ */
48
+ isExpanded?: boolean;
49
+ /**
50
+ * Child nodes
51
+ */
52
+ children?: AXHierarchyChartNode[];
53
+ /**
54
+ * Reference to parent node ID
55
+ */
56
+ parentId?: string | null;
57
+ /**
58
+ * Additional metadata (can be used for custom rendering or logic)
59
+ */
60
+ metadata?: Record<string, any>;
61
+ /**
62
+ * Current expanded state (set by component during rendering)
63
+ * @internal
64
+ */
65
+ expanded?: boolean;
66
+ /**
67
+ * Function to toggle the expanded state of this node (set by component during rendering)
68
+ * @internal
69
+ */
70
+ toggleExpanded?: () => void;
71
+ }
72
+ /**
73
+ * Hierarchy chart data type
74
+ */
75
+ export type AXHierarchyChartData = AXHierarchyChartNode;
76
+ /**
77
+ * Margin configuration for the chart
78
+ */
79
+ export interface AXHierarchyChartMargin {
80
+ top: number;
81
+ right: number;
82
+ bottom: number;
83
+ left: number;
84
+ }
85
+ /**
86
+ * Configuration options for the hierarchy chart
87
+ */
88
+ export interface AXHierarchyChartOption {
89
+ /**
90
+ * Fixed width for the chart (px). If not provided, container width is used.
91
+ */
92
+ width?: number;
93
+ /**
94
+ * Fixed height for the chart (px). If not provided, container height is used.
95
+ */
96
+ height?: number;
97
+ /**
98
+ * Margins around the chart content
99
+ */
100
+ margin?: AXHierarchyChartMargin;
101
+ /**
102
+ * Node radius in pixels (used when no custom node template is provided)
103
+ */
104
+ nodeRadius?: number;
105
+ /**
106
+ * Node fill color (used when no custom node template is provided)
107
+ */
108
+ nodeColor?: string;
109
+ /**
110
+ * Node stroke color (used when no custom node template is provided)
111
+ */
112
+ nodeStrokeColor?: string;
113
+ /**
114
+ * Node stroke width (used when no custom node template is provided)
115
+ */
116
+ nodeStrokeWidth?: number;
117
+ /**
118
+ * Link (connection) color
119
+ */
120
+ linkColor?: string;
121
+ /**
122
+ * Link (connection) width
123
+ */
124
+ linkWidth?: number;
125
+ /**
126
+ * Style of the links between nodes
127
+ * 'straight': Direct straight lines between parent and child
128
+ * 'curved': Default curved lines
129
+ * 'rounded': Curved lines with rounded corners
130
+ * 'step': L-shaped stepped lines
131
+ */
132
+ linkStyle?: 'straight' | 'curved' | 'rounded' | 'step';
133
+ /**
134
+ * Whether to show tooltips on hover
135
+ */
136
+ showTooltip?: boolean;
137
+ /**
138
+ * Direction of the hierarchy chart layout
139
+ * 'vertical': top-to-bottom flow
140
+ * 'horizontal': left-to-right flow
141
+ */
142
+ direction?: 'vertical' | 'horizontal';
143
+ /**
144
+ * Fixed node dimensions when using custom node templates
145
+ */
146
+ nodeWidth?: number;
147
+ nodeHeight?: number;
148
+ /**
149
+ * Spacing between nodes
150
+ */
151
+ nodeSpacingX?: number;
152
+ nodeSpacingY?: number;
153
+ /**
154
+ * Whether to allow node expansion/collapse
155
+ */
156
+ collapsible?: boolean;
157
+ /**
158
+ * Whether to initially expand all nodes
159
+ */
160
+ expandAll?: boolean;
161
+ /**
162
+ * Custom CSS class to apply to the chart container
163
+ */
164
+ className?: string;
165
+ /**
166
+ * Duration of the animation in milliseconds
167
+ */
168
+ animationDuration?: number;
169
+ /**
170
+ * Type of easing function to use for animations
171
+ */
172
+ animationEasing?: 'linear' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'cubic' | 'cubic-in' | 'cubic-out' | 'cubic-in-out';
173
+ }
174
+ /**
175
+ * Context data for node template rendering.
176
+ * This object is passed to the custom node template.
177
+ * The node with expanded state and toggle function is passed as $implicit.
178
+ *
179
+ * @example
180
+ * ```html
181
+ * <ng-template #nodeTemplate let-node>
182
+ * <div>{{ node.name }}</div>
183
+ * <button (click)="node.toggleExpanded()" *ngIf="node.children?.length">
184
+ * {{ node.expanded ? 'Collapse' : 'Expand' }}
185
+ * </button>
186
+ * </ng-template>
187
+ * ```
188
+ */
189
+ export interface AXHierarchyChartNodeContext {
190
+ /**
191
+ * The node data with expanded state and toggle function (passed as $implicit parameter)
192
+ */
193
+ $implicit: AXHierarchyChartNode & {
194
+ expanded: boolean;
195
+ toggleExpanded: () => void;
196
+ };
197
+ }
198
+ /**
199
+ * Event data for node click events
200
+ */
201
+ export interface AXHierarchyChartClickEvent {
202
+ /**
203
+ * The original DOM event
204
+ */
205
+ event: MouseEvent;
206
+ /**
207
+ * The data item that was clicked
208
+ */
209
+ item: AXHierarchyChartNode;
210
+ /**
211
+ * The DOM element that was clicked
212
+ */
213
+ element: HTMLElement;
214
+ }
215
+ /**
216
+ * Event data for node toggle events
217
+ */
218
+ export interface AXHierarchyChartToggleEvent {
219
+ /**
220
+ * The node that was toggled
221
+ */
222
+ node: AXHierarchyChartNode;
223
+ /**
224
+ * The new expansion state
225
+ */
226
+ expanded: boolean;
227
+ }
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const AX_CHARTS = "ACOREX_CHARTS";
@@ -0,0 +1,3 @@
1
+ # @acorex/chart/line-chart
2
+
3
+ Secondary entry point of `@acorex/chart`. It can be used by importing from `@acorex/chart/line-chart`.
@@ -0,0 +1,3 @@
1
+ export * from './lib/line-chart.component';
2
+ export * from './lib/line-chart.config';
3
+ export * from './lib/line-chart.type';
@@ -0,0 +1,96 @@
1
+ import { AXChartTooltipData } from '@acorex/charts/chart-tooltip';
2
+ import { NXComponent } from '@acorex/components/common';
3
+ import { AfterViewInit, OnDestroy, OnInit } from '@angular/core';
4
+ import { AXLineChartOption, AXLineChartPointClickEvent, AXLineChartValue } from './line-chart.type';
5
+ import * as i0 from "@angular/core";
6
+ export declare const AXPLineChartColors: {
7
+ defaultColors: string[];
8
+ getColor: (index: number, customPalette?: string[]) => string;
9
+ };
10
+ /**
11
+ * Line Chart Component for rendering data as lines with interactive hover effects and animations
12
+ */
13
+ export declare class AXLineChartComponent extends NXComponent implements OnInit, AfterViewInit, OnDestroy {
14
+ #private;
15
+ data: import("@angular/core").InputSignal<AXLineChartValue>;
16
+ options: import("@angular/core").InputSignal<AXLineChartOption>;
17
+ pointClick: import("@angular/core").OutputEmitterRef<AXLineChartPointClickEvent>;
18
+ private readonly chartContainerEl;
19
+ protected d3: typeof import('d3');
20
+ private svg;
21
+ private chart;
22
+ private xScale;
23
+ private yScale;
24
+ private xAxis;
25
+ private yAxis;
26
+ private width;
27
+ private height;
28
+ private margin;
29
+ private _tooltipVisible;
30
+ private _tooltipPosition;
31
+ private _tooltipData;
32
+ private _initialized;
33
+ private _rendered;
34
+ protected tooltipVisible: import("@angular/core").Signal<boolean>;
35
+ protected tooltipPosition: import("@angular/core").Signal<{
36
+ x: number;
37
+ y: number;
38
+ }>;
39
+ protected tooltipData: import("@angular/core").Signal<AXChartTooltipData>;
40
+ private configToken;
41
+ protected effectiveOptions: import("@angular/core").Signal<{
42
+ width?: number;
43
+ height?: number;
44
+ margins?: {
45
+ top?: number;
46
+ right?: number;
47
+ bottom?: number;
48
+ left?: number;
49
+ };
50
+ showXAxis?: boolean;
51
+ showYAxis?: boolean;
52
+ showGrid?: boolean;
53
+ showVerticalGrid?: boolean;
54
+ xAxisLabel?: string;
55
+ yAxisLabel?: string;
56
+ yAxisStartsAtZero?: boolean;
57
+ axisPadding?: number;
58
+ showTooltip?: boolean;
59
+ lineWidth?: number;
60
+ showPoints?: boolean;
61
+ pointRadius?: number;
62
+ smoothLine?: boolean;
63
+ fillArea?: boolean;
64
+ fillOpacity?: number;
65
+ showCrosshair?: boolean;
66
+ animationDuration?: number;
67
+ animationEasing?: "linear" | "ease" | "ease-in" | "ease-out" | "ease-in-out" | "cubic" | "cubic-in" | "cubic-out" | "cubic-in-out";
68
+ }>;
69
+ ngOnInit(): void;
70
+ ngAfterViewInit(): void;
71
+ ngOnDestroy(): void;
72
+ protected loadD3(): Promise<void>;
73
+ protected createChart(): void;
74
+ protected updateChart(): void;
75
+ protected cleanupChart(): void;
76
+ private setupDimensions;
77
+ private calculateMargins;
78
+ private setupScales;
79
+ private createAxes;
80
+ private renderLines;
81
+ private handlePointGroupEnter;
82
+ private handlePointGroupLeave;
83
+ private getReducedDataPoints;
84
+ private handlePointHover;
85
+ private showCrosshairLines;
86
+ private updateTooltipPosition;
87
+ private handlePointClick;
88
+ private showNoDataMessage;
89
+ private handleOverlappingPointsHover;
90
+ /**
91
+ * Gets the appropriate D3 easing function based on the option string
92
+ */
93
+ private getEasingFunction;
94
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXLineChartComponent, never>;
95
+ static ɵcmp: i0.ɵɵComponentDeclaration<AXLineChartComponent, "ax-line-chart", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; }, { "pointClick": "pointClick"; }, never, never, true, never>;
96
+ }
@@ -0,0 +1,6 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { AXLineChartOption } from './line-chart.type';
3
+ export declare const AXLineChartDefaultConfig: AXLineChartOption;
4
+ export declare const AX_LINE_CHART_CONFIG: InjectionToken<AXLineChartOption>;
5
+ export type PartialLineChartConfig = Partial<AXLineChartOption>;
6
+ export declare function lineChartConfig(config?: PartialLineChartConfig): AXLineChartOption;
@@ -0,0 +1,61 @@
1
+ import { NXNativeEvent } from '@acorex/components/common';
2
+ /**
3
+ * Line chart data point interface
4
+ */
5
+ export interface AXLineChartData {
6
+ id?: string;
7
+ label?: string;
8
+ lineColor?: string;
9
+ fillColor?: string;
10
+ data: Array<{
11
+ x: number | string;
12
+ y: number;
13
+ }>;
14
+ }
15
+ /**
16
+ * Line chart options interface
17
+ */
18
+ export interface AXLineChartOption {
19
+ width?: number;
20
+ height?: number;
21
+ margins?: {
22
+ top?: number;
23
+ right?: number;
24
+ bottom?: number;
25
+ left?: number;
26
+ };
27
+ showXAxis?: boolean;
28
+ showYAxis?: boolean;
29
+ showGrid?: boolean;
30
+ showVerticalGrid?: boolean;
31
+ xAxisLabel?: string;
32
+ yAxisLabel?: string;
33
+ yAxisStartsAtZero?: boolean;
34
+ axisPadding?: number;
35
+ showTooltip?: boolean;
36
+ lineWidth?: number;
37
+ showPoints?: boolean;
38
+ pointRadius?: number;
39
+ smoothLine?: boolean;
40
+ fillArea?: boolean;
41
+ fillOpacity?: number;
42
+ showCrosshair?: boolean;
43
+ animationDuration?: number;
44
+ animationEasing?: 'linear' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'cubic' | 'cubic-in' | 'cubic-out' | 'cubic-in-out';
45
+ }
46
+ /**
47
+ * Line chart point click event interface
48
+ */
49
+ export interface AXLineChartPointClickEvent {
50
+ series: AXLineChartData;
51
+ point: {
52
+ x: number | string;
53
+ y: number;
54
+ };
55
+ event: NXNativeEvent;
56
+ }
57
+ /**
58
+ * Line chart data type
59
+ * Supports both single series and array of series
60
+ */
61
+ export type AXLineChartValue = AXLineChartData[] | AXLineChartData;
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@acorex/charts",
3
+ "version": "19.13.2",
4
+ "peerDependencies": {
5
+ "@angular/common": "^19.2.0",
6
+ "@angular/core": "^19.2.0",
7
+ "d3": "^7.9.0"
8
+ },
9
+ "sideEffects": false,
10
+ "module": "fesm2022/acorex-charts.mjs",
11
+ "typings": "index.d.ts",
12
+ "exports": {
13
+ "./package.json": {
14
+ "default": "./package.json"
15
+ },
16
+ ".": {
17
+ "types": "./index.d.ts",
18
+ "default": "./fesm2022/acorex-charts.mjs"
19
+ },
20
+ "./bar-chart": {
21
+ "types": "./bar-chart/index.d.ts",
22
+ "default": "./fesm2022/acorex-charts-bar-chart.mjs"
23
+ },
24
+ "./chart-tooltip": {
25
+ "types": "./chart-tooltip/index.d.ts",
26
+ "default": "./fesm2022/acorex-charts-chart-tooltip.mjs"
27
+ },
28
+ "./donut-chart": {
29
+ "types": "./donut-chart/index.d.ts",
30
+ "default": "./fesm2022/acorex-charts-donut-chart.mjs"
31
+ },
32
+ "./gauge-chart": {
33
+ "types": "./gauge-chart/index.d.ts",
34
+ "default": "./fesm2022/acorex-charts-gauge-chart.mjs"
35
+ },
36
+ "./hierarchy-chart": {
37
+ "types": "./hierarchy-chart/index.d.ts",
38
+ "default": "./fesm2022/acorex-charts-hierarchy-chart.mjs"
39
+ },
40
+ "./line-chart": {
41
+ "types": "./line-chart/index.d.ts",
42
+ "default": "./fesm2022/acorex-charts-line-chart.mjs"
43
+ }
44
+ },
45
+ "dependencies": {
46
+ "tslib": "^2.3.0"
47
+ }
48
+ }