@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.
@@ -0,0 +1,184 @@
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 { OnInit, AfterViewInit, 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
+ * Line chart data point interface
11
+ */
12
+ interface AXLineChartData {
13
+ id?: string;
14
+ label?: string;
15
+ tooltipLabel?: string;
16
+ lineColor?: string;
17
+ fillColor?: string;
18
+ data: Array<{
19
+ x: number | string;
20
+ y: number;
21
+ tooltipLabel?: string;
22
+ }>;
23
+ }
24
+ /**
25
+ * Line chart options interface
26
+ *
27
+ * Component supports the following CSS custom properties (design tokens):
28
+ * - `--ax-comp-line-chart-labels-color`: Color for axis labels.
29
+ * Default: `--ax-sys-color-on-lightest-surface` (applied with 0.7 opacity where needed)
30
+ * - `--ax-comp-line-chart-axis-color`: Color for X/Y axis lines.
31
+ * Default: `--ax-sys-color-on-lightest-surface` (applied with 0.2 opacity)
32
+ * - `--ax-comp-line-chart-grid-lines-color`: Color for grid lines.
33
+ * Default: `--ax-sys-color-on-lightest-surface` (applied with 0.2 opacity)
34
+ * - `--ax-comp-line-chart-bg-color`: Background color for the chart.
35
+ * Default: `--ax-sys-color-lightest-surface`
36
+ * - `--ax-comp-line-chart-text-color`: Color for text elements like labels and no data message.
37
+ * Default: `--ax-sys-color-on-lightest-surface`
38
+ */
39
+ interface AXLineChartOption {
40
+ width?: number;
41
+ height?: number;
42
+ margins?: {
43
+ top?: number;
44
+ right?: number;
45
+ bottom?: number;
46
+ left?: number;
47
+ };
48
+ showXAxis?: boolean;
49
+ showYAxis?: boolean;
50
+ showGrid?: boolean;
51
+ showVerticalGrid?: boolean;
52
+ xAxisLabel?: string;
53
+ yAxisLabel?: string;
54
+ yAxisStartsAtZero?: boolean;
55
+ axisPadding?: number;
56
+ showTooltip?: boolean;
57
+ lineWidth?: number;
58
+ showPoints?: boolean;
59
+ pointRadius?: number;
60
+ smoothLine?: boolean;
61
+ fillArea?: boolean;
62
+ fillOpacity?: number;
63
+ showCrosshair?: boolean;
64
+ animationDuration?: number;
65
+ animationEasing?: AXAnimationEasing;
66
+ }
67
+ /**
68
+ * Line chart point click event interface
69
+ */
70
+ interface AXLineChartPointClickEvent {
71
+ series: AXLineChartData;
72
+ point: {
73
+ x: number | string;
74
+ y: number;
75
+ };
76
+ event: NXNativeEvent;
77
+ }
78
+ /**
79
+ * Line chart data type
80
+ * Supports both single series and array of series
81
+ */
82
+ type AXLineChartValue = AXLineChartData[] | AXLineChartData;
83
+
84
+ /**
85
+ * Line Chart Component for rendering data as lines with interactive hover effects and animations
86
+ */
87
+ declare class AXLineChartComponent extends NXComponent implements OnInit, AfterViewInit, OnDestroy, AXChartLegendCompatible {
88
+ #private;
89
+ data: _angular_core.InputSignal<AXLineChartValue>;
90
+ options: _angular_core.InputSignal<AXLineChartOption>;
91
+ pointClick: _angular_core.OutputEmitterRef<AXLineChartPointClickEvent>;
92
+ private readonly chartContainerEl;
93
+ protected d3: typeof d3;
94
+ private svg;
95
+ private chart;
96
+ private xScale;
97
+ private yScale;
98
+ private xAxis;
99
+ private yAxis;
100
+ private width;
101
+ private height;
102
+ private margin;
103
+ private _tooltipVisible;
104
+ private _tooltipPosition;
105
+ private _tooltipData;
106
+ private _initialized;
107
+ private _rendered;
108
+ private hiddenSeries;
109
+ private _fullNormalizedData;
110
+ protected tooltipVisible: _angular_core.Signal<boolean>;
111
+ protected tooltipPosition: _angular_core.Signal<{
112
+ x: number;
113
+ y: number;
114
+ }>;
115
+ protected tooltipData: _angular_core.Signal<AXChartTooltipData>;
116
+ private configToken;
117
+ private chartColors;
118
+ private platform;
119
+ protected effectiveOptions: _angular_core.Signal<{
120
+ width?: number;
121
+ height?: number;
122
+ margins?: {
123
+ top?: number;
124
+ right?: number;
125
+ bottom?: number;
126
+ left?: number;
127
+ };
128
+ showXAxis?: boolean;
129
+ showYAxis?: boolean;
130
+ showGrid?: boolean;
131
+ showVerticalGrid?: boolean;
132
+ xAxisLabel?: string;
133
+ yAxisLabel?: string;
134
+ yAxisStartsAtZero?: boolean;
135
+ axisPadding?: number;
136
+ showTooltip?: boolean;
137
+ lineWidth?: number;
138
+ showPoints?: boolean;
139
+ pointRadius?: number;
140
+ smoothLine?: boolean;
141
+ fillArea?: boolean;
142
+ fillOpacity?: number;
143
+ showCrosshair?: boolean;
144
+ animationDuration?: number;
145
+ animationEasing?: _acorex_cdk_common.AXAnimationEasing;
146
+ }>;
147
+ ngOnInit(): void;
148
+ ngAfterViewInit(): void;
149
+ ngOnDestroy(): void;
150
+ getLegendItems(): AXChartLegendItem[];
151
+ highlightSegment(id: string | null): void;
152
+ toggleSegment(id: string): boolean;
153
+ protected loadD3(): Promise<void>;
154
+ protected createChart(): void;
155
+ protected updateChart(): void;
156
+ protected cleanupChart(): void;
157
+ private setupDimensions;
158
+ private calculateMargins;
159
+ private setupScales;
160
+ private createAxes;
161
+ private renderLines;
162
+ private enablePointerEventsAfterAnimation;
163
+ private handlePointGroupEnter;
164
+ private handlePointGroupLeave;
165
+ private getReducedDataPoints;
166
+ private handlePointHover;
167
+ private showCrosshairLines;
168
+ private updateTooltipPosition;
169
+ private handlePointClick;
170
+ private showNoDataMessage;
171
+ private showAllSeriesHiddenMessage;
172
+ private handleOverlappingPointsHover;
173
+ private getEasingFunction;
174
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXLineChartComponent, never>;
175
+ static ɵcmp: _angular_core.ɵɵ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>;
176
+ }
177
+
178
+ declare const AXLineChartDefaultConfig: AXLineChartOption;
179
+ declare const AX_LINE_CHART_CONFIG: InjectionToken<AXLineChartOption>;
180
+ type PartialLineChartConfig = Partial<AXLineChartOption>;
181
+ declare function lineChartConfig(config?: PartialLineChartConfig): AXLineChartOption;
182
+
183
+ export { AXLineChartComponent, AXLineChartDefaultConfig, AX_LINE_CHART_CONFIG, lineChartConfig };
184
+ export type { AXLineChartData, AXLineChartOption, AXLineChartPointClickEvent, AXLineChartValue, PartialLineChartConfig };
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@acorex/charts",
3
+ "version": "0.0.1",
4
+ "peerDependencies": {
5
+ "@angular/common": "^20.0.0",
6
+ "@angular/core": "^20.0.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-legend": {
25
+ "types": "./chart-legend/index.d.ts",
26
+ "default": "./fesm2022/acorex-charts-chart-legend.mjs"
27
+ },
28
+ "./chart-tooltip": {
29
+ "types": "./chart-tooltip/index.d.ts",
30
+ "default": "./fesm2022/acorex-charts-chart-tooltip.mjs"
31
+ },
32
+ "./donut-chart": {
33
+ "types": "./donut-chart/index.d.ts",
34
+ "default": "./fesm2022/acorex-charts-donut-chart.mjs"
35
+ },
36
+ "./gauge-chart": {
37
+ "types": "./gauge-chart/index.d.ts",
38
+ "default": "./fesm2022/acorex-charts-gauge-chart.mjs"
39
+ },
40
+ "./hierarchy-chart": {
41
+ "types": "./hierarchy-chart/index.d.ts",
42
+ "default": "./fesm2022/acorex-charts-hierarchy-chart.mjs"
43
+ },
44
+ "./line-chart": {
45
+ "types": "./line-chart/index.d.ts",
46
+ "default": "./fesm2022/acorex-charts-line-chart.mjs"
47
+ }
48
+ },
49
+ "dependencies": {
50
+ "tslib": "^2.3.0"
51
+ }
52
+ }