@advt-gpt-chart/package 3.1.8 → 3.1.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/dist/Chart/ChartBase/constants.d.ts +2 -0
- package/dist/Chart/ChartBase/utils.d.ts +1 -8
- package/dist/Charts/Line/types.d.ts +2 -0
- package/dist/Charts/common/hooks/index.d.ts +1 -0
- package/dist/Charts/common/hooks/useDashLine.d.ts +27 -0
- package/dist/Charts/common/types.d.ts +21 -0
- package/dist/index.es.js +18270 -18189
- package/dist/index.es.js.gz +0 -0
- package/dist/index.umd.js +711 -711
- package/dist/index.umd.js.gz +0 -0
- package/dist/utils/data.d.ts +2 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ICartesianAxisSpec, InterpolateType } from '@visactor/vchart';
|
|
2
|
+
import { GenericDataType } from '../../utils/data';
|
|
2
3
|
import { AxesType } from './utils';
|
|
3
4
|
type CartesianOptions = {
|
|
4
5
|
xField: string;
|
|
@@ -33,6 +34,7 @@ type CompositeAxisSpec = {
|
|
|
33
34
|
export type Tools = {
|
|
34
35
|
formatValue: (field: string, value: any) => any;
|
|
35
36
|
getAxesType: (field: string) => 'band' | 'linear';
|
|
37
|
+
getFieldType: (fieldName: string, value?: any) => GenericDataType | undefined;
|
|
36
38
|
};
|
|
37
39
|
export declare const getPolarLegendSpec: (seriesField: string | boolean | undefined, categoryField: string, tools?: Tools) => {
|
|
38
40
|
visible: boolean;
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { AxisType } from '@visactor/vchart/esm/component/axis';
|
|
2
|
-
|
|
3
|
-
Number = 0,
|
|
4
|
-
String = 1,
|
|
5
|
-
Timestamp = 2,
|
|
6
|
-
Date = 3,
|
|
7
|
-
Boolean = 4,
|
|
8
|
-
Other = 5
|
|
9
|
-
}
|
|
2
|
+
import { GenericDataType } from '../../utils/data';
|
|
10
3
|
export declare const getDataType: (val: any, field?: string) => GenericDataType;
|
|
11
4
|
export type AxesType = {
|
|
12
5
|
axisType: AxisType;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../../types';
|
|
2
|
+
import type { DashSegment } from '../common/types';
|
|
2
3
|
export type LineDataItem = DataItem & {};
|
|
3
4
|
export type LineConfig = BaseVChartConfig & {
|
|
4
5
|
xField?: string;
|
|
5
6
|
yField?: string;
|
|
6
7
|
metrics?: string[];
|
|
7
8
|
dimensions?: string[];
|
|
9
|
+
dashSegments?: DashSegment[];
|
|
8
10
|
};
|
|
9
11
|
export type LineProps = BaseVChartProps & Partial<LineConfig>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { GenericDataType } from '../../../utils/data';
|
|
2
|
+
import type { DashSegment } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* 通用虚线处理 Hook
|
|
5
|
+
*
|
|
6
|
+
* 根据 dashSegments 配置修改原始数据,添加 _isDashLine 标记
|
|
7
|
+
* 并返回完整的样式配置(包含基础样式和虚线逻辑)
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const { processedData, style } = useDashLine({
|
|
12
|
+
* data,
|
|
13
|
+
* xField: 'time',
|
|
14
|
+
* getFieldType,
|
|
15
|
+
* dashSegments: [{ from: '00:45' }]
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const useDashLine: ({ data, xField, getFieldType, dashSegments, }: {
|
|
20
|
+
data: any[];
|
|
21
|
+
xField?: string;
|
|
22
|
+
getFieldType?: (fieldName: string, value?: any) => GenericDataType | undefined;
|
|
23
|
+
dashSegments?: DashSegment[];
|
|
24
|
+
}) => {
|
|
25
|
+
processedData: any[];
|
|
26
|
+
style: any;
|
|
27
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 虚线段配置
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* // 末尾预测(最常用)
|
|
7
|
+
* [{ from: '00:45' }]
|
|
8
|
+
*
|
|
9
|
+
* // 中间虚线
|
|
10
|
+
* [{ from: '00:30', to: '00:45' }]
|
|
11
|
+
*
|
|
12
|
+
* // 多段虚线
|
|
13
|
+
* [{ from: '00:30', to: '00:45' }, { from: '01:00' }]
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export interface DashSegment {
|
|
17
|
+
/** 起始点(x 轴的值,如时间、数值) */
|
|
18
|
+
from: string | number;
|
|
19
|
+
/** 结束点(可选,不填则到末尾) */
|
|
20
|
+
to?: string | number;
|
|
21
|
+
}
|