@antv/g2plot 2.4.11 → 2.4.14

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.
@@ -6,6 +6,7 @@ import { Geometry } from '../../adaptor/geometries/base';
6
6
  import { Animation } from '../../types/animation';
7
7
  import { Annotation } from '../../types/annotation';
8
8
  import { Interaction } from '../../types/interaction';
9
+ import { Slider } from '../../types/slider';
9
10
  import { IPlotTypes } from './utils';
10
11
 
11
12
  /**
@@ -67,11 +68,22 @@ export type IView = {
67
68
  * @title 子 plot 的配置
68
69
  */
69
70
  export type IPlot = IPlotTypes & {
71
+ /**
72
+ * @title 数据
73
+ * @description 设置画布具体的数据. 默认基础顶层 data
74
+ */
75
+ readonly data?: Record<string, any>[];
70
76
  /**
71
77
  * @title plot view 的布局范围
72
78
  * @default "占满全部"
73
79
  */
74
80
  readonly region?: Region;
81
+ /**
82
+ * @title 是否为顶层
83
+ * @description 设置为 true 时,几何图形挂在顶层 chart 对象上,而不是子 view 下。此时 region 设置无效,data 继承顶层 data 配置。
84
+ * @default false
85
+ */
86
+ readonly top?: boolean;
75
87
  };
76
88
 
77
89
  /**
@@ -79,6 +91,10 @@ export type IPlot = IPlotTypes & {
79
91
  */
80
92
  export interface MixOptions
81
93
  extends Omit<Options, 'data' | 'legend' | 'xAxis' | 'yAxis' | 'legend' | 'tooltip' | 'slider' | 'scrollbar'> {
94
+ /**
95
+ * @title 顶层数据配置
96
+ */
97
+ readonly data?: Options['data'];
82
98
  /**
83
99
  * @title 是否同步子 view 的配置
84
100
  * @description 目前仅仅支持 true / false,后续需要增加 function 的方式进行自定义 view 之前的布局同步
@@ -96,12 +112,18 @@ export interface MixOptions
96
112
  readonly plots?: IPlot[];
97
113
  /**
98
114
  * @title tooltip 配置
99
- * @description tooltip 配置在 chart 层配置
115
+ * @description Mix tooltip 组件配置,统一顶层配置
116
+ * TODO 字段映射
100
117
  */
101
118
  readonly tooltip?: Tooltip;
102
119
  /**
103
120
  * @title legend 配置
104
- * @description 统一顶层配置
121
+ * @description Mix 图例配置,统一顶层配置
105
122
  */
106
123
  readonly legend?: false | Record<string, Legend>;
124
+ /**
125
+ * @title slider 配置
126
+ * @description Mix 缩略轴配置,统一顶层配置
127
+ */
128
+ readonly slider?: Slider;
107
129
  }
@@ -9,12 +9,13 @@ import { adaptor as areaAdaptor } from '../area/adaptor';
9
9
  import { adaptor as gaugeAdaptor } from '../gauge/adaptor';
10
10
  import { adaptor as tinyLineAdaptor } from '../tiny-line/adaptor';
11
11
  import { adaptor as tinyColumnAdaptor } from '../tiny-column/adaptor';
12
- import { adaptor as tinyAreadaptor } from '../tiny-area/adaptor';
12
+ import { adaptor as tinyAreaAdaptor } from '../tiny-area/adaptor';
13
13
  import { adaptor as ringProgressAdaptor } from '../ring-progress/adaptor';
14
14
  import { adaptor as progressAdaptor } from '../progress/adaptor';
15
15
  import { adaptor as scatterAdaptor } from '../scatter/adaptor';
16
16
  import { adaptor as histogramAdaptor } from '../histogram/adaptor';
17
17
  import { adaptor as funnelAdaptor } from '../funnel/adaptor';
18
+ import { adaptor as stockAdaptor } from '../stock/adaptor';
18
19
  import { Line, LineOptions } from '../line';
19
20
  import { Pie, PieOptions } from '../pie';
20
21
  import { Bar, BarOptions } from '../bar';
@@ -29,11 +30,12 @@ import { Progress, ProgressOptions } from '../progress';
29
30
  import { Scatter, ScatterOptions } from '../scatter';
30
31
  import { Histogram, HistogramOptions } from '../histogram';
31
32
  import { Funnel, FunnelOptions } from '../funnel';
33
+ import { Stock, StockOptions } from '../stock';
32
34
 
33
35
  /**
34
- * 移除 options 中的 width、height 设置
36
+ * 移除 options 中的 width、height、data 设置
35
37
  */
36
- type OmitSize<T> = Omit<T, 'width' | 'height'>;
38
+ type OmitPlotOptions<T> = Omit<T, 'width' | 'height' | 'data'>;
37
39
 
38
40
  /**
39
41
  * multi-view 中的支持的 plots 类型(带 options 定义)
@@ -47,59 +49,63 @@ export type IPlotTypes =
47
49
  /**
48
50
  * plot 配置
49
51
  */
50
- readonly options: OmitSize<LineOptions>;
52
+ readonly options: OmitPlotOptions<LineOptions>;
51
53
  }
52
54
  | {
53
55
  readonly type: 'pie';
54
- readonly options: OmitSize<PieOptions>;
56
+ readonly options: OmitPlotOptions<PieOptions>;
55
57
  }
56
58
  | {
57
59
  readonly type: 'bar';
58
- readonly options: OmitSize<BarOptions>;
60
+ readonly options: OmitPlotOptions<BarOptions>;
59
61
  }
60
62
  | {
61
63
  readonly type: 'column';
62
- readonly options: OmitSize<ColumnOptions>;
64
+ readonly options: OmitPlotOptions<ColumnOptions>;
63
65
  }
64
66
  | {
65
67
  readonly type: 'area';
66
- readonly options: OmitSize<AreaOptions>;
68
+ readonly options: OmitPlotOptions<AreaOptions>;
67
69
  }
68
70
  | {
69
71
  readonly type: 'gauge';
70
- readonly options: OmitSize<GaugeOptions>;
72
+ readonly options: OmitPlotOptions<GaugeOptions>;
71
73
  }
72
74
  | {
73
75
  readonly type: 'tiny-line';
74
- readonly options: OmitSize<TinyLineOptions>;
76
+ readonly options: OmitPlotOptions<TinyLineOptions>;
75
77
  }
76
78
  | {
77
79
  readonly type: 'tiny-area';
78
- readonly options: OmitSize<TinyAreaOptions>;
80
+ readonly options: OmitPlotOptions<TinyAreaOptions>;
79
81
  }
80
82
  | {
81
83
  readonly type: 'tiny-column';
82
- readonly options: OmitSize<TinyColumnOptions>;
84
+ readonly options: OmitPlotOptions<TinyColumnOptions>;
83
85
  }
84
86
  | {
85
87
  readonly type: 'ring-progress';
86
- readonly options: OmitSize<RingProgressOptions>;
88
+ readonly options: OmitPlotOptions<RingProgressOptions>;
87
89
  }
88
90
  | {
89
91
  readonly type: 'progress';
90
- readonly options: OmitSize<ProgressOptions>;
92
+ readonly options: OmitPlotOptions<ProgressOptions>;
91
93
  }
92
94
  | {
93
95
  readonly type: 'histogram';
94
- readonly options: OmitSize<HistogramOptions>;
96
+ readonly options: OmitPlotOptions<HistogramOptions>;
95
97
  }
96
98
  | {
97
99
  readonly type: 'scatter';
98
- readonly options: OmitSize<ScatterOptions>;
100
+ readonly options: OmitPlotOptions<ScatterOptions>;
99
101
  }
100
102
  | {
101
103
  readonly type: 'funnel';
102
- readonly options: OmitSize<FunnelOptions>;
104
+ readonly options: OmitPlotOptions<FunnelOptions>;
105
+ }
106
+ | {
107
+ readonly type: 'stock';
108
+ readonly options: OmitPlotOptions<StockOptions>;
103
109
  };
104
110
 
105
111
  /**
@@ -114,12 +120,13 @@ const PLOT_ADAPTORS = {
114
120
  gauge: gaugeAdaptor,
115
121
  'tiny-line': tinyLineAdaptor,
116
122
  'tiny-column': tinyColumnAdaptor,
117
- 'tiny-area': tinyAreadaptor,
123
+ 'tiny-area': tinyAreaAdaptor,
118
124
  'ring-progress': ringProgressAdaptor,
119
125
  progress: progressAdaptor,
120
126
  scatter: scatterAdaptor,
121
127
  histogram: histogramAdaptor,
122
128
  funnel: funnelAdaptor,
129
+ stock: stockAdaptor,
123
130
  };
124
131
 
125
132
  /**
@@ -141,6 +148,7 @@ const PLOT_CONSTRUCTOR = {
141
148
  scatter: Scatter,
142
149
  histogram: Histogram,
143
150
  funnel: Funnel,
151
+ stock: Stock,
144
152
  };
145
153
 
146
154
  /**