@advt-gpt-chart/package 0.0.9
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 +55 -0
- package/dist/Area/index.d.ts +3 -0
- package/dist/Area/types.d.ts +9 -0
- package/dist/Bar/index.d.ts +3 -0
- package/dist/Bar/types.d.ts +9 -0
- package/dist/ChartCodeRender/Loading.d.ts +2 -0
- package/dist/ChartCodeRender/VisChart.d.ts +11 -0
- package/dist/ChartCodeRender/index.d.ts +8 -0
- package/dist/ChartCodeRender/type.d.ts +54 -0
- package/dist/ChartContainer/chartContextProvider.d.ts +10 -0
- package/dist/ChartContainer/index.d.ts +9 -0
- package/dist/ChartContainer/style.d.ts +5 -0
- package/dist/ConfigProvider/context.d.ts +3 -0
- package/dist/ConfigProvider/hooks/index.d.ts +1 -0
- package/dist/ConfigProvider/hooks/useConfig.d.ts +32 -0
- package/dist/ConfigProvider/index.d.ts +7 -0
- package/dist/Donut/index.d.ts +3 -0
- package/dist/Donut/types.d.ts +8 -0
- package/dist/Funnel/index.d.ts +3 -0
- package/dist/Funnel/types.d.ts +8 -0
- package/dist/GPTVis/Lite.d.ts +19 -0
- package/dist/GPTVis/hooks/useContext.d.ts +8 -0
- package/dist/GPTVis/hooks/useEvent.d.ts +1 -0
- package/dist/GPTVis/index.d.ts +6 -0
- package/dist/Gauge/index.d.ts +3 -0
- package/dist/Gauge/types.d.ts +8 -0
- package/dist/Heatmap/index.d.ts +3 -0
- package/dist/Heatmap/types.d.ts +8 -0
- package/dist/Indicator/contants.d.ts +5 -0
- package/dist/Indicator/index.d.ts +3 -0
- package/dist/Indicator/styles.d.ts +7 -0
- package/dist/Indicator/types.d.ts +15 -0
- package/dist/Line/index.d.ts +3 -0
- package/dist/Line/types.d.ts +9 -0
- package/dist/Pie/index.d.ts +3 -0
- package/dist/Pie/types.d.ts +8 -0
- package/dist/Radar/index.d.ts +3 -0
- package/dist/Radar/types.d.ts +9 -0
- package/dist/Radar/utils.d.ts +2 -0
- package/dist/Rank/index.d.ts +3 -0
- package/dist/Rank/types.d.ts +9 -0
- package/dist/Scatter/index.d.ts +3 -0
- package/dist/Scatter/types.d.ts +9 -0
- package/dist/Table/index.d.ts +3 -0
- package/dist/Table/theme.d.ts +2 -0
- package/dist/Table/types.d.ts +7 -0
- package/dist/Text/VisText.d.ts +3 -0
- package/dist/Text/config.d.ts +19 -0
- package/dist/Text/custom-icons/index.d.ts +2 -0
- package/dist/Text/index.d.ts +3 -0
- package/dist/Text/mini-charts/hooks/getElementFontSize.d.ts +1 -0
- package/dist/Text/mini-charts/hooks/index.d.ts +1 -0
- package/dist/Text/mini-charts/hooks/useSvgWrapper.d.ts +5 -0
- package/dist/Text/mini-charts/index.d.ts +2 -0
- package/dist/Text/mini-charts/line/SingleLineChart.d.ts +3 -0
- package/dist/Text/mini-charts/line/index.d.ts +1 -0
- package/dist/Text/mini-charts/line/scaleLinear.d.ts +4 -0
- package/dist/Text/mini-charts/line/useLineCompute.d.ts +6 -0
- package/dist/Text/mini-charts/proportion/getArcPath.d.ts +1 -0
- package/dist/Text/mini-charts/proportion/index.d.ts +3 -0
- package/dist/Text/theme.d.ts +24 -0
- package/dist/Text/types.d.ts +20 -0
- package/dist/Text/utils/getThemeColor.d.ts +11 -0
- package/dist/Text/utils/index.d.ts +2 -0
- package/dist/Text/utils/useAntdDarkAlgorithm.d.ts +2 -0
- package/dist/VChartBase/constants.d.ts +54 -0
- package/dist/VChartBase/index.d.ts +3 -0
- package/dist/VChartBase/tooltip.d.ts +1 -0
- package/dist/VChartBase/transformed.d.ts +129 -0
- package/dist/VChartBase/types.d.ts +15 -0
- package/dist/VChartBase/utils.d.ts +15 -0
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/light.d.ts +2 -0
- package/dist/export.d.ts +34 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.es.js +136615 -0
- package/dist/index.es.js.br +0 -0
- package/dist/index.umd.js +825 -0
- package/dist/index.umd.js.br +0 -0
- package/dist/types/chart.d.ts +27 -0
- package/dist/types/config.d.ts +16 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types.d.ts +1 -0
- package/dist/utils/config.d.ts +2 -0
- package/dist/utils/date.d.ts +3 -0
- package/dist/utils/echart.d.ts +4 -0
- package/dist/utils/index.d.ts +0 -0
- package/dist/version.d.ts +2 -0
- package/package.json +94 -0
package/README.md
ADDED
|
@@ -0,0 +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
|
+
```
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../types';
|
|
2
|
+
export type AreaDataItem = DataItem & {};
|
|
3
|
+
export type AreaConfig = BaseVChartConfig & {
|
|
4
|
+
xField: string;
|
|
5
|
+
yField: string;
|
|
6
|
+
metrics?: string[];
|
|
7
|
+
dimensions?: string[];
|
|
8
|
+
};
|
|
9
|
+
export type AreaProps = BaseVChartProps & Partial<AreaConfig>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../types';
|
|
2
|
+
export type BarDataItem = DataItem & {};
|
|
3
|
+
export type BarConfig = BaseVChartConfig & {
|
|
4
|
+
xField: string;
|
|
5
|
+
yField: string;
|
|
6
|
+
metrics?: string[];
|
|
7
|
+
dimensions?: string[];
|
|
8
|
+
};
|
|
9
|
+
export type BarProps = BaseVChartProps & Partial<BarConfig>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ChartComponents } from './type';
|
|
3
|
+
type RenderVisChartProps = {
|
|
4
|
+
content: string;
|
|
5
|
+
components: ChartComponents;
|
|
6
|
+
debug?: boolean;
|
|
7
|
+
loadingTimeout: number;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
};
|
|
10
|
+
export declare const RenderVisChart: React.FC<RenderVisChartProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CodeBlockComponent, WithChartCodeOptions } from './type';
|
|
2
|
+
export declare const withChartCode: (options: WithChartCodeOptions) => CodeBlockComponent;
|
|
3
|
+
/**
|
|
4
|
+
* Includes built-in chart components such as line charts, pie charts, etc.
|
|
5
|
+
* @param componentsArray
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export declare const withDefaultChartCode: (options?: Partial<WithChartCodeOptions>) => CodeBlockComponent;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { FC } from 'react';
|
|
3
|
+
import type { Components, ExtraProps } from 'react-markdown';
|
|
4
|
+
export type WithChartCodeOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* 要额外加载的图表组件
|
|
7
|
+
*/
|
|
8
|
+
components: ChartComponents;
|
|
9
|
+
/**
|
|
10
|
+
* 自定义其它语言代码块渲染器
|
|
11
|
+
*/
|
|
12
|
+
languageRenderers?: LanguageRenderers;
|
|
13
|
+
/**
|
|
14
|
+
* 默认的代码渲染器
|
|
15
|
+
*/
|
|
16
|
+
defaultRenderer?: CodeRenderer;
|
|
17
|
+
/**
|
|
18
|
+
* 打开调试日志
|
|
19
|
+
*/
|
|
20
|
+
debug?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* 设置loading动画的超时时间,默认为 5s
|
|
23
|
+
*/
|
|
24
|
+
loadingTimeout?: number;
|
|
25
|
+
/**
|
|
26
|
+
* 图表样式,配置容器样式
|
|
27
|
+
*/
|
|
28
|
+
style?: React.CSSProperties;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* 图表渲染数据接口,后续拓展,这里只是写个示例
|
|
32
|
+
*/
|
|
33
|
+
export interface ChartJson {
|
|
34
|
+
type: string;
|
|
35
|
+
data: any;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 图表组件字典
|
|
39
|
+
*/
|
|
40
|
+
export interface ChartComponents {
|
|
41
|
+
[key: string]: FC<any>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* 代码块渲染器接口
|
|
45
|
+
*/
|
|
46
|
+
export type CodeBlockComponent = Components['code'];
|
|
47
|
+
type CodeRenderer = FC<React.ClassAttributes<HTMLElement> & React.HTMLAttributes<HTMLElement> & ExtraProps>;
|
|
48
|
+
/**
|
|
49
|
+
* 自定义其它语言代码块渲染器
|
|
50
|
+
*/
|
|
51
|
+
interface LanguageRenderers {
|
|
52
|
+
[key: string]: CodeRenderer;
|
|
53
|
+
}
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ChartConfigType {
|
|
3
|
+
theme?: string;
|
|
4
|
+
}
|
|
5
|
+
export type ChartConfigProviderProps = {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
} & ChartConfigType;
|
|
8
|
+
export declare const ChartConfigContext: React.Context<ChartConfigType>;
|
|
9
|
+
export declare const ChartConfigProvider: React.FC<ChartConfigProviderProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BaseChartProps } from '../types';
|
|
3
|
+
export interface ChartContainerProps extends BaseChartProps {
|
|
4
|
+
Chart?: React.ReactNode;
|
|
5
|
+
chartTheme?: string;
|
|
6
|
+
chartName?: string;
|
|
7
|
+
}
|
|
8
|
+
declare function ChartContainer({ Chart, containerStyle, className, chartTheme, chartName }: ChartContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export { ChartContainer };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const StyleChartContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
3
|
+
theme: string;
|
|
4
|
+
style?: React.CSSProperties;
|
|
5
|
+
}>> & string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useConfig';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AreaConfig } from '../../Area/types';
|
|
2
|
+
import { BarConfig } from '../../Bar/types';
|
|
3
|
+
import { FunnelConfig } from '../../Funnel/types';
|
|
4
|
+
import { GaugeConfig } from '../../Gauge/types';
|
|
5
|
+
import { HeatmapConfig } from '../../Heatmap/types';
|
|
6
|
+
import { IndicatorConfig } from '../../Indicator/types';
|
|
7
|
+
import { LineConfig } from '../../Line/types';
|
|
8
|
+
import { PieConfig } from '../../Pie/types';
|
|
9
|
+
import { RadarConfig } from '../../Radar/types';
|
|
10
|
+
import { ScatterConfig } from '../../Scatter/types';
|
|
11
|
+
import { TableConfig } from '../../Table/types';
|
|
12
|
+
import { type Charts } from '../../types';
|
|
13
|
+
export declare function useComponentGlobalConfig(name: Charts): Record<string, any> | undefined;
|
|
14
|
+
export declare function useCommonGlobalConfig(name: Charts): {
|
|
15
|
+
[x: string]: any;
|
|
16
|
+
theme?: string;
|
|
17
|
+
};
|
|
18
|
+
export type ChartConfig = AreaConfig | BarConfig | FunnelConfig | GaugeConfig | HeatmapConfig | LineConfig | PieConfig | RadarConfig | ScatterConfig | TableConfig | IndicatorConfig;
|
|
19
|
+
export declare function useVChartConfig<T1 extends ChartConfig>(name: Charts, defaultConfig: Partial<T1> | ((props: T1) => any), props: Partial<T1>): {
|
|
20
|
+
mergedProps: {
|
|
21
|
+
[x: string]: any;
|
|
22
|
+
color?: string[];
|
|
23
|
+
theme?: string;
|
|
24
|
+
} & Partial<T1>;
|
|
25
|
+
options: any;
|
|
26
|
+
};
|
|
27
|
+
export declare function useCommonConfig<T>(name: Charts, props: Partial<T>): {
|
|
28
|
+
transformedProps: {
|
|
29
|
+
[x: string]: any;
|
|
30
|
+
theme?: string;
|
|
31
|
+
} & Partial<T>;
|
|
32
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../types';
|
|
2
|
+
export type DonutDataItem = DataItem & {};
|
|
3
|
+
export type DonutConfig = BaseVChartConfig & {
|
|
4
|
+
nameField: string;
|
|
5
|
+
valField: string;
|
|
6
|
+
dimensions?: string[];
|
|
7
|
+
};
|
|
8
|
+
export type DonutProps = BaseVChartProps & Partial<DonutConfig>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../types';
|
|
2
|
+
export type LineDataItem = DataItem & {};
|
|
3
|
+
export type FunnelConfig = BaseVChartConfig & {
|
|
4
|
+
nameField: string;
|
|
5
|
+
valField: string;
|
|
6
|
+
dimensions?: string[];
|
|
7
|
+
};
|
|
8
|
+
export type FunnelProps = BaseVChartProps & Partial<FunnelConfig>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Options } from 'react-markdown';
|
|
3
|
+
import { useEventPublish } from './hooks/useEvent';
|
|
4
|
+
export interface GPTVisLiteProps extends Options {
|
|
5
|
+
/**
|
|
6
|
+
* 自定义 markdown components
|
|
7
|
+
*/
|
|
8
|
+
components?: Options['components'] | {
|
|
9
|
+
[key: string]: (props: any) => React.ReactNode;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* 🧪 订阅组件事件,实验性属性
|
|
13
|
+
* 用于子组件与容器组件通信
|
|
14
|
+
*/
|
|
15
|
+
eventSubs?: Record<string, (data?: any) => void>;
|
|
16
|
+
}
|
|
17
|
+
export { useEventPublish };
|
|
18
|
+
declare const _default: React.NamedExoticComponent<GPTVisLiteProps>;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type EventEmitter from '@antv/event-emitter';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
type GPTVisContextValue = {
|
|
4
|
+
eventBus: EventEmitter;
|
|
5
|
+
};
|
|
6
|
+
export declare const GPTVisContext: React.Context<GPTVisContextValue>;
|
|
7
|
+
export declare function useGPTVisContext<T = GPTVisContextValue>(): T;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useEventPublish: () => (evt: string, ...args: any[]) => void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../types';
|
|
2
|
+
export type LineDataItem = DataItem & {};
|
|
3
|
+
export type GaugeConfig = BaseVChartConfig & {
|
|
4
|
+
nameField: string;
|
|
5
|
+
valField: string;
|
|
6
|
+
dimensions?: string[];
|
|
7
|
+
};
|
|
8
|
+
export type GaugeProps = BaseVChartProps & Partial<GaugeConfig>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../types';
|
|
2
|
+
export type HeatmapDataItem = DataItem & {};
|
|
3
|
+
export type HeatmapConfig = BaseVChartConfig & {
|
|
4
|
+
xField: string | string[];
|
|
5
|
+
yField: string | string[];
|
|
6
|
+
valField: string;
|
|
7
|
+
};
|
|
8
|
+
export type HeatmapProps = BaseVChartProps & Partial<HeatmapConfig>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface StyleProps {
|
|
2
|
+
ctheme: 'dark' | 'light';
|
|
3
|
+
fontSize?: number;
|
|
4
|
+
}
|
|
5
|
+
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
|
+
export declare const CardStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("antd").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>, StyleProps>> & string & Omit<import("react").ForwardRefExoticComponent<import("antd").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, keyof import("react").Component<any, {}, any>>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import type { DataItem } from '../types';
|
|
3
|
+
import { VChartGlobalConfig } from '../types/config';
|
|
4
|
+
export type TableDataItem = DataItem & {};
|
|
5
|
+
export type IndicatorConfig = VChartGlobalConfig & {
|
|
6
|
+
data: TableDataItem[];
|
|
7
|
+
nameField: string;
|
|
8
|
+
valField: string;
|
|
9
|
+
dimensions?: string[];
|
|
10
|
+
metrics?: string[];
|
|
11
|
+
};
|
|
12
|
+
export type IndicatorProps = {
|
|
13
|
+
className?: string;
|
|
14
|
+
containerStyle?: CSSProperties;
|
|
15
|
+
} & Partial<IndicatorConfig>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../types';
|
|
2
|
+
export type LineDataItem = DataItem & {};
|
|
3
|
+
export type LineConfig = BaseVChartConfig & {
|
|
4
|
+
xField: string;
|
|
5
|
+
yField: string;
|
|
6
|
+
metrics?: string[];
|
|
7
|
+
dimensions?: string[];
|
|
8
|
+
};
|
|
9
|
+
export type LineProps = BaseVChartProps & Partial<LineConfig>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../types';
|
|
2
|
+
export type LineDataItem = DataItem & {};
|
|
3
|
+
export type PieConfig = BaseVChartConfig & {
|
|
4
|
+
nameField: string;
|
|
5
|
+
valField: string;
|
|
6
|
+
dimensions?: string[];
|
|
7
|
+
};
|
|
8
|
+
export type PieProps = BaseVChartProps & Partial<PieConfig>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../types';
|
|
2
|
+
export type LineDataItem = DataItem & {};
|
|
3
|
+
export type RadarConfig = BaseVChartConfig & {
|
|
4
|
+
nameField: string;
|
|
5
|
+
valField?: string;
|
|
6
|
+
dimensions?: string[];
|
|
7
|
+
metrics?: string[];
|
|
8
|
+
};
|
|
9
|
+
export type RadarProps = BaseVChartProps & Partial<RadarConfig>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../types';
|
|
2
|
+
export type RankDataItem = DataItem & {};
|
|
3
|
+
export type RankConfig = BaseVChartConfig & {
|
|
4
|
+
xField: string;
|
|
5
|
+
yField: string;
|
|
6
|
+
metrics?: string[];
|
|
7
|
+
dimensions?: string[];
|
|
8
|
+
};
|
|
9
|
+
export type RankProps = BaseVChartProps & Partial<RankConfig>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../types';
|
|
2
|
+
export type LineDataItem = DataItem & {};
|
|
3
|
+
export type ScatterConfig = BaseVChartConfig & {
|
|
4
|
+
xField: string;
|
|
5
|
+
yField: string;
|
|
6
|
+
metrics?: string[];
|
|
7
|
+
dimensions?: string[];
|
|
8
|
+
};
|
|
9
|
+
export type ScatterProps = BaseVChartProps & Partial<ScatterConfig>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BaseChartProps, DataItem } from '../types';
|
|
2
|
+
import { CommonGlobalConfig } from '../types/config';
|
|
3
|
+
export type TableDataItem = DataItem & {};
|
|
4
|
+
export type TableConfig = CommonGlobalConfig & {
|
|
5
|
+
data: TableDataItem[];
|
|
6
|
+
};
|
|
7
|
+
export type TableProps = BaseChartProps & Partial<TableConfig>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { CSSProperties } from 'react';
|
|
3
|
+
import type { VisTextProps } from './types';
|
|
4
|
+
declare const INNER_ENTITY_TYPES: readonly ["metric_name", "metric_value", "other_metric_value", "time_desc", "dim_value", "trend_desc", "delta_value", "ratio_value", "delta_value_pos", "delta_value_neg", "ratio_value_pos", "ratio_value_neg", "proportion", "contribute_ratio"];
|
|
5
|
+
export type InnerEntityType = (typeof INNER_ENTITY_TYPES)[number];
|
|
6
|
+
export type TextEntityType = InnerEntityType | string;
|
|
7
|
+
export type TextEncoding = Partial<Pick<CSSProperties, 'color' | 'backgroundColor' | 'fontWeight'> & {
|
|
8
|
+
/** 前缀 */
|
|
9
|
+
prefix: string;
|
|
10
|
+
/** 后缀 */
|
|
11
|
+
suffix: string;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const STATICS_KEY: "__statics";
|
|
14
|
+
/** 文本组件配置信息 */
|
|
15
|
+
export type TextConfig = Record<InnerEntityType & string, TextEncoding> & {
|
|
16
|
+
[STATICS_KEY]: Record<string, React.FC<VisTextProps>>;
|
|
17
|
+
};
|
|
18
|
+
export declare const DEFAULT_VIS_TEXT_CONFIG: TextConfig;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getElementFontSize(ele: Element, defaultSize?: number): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useSvgWrapper } from './useSvgWrapper';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
type SvgProps = PropsWithChildren<React.SVGProps<SVGSVGElement>>;
|
|
4
|
+
export declare const useSvgWrapper: () => readonly [({ children, ...otherProps }: SvgProps) => import("react/jsx-runtime").JSX.Element, number];
|
|
5
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SingleLineChart } from './SingleLineChart';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getArcPath(size: number, data: number): string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const TEXT_THEME: {
|
|
2
|
+
fontSizeBase: number;
|
|
3
|
+
chart: {
|
|
4
|
+
proportionShadowColor: string;
|
|
5
|
+
proportionFillColor: string;
|
|
6
|
+
lineStrokeColor: string;
|
|
7
|
+
};
|
|
8
|
+
light: {
|
|
9
|
+
primaryColor: string;
|
|
10
|
+
default88Color: string;
|
|
11
|
+
default65Color: string;
|
|
12
|
+
posColor: string;
|
|
13
|
+
negColor: string;
|
|
14
|
+
conclusionColor: string;
|
|
15
|
+
};
|
|
16
|
+
dark: {
|
|
17
|
+
primaryColor: string;
|
|
18
|
+
default88Color: string;
|
|
19
|
+
default65Color: string;
|
|
20
|
+
posColor: string;
|
|
21
|
+
negColor: string;
|
|
22
|
+
conclusionColor: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CSSProperties, PropsWithChildren } from 'react';
|
|
2
|
+
import type { TextEntityType } from './config';
|
|
3
|
+
/**
|
|
4
|
+
* the props for the Text
|
|
5
|
+
*/
|
|
6
|
+
export type VisTextProps = PropsWithChildren<{
|
|
7
|
+
style?: CSSProperties;
|
|
8
|
+
className?: string;
|
|
9
|
+
children: string;
|
|
10
|
+
/** 类型,包括内置的类型,以及 string 用于用户自行扩展 */
|
|
11
|
+
type?: TextEntityType;
|
|
12
|
+
/**
|
|
13
|
+
* 原始数值
|
|
14
|
+
* 用于传递各种情况的原始数据值,比如:
|
|
15
|
+
* 1. metric_value: 未经过格式化的指标值,原始数据;eg 1.234
|
|
16
|
+
* 2. proportion: 百分比,eg 0.37
|
|
17
|
+
* 3. trend_desc: 趋势值,eg [1, 2, 6, 18, 24, 48]
|
|
18
|
+
*/
|
|
19
|
+
origin?: any;
|
|
20
|
+
}>;
|