@wso2/oxygen-ui-charts-react 0.2.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.
@@ -0,0 +1,215 @@
1
+ /**
2
+ * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ import React from 'react';
19
+ import { Tooltip } from 'recharts';
20
+ export interface BarChartProps {
21
+ /**
22
+ * Data to be displayed in the chart.
23
+ */
24
+ data?: any[];
25
+ /**
26
+ * Configuration for the bars in the chart.
27
+ */
28
+ bars?: Array<{
29
+ dataKey: string;
30
+ name?: string;
31
+ fill?: string;
32
+ /**
33
+ * The id of the stack the bar belongs to.
34
+ */
35
+ stackId?: string | number;
36
+ /**
37
+ * The radius of the bar's corners.
38
+ */
39
+ radius?: number | [number, number, number, number];
40
+ /**
41
+ * If true, the bar will be hidden.
42
+ */
43
+ hide?: boolean;
44
+ /**
45
+ * Configuration for the bar's label.
46
+ */
47
+ label?: boolean | any;
48
+ /**
49
+ * If true, the bar will be animated.
50
+ * @default true
51
+ */
52
+ isAnimationActive?: boolean;
53
+ /**
54
+ * Duration of the animation in ms.
55
+ * @default 1500
56
+ */
57
+ animationDuration?: number;
58
+ /**
59
+ * Delay before the animation begins in ms.
60
+ * @default 0
61
+ */
62
+ animationBegin?: number;
63
+ /**
64
+ * Easing function for the animation.
65
+ * @default 'ease'
66
+ */
67
+ animationEasing?: 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear';
68
+ onClick?: (data: any, index: number, event: React.MouseEvent) => void;
69
+ onMouseEnter?: (data: any, index: number, event: React.MouseEvent) => void;
70
+ onMouseLeave?: (data: any, index: number, event: React.MouseEvent) => void;
71
+ onMouseDown?: (data: any, index: number, event: React.MouseEvent) => void;
72
+ onMouseUp?: (data: any, index: number, event: React.MouseEvent) => void;
73
+ onMouseMove?: (data: any, index: number, event: React.MouseEvent) => void;
74
+ }>;
75
+ /**
76
+ * Custom colors for the bars.
77
+ */
78
+ colors?: string[];
79
+ /**
80
+ * The key of each category/series label in data.
81
+ */
82
+ xAxisDataKey?: string;
83
+ /**
84
+ * Height of the chart.
85
+ * @default 300
86
+ */
87
+ height?: number | `${number}%`;
88
+ /**
89
+ * Width of the chart.
90
+ * @default '100%'
91
+ */
92
+ width?: number | `${number}%`;
93
+ /**
94
+ * Legend configuration.
95
+ */
96
+ legend?: {
97
+ show?: boolean;
98
+ align?: 'left' | 'center' | 'right';
99
+ verticalAlign?: 'top' | 'middle' | 'bottom';
100
+ };
101
+ /**
102
+ * Grid configuration.
103
+ */
104
+ grid?: {
105
+ show?: boolean;
106
+ strokeDasharray?: string;
107
+ };
108
+ /**
109
+ * Tooltip configuration.
110
+ */
111
+ tooltip?: {
112
+ show?: boolean;
113
+ } & React.ComponentProps<typeof Tooltip>;
114
+ /**
115
+ * The layout of the chart.
116
+ * @default 'horizontal'
117
+ */
118
+ layout?: 'horizontal' | 'vertical';
119
+ /**
120
+ * Margin around the chart.
121
+ */
122
+ margin?: {
123
+ top?: number;
124
+ right?: number;
125
+ bottom?: number;
126
+ left?: number;
127
+ };
128
+ /**
129
+ * The gap between two bar categories.
130
+ */
131
+ barCategoryGap?: number | string;
132
+ /**
133
+ * The gap between two bars in the same category.
134
+ */
135
+ barGap?: number | string;
136
+ /**
137
+ * The width or height of each bar.
138
+ */
139
+ barSize?: number | string;
140
+ /**
141
+ * The maximum width or height of each bar.
142
+ */
143
+ maxBarSize?: number;
144
+ /**
145
+ * The offset of the stacks.
146
+ */
147
+ stackOffset?: 'sign' | 'expand' | 'none' | 'wiggle' | 'silhouette' | 'positive';
148
+ /**
149
+ * If true, an accessibility layer will be added to the chart.
150
+ * @default true
151
+ */
152
+ accessibilityLayer?: boolean;
153
+ /**
154
+ * XAxis configuration.
155
+ */
156
+ xAxis?: {
157
+ show?: boolean;
158
+ name?: string;
159
+ };
160
+ /**
161
+ * YAxis configuration.
162
+ */
163
+ yAxis?: {
164
+ show?: boolean;
165
+ name?: string;
166
+ };
167
+ /**
168
+ * If true, the chart bars will be animated.
169
+ * @default true
170
+ */
171
+ isAnimationActive?: boolean;
172
+ /**
173
+ * Duration of the animation in ms.
174
+ * @default 1500
175
+ */
176
+ animationDuration?: number;
177
+ /**
178
+ * Delay before the animation begins in ms.
179
+ * @default 0
180
+ */
181
+ animationBegin?: number;
182
+ /**
183
+ * Easing function for the animation.
184
+ * @default 'ease'
185
+ */
186
+ animationEasing?: 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear';
187
+ /**
188
+ * Optional children for composition.
189
+ */
190
+ children?: React.ReactNode;
191
+ /**
192
+ * Default click event handler.
193
+ */
194
+ onClick?: (data: any, index: number, event: React.MouseEvent) => void;
195
+ /**
196
+ * Default mouse enter event handler.
197
+ */
198
+ onMouseEnter?: (data: any, index: number, event: React.MouseEvent) => void;
199
+ /**
200
+ * Default mouse leave event handler.
201
+ */
202
+ onMouseLeave?: (data: any, index: number, event: React.MouseEvent) => void;
203
+ /**
204
+ * Default mouse down event handler.
205
+ */
206
+ onMouseDown?: (data: any, index: number, event: React.MouseEvent) => void;
207
+ /**
208
+ * Default mouse up event handler.
209
+ */
210
+ onMouseUp?: (data: any, index: number, event: React.MouseEvent) => void;
211
+ /**
212
+ * Default mouse move event handler.
213
+ */
214
+ onMouseMove?: (data: any, index: number, event: React.MouseEvent) => void;
215
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ export { default } from './BarChart';
19
+ export * from './BarChart';
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ import React from 'react';
19
+ import { LineChartProps } from './LineChart.types';
20
+ /**
21
+ * LineChart component for Oxygen UI powered by Recharts.
22
+ */
23
+ declare const LineChart: {
24
+ ({ data, lines, xAxisDataKey, height, width, legend, grid, tooltip, layout, margin, syncId, syncMethod, role, title, desc, accessibilityLayer, xAxis, yAxis, onClick, onMouseDown, onMouseUp, onMouseMove, onMouseEnter, onMouseLeave, isAnimationActive, animationDuration, animationBegin, animationEasing, colors: customColors, children, }: LineChartProps): React.ReactElement;
25
+ displayName: string;
26
+ };
27
+ export default LineChart;
@@ -0,0 +1,235 @@
1
+ /**
2
+ * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ import React from 'react';
19
+ import { Tooltip } from 'recharts';
20
+ export interface LineChartProps {
21
+ /**
22
+ * Data to be displayed in the chart.
23
+ */
24
+ data?: any[];
25
+ /**
26
+ * Configuration for the lines in the chart.
27
+ */
28
+ lines?: Array<{
29
+ dataKey: string;
30
+ name?: string;
31
+ stroke?: string;
32
+ strokeWidth?: number;
33
+ strokeDasharray?: string | number;
34
+ /**
35
+ * The interpolation type of curve.
36
+ * @default 'monotone'
37
+ */
38
+ type?: 'basis' | 'basisClosed' | 'basisOpen' | 'linear' | 'linearClosed' | 'natural' | 'monotoneX' | 'monotoneY' | 'monotone' | 'step' | 'stepBefore' | 'stepAfter';
39
+ /**
40
+ * If true, the line will be hidden.
41
+ */
42
+ hide?: boolean;
43
+ /**
44
+ * Configuration for the line's label.
45
+ */
46
+ label?: boolean | any;
47
+ /**
48
+ * If false, dots will not be drawn.
49
+ * @default true
50
+ */
51
+ dot?: boolean | any;
52
+ /**
53
+ * The dot is shown when user enter a line chart and this chart has tooltip.
54
+ * @default true
55
+ */
56
+ activeDot?: boolean | any;
57
+ /**
58
+ * Whether to connect the line across null points.
59
+ * @default false
60
+ */
61
+ connectNulls?: boolean;
62
+ /**
63
+ * The unit of data. This option will be used in tooltip.
64
+ */
65
+ unit?: string | number;
66
+ /**
67
+ * The type of icon in legend.
68
+ * @default 'line'
69
+ */
70
+ legendType?: 'line' | 'plainline' | 'square' | 'rect' | 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none';
71
+ /**
72
+ * Event handlers for individual lines.
73
+ * Receives (props, event) where props contains all line properties including its data.
74
+ */
75
+ onClick?: (props: any, event: React.MouseEvent) => void;
76
+ onMouseDown?: (props: any, event: React.MouseEvent) => void;
77
+ onMouseUp?: (props: any, event: React.MouseEvent) => void;
78
+ onMouseMove?: (props: any, event: React.MouseEvent) => void;
79
+ onMouseOver?: (props: any, event: React.MouseEvent) => void;
80
+ onMouseOut?: (props: any, event: React.MouseEvent) => void;
81
+ onMouseEnter?: (props: any, event: React.MouseEvent) => void;
82
+ onMouseLeave?: (props: any, event: React.MouseEvent) => void;
83
+ /**
84
+ * If true, the line will be animated.
85
+ * @default true
86
+ */
87
+ isAnimationActive?: boolean;
88
+ /**
89
+ * Duration of the animation in ms.
90
+ * @default 1500
91
+ */
92
+ animationDuration?: number;
93
+ /**
94
+ * Delay before the animation begins in ms.
95
+ * @default 0
96
+ */
97
+ animationBegin?: number;
98
+ /**
99
+ * Easing function for the animation.
100
+ * @default 'ease'
101
+ */
102
+ animationEasing?: 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear';
103
+ }>;
104
+ /**
105
+ * Custom colors for the lines.
106
+ */
107
+ colors?: string[];
108
+ /**
109
+ * The key of each category/series label in data.
110
+ */
111
+ xAxisDataKey?: string;
112
+ /**
113
+ * Height of the chart.
114
+ * @default 300
115
+ */
116
+ height?: number | `${number}%`;
117
+ /**
118
+ * Width of the chart.
119
+ * @default '100%'
120
+ */
121
+ width?: number | `${number}%`;
122
+ /**
123
+ * Legend configuration.
124
+ */
125
+ legend?: {
126
+ show?: boolean;
127
+ align?: 'left' | 'center' | 'right';
128
+ verticalAlign?: 'top' | 'middle' | 'bottom';
129
+ };
130
+ /**
131
+ * Grid configuration.
132
+ */
133
+ grid?: {
134
+ show?: boolean;
135
+ strokeDasharray?: string;
136
+ };
137
+ /**
138
+ * Tooltip configuration.
139
+ */
140
+ tooltip?: {
141
+ show?: boolean;
142
+ } & React.ComponentProps<typeof Tooltip>;
143
+ /**
144
+ * The layout of the chart.
145
+ * @default 'horizontal'
146
+ */
147
+ layout?: 'horizontal' | 'vertical';
148
+ /**
149
+ * Margin around the chart.
150
+ */
151
+ margin?: {
152
+ top?: number;
153
+ right?: number;
154
+ bottom?: number;
155
+ left?: number;
156
+ };
157
+ /**
158
+ * Charts with the same syncId will synchronize Tooltip and Brush events.
159
+ */
160
+ syncId?: number | string;
161
+ /**
162
+ * Customize how the charts will synchronize tooltips and brushes.
163
+ * @default 'index'
164
+ */
165
+ syncMethod?: 'index' | 'value' | ((ticks: readonly any[], data: any) => number);
166
+ /**
167
+ * ARIA role for the chart.
168
+ */
169
+ role?: string;
170
+ /**
171
+ * Accessible title and description.
172
+ */
173
+ title?: string;
174
+ desc?: string;
175
+ /**
176
+ * If true, an accessibility layer will be added to the chart.
177
+ * @default true
178
+ */
179
+ accessibilityLayer?: boolean;
180
+ /**
181
+ * XAxis configuration.
182
+ */
183
+ xAxis?: {
184
+ show?: boolean;
185
+ name?: string;
186
+ domain?: [any, any];
187
+ type?: 'number' | 'category';
188
+ tickCount?: number;
189
+ interval?: number | 'preserveStart' | 'preserveEnd' | 'preserveStartEnd';
190
+ };
191
+ /**
192
+ * YAxis configuration.
193
+ */
194
+ yAxis?: {
195
+ show?: boolean;
196
+ name?: string;
197
+ domain?: [any, any];
198
+ type?: 'number' | 'category';
199
+ tickCount?: number;
200
+ interval?: number | 'preserveStart' | 'preserveEnd' | 'preserveStartEnd';
201
+ };
202
+ /**
203
+ * Event handlers for the entire chart.
204
+ */
205
+ onClick?: (data: any, event: React.MouseEvent) => void;
206
+ onMouseDown?: (data: any, event: React.MouseEvent) => void;
207
+ onMouseUp?: (data: any, event: React.MouseEvent) => void;
208
+ onMouseMove?: (data: any, event: React.MouseEvent) => void;
209
+ onMouseEnter?: (data: any, event: React.MouseEvent) => void;
210
+ onMouseLeave?: (data: any, event: React.MouseEvent) => void;
211
+ /**
212
+ * If true, the chart lines will be animated.
213
+ * @default true
214
+ */
215
+ isAnimationActive?: boolean;
216
+ /**
217
+ * Duration of the animation in ms.
218
+ * @default 1500
219
+ */
220
+ animationDuration?: number;
221
+ /**
222
+ * Delay before the animation begins in ms.
223
+ * @default 0
224
+ */
225
+ animationBegin?: number;
226
+ /**
227
+ * Easing function for the animation.
228
+ * @default 'ease'
229
+ */
230
+ animationEasing?: 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear';
231
+ /**
232
+ * Optional children for composition.
233
+ */
234
+ children?: React.ReactNode;
235
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ export { default } from './LineChart';
19
+ export * from './LineChart';
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ import React from 'react';
19
+ import { PieChartProps } from './PieChart.types';
20
+ /**
21
+ * PieChart component for Oxygen UI powered by Recharts.
22
+ */
23
+ declare const PieChart: {
24
+ ({ data, pies, nameKey, height, width, legend, tooltip, margin, cx, cy, startAngle, endAngle, innerRadius, outerRadius, paddingAngle, cornerRadius, minAngle, isAnimationActive, animationDuration, animationBegin, animationEasing, colors: customColors, label, labelLine, onClick, onMouseEnter, onMouseLeave, onMouseDown, onMouseUp, onMouseMove, onContextMenu, onDoubleClick, children, }: PieChartProps): React.ReactElement;
25
+ displayName: string;
26
+ };
27
+ export default PieChart;