@advt-gpt-chart/package 3.0.19 → 3.1.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.
Files changed (93) hide show
  1. package/README.md +55 -55
  2. package/dist/Chart/ChartBase/constants.d.ts +19 -4
  3. package/dist/Chart/ChartBase/index.d.ts +1 -1
  4. package/dist/Chart/ChartBase/transformed.d.ts +5 -0
  5. package/dist/Chart/ChartBase/types.d.ts +7 -1
  6. package/dist/Chart/ChartBase/utils.d.ts +1 -1
  7. package/dist/Chart/ChartCodeRender/type.d.ts +23 -0
  8. package/dist/Chart/ChartCodeRender/visChart/ChartStoreContext.d.ts +2 -2
  9. package/dist/Chart/ChartControllers/Orders/OrdersController.d.ts +1 -1
  10. package/dist/Chart/ChartControllers/index.d.ts +1 -1
  11. package/dist/Chart/ChartWrapper/style.d.ts +2 -1
  12. package/dist/Chart/ChartWrapper/utils.d.ts +7 -0
  13. package/dist/Chart/DataSource/metricInsight.d.ts +14 -1
  14. package/dist/Chart/DataSource/types.d.ts +1 -1
  15. package/dist/Chart/DataSource/useChartDataQuery.d.ts +1 -1
  16. package/dist/Charts/AgentCharts/AgentChartHeader.d.ts +7 -0
  17. package/dist/Charts/AgentCharts/AgentChartHeaderStyle.d.ts +9 -0
  18. package/dist/Charts/AgentCharts/DimensionAttribution/index.d.ts +3 -0
  19. package/dist/Charts/AgentCharts/DimensionAttribution/types.d.ts +8 -0
  20. package/dist/Charts/AgentCharts/FactorAttribution/index.d.ts +3 -0
  21. package/dist/Charts/AgentCharts/FactorAttribution/types.d.ts +8 -0
  22. package/dist/Charts/AgentCharts/index.d.ts +3 -0
  23. package/dist/Charts/AgentCharts/types.d.ts +70 -0
  24. package/dist/Charts/Area/types.d.ts +2 -2
  25. package/dist/Charts/Bar/types.d.ts +2 -2
  26. package/dist/Charts/Composite/config.d.ts +22 -0
  27. package/dist/Charts/Composite/index.d.ts +3 -0
  28. package/dist/Charts/Composite/types.d.ts +11 -0
  29. package/dist/Charts/Composite/util.d.ts +18 -0
  30. package/dist/Charts/Donut/types.d.ts +2 -2
  31. package/dist/Charts/Funnel/types.d.ts +2 -2
  32. package/dist/Charts/Gauge/types.d.ts +2 -2
  33. package/dist/Charts/Heatmap/types.d.ts +3 -3
  34. package/dist/Charts/Indicator/contants.d.ts +2 -2
  35. package/dist/Charts/Indicator/styles.d.ts +2 -0
  36. package/dist/Charts/Indicator/types.d.ts +4 -2
  37. package/dist/Charts/Line/types.d.ts +2 -2
  38. package/dist/Charts/Pie/types.d.ts +2 -2
  39. package/dist/Charts/PivotTable/index.d.ts +3 -0
  40. package/dist/Charts/PivotTable/theme.d.ts +3 -0
  41. package/dist/Charts/PivotTable/types.d.ts +22 -0
  42. package/dist/Charts/Radar/types.d.ts +1 -1
  43. package/dist/Charts/Rank/types.d.ts +2 -2
  44. package/dist/Charts/Scatter/types.d.ts +2 -2
  45. package/dist/Charts/Tabs/index.d.ts +3 -0
  46. package/dist/Charts/Tabs/styles.d.ts +3 -0
  47. package/dist/Charts/Tabs/types.d.ts +18 -0
  48. package/dist/ConfigProvider/hooks/useConfig.d.ts +3 -7
  49. package/dist/{Chart/ChartControllers/TimeRange → components/CustomTimeRange}/index.d.ts +1 -1
  50. package/dist/{Chart/ChartControllers/TimeRange → components/CustomTimeRange}/types.d.ts +4 -4
  51. package/dist/{Chart/ChartControllers/TimeRange → components/CustomTimeRange}/utils.d.ts +2 -2
  52. package/dist/components/VTabs.d.ts +5 -0
  53. package/dist/components/index.d.ts +9 -0
  54. package/dist/export.d.ts +14 -2
  55. package/dist/index.d.ts +2 -0
  56. package/dist/index.es.js +178746 -182506
  57. package/dist/index.es.js.gz +0 -0
  58. package/dist/index.umd.js +2430 -2215
  59. package/dist/index.umd.js.gz +0 -0
  60. package/dist/locale/en-US.d.ts +14 -0
  61. package/dist/locale/zh-CN.d.ts +14 -0
  62. package/dist/locale/zh-TW.d.ts +14 -0
  63. package/dist/services/constants.d.ts +5 -1
  64. package/dist/services/index.d.ts +104 -2
  65. package/dist/services/types.d.ts +15 -0
  66. package/dist/types/chart.d.ts +16 -3
  67. package/dist/types/config.d.ts +1 -0
  68. package/dist/utils/useTools.d.ts +3 -1
  69. package/dist/version.d.ts +1 -1
  70. package/package.json +45 -114
  71. /package/dist/{Text → Charts/Text}/VisText.d.ts +0 -0
  72. /package/dist/{Text → Charts/Text}/config.d.ts +0 -0
  73. /package/dist/{Text → Charts/Text}/custom-icons/index.d.ts +0 -0
  74. /package/dist/{Text → Charts/Text}/index.d.ts +0 -0
  75. /package/dist/{Text → Charts/Text}/mini-charts/hooks/getElementFontSize.d.ts +0 -0
  76. /package/dist/{Text → Charts/Text}/mini-charts/hooks/index.d.ts +0 -0
  77. /package/dist/{Text → Charts/Text}/mini-charts/hooks/useSvgWrapper.d.ts +0 -0
  78. /package/dist/{Text → Charts/Text}/mini-charts/index.d.ts +0 -0
  79. /package/dist/{Text → Charts/Text}/mini-charts/line/SingleLineChart.d.ts +0 -0
  80. /package/dist/{Text → Charts/Text}/mini-charts/line/index.d.ts +0 -0
  81. /package/dist/{Text → Charts/Text}/mini-charts/line/scaleLinear.d.ts +0 -0
  82. /package/dist/{Text → Charts/Text}/mini-charts/line/useLineCompute.d.ts +0 -0
  83. /package/dist/{Text → Charts/Text}/mini-charts/proportion/getArcPath.d.ts +0 -0
  84. /package/dist/{Text → Charts/Text}/mini-charts/proportion/index.d.ts +0 -0
  85. /package/dist/{Text → Charts/Text}/theme.d.ts +0 -0
  86. /package/dist/{Text → Charts/Text}/types.d.ts +0 -0
  87. /package/dist/{Text → Charts/Text}/utils/getThemeColor.d.ts +0 -0
  88. /package/dist/{Text → Charts/Text}/utils/index.d.ts +0 -0
  89. /package/dist/{Text → Charts/Text}/utils/useAntdDarkAlgorithm.d.ts +0 -0
  90. /package/dist/{Chart/ChartControllers/TimeRange → components/CustomTimeRange}/AdvancedContent.d.ts +0 -0
  91. /package/dist/{Chart/ChartControllers/TimeRange → components/CustomTimeRange}/CustomContent.d.ts +0 -0
  92. /package/dist/{Chart/ChartControllers/TimeRange → components/CustomTimeRange}/TimeRangePopover.d.ts +0 -0
  93. /package/dist/{Chart/ChartControllers/TimeRange → components/CustomTimeRange}/styles.d.ts +0 -0
package/README.md CHANGED
@@ -1,55 +1,55 @@
1
- # advt-gpt-chart 可视化组件库
2
-
3
- ## 特性
4
-
5
- - 📊 支持13+图表类型(折线图/柱状图/饼图/雷达图等)
6
- - 🎨 内置Light/Dark双主题体系
7
- - 📝 Markdown协议直接渲染图表
8
- <!-- - 🌐 国际化多语言支持 -->
9
- - 🛠 完善的TypeScript类型定义
10
-
11
- # 安装依赖
12
-
13
- ```bash
14
- npm install @advt-gpt-chart/package
15
- pnpm install @advt-gpt-chart/package
16
- ```
17
-
18
- # 使用
19
- ```tsx
20
- import { ConfigProvider, Line, GPTVis } from '@advt-gpt-chart/package';
21
-
22
- function App() {
23
-
24
- const markdownContent = `
25
- 以下是为你绘制的一个饼图
26
- \`\`\`vis-chart
27
- {
28
- "type": "pie",
29
- "data": [
30
- { "category": "分类一", "value": 27 },
31
- { "category": "分类二", "value": 25 },
32
- { "category": "分类三", "value": 18 },
33
- { "category": "分类四", "value": 15 },
34
- { "category": "分类五", "value": 10 },
35
- { "category": "其他", "value": 5 }
36
- ],
37
- "nameField": "category",
38
- "valField": "value"
39
- }
40
- \`\`\`
41
- `;
42
-
43
- return (
44
- <ConfigProvider theme="dark">
45
- {/* 直接使用图表组件 */}
46
- <Line data={[...]} />
47
-
48
- {/* 通过Markdown渲染 */}
49
- <GPTVis>
50
- {markdownContent}
51
- </GPTVis>
52
- </ConfigProvider>
53
- );
54
- }
55
- ```
1
+ # advt-gpt-chart 可视化组件库
2
+
3
+ ## 特性
4
+
5
+ - 📊 支持13+图表类型(折线图/柱状图/饼图/雷达图等)
6
+ - 🎨 内置Light/Dark双主题体系
7
+ - 📝 Markdown协议直接渲染图表
8
+ <!-- - 🌐 国际化多语言支持 -->
9
+ - 🛠 完善的TypeScript类型定义
10
+
11
+ # 安装依赖
12
+
13
+ ```bash
14
+ npm install @advt-gpt-chart/package
15
+ pnpm install @advt-gpt-chart/package
16
+ ```
17
+
18
+ # 使用
19
+ ```tsx
20
+ import { ConfigProvider, Line, GPTVis } from '@advt-gpt-chart/package';
21
+
22
+ function App() {
23
+
24
+ const markdownContent = `
25
+ 以下是为你绘制的一个饼图
26
+ \`\`\`vis-chart
27
+ {
28
+ "type": "pie",
29
+ "data": [
30
+ { "category": "分类一", "value": 27 },
31
+ { "category": "分类二", "value": 25 },
32
+ { "category": "分类三", "value": 18 },
33
+ { "category": "分类四", "value": 15 },
34
+ { "category": "分类五", "value": 10 },
35
+ { "category": "其他", "value": 5 }
36
+ ],
37
+ "nameField": "category",
38
+ "valField": "value"
39
+ }
40
+ \`\`\`
41
+ `;
42
+
43
+ return (
44
+ <ConfigProvider theme="dark">
45
+ {/* 直接使用图表组件 */}
46
+ <Line data={[...]} />
47
+
48
+ {/* 通过Markdown渲染 */}
49
+ <GPTVis>
50
+ {markdownContent}
51
+ </GPTVis>
52
+ </ConfigProvider>
53
+ );
54
+ }
55
+ ```
@@ -3,6 +3,7 @@ import { AxesType } from './utils';
3
3
  type CartesianOptions = {
4
4
  xField: string;
5
5
  yField: string;
6
+ yFields?: string[];
6
7
  };
7
8
  type CartesianTooltipOptions = CartesianOptions & {
8
9
  seriesField?: string;
@@ -14,7 +15,20 @@ type PolarTooltipOptions = {
14
15
  showPercent?: boolean;
15
16
  categoryFieldType?: AxesType;
16
17
  };
17
- export declare const getPolarLegendSpec: (seriesField: string | boolean | undefined, categoryField: string) => {
18
+ type CompositeAxisSpec = {
19
+ orient: 'left' | 'right' | 'bottom' | 'top';
20
+ seriesIndex?: number[];
21
+ seriesId?: string[];
22
+ type?: string;
23
+ label?: any;
24
+ grid?: any;
25
+ title?: any;
26
+ };
27
+ export type Tools = {
28
+ formatValue: (field: string, value: any) => any;
29
+ getAxesType: (field: string) => 'band' | 'linear';
30
+ };
31
+ export declare const getPolarLegendSpec: (seriesField: string | boolean | undefined, categoryField: string, tools?: Tools) => {
18
32
  visible: boolean;
19
33
  item: {
20
34
  label: {
@@ -23,7 +37,7 @@ export declare const getPolarLegendSpec: (seriesField: string | boolean | undefi
23
37
  };
24
38
  };
25
39
  export declare const getCartesianLegend: (xField?: string, seriesField?: string | boolean) => any;
26
- export declare const getPolarTooltipSpec: ({ categoryField, valueField, seriesField, showPercent }: PolarTooltipOptions) => {
40
+ export declare const getPolarTooltipSpec: ({ categoryField, valueField, seriesField, showPercent }: PolarTooltipOptions, tools?: Tools) => {
27
41
  mark: {
28
42
  title: {
29
43
  value: (datum: any) => any;
@@ -65,8 +79,9 @@ export declare const getLineStyle: () => {
65
79
  };
66
80
  };
67
81
  };
68
- export declare const getCartesianAxesSpec: (options: CartesianOptions) => ICartesianAxisSpec[];
69
- export declare const getCartesianTootipSpec: ({ xField, yField, seriesField }: CartesianTooltipOptions) => {
82
+ export declare const getCartesianAxesSpec: (options: CartesianOptions, tools?: Tools) => ICartesianAxisSpec[];
83
+ export declare const getCompositeAxesSpec: (series: any[], yFields: string[]) => CompositeAxisSpec[];
84
+ export declare const getCartesianTootipSpec: ({ xField, yField, seriesField }: CartesianTooltipOptions, tools?: Tools) => {
70
85
  mark: {
71
86
  updateTitle: (prev: any) => any;
72
87
  content: {
@@ -1,3 +1,3 @@
1
1
  import { VChartBaseProps } from './types';
2
- declare function VChartBase({ VChart, spec }: VChartBaseProps): import("react/jsx-runtime").JSX.Element;
2
+ declare function VChartBase({ VChart, spec, mergedProps }: VChartBaseProps): import("react/jsx-runtime").JSX.Element;
3
3
  export { VChartBase };
@@ -16,6 +16,11 @@ export interface PolarParams {
16
16
  valField: string;
17
17
  dimensions?: string[];
18
18
  }
19
+ /**
20
+ * 从 AxesConfig 中提取单一 xField 值
21
+ * 用于需要点对齐的图表(Line, Area, Scatter)
22
+ */
23
+ export declare const getAlignedXField: (axesConfig: AxesConfig) => string;
19
24
  export declare function transfrom2CartesianAxes(dataset: Dataset | undefined, { xField, yField, dimensions }: CartesianParams): AxesConfig;
20
25
  export declare function transfrom2PolarAxes(dataset: Dataset | undefined, { nameField, valField }: PolarParams): {
21
26
  nameField: string;
@@ -1,11 +1,17 @@
1
1
  import type { IChartSpec } from '@visactor/vchart';
2
2
  import type { ComponentType } from 'react';
3
+ import { ContextMenu } from '../../GPTVis/hooks/useChartStore';
3
4
  import { BaseChartProps, DataItem } from '../../types';
5
+ import { ChartJson } from '../ChartCodeRender/type';
4
6
  import { Dataset, FieldInfoItem } from '../Dataset/types';
5
7
  import { DataSource } from '../DataSource/types';
6
- export interface VChartBaseProps extends BaseChartProps {
8
+ export interface MergedProps extends ChartJson {
9
+ onContextMenu?: (menu: ContextMenu) => void;
10
+ }
11
+ export interface VChartBaseProps {
7
12
  VChart: ComponentType<any>;
8
13
  spec?: Partial<IChartSpec>;
14
+ mergedProps: MergedProps;
9
15
  }
10
16
  export interface BaseVChartConfig<T = DataItem> {
11
17
  data: T[];
@@ -12,4 +12,4 @@ export type AxesType = {
12
12
  axisType: AxisType;
13
13
  dataType: GenericDataType;
14
14
  };
15
- export declare const getAxesType: (val: any, field?: string) => AxesType;
15
+ export declare const getAxesTypeAndDataType: (val: any, field?: string) => AxesType;
@@ -5,6 +5,26 @@ import { ChartType, DataItem } from '../../types';
5
5
  import { TimeGrainType } from '../../utils';
6
6
  import { DataFormat, FieldInfoItem } from '../Dataset/types';
7
7
  import { DataSource } from '../DataSource/types';
8
+ export interface MetricItem {
9
+ id: string;
10
+ name: string;
11
+ }
12
+ export interface DimensionItem {
13
+ id: string;
14
+ name: string;
15
+ }
16
+ export interface AgentParams {
17
+ metrics?: MetricItem[];
18
+ dimensions?: DimensionItem[];
19
+ analyzeDate?: any;
20
+ comparisonDate?: any;
21
+ filters?: any;
22
+ type?: string;
23
+ }
24
+ export interface AgentConfig {
25
+ name?: string;
26
+ params?: AgentParams;
27
+ }
8
28
  export type WithChartCodeOptions = {
9
29
  /**
10
30
  * 要额外加载的图表组件
@@ -47,6 +67,9 @@ export interface ChartJson {
47
67
  columns?: FieldInfoItem[];
48
68
  timeGrain?: TimeGrainType;
49
69
  dataFormat?: DataFormat;
70
+ hideChartHeader?: boolean;
71
+ series?: any[];
72
+ agent?: AgentConfig;
50
73
  }
51
74
  /**
52
75
  * 图表组件字典
@@ -7,8 +7,8 @@ interface ChartStoreContextType {
7
7
  chartId: string;
8
8
  }
9
9
  export declare const ChartStoreContext: React.Context<ChartStoreContextType | null>;
10
- export declare const useChartContext: () => ChartStoreContextType;
11
- export declare const getChartId: () => string;
10
+ export declare const useChartContext: () => ChartStoreContextType | null;
11
+ export declare const getChartId: () => string | undefined;
12
12
  export declare const getChartStore: () => VizChartState;
13
13
  interface ChartStoreProviderProps {
14
14
  chartProps: BaseChartProps & ChartJson;
@@ -1,4 +1,4 @@
1
- import { OptionType } from '../TimeRange/types';
1
+ import { OptionType } from '../../../components/CustomTimeRange/types';
2
2
  import { dimensionsOptionType } from '../types';
3
3
  import { OrderItemType } from './types';
4
4
  interface Props {
@@ -1,8 +1,8 @@
1
+ import { OptionType, TimeRange } from '../../components/CustomTimeRange/types';
1
2
  import { TimeGrainType } from '../../utils/date';
2
3
  import { DataSource } from '../DataSource/types';
3
4
  import { FilterItemType } from './Filter/types';
4
5
  import { OrderItemType } from './Orders/types';
5
- import { OptionType, TimeRange } from './TimeRange/types';
6
6
  import { dimensionsOptionType } from './types';
7
7
  export interface ChartHeaderProps {
8
8
  theme?: string;
@@ -1,5 +1,6 @@
1
- export declare const StyleChart: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
1
+ export declare const StyleWrapperInner: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
2
2
  theme: string;
3
+ $hideChartHeader?: boolean;
3
4
  style?: any;
4
5
  }>> & string;
5
6
  export declare const StyleChartHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
@@ -21,5 +21,12 @@ export declare function chartAdvisor(chartJson: ChartJson): Promise<{
21
21
  columns?: import("../Dataset/types").FieldInfoItem[];
22
22
  timeGrain?: import("../../utils").TimeGrainType;
23
23
  dataFormat?: import("../Dataset/types").DataFormat;
24
+ hideChartHeader?: boolean;
25
+ series?: any[];
26
+ agent?: import("../ChartCodeRender/type").AgentConfig;
24
27
  }>;
25
28
  export declare function exportToExcel(data: any[], fileName: string): void;
29
+ export declare function exportToExcelWithSheets(sheets: Array<{
30
+ name: string;
31
+ data: any[];
32
+ }>, fileName: string): void;
@@ -1,6 +1,19 @@
1
- import { QueryData, TableData } from '../ChartControllers/TimeRange/types';
1
+ import { QueryData, TableData } from '../../components/CustomTimeRange/types';
2
2
  import { DataSource } from './types';
3
3
  export declare const queryMetricId: (id: string) => Promise<any>;
4
+ export interface MetricAttributionParams {
5
+ analyzeDate?: string;
6
+ comparisonDate?: string;
7
+ timeUnit?: string;
8
+ dimensions?: any[];
9
+ filters?: any[];
10
+ indirectionDate?: string;
11
+ mainMetric?: string;
12
+ subMetrics?: string[];
13
+ topK?: number;
14
+ type?: string;
15
+ }
16
+ export declare const queryMetricAttribution: (metricId: string, params?: MetricAttributionParams) => Promise<any>;
4
17
  export declare const queryDimensions: (metricIds: string[]) => Promise<any>;
5
18
  export declare const queryMql2Params: (mql: any) => Promise<any>;
6
19
  export declare const queryChartData: (dataSource: DataSource, queryData: QueryData) => Promise<any>;
@@ -1,5 +1,5 @@
1
+ import { TimeRange } from '../../components/CustomTimeRange/types';
1
2
  import { FilterItem } from '../ChartControllers/Filter/types';
2
- import { TimeRange } from '../ChartControllers/TimeRange/types';
3
3
  import { FieldInfoItem } from '../Dataset/types';
4
4
  export declare const DataSourceTypes: {
5
5
  METRIC: string;
@@ -1,4 +1,4 @@
1
- import { QueryData } from '../ChartControllers/TimeRange/types';
1
+ import { QueryData } from '../../components/CustomTimeRange/types';
2
2
  import { DataSource } from './types';
3
3
  type QueryChartData = {
4
4
  queryData: QueryData;
@@ -0,0 +1,7 @@
1
+ interface AgentChartHeaderProps {
2
+ theme?: 'light' | 'dark';
3
+ chartName?: string;
4
+ onDownloadExcel?: () => void | Promise<void>;
5
+ }
6
+ export declare const AgentChartHeader: ({ theme, chartName, onDownloadExcel }: AgentChartHeaderProps) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,9 @@
1
+ export declare const StyleAgentChartHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
2
+ ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
3
+ }>, never>, {
4
+ theme?: string;
5
+ }>> & string;
6
+ export declare const StyleAgentChartWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
7
+ theme?: string;
8
+ $isFullScreen?: boolean;
9
+ }>> & string;
@@ -0,0 +1,3 @@
1
+ import { DimensionAttributionProps } from './types';
2
+ declare const DimensionAttribution: (props: DimensionAttributionProps) => import("react/jsx-runtime").JSX.Element | null;
3
+ export default DimensionAttribution;
@@ -0,0 +1,8 @@
1
+ import type { BaseChartProps } from '../../../types';
2
+ import type { AgentConfig, SeriesItem } from '../types';
3
+ export interface DimensionAttributionProps extends BaseChartProps {
4
+ series?: SeriesItem[];
5
+ theme?: 'light' | 'dark';
6
+ chartName?: string;
7
+ agent?: AgentConfig;
8
+ }
@@ -0,0 +1,3 @@
1
+ import type { FactorAttributionProps } from './types';
2
+ declare const FactorAttribution: (props: FactorAttributionProps) => import("react/jsx-runtime").JSX.Element | null;
3
+ export default FactorAttribution;
@@ -0,0 +1,8 @@
1
+ import type { BaseChartProps } from '../../../types';
2
+ import type { AgentConfig, AgentDataItem } from '../types';
3
+ export interface FactorAttributionProps extends BaseChartProps {
4
+ data?: AgentDataItem[];
5
+ theme?: 'light' | 'dark';
6
+ chartName?: string;
7
+ agent?: AgentConfig;
8
+ }
@@ -0,0 +1,3 @@
1
+ import type { AgentChartsProps } from './types';
2
+ declare const AgentChartsComponent: (props: AgentChartsProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default AgentChartsComponent;
@@ -0,0 +1,70 @@
1
+ import type { BaseChartProps, ChartType, DataItem } from '../../types';
2
+ export interface DimensionItem {
3
+ id: string;
4
+ name: string;
5
+ }
6
+ export interface AgentParams {
7
+ metricId?: string;
8
+ dimensions?: DimensionItem[];
9
+ analyzeDate?: string;
10
+ comparisonDate?: string;
11
+ timeUnit?: string;
12
+ filters?: any[];
13
+ indirectionDate?: string;
14
+ mainMetric?: string;
15
+ subMetrics?: string[];
16
+ topK?: number;
17
+ type?: string;
18
+ }
19
+ export interface AgentConfig {
20
+ name?: string;
21
+ params?: AgentParams;
22
+ }
23
+ export type AgentChartType = 'factor-attribution' | 'dimension-attribution';
24
+ export interface AgentDataItem {
25
+ metricName: string;
26
+ metricId: string;
27
+ metricType: string;
28
+ dimensionKey?: string;
29
+ dimensionValue?: string;
30
+ currentValue?: number;
31
+ comparisonValue?: number;
32
+ growthValue?: number;
33
+ absoluteValue?: number;
34
+ changeRate?: number;
35
+ contributionToTotalRate?: number;
36
+ contributionToParentRate?: number;
37
+ hasChildren?: boolean;
38
+ isExpandable?: boolean;
39
+ [key: string]: any;
40
+ }
41
+ export interface SeriesItem {
42
+ key: string;
43
+ label: string;
44
+ englishName?: string;
45
+ displayName?: string;
46
+ data?: DataItem[];
47
+ chartType?: ChartType;
48
+ chartConfig?: any;
49
+ }
50
+ export interface AgentChartsConfig {
51
+ agentChartType?: AgentChartType;
52
+ agent?: AgentConfig;
53
+ data: AgentDataItem[];
54
+ series?: SeriesItem[];
55
+ theme?: 'light' | 'dark';
56
+ chartName?: string;
57
+ dimensions?: string[];
58
+ metrics?: string[];
59
+ }
60
+ export interface AgentChartsProps extends BaseChartProps, Partial<AgentChartsConfig> {
61
+ }
62
+ export interface FactorAttributionConfig {
63
+ agentChartType: 'factor-attribution';
64
+ data: AgentDataItem[];
65
+ agent?: AgentConfig;
66
+ }
67
+ export interface DimensionAttributionConfig {
68
+ agentChartType: 'dimension-attribution';
69
+ series: SeriesItem[];
70
+ }
@@ -1,8 +1,8 @@
1
1
  import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../../types';
2
2
  export type AreaDataItem = DataItem & {};
3
3
  export type AreaConfig = BaseVChartConfig & {
4
- xField: string;
5
- yField: string;
4
+ xField?: string;
5
+ yField?: string;
6
6
  metrics?: string[];
7
7
  dimensions?: string[];
8
8
  };
@@ -1,8 +1,8 @@
1
1
  import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../../types';
2
2
  export type BarDataItem = DataItem & {};
3
3
  export type BarConfig = BaseVChartConfig & {
4
- xField: string;
5
- yField: string;
4
+ xField?: string;
5
+ yField?: string;
6
6
  metrics?: string[];
7
7
  dimensions?: string[];
8
8
  };
@@ -0,0 +1,22 @@
1
+ import { CompositeSeries } from './types';
2
+ interface SeriesSpec {
3
+ spec: any;
4
+ yField: string;
5
+ }
6
+ /**
7
+ * 获取 Bar 图表的 spec
8
+ */
9
+ export declare function getBarSpec(series: CompositeSeries): SeriesSpec;
10
+ /**
11
+ * 获取 Line 图表的 spec
12
+ */
13
+ export declare function getLineSpec(series: CompositeSeries): SeriesSpec;
14
+ /**
15
+ * 获取 Area 图表的 spec
16
+ */
17
+ export declare function getAreaSpec(series: CompositeSeries): SeriesSpec;
18
+ /**
19
+ * 根据 series type 获取对应的 spec
20
+ */
21
+ export declare function getSeriesSpec(series: CompositeSeries): SeriesSpec;
22
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { CompositeProps } from './types';
2
+ declare const Composite: (props: CompositeProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default Composite;
@@ -0,0 +1,11 @@
1
+ import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../../types';
2
+ import { BarConfig } from '../Bar/types';
3
+ export type CompositeSeriesType = 'bar' | 'line' | 'area' | 'scatter';
4
+ export type CompositeSeries = Omit<BarConfig, 'data' | 'chartName'> & {
5
+ type: CompositeSeriesType;
6
+ data?: DataItem[];
7
+ };
8
+ export type CompositeConfig = Omit<BaseVChartConfig, 'data'> & {
9
+ series: CompositeSeries[];
10
+ };
11
+ export type CompositeProps = BaseVChartProps & Partial<CompositeConfig>;
@@ -0,0 +1,18 @@
1
+ import { DataItem } from '../../types';
2
+ import { CompositeSeries } from './types';
3
+ /**
4
+ * 合并所有系列的数据到一个数据源
5
+ */
6
+ export declare function mergeSeriesData(series: CompositeSeries[]): DataItem[];
7
+ /**
8
+ * 为每个系列生成数据ID和索引映射
9
+ */
10
+ export declare function generateSeriesDataMapping(series: CompositeSeries[]): Record<string, number>;
11
+ /**
12
+ * 获取系列的 yField 列表(用于轴配置)
13
+ */
14
+ export declare function getYFields(series: CompositeSeries[]): string[];
15
+ /**
16
+ * 获取系列的 xField
17
+ */
18
+ export declare function getXField(series: CompositeSeries[]): string;
@@ -1,8 +1,8 @@
1
1
  import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../../types';
2
2
  export type DonutDataItem = DataItem & {};
3
3
  export type DonutConfig = BaseVChartConfig & {
4
- nameField: string;
5
- valField: string;
4
+ nameField?: string;
5
+ valField?: string;
6
6
  dimensions?: string[];
7
7
  };
8
8
  export type DonutProps = BaseVChartProps & Partial<DonutConfig>;
@@ -1,8 +1,8 @@
1
1
  import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../../types';
2
2
  export type LineDataItem = DataItem & {};
3
3
  export type FunnelConfig = BaseVChartConfig & {
4
- nameField: string;
5
- valField: string;
4
+ nameField?: string;
5
+ valField?: string;
6
6
  dimensions?: string[];
7
7
  };
8
8
  export type FunnelProps = BaseVChartProps & Partial<FunnelConfig>;
@@ -1,8 +1,8 @@
1
1
  import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../../types';
2
2
  export type LineDataItem = DataItem & {};
3
3
  export type GaugeConfig = BaseVChartConfig & {
4
- nameField: string;
5
- valField: string;
4
+ nameField?: string;
5
+ valField?: string;
6
6
  dimensions?: string[];
7
7
  };
8
8
  export type GaugeProps = BaseVChartProps & Partial<GaugeConfig>;
@@ -1,8 +1,8 @@
1
1
  import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../../types';
2
2
  export type HeatmapDataItem = DataItem & {};
3
3
  export type HeatmapConfig = BaseVChartConfig & {
4
- xField: string;
5
- yField: string;
6
- valField: string;
4
+ xField?: string;
5
+ yField?: string;
6
+ valField?: string;
7
7
  };
8
8
  export type HeatmapProps = BaseVChartProps & Partial<HeatmapConfig>;
@@ -1,5 +1,5 @@
1
- import { Gutter } from 'antd/lib/grid/row';
2
1
  export declare const MAX_COL = 24;
3
- export declare const ROW_GUTTER: [Gutter, Gutter];
2
+ export declare const ROW_GUTTER: number[];
3
+ export declare const MIN_ITEM_WIDTH = 180;
4
4
  export declare const COLUMN_COUNT: number[];
5
5
  export declare const marks: Record<number, string>;
@@ -1,6 +1,8 @@
1
+ import { IndicatorLayout } from './types';
1
2
  interface StyleProps {
2
3
  ctheme: 'dark' | 'light';
3
4
  fontSize?: number;
5
+ layout?: IndicatorLayout;
4
6
  }
5
7
  export declare const IndicatorStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyleProps>> & string;
6
8
  export declare const CardStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<import("antd").FlexProps<import("antd/es/_util/type").AnyObject> & {
@@ -2,12 +2,14 @@ import { CSSProperties } from 'react';
2
2
  import type { DataItem } from '../../types';
3
3
  import { VChartGlobalConfig } from '../../types/config';
4
4
  export type TableDataItem = DataItem & {};
5
+ export type IndicatorLayout = 'grid' | 'cards';
5
6
  export type IndicatorConfig = VChartGlobalConfig & {
6
7
  data: TableDataItem[];
7
- nameField: string;
8
- valField: string;
8
+ nameField?: string;
9
+ valField?: string;
9
10
  dimensions?: string[];
10
11
  metrics?: string[];
12
+ layout?: IndicatorLayout;
11
13
  };
12
14
  export type IndicatorProps = {
13
15
  className?: string;
@@ -1,8 +1,8 @@
1
1
  import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../../types';
2
2
  export type LineDataItem = DataItem & {};
3
3
  export type LineConfig = BaseVChartConfig & {
4
- xField: string;
5
- yField: string;
4
+ xField?: string;
5
+ yField?: string;
6
6
  metrics?: string[];
7
7
  dimensions?: string[];
8
8
  };