@advt-gpt-chart/package 3.2.5 → 3.2.7

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.
@@ -1,10 +1,13 @@
1
1
  import { ICartesianAxisSpec, InterpolateType } from '@visactor/vchart';
2
+ import { AxisConfig } from '../../Charts/common/types';
2
3
  import { GenericDataType } from '../../utils/data';
3
4
  import { AxesType } from './utils';
4
5
  type CartesianOptions = {
5
6
  xField: string;
6
7
  yField: string;
7
8
  isMetricFolded?: boolean;
9
+ xAxis?: AxisConfig;
10
+ yAxis?: AxisConfig;
8
11
  };
9
12
  type CartesianTooltipOptions = CartesianOptions & {
10
13
  seriesField?: string;
@@ -1,9 +1,12 @@
1
1
  import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../../types';
2
+ import type { AxisConfig } from '../common/types';
2
3
  export type AreaDataItem = DataItem & {};
3
4
  export type AreaConfig = BaseVChartConfig & {
4
5
  xField?: string;
5
6
  yField?: string;
6
7
  metrics?: string[];
7
8
  dimensions?: string[];
9
+ xAxis?: AxisConfig;
10
+ yAxis?: AxisConfig;
8
11
  };
9
12
  export type AreaProps = BaseVChartProps & Partial<AreaConfig>;
@@ -1,9 +1,13 @@
1
1
  import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../../types';
2
+ import type { AxisConfig, ThresholdItem } from '../common/types';
2
3
  export type BarDataItem = DataItem & {};
3
4
  export type BarConfig = BaseVChartConfig & {
4
5
  xField?: string;
5
6
  yField?: string;
6
7
  metrics?: string[];
7
8
  dimensions?: string[];
9
+ threshold?: ThresholdItem[];
10
+ xAxis?: AxisConfig;
11
+ yAxis?: AxisConfig;
8
12
  };
9
13
  export type BarProps = BaseVChartProps & Partial<BarConfig>;
@@ -1,8 +1,9 @@
1
1
  import { IndicatorLayout } from './types';
2
2
  interface StyleProps {
3
- ctheme: 'dark' | 'light';
4
- fontSize?: number;
3
+ $theme: 'dark' | 'light';
5
4
  layout?: IndicatorLayout;
5
+ $nameFontSize?: number;
6
+ $valueFontSize?: number;
6
7
  }
7
8
  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;
8
9
  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> & {
@@ -10,6 +10,8 @@ export type IndicatorConfig = VChartGlobalConfig & {
10
10
  dimensions?: string[];
11
11
  metrics?: string[];
12
12
  layout?: IndicatorLayout;
13
+ nameFontSize?: number;
14
+ valueFontSize?: number;
13
15
  };
14
16
  export type IndicatorProps = {
15
17
  className?: string;
@@ -1,5 +1,5 @@
1
1
  import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../../types';
2
- import type { DashSegment } from '../common/types';
2
+ import type { AxisConfig, DashSegment, ThresholdItem } from '../common/types';
3
3
  export type LineDataItem = DataItem & {};
4
4
  export type LineConfig = BaseVChartConfig & {
5
5
  xField?: string;
@@ -7,5 +7,8 @@ export type LineConfig = BaseVChartConfig & {
7
7
  metrics?: string[];
8
8
  dimensions?: string[];
9
9
  dashSegments?: DashSegment[];
10
+ threshold?: ThresholdItem[];
11
+ xAxis?: AxisConfig;
12
+ yAxis?: AxisConfig;
10
13
  };
11
14
  export type LineProps = BaseVChartProps & Partial<LineConfig>;
@@ -1,9 +1,12 @@
1
1
  import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../../types';
2
+ import type { AxisConfig } from '../common/types';
2
3
  export type RankDataItem = DataItem & {};
3
4
  export type RankConfig = BaseVChartConfig & {
4
5
  xField?: string;
5
6
  yField?: string;
6
7
  metrics?: string[];
7
8
  dimensions?: string[];
9
+ xAxis?: AxisConfig;
10
+ yAxis?: AxisConfig;
8
11
  };
9
12
  export type RankProps = BaseVChartProps & Partial<RankConfig>;
@@ -1,9 +1,12 @@
1
1
  import type { BaseVChartConfig, BaseVChartProps, DataItem } from '../../types';
2
+ import type { AxisConfig } from '../common/types';
2
3
  export type LineDataItem = DataItem & {};
3
4
  export type ScatterConfig = BaseVChartConfig & {
4
5
  xField?: string;
5
6
  yField?: string;
6
7
  metrics?: string[];
7
8
  dimensions?: string[];
9
+ xAxis?: AxisConfig;
10
+ yAxis?: AxisConfig;
8
11
  };
9
12
  export type ScatterProps = BaseVChartProps & Partial<ScatterConfig>;
@@ -1,4 +1,5 @@
1
1
  import { Tools } from '../../Chart/ChartBase/constants';
2
+ import { AxisConfig } from './types';
2
3
  interface CartesianCommonOptions {
3
4
  axesConfig: {
4
5
  xField: string | string[];
@@ -9,6 +10,8 @@ interface CartesianCommonOptions {
9
10
  dataset?: any;
10
11
  tools: Tools;
11
12
  chartConfig?: any;
13
+ xAxis?: AxisConfig;
14
+ yAxis?: AxisConfig;
12
15
  }
13
16
  export declare function cartesianCommon(options: CartesianCommonOptions): {
14
17
  legends: any;
@@ -1,5 +1,6 @@
1
1
  import type { ILabelSpec } from '@visactor/vchart';
2
2
  import type { ChartConfigTools, ChartProps, UseChartConfigToolsOptions as ChartConfigToolsOptions } from '../../../Chart/ChartCodeRender/type';
3
+ import type { ThresholdItem } from '../types';
3
4
  export type IMultiLabelSpec<T extends Omit<ILabelSpec, 'position'>> = T | T[];
4
5
  interface ChartDimensions {
5
6
  width: number;
@@ -11,6 +12,7 @@ interface UseChartConfigToolsOptions extends ChartConfigToolsOptions {
11
12
  interface ChartConfigToolsResult extends ChartConfigTools {
12
13
  label: IMultiLabelSpec<Omit<ILabelSpec, 'position'>>;
13
14
  getDimensions: () => ChartDimensions;
15
+ buildMarkLine: (threshold?: ThresholdItem[]) => any[] | undefined;
14
16
  }
15
17
  /**
16
18
  * 通用图表配置工具 Hook
@@ -19,3 +19,42 @@ export interface DashSegment {
19
19
  /** 结束点(可选,不填则到末尾) */
20
20
  to?: string | number;
21
21
  }
22
+ /**
23
+ * 阈值线配置
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * // 单个阈值
28
+ * { value: 90, label: '目标值' }
29
+ *
30
+ * // 多个阈值
31
+ * [
32
+ * { value: 90, label: '目标' },
33
+ * { value: 60, label: '警戒' }
34
+ * ]
35
+ * ```
36
+ */
37
+ export interface ThresholdItem {
38
+ /** 阈值数值(支持时间和数值) */
39
+ value: number | string;
40
+ /** 标签文本(可选,不填则显示数值) */
41
+ label?: string;
42
+ }
43
+ /**
44
+ * 轴配置(用于 x 轴/y 轴的别名和显示控制)
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * // 简单配置
49
+ * { title: '销售额(元)' }
50
+ *
51
+ * // 完整配置
52
+ * { title: '时间', visible: true }
53
+ * ```
54
+ */
55
+ export interface AxisConfig {
56
+ /** 轴标题别名(可选,不填则使用字段名) */
57
+ title?: string;
58
+ /** 是否显示轴(可选,不填时保持当前逻辑) */
59
+ visible?: boolean;
60
+ }