@advt-gpt-chart/package 3.2.0 → 3.2.3
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 +8 -19
- package/dist/Chart/ChartBase/transformed.d.ts +1 -1
- package/dist/Chart/ChartBase/types.d.ts +2 -2
- package/dist/Chart/ChartCodeRender/type.d.ts +2 -2
- package/dist/Chart/ChartControllers/ChartDetailData/index.d.ts +1 -1
- package/dist/Chart/ChartControllers/index.d.ts +1 -1
- package/dist/Chart/ChartEvents/ChartContextMenu/utils.d.ts +1 -1
- package/dist/Chart/ChartEvents/DrillBy/DrillByChart.d.ts +1 -1
- package/dist/Chart/ChartWrapper/ChartHeader.d.ts +1 -1
- package/dist/Chart/ChartWrapper/ChartMenu.d.ts +1 -1
- package/dist/Chart/ChartWrapper/utils.d.ts +4 -4
- package/dist/Charts/Area/index.d.ts +1 -2
- package/dist/Charts/Bar/index.d.ts +1 -2
- package/dist/Charts/Composite/index.d.ts +1 -2
- package/dist/Charts/Composite/transform.d.ts +13 -0
- package/dist/Charts/Composite/types.d.ts +14 -23
- package/dist/Charts/Composite/util.d.ts +29 -9
- package/dist/Charts/Donut/index.d.ts +1 -2
- package/dist/Charts/Funnel/index.d.ts +1 -2
- package/dist/Charts/Gauge/index.d.ts +1 -2
- package/dist/Charts/Heatmap/index.d.ts +1 -2
- package/dist/Charts/Line/index.d.ts +1 -2
- package/dist/Charts/Pie/index.d.ts +1 -2
- package/dist/Charts/Radar/index.d.ts +1 -2
- package/dist/Charts/Rank/index.d.ts +1 -2
- package/dist/Charts/Scatter/index.d.ts +1 -2
- package/dist/Charts/common/cartesianCommon.d.ts +34 -0
- package/dist/Charts/common/createChart.d.ts +7 -0
- package/dist/Charts/common/hooks/useDashLine.d.ts +3 -2
- package/dist/Charts/common/index.d.ts +3 -0
- package/dist/Charts/common/polarCommon.d.ts +44 -0
- package/dist/{Chart → DataView}/DataSource/types.d.ts +1 -1
- package/dist/DataView/Dataset/DataView.d.ts +40 -0
- package/dist/DataView/Dataset/constants.d.ts +15 -0
- package/dist/DataView/Dataset/index.d.ts +9 -0
- package/dist/DataView/Dataset/transforms.d.ts +95 -0
- package/dist/{Chart → DataView}/Dataset/types.d.ts +1 -0
- package/dist/DataView/data-set/data-set.d.ts +39 -0
- package/dist/DataView/data-set/index.d.ts +3 -0
- package/dist/DataView/data-set/transforms/format-transform.d.ts +9 -0
- package/dist/DataView/data-set/transforms/index.d.ts +3 -0
- package/dist/DataView/data-set/transforms/multi-dimension-transform.d.ts +3 -0
- package/dist/DataView/data-set/transforms/multi-metric-transform.d.ts +3 -0
- package/dist/DataView/data-set/types.d.ts +55 -0
- package/dist/GPTVis/hooks/useChartStore.d.ts +2 -2
- package/dist/components/CustomTimeRange/types.d.ts +1 -1
- package/dist/components/CustomTimeRange/utils.d.ts +1 -1
- package/dist/index.es.js +128730 -89369
- package/dist/index.es.js.gz +0 -0
- package/dist/index.umd.js +1284 -923
- package/dist/index.umd.js.gz +0 -0
- package/dist/types/chart.d.ts +12 -12
- package/dist/utils/useTools.d.ts +5 -2
- package/dist/version.d.ts +1 -1
- package/package.json +27 -1
- package/dist/Chart/Dataset/useDataset.d.ts +0 -92
- package/dist/Charts/Composite/config.d.ts +0 -22
- package/dist/Charts/common/constants/index.d.ts +0 -0
- package/dist/Charts/common/tools/index.d.ts +0 -0
- /package/dist/{Chart → DataView}/DataSource/index.d.ts +0 -0
- /package/dist/{Chart → DataView}/DataSource/metricInsight.d.ts +0 -0
- /package/dist/{Chart → DataView}/DataSource/simpleJson.d.ts +0 -0
- /package/dist/{Chart → DataView}/DataSource/useChartDataQuery.d.ts +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { DataItem } from '../../types';
|
|
2
|
+
import { GenericDataType } from '../../utils/data';
|
|
3
|
+
import { multiDimensionTransform, multiMetricTransform } from './transforms';
|
|
4
|
+
import type { DataSetOptions, ProcessedItem, TransformOptions } from './types';
|
|
5
|
+
export declare class DataSet {
|
|
6
|
+
private data;
|
|
7
|
+
private options;
|
|
8
|
+
constructor(data: DataItem[], options?: DataSetOptions);
|
|
9
|
+
/**
|
|
10
|
+
* 获取字段类型
|
|
11
|
+
*/
|
|
12
|
+
getFieldType(fieldName: string): GenericDataType;
|
|
13
|
+
/**
|
|
14
|
+
* 获取轴类型
|
|
15
|
+
*/
|
|
16
|
+
getAxesType(fieldName: string): 'band' | 'linear';
|
|
17
|
+
/**
|
|
18
|
+
* 格式化单个值
|
|
19
|
+
*/
|
|
20
|
+
formatValue(fieldName: string, value: any, formatTimeStr?: string): any;
|
|
21
|
+
/**
|
|
22
|
+
* 创建 label 格式化方法
|
|
23
|
+
*/
|
|
24
|
+
createLabelFormatMethod(fieldName: string): (text: string | string[], datum: any) => any;
|
|
25
|
+
/**
|
|
26
|
+
* 创建 tooltip 格式化方法
|
|
27
|
+
*/
|
|
28
|
+
createTooltipFormatMethod(fieldName: string): (datum: any) => any;
|
|
29
|
+
format(dataFormat?: DataSetOptions['dataFormat']): DataSet;
|
|
30
|
+
transform(options: TransformOptions | ((data: DataItem[]) => DataItem[])): DataSet;
|
|
31
|
+
private applyDeriveTransform;
|
|
32
|
+
multiDimension(options: Parameters<typeof multiDimensionTransform>[1]): DataSet;
|
|
33
|
+
multiMetric(options: Parameters<typeof multiMetricTransform>[1]): DataSet;
|
|
34
|
+
filter(predicate: (item: DataItem) => boolean): DataSet;
|
|
35
|
+
sort(compareFn?: (a: DataItem, b: DataItem) => number): DataSet;
|
|
36
|
+
result(): ProcessedItem[];
|
|
37
|
+
getData(): DataItem[];
|
|
38
|
+
}
|
|
39
|
+
export default DataSet;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DataItem } from '../../../types';
|
|
2
|
+
import type { ColumnInfo, FormatTransformOptions } from '../types';
|
|
3
|
+
export declare function formatNumber(value: number, config: any): string;
|
|
4
|
+
export declare function formatTime(value: any, timeGrain?: string): string;
|
|
5
|
+
export declare function isTimeFieldType(type: string): boolean;
|
|
6
|
+
export declare function formatTransform(data: DataItem[], options: FormatTransformOptions & {
|
|
7
|
+
timeGrain?: string;
|
|
8
|
+
columns?: ColumnInfo[];
|
|
9
|
+
}): DataItem[];
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { DataItem } from "../../types";
|
|
2
|
+
export type FormatType = 'none' | 'number' | 'percentage_raw' | 'percentage_scaled' | 'date' | 'time';
|
|
3
|
+
export interface FormatConfig {
|
|
4
|
+
formatType: FormatType;
|
|
5
|
+
suffix?: string;
|
|
6
|
+
prefix?: string;
|
|
7
|
+
decimalPlaces?: number;
|
|
8
|
+
valueUnit?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface DataFormat {
|
|
11
|
+
[field: string]: FormatConfig;
|
|
12
|
+
}
|
|
13
|
+
export interface ColumnInfo {
|
|
14
|
+
name: string;
|
|
15
|
+
type: string;
|
|
16
|
+
}
|
|
17
|
+
export interface DataSetOptions {
|
|
18
|
+
dataFormat?: DataFormat;
|
|
19
|
+
columns?: ColumnInfo[];
|
|
20
|
+
timeGrain?: string;
|
|
21
|
+
timeGrainFormat?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface TransformOptions {
|
|
24
|
+
type: 'format' | 'multi-dimension' | 'multi-metric' | 'derive' | string;
|
|
25
|
+
options: any;
|
|
26
|
+
}
|
|
27
|
+
export interface MultiDimensionOptions {
|
|
28
|
+
dimensions: string[];
|
|
29
|
+
metrics: string[];
|
|
30
|
+
transformType: 'fold' | 'pivot';
|
|
31
|
+
key?: string;
|
|
32
|
+
value?: string;
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
}
|
|
35
|
+
export interface MultiMetricOptions {
|
|
36
|
+
groupBy: string[];
|
|
37
|
+
aggregations: AggregationConfig[];
|
|
38
|
+
}
|
|
39
|
+
export interface AggregationConfig {
|
|
40
|
+
field: string;
|
|
41
|
+
op: 'sum' | 'avg' | 'count' | 'max' | 'min' | string;
|
|
42
|
+
as: string;
|
|
43
|
+
}
|
|
44
|
+
export type ProcessedItem = DataItem & {
|
|
45
|
+
[key: string]: any;
|
|
46
|
+
};
|
|
47
|
+
export interface FormatTransformOptions {
|
|
48
|
+
dataFormat?: DataFormat;
|
|
49
|
+
timeGrain?: string;
|
|
50
|
+
columns?: ColumnInfo[];
|
|
51
|
+
}
|
|
52
|
+
export interface DeriveTransformOptions {
|
|
53
|
+
field: string;
|
|
54
|
+
formula: (item: DataItem) => any;
|
|
55
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ChartJson } from '../../Chart/ChartCodeRender/type';
|
|
2
2
|
import { ChartControllersState } from '../../Chart/ChartControllers';
|
|
3
|
-
import type { Dataset } from '../../
|
|
4
|
-
import { DataSourceQueryInfo } from '../../
|
|
3
|
+
import type { Dataset } from '../../DataView/Dataset/types';
|
|
4
|
+
import { DataSourceQueryInfo } from '../../DataView/DataSource/types';
|
|
5
5
|
import { BaseChartProps } from '../../types';
|
|
6
6
|
export interface ContextMenu {
|
|
7
7
|
visible: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Dayjs } from 'dayjs';
|
|
2
2
|
import { FilterItemType } from '../../Chart/ChartControllers/Filter/types';
|
|
3
3
|
import { OrderItemType } from '../../Chart/ChartControllers/Orders/types';
|
|
4
|
-
import { DataFormat } from '../../
|
|
4
|
+
import { DataFormat } from '../../DataView/Dataset/types';
|
|
5
5
|
import { TimeGrainType } from '../../utils';
|
|
6
6
|
export type CustomTimeRange = {
|
|
7
7
|
from?: Dayjs;
|