@agions/taroviz 1.10.0 → 1.11.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 +122 -275
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/vendors.js +1 -0
- package/dist/cjs/vendors~echarts.js +1 -0
- package/dist/esm/index.js +7106 -50834
- package/dist/esm/vendors.js +16770 -0
- package/dist/esm/vendors~echarts.js +59417 -0
- package/package.json +10 -11
- package/src/adapters/MiniAppAdapter.ts +136 -0
- package/src/adapters/__tests__/index.test.ts +1 -1
- package/src/adapters/h5/__tests__/index.test.ts +4 -2
- package/src/adapters/h5/index.ts +32 -33
- package/src/adapters/harmony/index.ts +23 -245
- package/src/adapters/index.ts +18 -12
- package/src/adapters/swan/index.ts +6 -69
- package/src/adapters/tt/index.ts +7 -70
- package/src/adapters/types.ts +2 -3
- package/src/adapters/weapp/index.ts +6 -69
- package/src/charts/__tests__/testUtils.tsx +87 -0
- package/src/charts/boxplot/__tests__/index.test.tsx +49 -103
- package/src/charts/boxplot/index.tsx +2 -1
- package/src/charts/boxplot/types.ts +15 -14
- package/src/charts/common/BaseChartWrapper.tsx +84 -78
- package/src/charts/common/__mocks__/BaseChartWrapper.tsx +17 -0
- package/src/charts/createChartComponent.tsx +48 -0
- package/src/charts/index.ts +88 -30
- package/src/charts/liquid/index.tsx +260 -77
- package/src/charts/liquid/types.ts +5 -5
- package/src/charts/parallel/__tests__/index.test.tsx +40 -67
- package/src/charts/parallel/index.tsx +2 -1
- package/src/charts/parallel/types.ts +16 -15
- package/src/charts/tree/index.tsx +4 -1
- package/src/charts/tree/types.ts +1 -1
- package/src/charts/utils.ts +9 -7
- package/src/components/DataFilter/index.tsx +25 -4
- package/src/core/animation/AnimationManager.ts +9 -6
- package/src/core/animation/types.ts +30 -0
- package/src/core/components/Annotation.tsx +2 -3
- package/src/core/components/BaseChart.tsx +60 -72
- package/src/core/components/ErrorBoundary.tsx +17 -4
- package/src/core/components/LazyChart.tsx +83 -57
- package/src/core/components/hooks/useChartInit.ts +6 -3
- package/src/core/index.ts +1 -1
- package/src/core/themes/ThemeManager.ts +1 -1
- package/src/core/types/common.ts +100 -5
- package/src/core/types/index.ts +0 -12
- package/src/core/types/platform.ts +2 -5
- package/src/core/utils/codeGenerator/CodeGenerator.ts +1 -1
- package/src/core/utils/codeGenerator/types.ts +2 -2
- package/src/core/utils/common.ts +12 -5
- package/src/core/utils/configGenerator/ConfigGenerator.ts +4 -4
- package/src/core/utils/configGenerator/types.ts +16 -12
- package/src/core/utils/debug/DebugPanel.tsx +14 -11
- package/src/core/utils/debug/debugger.ts +9 -9
- package/src/core/utils/debug/types.ts +4 -4
- package/src/core/utils/download.ts +134 -0
- package/src/core/utils/drillDown.ts +33 -353
- package/src/core/utils/drillDownHelpers.ts +426 -0
- package/src/core/utils/export/ExportUtils.ts +67 -69
- package/src/core/utils/index.ts +23 -15
- package/src/core/utils/performance/PerformanceAnalyzer.ts +43 -18
- package/src/core/utils/performance/types.ts +10 -1
- package/src/core/utils/performanceUtils.ts +310 -0
- package/src/core/utils/setOptionUtils.ts +59 -0
- package/src/core/version.ts +14 -0
- package/src/editor/EnhancedThemeEditor.tsx +362 -540
- package/src/editor/ThemeEditor.tsx +55 -321
- package/src/editor/components/ThemeBasicSettings.tsx +113 -0
- package/src/editor/components/ThemeColorEditor.tsx +105 -0
- package/src/editor/components/ThemeSelector.tsx +70 -0
- package/src/editor/hooks/useThemeEditorState.ts +201 -0
- package/src/editor/index.ts +10 -2
- package/src/hooks/__tests__/index.test.tsx +3 -1
- package/src/hooks/chartConnectHelpers.ts +335 -0
- package/src/hooks/index.ts +62 -63
- package/src/hooks/types.ts +162 -0
- package/src/hooks/useAnimation.ts +41 -38
- package/src/hooks/useChartConnect.ts +88 -238
- package/src/hooks/useChartDownload.ts +42 -288
- package/src/hooks/useChartHistory.ts +33 -46
- package/src/hooks/useChartSelection.ts +31 -39
- package/src/hooks/useDataTransform.ts +39 -286
- package/src/hooks/useDataZoom.ts +164 -168
- package/src/hooks/usePerformance.ts +20 -12
- package/src/hooks/usePerformanceHooks.ts +278 -0
- package/src/hooks/utils/chartDownloadUtils.ts +260 -0
- package/src/hooks/utils/dataTransformUtils.ts +309 -0
- package/src/index.ts +52 -33
- package/src/main.tsx +4 -9
- package/src/charts/bar/__tests__/index.test.tsx +0 -113
- package/src/charts/bar/index.tsx +0 -14
- package/src/charts/candlestick/__tests__/index.test.tsx +0 -37
- package/src/charts/candlestick/index.tsx +0 -13
- package/src/charts/funnel/index.tsx +0 -14
- package/src/charts/gauge/index.tsx +0 -14
- package/src/charts/graph/__tests__/index.test.tsx +0 -41
- package/src/charts/graph/index.tsx +0 -13
- package/src/charts/heatmap/index.tsx +0 -14
- package/src/charts/line/__tests__/index.test.tsx +0 -107
- package/src/charts/line/index.tsx +0 -15
- package/src/charts/pie/__tests__/index.test.tsx +0 -112
- package/src/charts/pie/index.tsx +0 -14
- package/src/charts/radar/index.tsx +0 -14
- package/src/charts/sankey/index.tsx +0 -18
- package/src/charts/scatter/index.tsx +0 -14
- package/src/charts/sunburst/index.tsx +0 -18
- package/src/charts/treemap/index.tsx +0 -18
- package/src/charts/wordcloud/__tests__/index.test.tsx +0 -36
- package/src/charts/wordcloud/index.tsx +0 -13
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @version v1.5.0
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { render } from '@testing-library/react';
|
|
7
|
-
import GraphChart from '../index';
|
|
8
|
-
|
|
9
|
-
describe('GraphChart', () => {
|
|
10
|
-
it('renders without crashing', () => {
|
|
11
|
-
const { container } = render(<GraphChart />);
|
|
12
|
-
expect(container).toBeTruthy();
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('renders with custom className', () => {
|
|
16
|
-
const { container } = render(<GraphChart className="test-graph" />);
|
|
17
|
-
expect(container.firstChild).toHaveClass('test-graph');
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('renders with custom width and height', () => {
|
|
21
|
-
const { container } = render(<GraphChart width={500} height={400} />);
|
|
22
|
-
expect(container.firstChild).toHaveStyle({ width: '500px', height: '400px' });
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('renders with basic option', () => {
|
|
26
|
-
const option = {
|
|
27
|
-
series: [
|
|
28
|
-
{
|
|
29
|
-
type: 'graph' as const,
|
|
30
|
-
nodes: [
|
|
31
|
-
{ id: '1', name: 'Node 1' },
|
|
32
|
-
{ id: '2', name: 'Node 2' },
|
|
33
|
-
],
|
|
34
|
-
links: [{ source: '1', target: '2' }],
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
|
-
};
|
|
38
|
-
const { container } = render(<GraphChart option={option} />);
|
|
39
|
-
expect(container).toBeTruthy();
|
|
40
|
-
});
|
|
41
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GraphChart组件
|
|
3
|
-
*/
|
|
4
|
-
import React, { memo } from 'react';
|
|
5
|
-
import BaseChartWrapper from '../common/BaseChartWrapper';
|
|
6
|
-
import { GraphChartProps } from '../types';
|
|
7
|
-
|
|
8
|
-
const GraphChart: React.FC<GraphChartProps> = memo((props) => (
|
|
9
|
-
<BaseChartWrapper {...props} chartType="graph-chart" />
|
|
10
|
-
));
|
|
11
|
-
GraphChart.displayName = 'GraphChart';
|
|
12
|
-
|
|
13
|
-
export default GraphChart;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HeatmapChart组件
|
|
3
|
-
*/
|
|
4
|
-
import React, { memo } from 'react';
|
|
5
|
-
import BaseChartWrapper from '../common/BaseChartWrapper';
|
|
6
|
-
import { HeatmapChartProps } from '../types';
|
|
7
|
-
import '@/core/echarts';
|
|
8
|
-
|
|
9
|
-
const HeatmapChart: React.FC<HeatmapChartProps> = memo((props) => (
|
|
10
|
-
<BaseChartWrapper {...props} chartType="heatmap-chart" />
|
|
11
|
-
));
|
|
12
|
-
HeatmapChart.displayName = 'HeatmapChart';
|
|
13
|
-
|
|
14
|
-
export default HeatmapChart;
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
import LineChart from '../index';
|
|
5
|
-
|
|
6
|
-
// Mock ECharts and adapters
|
|
7
|
-
jest.mock('echarts/core', () => ({
|
|
8
|
-
use: jest.fn(),
|
|
9
|
-
init: jest.fn(() => ({
|
|
10
|
-
setOption: jest.fn(),
|
|
11
|
-
showLoading: jest.fn(),
|
|
12
|
-
hideLoading: jest.fn(),
|
|
13
|
-
on: jest.fn(),
|
|
14
|
-
off: jest.fn(),
|
|
15
|
-
dispose: jest.fn(),
|
|
16
|
-
resize: jest.fn(),
|
|
17
|
-
})),
|
|
18
|
-
getInstanceByDom: jest.fn(),
|
|
19
|
-
}));
|
|
20
|
-
|
|
21
|
-
// Mock specific ECharts chart imports
|
|
22
|
-
jest.mock('echarts/charts', () => ({
|
|
23
|
-
LineChart: jest.fn(),
|
|
24
|
-
}));
|
|
25
|
-
|
|
26
|
-
jest.mock('echarts/components', () => ({
|
|
27
|
-
GridComponent: jest.fn(),
|
|
28
|
-
TooltipComponent: jest.fn(),
|
|
29
|
-
TitleComponent: jest.fn(),
|
|
30
|
-
LegendComponent: jest.fn(),
|
|
31
|
-
}));
|
|
32
|
-
|
|
33
|
-
jest.mock('../../common/BaseChartWrapper', () => ({
|
|
34
|
-
__esModule: true,
|
|
35
|
-
default: (props: any) => (
|
|
36
|
-
<div
|
|
37
|
-
data-testid="base-chart-wrapper"
|
|
38
|
-
className={`taroviz-${props.chartType} ${props.className || ''}`}
|
|
39
|
-
style={{ width: props.width, height: props.height }}
|
|
40
|
-
>
|
|
41
|
-
<div data-testid="chart-option">{JSON.stringify(props.option)}</div>
|
|
42
|
-
</div>
|
|
43
|
-
),
|
|
44
|
-
}));
|
|
45
|
-
|
|
46
|
-
describe('LineChart Component', () => {
|
|
47
|
-
const mockOption = {
|
|
48
|
-
xAxis: {
|
|
49
|
-
type: 'category' as const,
|
|
50
|
-
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
|
51
|
-
},
|
|
52
|
-
yAxis: {
|
|
53
|
-
type: 'value' as const,
|
|
54
|
-
},
|
|
55
|
-
series: [
|
|
56
|
-
{
|
|
57
|
-
data: [150, 230, 224, 218, 135, 147, 260],
|
|
58
|
-
type: 'line' as const,
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
it('should render correctly with default props', () => {
|
|
64
|
-
const { getByTestId } = render(<LineChart option={mockOption} />);
|
|
65
|
-
|
|
66
|
-
const chartWrapper = getByTestId('base-chart-wrapper');
|
|
67
|
-
expect(chartWrapper).toBeInTheDocument();
|
|
68
|
-
expect(chartWrapper).toHaveClass('taroviz-line-chart');
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it('should pass the correct option to BaseChartWrapper', () => {
|
|
72
|
-
const { getByTestId } = render(<LineChart option={mockOption} />);
|
|
73
|
-
|
|
74
|
-
const chartOption = getByTestId('chart-option');
|
|
75
|
-
expect(JSON.parse(chartOption.textContent || '')).toEqual(mockOption);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('should render with custom width and height', () => {
|
|
79
|
-
const customWidth = '500px';
|
|
80
|
-
const customHeight = '400px';
|
|
81
|
-
|
|
82
|
-
const { getByTestId } = render(
|
|
83
|
-
<LineChart option={mockOption} width={customWidth} height={customHeight} />
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
const chartWrapper = getByTestId('base-chart-wrapper');
|
|
87
|
-
expect(chartWrapper).toHaveStyle(`width: ${customWidth}`);
|
|
88
|
-
expect(chartWrapper).toHaveStyle(`height: ${customHeight}`);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it('should render with custom className', () => {
|
|
92
|
-
const customClass = 'custom-line-chart';
|
|
93
|
-
|
|
94
|
-
const { getByTestId } = render(<LineChart option={mockOption} className={customClass} />);
|
|
95
|
-
|
|
96
|
-
const chartWrapper = getByTestId('base-chart-wrapper');
|
|
97
|
-
expect(chartWrapper).toHaveClass(customClass);
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it('should render with loading state', () => {
|
|
101
|
-
const { getByTestId } = render(<LineChart option={mockOption} loading={true} />);
|
|
102
|
-
|
|
103
|
-
const chartWrapper = getByTestId('base-chart-wrapper');
|
|
104
|
-
expect(chartWrapper).toBeInTheDocument();
|
|
105
|
-
// The loading state is handled by BaseChartWrapper, which we've mocked
|
|
106
|
-
});
|
|
107
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 折线图组件
|
|
3
|
-
*/
|
|
4
|
-
import React, { memo } from 'react';
|
|
5
|
-
import BaseChartWrapper from '../common/BaseChartWrapper';
|
|
6
|
-
import { LineChartProps } from '../types';
|
|
7
|
-
|
|
8
|
-
import '@/core/echarts';
|
|
9
|
-
|
|
10
|
-
const LineChart: React.FC<LineChartProps> = memo((props) => (
|
|
11
|
-
<BaseChartWrapper {...props} chartType="line-chart" />
|
|
12
|
-
));
|
|
13
|
-
LineChart.displayName = 'LineChart';
|
|
14
|
-
|
|
15
|
-
export default LineChart;
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
import PieChart from '../index';
|
|
5
|
-
|
|
6
|
-
// Mock ECharts and adapters
|
|
7
|
-
jest.mock('echarts/core', () => ({
|
|
8
|
-
use: jest.fn(),
|
|
9
|
-
init: jest.fn(() => ({
|
|
10
|
-
setOption: jest.fn(),
|
|
11
|
-
showLoading: jest.fn(),
|
|
12
|
-
hideLoading: jest.fn(),
|
|
13
|
-
on: jest.fn(),
|
|
14
|
-
off: jest.fn(),
|
|
15
|
-
dispose: jest.fn(),
|
|
16
|
-
resize: jest.fn(),
|
|
17
|
-
})),
|
|
18
|
-
getInstanceByDom: jest.fn(),
|
|
19
|
-
}));
|
|
20
|
-
|
|
21
|
-
// Mock specific ECharts chart imports
|
|
22
|
-
jest.mock('echarts/charts', () => ({
|
|
23
|
-
PieChart: jest.fn(),
|
|
24
|
-
}));
|
|
25
|
-
|
|
26
|
-
jest.mock('echarts/components', () => ({
|
|
27
|
-
GridComponent: jest.fn(),
|
|
28
|
-
TooltipComponent: jest.fn(),
|
|
29
|
-
TitleComponent: jest.fn(),
|
|
30
|
-
LegendComponent: jest.fn(),
|
|
31
|
-
}));
|
|
32
|
-
|
|
33
|
-
jest.mock('../../common/BaseChartWrapper', () => ({
|
|
34
|
-
__esModule: true,
|
|
35
|
-
default: (props: any) => (
|
|
36
|
-
<div
|
|
37
|
-
data-testid="base-chart-wrapper"
|
|
38
|
-
className={`taroviz-${props.chartType} ${props.className || ''}`}
|
|
39
|
-
style={{ width: props.width, height: props.height }}
|
|
40
|
-
>
|
|
41
|
-
<div data-testid="chart-option">{JSON.stringify(props.option)}</div>
|
|
42
|
-
</div>
|
|
43
|
-
),
|
|
44
|
-
}));
|
|
45
|
-
|
|
46
|
-
describe('PieChart Component', () => {
|
|
47
|
-
const mockOption = {
|
|
48
|
-
series: [
|
|
49
|
-
{
|
|
50
|
-
type: 'pie' as const,
|
|
51
|
-
data: [
|
|
52
|
-
{ value: 1048, name: 'Search Engine' },
|
|
53
|
-
{ value: 735, name: 'Direct' },
|
|
54
|
-
{ value: 580, name: 'Email' },
|
|
55
|
-
{ value: 484, name: 'Union Ads' },
|
|
56
|
-
{ value: 300, name: 'Video Ads' },
|
|
57
|
-
],
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
it('should render correctly with default props', () => {
|
|
63
|
-
const { getByTestId } = render(<PieChart option={mockOption} />);
|
|
64
|
-
|
|
65
|
-
const chartWrapper = getByTestId('base-chart-wrapper');
|
|
66
|
-
expect(chartWrapper).toBeInTheDocument();
|
|
67
|
-
expect(chartWrapper).toHaveClass('taroviz-pie-chart');
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('should pass the correct option to BaseChartWrapper', () => {
|
|
71
|
-
const { getByTestId } = render(<PieChart option={mockOption} />);
|
|
72
|
-
|
|
73
|
-
const chartOption = getByTestId('chart-option');
|
|
74
|
-
expect(JSON.parse(chartOption.textContent || '')).toEqual(mockOption);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it('should render with custom width and height', () => {
|
|
78
|
-
const customWidth = '400px';
|
|
79
|
-
const customHeight = '400px';
|
|
80
|
-
|
|
81
|
-
const { getByTestId } = render(
|
|
82
|
-
<PieChart option={mockOption} width={customWidth} height={customHeight} />
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
const chartWrapper = getByTestId('base-chart-wrapper');
|
|
86
|
-
expect(chartWrapper).toHaveStyle(`width: ${customWidth}`);
|
|
87
|
-
expect(chartWrapper).toHaveStyle(`height: ${customHeight}`);
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it('should render with custom className', () => {
|
|
91
|
-
const customClass = 'custom-pie-chart';
|
|
92
|
-
|
|
93
|
-
const { getByTestId } = render(<PieChart option={mockOption} className={customClass} />);
|
|
94
|
-
|
|
95
|
-
const chartWrapper = getByTestId('base-chart-wrapper');
|
|
96
|
-
expect(chartWrapper).toHaveClass(customClass);
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('should render with loading state', () => {
|
|
100
|
-
const { getByTestId } = render(<PieChart option={mockOption} loading={true} />);
|
|
101
|
-
|
|
102
|
-
const chartWrapper = getByTestId('base-chart-wrapper');
|
|
103
|
-
expect(chartWrapper).toBeInTheDocument();
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it('should render with theme', () => {
|
|
107
|
-
const { getByTestId } = render(<PieChart option={mockOption} theme="dark" />);
|
|
108
|
-
|
|
109
|
-
const chartWrapper = getByTestId('base-chart-wrapper');
|
|
110
|
-
expect(chartWrapper).toBeInTheDocument();
|
|
111
|
-
});
|
|
112
|
-
});
|
package/src/charts/pie/index.tsx
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PieChart组件
|
|
3
|
-
*/
|
|
4
|
-
import React, { memo } from 'react';
|
|
5
|
-
import BaseChartWrapper from '../common/BaseChartWrapper';
|
|
6
|
-
import { BaseChartProps } from '../types';
|
|
7
|
-
import '@/core/echarts';
|
|
8
|
-
|
|
9
|
-
const PieChart: React.FC<BaseChartProps> = memo((props) => (
|
|
10
|
-
<BaseChartWrapper {...props} chartType="pie-chart" />
|
|
11
|
-
));
|
|
12
|
-
PieChart.displayName = 'PieChart';
|
|
13
|
-
|
|
14
|
-
export default PieChart;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RadarChart组件
|
|
3
|
-
*/
|
|
4
|
-
import React, { memo } from 'react';
|
|
5
|
-
import BaseChartWrapper from '../common/BaseChartWrapper';
|
|
6
|
-
import { RadarChartProps } from '../types';
|
|
7
|
-
import '@/core/echarts';
|
|
8
|
-
|
|
9
|
-
const RadarChart: React.FC<RadarChartProps> = memo((props) => (
|
|
10
|
-
<BaseChartWrapper {...props} chartType="radar-chart" />
|
|
11
|
-
));
|
|
12
|
-
RadarChart.displayName = 'RadarChart';
|
|
13
|
-
|
|
14
|
-
export default RadarChart;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sankey 桑基图组件
|
|
3
|
-
* 用于展示数据流向和转移关系
|
|
4
|
-
*/
|
|
5
|
-
import React, { memo } from 'react';
|
|
6
|
-
import BaseChartWrapper from '../common/BaseChartWrapper';
|
|
7
|
-
import { SankeyChartProps } from '../types';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Sankey 桑基图组件
|
|
11
|
-
*/
|
|
12
|
-
const SankeyChart: React.FC<SankeyChartProps> = memo((props) => (
|
|
13
|
-
<BaseChartWrapper {...props} chartType="sankey-chart" />
|
|
14
|
-
));
|
|
15
|
-
|
|
16
|
-
SankeyChart.displayName = 'SankeyChart';
|
|
17
|
-
|
|
18
|
-
export default SankeyChart;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ScatterChart组件
|
|
3
|
-
*/
|
|
4
|
-
import React, { memo } from 'react';
|
|
5
|
-
import BaseChartWrapper from '../common/BaseChartWrapper';
|
|
6
|
-
import { ScatterChartProps } from '../types';
|
|
7
|
-
import '@/core/echarts';
|
|
8
|
-
|
|
9
|
-
const ScatterChart: React.FC<ScatterChartProps> = memo((props) => (
|
|
10
|
-
<BaseChartWrapper {...props} chartType="scatter-chart" />
|
|
11
|
-
));
|
|
12
|
-
ScatterChart.displayName = 'ScatterChart';
|
|
13
|
-
|
|
14
|
-
export default ScatterChart;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sunburst 旭日图组件
|
|
3
|
-
* 用于展示带有层级结构的数据,以同心圆的形式展示
|
|
4
|
-
*/
|
|
5
|
-
import React, { memo } from 'react';
|
|
6
|
-
import BaseChartWrapper from '../common/BaseChartWrapper';
|
|
7
|
-
import { SunburstChartProps } from '../types';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Sunburst 旭日图组件
|
|
11
|
-
*/
|
|
12
|
-
const SunburstChart: React.FC<SunburstChartProps> = memo((props) => (
|
|
13
|
-
<BaseChartWrapper {...props} chartType="sunburst-chart" />
|
|
14
|
-
));
|
|
15
|
-
|
|
16
|
-
SunburstChart.displayName = 'SunburstChart';
|
|
17
|
-
|
|
18
|
-
export default SunburstChart;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TreeMap 图表组件
|
|
3
|
-
* 用于展示带有层级结构的数据,通过矩形面积表示数据大小
|
|
4
|
-
*/
|
|
5
|
-
import React, { memo } from 'react';
|
|
6
|
-
import BaseChartWrapper from '../common/BaseChartWrapper';
|
|
7
|
-
import { TreeMapChartProps } from '../types';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* TreeMap 图表组件
|
|
11
|
-
*/
|
|
12
|
-
const TreeMapChart: React.FC<TreeMapChartProps> = memo((props) => (
|
|
13
|
-
<BaseChartWrapper {...props} chartType="treemap-chart" />
|
|
14
|
-
));
|
|
15
|
-
|
|
16
|
-
TreeMapChart.displayName = 'TreeMapChart';
|
|
17
|
-
|
|
18
|
-
export default TreeMapChart;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @version v1.5.0
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { render } from '@testing-library/react';
|
|
7
|
-
import WordCloudChart from '../index';
|
|
8
|
-
|
|
9
|
-
describe('WordCloudChart', () => {
|
|
10
|
-
it('renders without crashing', () => {
|
|
11
|
-
const { container } = render(<WordCloudChart />);
|
|
12
|
-
expect(container).toBeTruthy();
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('renders with custom width and height', () => {
|
|
16
|
-
const { container } = render(<WordCloudChart width={600} height={400} />);
|
|
17
|
-
expect(container.firstChild).toHaveStyle({ width: '600px', height: '400px' });
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('renders with word data', () => {
|
|
21
|
-
const option = {
|
|
22
|
-
series: [
|
|
23
|
-
{
|
|
24
|
-
type: 'wordCloud' as const,
|
|
25
|
-
data: [
|
|
26
|
-
{ name: 'JavaScript', value: 10000 },
|
|
27
|
-
{ name: 'TypeScript', value: 8000 },
|
|
28
|
-
{ name: 'React', value: 6000 },
|
|
29
|
-
],
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
} as any;
|
|
33
|
-
const { container } = render(<WordCloudChart option={option} />);
|
|
34
|
-
expect(container).toBeTruthy();
|
|
35
|
-
});
|
|
36
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordCloudChart组件
|
|
3
|
-
*/
|
|
4
|
-
import React, { memo } from 'react';
|
|
5
|
-
import BaseChartWrapper from '../common/BaseChartWrapper';
|
|
6
|
-
import { WordCloudChartProps } from '../types';
|
|
7
|
-
|
|
8
|
-
const WordCloudChart: React.FC<WordCloudChartProps> = memo((props) => (
|
|
9
|
-
<BaseChartWrapper {...props} chartType="wordcloud-chart" />
|
|
10
|
-
));
|
|
11
|
-
WordCloudChart.displayName = 'WordCloudChart';
|
|
12
|
-
|
|
13
|
-
export default WordCloudChart;
|