@shohojdhara/atomix 0.2.3 → 0.2.5
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 +19 -0
- package/dist/atomix.css +1703 -1544
- package/dist/atomix.min.css +4 -4
- package/dist/index.d.ts +1465 -963
- package/dist/index.esm.js +16289 -25908
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +15650 -21780
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/themes/applemix.css +15008 -0
- package/dist/themes/applemix.min.css +72 -0
- package/dist/themes/boomdevs.css +1608 -1450
- package/dist/themes/boomdevs.min.css +5 -5
- package/dist/themes/esrar.css +1702 -1543
- package/dist/themes/esrar.min.css +4 -4
- package/dist/themes/flashtrade.css +15159 -0
- package/dist/themes/flashtrade.min.css +86 -0
- package/dist/themes/mashroom.css +1699 -1540
- package/dist/themes/mashroom.min.css +7 -7
- package/dist/themes/shaj-default.css +1693 -1534
- package/dist/themes/shaj-default.min.css +4 -4
- package/package.json +6 -17
- package/src/components/Accordion/Accordion.stories.tsx +662 -21
- package/src/components/Accordion/Accordion.tsx +21 -14
- package/src/components/AtomixGlass/AtomixGlass.test.tsx +106 -72
- package/src/components/AtomixGlass/AtomixGlass.tsx +529 -1195
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +400 -0
- package/src/components/AtomixGlass/GlassFilter.tsx +156 -0
- package/src/components/AtomixGlass/README.md +124 -2
- package/src/components/AtomixGlass/atomixGLass.old.tsx +1266 -0
- package/src/components/AtomixGlass/glass-utils.ts +263 -0
- package/src/components/AtomixGlass/shader-utils.ts +792 -68
- package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +1250 -0
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +5768 -0
- package/src/components/AtomixGlass/stories/Modes.stories.tsx +1065 -0
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +1129 -0
- package/src/components/AtomixGlass/stories/ShaderVariants.stories.tsx +395 -0
- package/src/components/AtomixGlass/stories/shared-components.tsx +301 -0
- package/src/components/AtomixGlass/utils.ts +3 -3
- package/src/components/Avatar/Avatar.tsx +3 -0
- package/src/components/Avatar/AvatarGroup.tsx +2 -1
- package/src/components/Badge/Badge.stories.tsx +76 -55
- package/src/components/Badge/Badge.tsx +12 -14
- package/src/components/Breadcrumb/Breadcrumb.tsx +23 -4
- package/src/components/Button/Button.stories.tsx +501 -20
- package/src/components/Button/Button.tsx +5 -8
- package/src/components/Callout/Callout.stories.tsx +86 -35
- package/src/components/Callout/Callout.tsx +31 -9
- package/src/components/Card/Card.stories.tsx +565 -2
- package/src/components/Card/Card.tsx +15 -4
- package/src/components/Card/ElevationCard.tsx +2 -0
- package/src/components/Chart/AnimatedChart.tsx +179 -156
- package/src/components/Chart/AreaChart.tsx +123 -12
- package/src/components/Chart/BarChart.tsx +91 -100
- package/src/components/Chart/BaseChart.tsx +80 -0
- package/src/components/Chart/BubbleChart.tsx +114 -290
- package/src/components/Chart/CandlestickChart.tsx +282 -622
- package/src/components/Chart/Chart.stories.tsx +576 -179
- package/src/components/Chart/Chart.tsx +374 -75
- package/src/components/Chart/ChartRenderer.tsx +371 -220
- package/src/components/Chart/ChartToolbar.tsx +372 -61
- package/src/components/Chart/ChartTooltip.tsx +33 -18
- package/src/components/Chart/DonutChart.tsx +172 -254
- package/src/components/Chart/FunnelChart.tsx +169 -240
- package/src/components/Chart/GaugeChart.tsx +224 -392
- package/src/components/Chart/HeatmapChart.tsx +302 -440
- package/src/components/Chart/LineChart.tsx +148 -103
- package/src/components/Chart/MultiAxisChart.tsx +267 -395
- package/src/components/Chart/PieChart.tsx +114 -64
- package/src/components/Chart/RadarChart.tsx +202 -218
- package/src/components/Chart/ScatterChart.tsx +111 -97
- package/src/components/Chart/TreemapChart.tsx +147 -222
- package/src/components/Chart/WaterfallChart.tsx +253 -291
- package/src/components/Chart/index.ts +11 -9
- package/src/components/Chart/types.ts +85 -9
- package/src/components/Chart/utils.ts +66 -0
- package/src/components/ColorModeToggle/ColorModeToggle.tsx +6 -3
- package/src/components/Countdown/Countdown.tsx +4 -0
- package/src/components/DataTable/DataTable.tsx +2 -1
- package/src/components/DatePicker/DatePicker.stories.tsx +689 -12
- package/src/components/DatePicker/DatePicker.tsx +3 -9
- package/src/components/DatePicker/types.ts +5 -0
- package/src/components/Dropdown/Dropdown.stories.tsx +32 -25
- package/src/components/Dropdown/Dropdown.tsx +26 -28
- package/src/components/EdgePanel/EdgePanel.stories.tsx +473 -2
- package/src/components/EdgePanel/EdgePanel.tsx +101 -13
- package/src/components/Footer/Footer.stories.tsx +187 -60
- package/src/components/Footer/Footer.test.tsx +134 -0
- package/src/components/Footer/Footer.tsx +133 -34
- package/src/components/Footer/FooterLink.tsx +1 -1
- package/src/components/Footer/FooterSection.tsx +53 -36
- package/src/components/Footer/FooterSocialLink.tsx +32 -29
- package/src/components/Footer/README.md +82 -3
- package/src/components/Footer/index.ts +1 -1
- package/src/components/Form/Checkbox.stories.tsx +13 -5
- package/src/components/Form/Checkbox.tsx +3 -6
- package/src/components/Form/Form.stories.tsx +10 -3
- package/src/components/Form/Form.tsx +2 -0
- package/src/components/Form/FormGroup.tsx +2 -1
- package/src/components/Form/Input.stories.tsx +12 -11
- package/src/components/Form/Input.tsx +97 -95
- package/src/components/Form/Radio.stories.tsx +22 -7
- package/src/components/Form/Radio.tsx +3 -6
- package/src/components/Form/Select.stories.tsx +21 -6
- package/src/components/Form/Select.tsx +3 -5
- package/src/components/Form/Textarea.stories.tsx +13 -11
- package/src/components/Form/Textarea.tsx +88 -86
- package/src/components/Hero/Hero.stories.tsx +2 -3
- package/src/components/Hero/Hero.tsx +5 -6
- package/src/components/Icon/Icon.tsx +12 -1
- package/src/components/List/List.tsx +2 -1
- package/src/components/List/ListGroup.tsx +2 -1
- package/src/components/Messages/Messages.stories.tsx +113 -0
- package/src/components/Messages/Messages.tsx +52 -9
- package/src/components/Modal/Modal.stories.tsx +48 -32
- package/src/components/Modal/Modal.tsx +19 -24
- package/src/components/Navigation/Menu/MegaMenu.tsx +2 -2
- package/src/components/Navigation/Menu/Menu.tsx +2 -2
- package/src/components/Navigation/Nav/Nav.stories.tsx +469 -0
- package/src/components/Navigation/Nav/Nav.tsx +22 -4
- package/src/components/Navigation/Nav/NavDropdown.tsx +10 -1
- package/src/components/Navigation/Navbar/Navbar.stories.tsx +413 -0
- package/src/components/Navigation/Navbar/Navbar.tsx +70 -29
- package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +340 -0
- package/src/components/Navigation/SideMenu/SideMenu.tsx +29 -2
- package/src/components/Pagination/Pagination.stories.tsx +13 -6
- package/src/components/Pagination/Pagination.tsx +7 -6
- package/src/components/PhotoViewer/PhotoViewer.tsx +2 -1
- package/src/components/Popover/Popover.stories.tsx +32 -24
- package/src/components/Popover/Popover.tsx +4 -1
- package/src/components/ProductReview/ProductReview.tsx +8 -2
- package/src/components/Progress/Progress.tsx +19 -3
- package/src/components/Rating/Rating.stories.tsx +11 -6
- package/src/components/Rating/Rating.tsx +3 -5
- package/src/components/River/River.tsx +5 -5
- package/src/components/SectionIntro/SectionIntro.tsx +8 -2
- package/src/components/Slider/Slider.stories.tsx +4 -4
- package/src/components/Slider/Slider.tsx +4 -3
- package/src/components/Spinner/Spinner.tsx +19 -3
- package/src/components/Steps/Steps.stories.tsx +5 -4
- package/src/components/Steps/Steps.tsx +8 -5
- package/src/components/Tab/Tab.stories.tsx +4 -3
- package/src/components/Tab/Tab.tsx +8 -6
- package/src/components/Testimonial/Testimonial.tsx +8 -2
- package/src/components/Todo/Todo.tsx +2 -1
- package/src/components/Toggle/Toggle.stories.tsx +5 -4
- package/src/components/Toggle/Toggle.tsx +8 -5
- package/src/components/Tooltip/Tooltip.stories.tsx +40 -30
- package/src/components/Tooltip/Tooltip.tsx +9 -2
- package/src/components/Upload/Upload.stories.tsx +252 -0
- package/src/components/Upload/Upload.tsx +92 -53
- package/src/components/VideoPlayer/VideoPlayer.tsx +3 -1
- package/src/components/index.ts +0 -4
- package/src/layouts/Grid/Grid.stories.tsx +10 -23
- package/src/layouts/Grid/Grid.tsx +20 -1
- package/src/layouts/Grid/GridCol.tsx +76 -48
- package/src/lib/composables/useAtomixGlass.ts +861 -44
- package/src/lib/composables/useBarChart.ts +21 -4
- package/src/lib/composables/useChart.ts +227 -370
- package/src/lib/composables/useChartExport.ts +19 -78
- package/src/lib/composables/useChartToolbar.ts +11 -21
- package/src/lib/composables/useEdgePanel.ts +125 -71
- package/src/lib/composables/useFooter.ts +3 -3
- package/src/lib/composables/useGlassContainer.ts +16 -7
- package/src/lib/composables/useLineChart.ts +11 -2
- package/src/lib/composables/usePieChart.ts +4 -14
- package/src/lib/composables/useRiver.ts +5 -0
- package/src/lib/composables/useSlider.ts +62 -24
- package/src/lib/composables/useVideoPlayer.ts +60 -63
- package/src/lib/constants/components.ts +147 -32
- package/src/lib/types/components.ts +355 -25
- package/src/lib/utils/displacement-generator.ts +55 -49
- package/src/lib/utils/icons.ts +1 -1
- package/src/lib/utils/index.ts +16 -10
- package/src/styles/01-settings/_settings.accordion.scss +19 -19
- package/src/styles/01-settings/_settings.animations.scss +5 -5
- package/src/styles/01-settings/_settings.avatar-group.scss +1 -1
- package/src/styles/01-settings/_settings.avatar.scss +17 -17
- package/src/styles/01-settings/_settings.background.scss +0 -3
- package/src/styles/01-settings/_settings.badge.scss +1 -1
- package/src/styles/01-settings/_settings.breadcrumb.scss +1 -1
- package/src/styles/01-settings/_settings.card.scss +1 -1
- package/src/styles/01-settings/_settings.chart.scss +65 -2
- package/src/styles/01-settings/_settings.dropdown.scss +1 -1
- package/src/styles/01-settings/_settings.edge-panel.scss +1 -1
- package/src/styles/01-settings/_settings.footer.scss +35 -42
- package/src/styles/01-settings/_settings.input.scss +1 -1
- package/src/styles/01-settings/_settings.list.scss +1 -1
- package/src/styles/01-settings/_settings.rating.scss +1 -1
- package/src/styles/01-settings/_settings.tabs.scss +1 -1
- package/src/styles/01-settings/_settings.upload.scss +6 -5
- package/src/styles/02-tools/_tools.animations.scss +4 -5
- package/src/styles/02-tools/_tools.background.scss +1 -13
- package/src/styles/02-tools/_tools.glass.scss +0 -1
- package/src/styles/02-tools/_tools.utility-api.scss +91 -48
- package/src/styles/03-generic/_generic.root.scss +1 -4
- package/src/styles/04-elements/_elements.body.scss +0 -1
- package/src/styles/06-components/_components.atomix-glass.scss +249 -0
- package/src/styles/06-components/_components.badge.scss +8 -23
- package/src/styles/06-components/_components.button.scss +8 -3
- package/src/styles/06-components/_components.callout.scss +10 -5
- package/src/styles/06-components/_components.card.scss +2 -14
- package/src/styles/06-components/_components.chart.scss +969 -1449
- package/src/styles/06-components/_components.dropdown.scss +19 -7
- package/src/styles/06-components/_components.edge-panel.scss +103 -0
- package/src/styles/06-components/_components.footer.scss +166 -85
- package/src/styles/06-components/_components.input.scss +8 -9
- package/src/styles/06-components/_components.list.scss +1 -0
- package/src/styles/06-components/_components.messages.scss +176 -0
- package/src/styles/06-components/_components.modal.scss +16 -4
- package/src/styles/06-components/_components.navbar.scss +12 -1
- package/src/styles/06-components/_components.side-menu.scss +5 -0
- package/src/styles/06-components/_components.skeleton.scss +8 -6
- package/src/styles/06-components/_components.upload.scss +219 -4
- package/src/styles/06-components/old.chart.styles.scss +1 -30
- package/src/styles/99-utilities/_index.scss +1 -0
- package/src/styles/99-utilities/_utilities.glass-fixes.scss +1 -0
- package/src/styles/99-utilities/_utilities.scss +1 -1
- package/src/components/AtomixGlass/AtomixGlass.stories.tsx +0 -3011
- package/src/components/AtomixGlass/AtomixGlassComprehensivePreview.stories.tsx +0 -1369
- package/src/components/Chart/AdvancedChart.tsx +0 -624
- package/src/components/Chart/LineChartNew.tsx +0 -167
- package/src/components/Chart/RealTimeChart.tsx +0 -436
- package/src/components/DatePicker/DatePicker copy.tsx +0 -551
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { forwardRef, memo,
|
|
2
|
-
import
|
|
3
|
-
import ChartRenderer from './ChartRenderer';
|
|
1
|
+
import { forwardRef, memo, useState } from 'react';
|
|
2
|
+
import BaseChart from './BaseChart';
|
|
4
3
|
import ChartTooltip from './ChartTooltip';
|
|
5
4
|
import { ChartProps } from './types';
|
|
6
5
|
|
|
@@ -95,313 +94,138 @@ const BubbleChart = memo(
|
|
|
95
94
|
sizeBasedColoring = false,
|
|
96
95
|
} = bubbleOptions;
|
|
97
96
|
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const renderContent = useCallback(
|
|
105
|
-
({ scales, colors, handlers }: { scales: any; colors: any; handlers: any }) => {
|
|
106
|
-
if (!bubbleData.length) return null;
|
|
107
|
-
|
|
108
|
-
// Calculate scales
|
|
109
|
-
const xValues = bubbleData.map(d => d.x);
|
|
110
|
-
const yValues = bubbleData.map(d => d.y);
|
|
111
|
-
const sizeValues = bubbleData.map(d => d.size);
|
|
112
|
-
|
|
113
|
-
const xMin = Math.min(...xValues);
|
|
114
|
-
const xMax = Math.max(...xValues);
|
|
115
|
-
const yMin = Math.min(...yValues);
|
|
116
|
-
const yMax = Math.max(...yValues);
|
|
117
|
-
const sizeMin = Math.min(...sizeValues);
|
|
118
|
-
const sizeMax = Math.max(...sizeValues);
|
|
119
|
-
|
|
120
|
-
const padding = 60;
|
|
121
|
-
const chartWidth = scales.width - padding * 2;
|
|
122
|
-
const chartHeight = scales.height - padding * 2;
|
|
123
|
-
|
|
124
|
-
const xScale = (value: number) => padding + ((value - xMin) / (xMax - xMin)) * chartWidth;
|
|
125
|
-
const yScale = (value: number) =>
|
|
126
|
-
padding + chartHeight - ((value - yMin) / (yMax - yMin)) * chartHeight;
|
|
127
|
-
const sizeScale = (value: number) =>
|
|
128
|
-
minBubbleSize +
|
|
129
|
-
((value - sizeMin) / (sizeMax - sizeMin)) * (maxBubbleSize - minBubbleSize);
|
|
130
|
-
|
|
131
|
-
// Generate bubbles
|
|
132
|
-
const bubbleElements = bubbleData.map((bubble, index) => {
|
|
133
|
-
const x = xScale(bubble.x);
|
|
134
|
-
const y = yScale(bubble.y);
|
|
135
|
-
const radius = sizeScale(bubble.size);
|
|
97
|
+
const datasets = [
|
|
98
|
+
{
|
|
99
|
+
label: 'Bubbles',
|
|
100
|
+
data: bubbleData,
|
|
101
|
+
},
|
|
102
|
+
];
|
|
136
103
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
104
|
+
const renderContent = ({
|
|
105
|
+
scales,
|
|
106
|
+
colors,
|
|
107
|
+
datasets: renderedDatasets,
|
|
108
|
+
handlers,
|
|
109
|
+
hoveredPoint,
|
|
110
|
+
toolbarState,
|
|
111
|
+
config: renderConfig,
|
|
112
|
+
}: ChartRenderContentParams) => {
|
|
113
|
+
if (!bubbleData.length) return null;
|
|
114
|
+
|
|
115
|
+
// Use toolbar state if available, fallback to config for backward compatibility
|
|
116
|
+
const showTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? true;
|
|
117
|
+
|
|
118
|
+
// Calculate bubble sizes based on data
|
|
119
|
+
const sizeValues = bubbleData.map(b => b.size);
|
|
120
|
+
const minSize = Math.min(...sizeValues);
|
|
121
|
+
const maxSize = Math.max(...sizeValues);
|
|
122
|
+
const sizeRange = maxSize - minSize || 1; // Avoid division by zero
|
|
123
|
+
|
|
124
|
+
const bubbles = bubbleData.map((bubble, index) => {
|
|
125
|
+
// Calculate scaled size
|
|
126
|
+
const scaledSize =
|
|
127
|
+
minBubbleSize + ((bubble.size - minSize) / sizeRange) * (maxBubbleSize - minBubbleSize);
|
|
128
|
+
|
|
129
|
+
// Calculate position
|
|
130
|
+
const x = scales.padding.left + (bubble.x / 100) * scales.innerWidth;
|
|
131
|
+
const y = scales.padding.top + scales.innerHeight - (bubble.y / 100) * scales.innerHeight;
|
|
132
|
+
|
|
133
|
+
// Determine color
|
|
134
|
+
let bubbleColor = bubble.color;
|
|
135
|
+
if (!bubbleColor) {
|
|
136
|
+
if (sizeBasedColoring) {
|
|
137
|
+
// Color based on size
|
|
138
|
+
const colorIndex = Math.floor(
|
|
139
|
+
(colorScheme.length - 1) * ((bubble.size - minSize) / sizeRange)
|
|
140
|
+
);
|
|
141
|
+
bubbleColor = colorScheme[colorIndex];
|
|
142
|
+
} else {
|
|
143
|
+
// Use color scheme cyclically
|
|
144
|
+
bubbleColor = colorScheme[index % colorScheme.length];
|
|
147
145
|
}
|
|
146
|
+
}
|
|
148
147
|
|
|
149
|
-
|
|
148
|
+
const isHovered = hoveredPoint?.pointIndex === index;
|
|
150
149
|
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
return (
|
|
151
|
+
<g key={`bubble-${index}`}>
|
|
153
152
|
<circle
|
|
154
|
-
key={`bubble-${index}`}
|
|
155
153
|
cx={x}
|
|
156
154
|
cy={y}
|
|
157
|
-
r={
|
|
155
|
+
r={scaledSize}
|
|
158
156
|
fill={bubbleColor}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
157
|
+
opacity={bubbleOpacity}
|
|
158
|
+
className={`c-chart__bubble ${isHovered ? 'c-chart__bubble--hovered' : ''}`}
|
|
159
|
+
style={enableAnimations ? { transition: `all ${animationDuration}ms ease` } : {}}
|
|
160
|
+
onClick={() => handlers.onDataPointClick?.(bubble, 0, index)}
|
|
162
161
|
onMouseEnter={e => {
|
|
163
|
-
const rect = e.currentTarget.
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
162
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
163
|
+
handlers.onPointHover(
|
|
164
|
+
0,
|
|
165
|
+
index,
|
|
166
|
+
x,
|
|
167
|
+
y,
|
|
168
|
+
rect.left + rect.width / 2,
|
|
169
|
+
rect.top + rect.height / 2
|
|
170
|
+
);
|
|
167
171
|
}}
|
|
168
|
-
onMouseLeave={
|
|
172
|
+
onMouseLeave={handlers.onPointLeave}
|
|
169
173
|
/>
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
// Bubble label
|
|
173
|
-
if (showLabels) {
|
|
174
|
-
let labelX = x;
|
|
175
|
-
let labelY = y;
|
|
176
|
-
let textAnchor: 'start' | 'middle' | 'end' = 'middle';
|
|
177
|
-
let dominantBaseline: 'auto' | 'middle' | 'hanging' = 'middle';
|
|
178
|
-
|
|
179
|
-
switch (labelPosition) {
|
|
180
|
-
case 'top':
|
|
181
|
-
labelY = y - radius - 5;
|
|
182
|
-
dominantBaseline = 'auto';
|
|
183
|
-
break;
|
|
184
|
-
case 'bottom':
|
|
185
|
-
labelY = y + radius + 15;
|
|
186
|
-
dominantBaseline = 'hanging';
|
|
187
|
-
break;
|
|
188
|
-
case 'left':
|
|
189
|
-
labelX = x - radius - 5;
|
|
190
|
-
textAnchor = 'end';
|
|
191
|
-
break;
|
|
192
|
-
case 'right':
|
|
193
|
-
labelX = x + radius + 5;
|
|
194
|
-
textAnchor = 'start';
|
|
195
|
-
break;
|
|
196
|
-
case 'center':
|
|
197
|
-
default:
|
|
198
|
-
// Keep center position
|
|
199
|
-
break;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
elements.push(
|
|
203
|
-
<text
|
|
204
|
-
key={`label-${index}`}
|
|
205
|
-
x={labelX}
|
|
206
|
-
y={labelY}
|
|
207
|
-
textAnchor={textAnchor}
|
|
208
|
-
dominantBaseline={dominantBaseline}
|
|
209
|
-
className={`c-chart__bubble-label ${labelPosition === 'center' ? 'c-chart__bubble-label--center' : ''}`}
|
|
210
|
-
>
|
|
211
|
-
{bubble.label}
|
|
212
|
-
</text>
|
|
213
|
-
);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
return <g key={`bubble-group-${index}`}>{elements}</g>;
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
// Generate axes
|
|
220
|
-
const axisElements = [];
|
|
221
|
-
|
|
222
|
-
// X-axis
|
|
223
|
-
axisElements.push(
|
|
224
|
-
<line
|
|
225
|
-
key="x-axis"
|
|
226
|
-
x1={padding}
|
|
227
|
-
y1={scales.height - padding}
|
|
228
|
-
x2={scales.width - padding}
|
|
229
|
-
y2={scales.height - padding}
|
|
230
|
-
className="c-chart__axis-line c-chart__axis-line--x"
|
|
231
|
-
/>
|
|
232
|
-
);
|
|
233
|
-
|
|
234
|
-
// Y-axis
|
|
235
|
-
axisElements.push(
|
|
236
|
-
<line
|
|
237
|
-
key="y-axis"
|
|
238
|
-
x1={padding}
|
|
239
|
-
y1={padding}
|
|
240
|
-
x2={padding}
|
|
241
|
-
y2={scales.height - padding}
|
|
242
|
-
className="c-chart__axis-line c-chart__axis-line--y"
|
|
243
|
-
/>
|
|
244
|
-
);
|
|
245
|
-
|
|
246
|
-
// X-axis labels
|
|
247
|
-
const xTicks = 5;
|
|
248
|
-
for (let i = 0; i <= xTicks; i++) {
|
|
249
|
-
const value = xMin + (i / xTicks) * (xMax - xMin);
|
|
250
|
-
const x = xScale(value);
|
|
251
|
-
|
|
252
|
-
axisElements.push(
|
|
253
|
-
<g key={`x-tick-${i}`}>
|
|
254
|
-
<line
|
|
255
|
-
x1={x}
|
|
256
|
-
y1={scales.height - padding}
|
|
257
|
-
x2={x}
|
|
258
|
-
y2={scales.height - padding + 5}
|
|
259
|
-
className="c-chart__tick-line"
|
|
260
|
-
/>
|
|
174
|
+
{showLabels && (
|
|
261
175
|
<text
|
|
262
176
|
x={x}
|
|
263
|
-
y={scales.height - padding + 20}
|
|
264
|
-
textAnchor="middle"
|
|
265
|
-
className="c-chart__tick-label"
|
|
266
|
-
>
|
|
267
|
-
{value.toFixed(1)}
|
|
268
|
-
</text>
|
|
269
|
-
</g>
|
|
270
|
-
);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
// Y-axis labels
|
|
274
|
-
const yTicks = 5;
|
|
275
|
-
for (let i = 0; i <= yTicks; i++) {
|
|
276
|
-
const value = yMin + (i / yTicks) * (yMax - yMin);
|
|
277
|
-
const y = yScale(value);
|
|
278
|
-
|
|
279
|
-
axisElements.push(
|
|
280
|
-
<g key={`y-tick-${i}`}>
|
|
281
|
-
<line x1={padding - 5} y1={y} x2={padding} y2={y} className="c-chart__tick-line" />
|
|
282
|
-
<text
|
|
283
|
-
x={padding - 10}
|
|
284
177
|
y={y}
|
|
285
|
-
textAnchor="
|
|
286
|
-
dominantBaseline=
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
// Size legend
|
|
296
|
-
const legendElements = [];
|
|
297
|
-
if (showSizeLegend) {
|
|
298
|
-
const legendX = scales.width - 120;
|
|
299
|
-
const legendY = 30;
|
|
300
|
-
|
|
301
|
-
legendElements.push(
|
|
302
|
-
<g key="size-legend">
|
|
303
|
-
<text
|
|
304
|
-
x={legendX}
|
|
305
|
-
y={legendY}
|
|
306
|
-
fontSize="12"
|
|
307
|
-
fontWeight="bold"
|
|
308
|
-
fill="var(--atomix-gray-8)"
|
|
178
|
+
textAnchor="middle"
|
|
179
|
+
dominantBaseline={
|
|
180
|
+
labelPosition === 'center'
|
|
181
|
+
? 'middle'
|
|
182
|
+
: labelPosition === 'top'
|
|
183
|
+
? 'text-before-edge'
|
|
184
|
+
: 'text-after-edge'
|
|
185
|
+
}
|
|
186
|
+
className="c-chart__bubble-label"
|
|
309
187
|
>
|
|
310
|
-
{
|
|
188
|
+
{bubble.label}
|
|
311
189
|
</text>
|
|
312
|
-
|
|
313
|
-
{[sizeMin, (sizeMin + sizeMax) / 2, sizeMax].map((size, i) => {
|
|
314
|
-
const radius = sizeScale(size);
|
|
315
|
-
const y = legendY + 20 + i * 30;
|
|
316
|
-
|
|
317
|
-
return (
|
|
318
|
-
<g key={`legend-${i}`}>
|
|
319
|
-
<circle
|
|
320
|
-
cx={legendX + 15}
|
|
321
|
-
cy={y}
|
|
322
|
-
r={radius / 2}
|
|
323
|
-
fill="var(--atomix-gray-5)"
|
|
324
|
-
opacity="0.7"
|
|
325
|
-
/>
|
|
326
|
-
<text
|
|
327
|
-
x={legendX + 35}
|
|
328
|
-
y={y}
|
|
329
|
-
dominantBaseline="middle"
|
|
330
|
-
fontSize="10"
|
|
331
|
-
fill="var(--atomix-gray-6)"
|
|
332
|
-
>
|
|
333
|
-
{size.toFixed(0)}
|
|
334
|
-
</text>
|
|
335
|
-
</g>
|
|
336
|
-
);
|
|
337
|
-
})}
|
|
338
|
-
</g>
|
|
339
|
-
);
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
return (
|
|
343
|
-
<g>
|
|
344
|
-
{axisElements}
|
|
345
|
-
{bubbleElements}
|
|
346
|
-
{legendElements}
|
|
190
|
+
)}
|
|
347
191
|
</g>
|
|
348
192
|
);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
y: bubble.y,
|
|
375
|
-
})),
|
|
376
|
-
},
|
|
377
|
-
];
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
return (
|
|
196
|
+
<>
|
|
197
|
+
{bubbles}
|
|
198
|
+
{showTooltips &&
|
|
199
|
+
hoveredPoint &&
|
|
200
|
+
hoveredPoint.pointIndex < bubbleData.length && (
|
|
201
|
+
<ChartTooltip
|
|
202
|
+
dataPoint={bubbleData[hoveredPoint.pointIndex]}
|
|
203
|
+
datasetLabel="Bubbles"
|
|
204
|
+
datasetColor={
|
|
205
|
+
bubbleData[hoveredPoint.pointIndex]?.color ||
|
|
206
|
+
colorScheme[hoveredPoint.pointIndex % colorScheme.length]
|
|
207
|
+
}
|
|
208
|
+
position={{
|
|
209
|
+
x: hoveredPoint.clientX,
|
|
210
|
+
y: hoveredPoint.clientY,
|
|
211
|
+
}}
|
|
212
|
+
visible={true}
|
|
213
|
+
/>
|
|
214
|
+
)}
|
|
215
|
+
</>
|
|
216
|
+
);
|
|
217
|
+
};
|
|
378
218
|
|
|
379
219
|
return (
|
|
380
|
-
<
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
{
|
|
388
|
-
|
|
389
|
-
dataPoint={{
|
|
390
|
-
label: bubbleData[hoveredBubble.index]?.label || '',
|
|
391
|
-
value: bubbleData[hoveredBubble.index]?.size || 0,
|
|
392
|
-
metadata: {
|
|
393
|
-
x: bubbleData[hoveredBubble.index]?.x,
|
|
394
|
-
y: bubbleData[hoveredBubble.index]?.y,
|
|
395
|
-
...bubbleData[hoveredBubble.index]?.metadata,
|
|
396
|
-
},
|
|
397
|
-
}}
|
|
398
|
-
datasetLabel="Bubble Data"
|
|
399
|
-
datasetColor={bubbleData[hoveredBubble.index]?.color}
|
|
400
|
-
position={{ x: hoveredBubble.clientX, y: hoveredBubble.clientY }}
|
|
401
|
-
visible={true}
|
|
402
|
-
/>
|
|
403
|
-
)}
|
|
404
|
-
</Chart>
|
|
220
|
+
<BaseChart
|
|
221
|
+
ref={ref}
|
|
222
|
+
type="bubble"
|
|
223
|
+
datasets={datasets}
|
|
224
|
+
config={config}
|
|
225
|
+
renderContent={renderContent}
|
|
226
|
+
onDataPointClick={onDataPointClick}
|
|
227
|
+
{...props}
|
|
228
|
+
/>
|
|
405
229
|
);
|
|
406
230
|
}
|
|
407
231
|
)
|