@antv/g2plot 2.4.12 → 2.4.15
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/CHANGELOG.md +32 -0
- package/dist/g2plot.min.js +4 -4
- package/dist/g2plot.min.js.map +1 -1
- package/esm/adaptor/common.d.ts +10 -0
- package/esm/adaptor/common.js +25 -0
- package/esm/adaptor/common.js.map +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/plots/area/adaptor.js +4 -4
- package/esm/plots/area/adaptor.js.map +1 -1
- package/esm/plots/area/index.js +2 -2
- package/esm/plots/area/index.js.map +1 -1
- package/esm/plots/area/types.d.ts +6 -0
- package/esm/plots/area/types.js.map +1 -1
- package/esm/plots/bar/adaptor.js +3 -3
- package/esm/plots/bar/adaptor.js.map +1 -1
- package/esm/plots/bar/index.js +2 -2
- package/esm/plots/bar/index.js.map +1 -1
- package/esm/plots/column/adaptor.js +4 -4
- package/esm/plots/column/adaptor.js.map +1 -1
- package/esm/plots/column/index.js +2 -2
- package/esm/plots/column/index.js.map +1 -1
- package/esm/plots/column/types.d.ts +6 -0
- package/esm/plots/column/types.js.map +1 -1
- package/esm/plots/mix/adaptor.d.ts +5 -0
- package/esm/plots/mix/adaptor.js +18 -5
- package/esm/plots/mix/adaptor.js.map +1 -1
- package/esm/plots/mix/types.d.ts +24 -2
- package/esm/plots/mix/types.js.map +1 -1
- package/esm/plots/mix/utils.d.ts +21 -16
- package/esm/plots/mix/utils.js +6 -2
- package/esm/plots/mix/utils.js.map +1 -1
- package/esm/plots/pie/adaptor.js +1 -1
- package/esm/plots/pie/adaptor.js.map +1 -1
- package/esm/types/coordinate.d.ts +13 -0
- package/esm/types/coordinate.js +1 -0
- package/esm/types/coordinate.js.map +1 -0
- package/esm/utils/transform/percent.d.ts +1 -1
- package/esm/utils/transform/percent.js +1 -1
- package/esm/utils/transform/percent.js.map +1 -1
- package/lib/adaptor/common.d.ts +10 -0
- package/lib/adaptor/common.js +27 -1
- package/lib/adaptor/common.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/plots/area/adaptor.js +2 -2
- package/lib/plots/area/adaptor.js.map +1 -1
- package/lib/plots/area/index.js +1 -1
- package/lib/plots/area/index.js.map +1 -1
- package/lib/plots/area/types.d.ts +6 -0
- package/lib/plots/area/types.js.map +1 -1
- package/lib/plots/bar/adaptor.js +3 -3
- package/lib/plots/bar/adaptor.js.map +1 -1
- package/lib/plots/bar/index.js +1 -1
- package/lib/plots/bar/index.js.map +1 -1
- package/lib/plots/column/adaptor.js +2 -2
- package/lib/plots/column/adaptor.js.map +1 -1
- package/lib/plots/column/index.js +1 -1
- package/lib/plots/column/index.js.map +1 -1
- package/lib/plots/column/types.d.ts +6 -0
- package/lib/plots/column/types.js.map +1 -1
- package/lib/plots/mix/adaptor.d.ts +5 -0
- package/lib/plots/mix/adaptor.js +19 -5
- package/lib/plots/mix/adaptor.js.map +1 -1
- package/lib/plots/mix/types.d.ts +24 -2
- package/lib/plots/mix/types.js.map +1 -1
- package/lib/plots/mix/utils.d.ts +21 -16
- package/lib/plots/mix/utils.js +4 -0
- package/lib/plots/mix/utils.js.map +1 -1
- package/lib/plots/pie/adaptor.js +1 -1
- package/lib/plots/pie/adaptor.js.map +1 -1
- package/lib/types/coordinate.d.ts +13 -0
- package/lib/types/coordinate.js +3 -0
- package/lib/types/coordinate.js.map +1 -0
- package/lib/utils/transform/percent.d.ts +1 -1
- package/lib/utils/transform/percent.js +3 -3
- package/lib/utils/transform/percent.js.map +1 -1
- package/package.json +1 -1
- package/src/adaptor/common.ts +28 -1
- package/src/index.ts +1 -1
- package/src/plots/area/adaptor.ts +14 -3
- package/src/plots/area/index.ts +2 -2
- package/src/plots/area/types.ts +7 -0
- package/src/plots/bar/adaptor.ts +3 -3
- package/src/plots/bar/index.ts +2 -2
- package/src/plots/column/adaptor.ts +4 -2
- package/src/plots/column/index.ts +2 -2
- package/src/plots/column/types.ts +7 -0
- package/src/plots/mix/adaptor.ts +24 -5
- package/src/plots/mix/types.ts +24 -2
- package/src/plots/mix/utils.ts +27 -18
- package/src/plots/pie/adaptor.ts +1 -1
- package/src/types/coordinate.ts +17 -0
- package/src/utils/transform/percent.ts +1 -1
package/src/plots/bar/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Plot } from '../../core/plot';
|
|
2
2
|
import { Adaptor } from '../../core/adaptor';
|
|
3
|
-
import {
|
|
3
|
+
import { getDataWhetherPercentage } from '../../utils/transform/percent';
|
|
4
4
|
import { BarOptions } from './types';
|
|
5
5
|
import { adaptor, meta } from './adaptor';
|
|
6
6
|
import { DEFAULT_OPTIONS } from './constants';
|
|
@@ -31,7 +31,7 @@ export class Bar extends Plot<BarOptions> {
|
|
|
31
31
|
const { xField, yField, isPercent } = options;
|
|
32
32
|
const switchedFieldOptions = { ...options, xField: yField, yField: xField };
|
|
33
33
|
meta({ chart, options: switchedFieldOptions });
|
|
34
|
-
chart.changeData(
|
|
34
|
+
chart.changeData(getDataWhetherPercentage(data, xField, yField, xField, isPercent));
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/**
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
scrollbar,
|
|
12
12
|
limitInPlot,
|
|
13
13
|
state,
|
|
14
|
+
transformations,
|
|
14
15
|
} from '../../adaptor/common';
|
|
15
16
|
import { conversionTag } from '../../adaptor/conversion-tag';
|
|
16
17
|
import { connectedArea } from '../../adaptor/connected-area';
|
|
@@ -18,7 +19,7 @@ import { interval } from '../../adaptor/geometries';
|
|
|
18
19
|
import { pattern } from '../../adaptor/pattern';
|
|
19
20
|
import { brushInteraction } from '../../adaptor/brush';
|
|
20
21
|
import { flow, transformLabel, deepAssign, findGeometry, adjustYMetaByZero, pick } from '../../utils';
|
|
21
|
-
import {
|
|
22
|
+
import { getDataWhetherPercentage, getDeepPercent } from '../../utils/transform/percent';
|
|
22
23
|
import { Datum } from '../../types';
|
|
23
24
|
import { ColumnOptions } from './types';
|
|
24
25
|
|
|
@@ -73,7 +74,7 @@ function geometry(params: Params<ColumnOptions>): Params<ColumnOptions> {
|
|
|
73
74
|
const percentData =
|
|
74
75
|
isPercent && isGroup && isStack
|
|
75
76
|
? getDeepPercent(data, yField, [xField, groupField], yField)
|
|
76
|
-
:
|
|
77
|
+
: getDataWhetherPercentage(data, yField, xField, yField, isPercent);
|
|
77
78
|
|
|
78
79
|
let chartData = [];
|
|
79
80
|
|
|
@@ -292,6 +293,7 @@ export function adaptor(params: Params<ColumnOptions>, isBar = false) {
|
|
|
292
293
|
theme, // theme 需要在 geometry 之前
|
|
293
294
|
pattern('columnStyle'),
|
|
294
295
|
state,
|
|
296
|
+
transformations('rect'),
|
|
295
297
|
geometry,
|
|
296
298
|
meta,
|
|
297
299
|
axis,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Plot } from '../../core/plot';
|
|
2
2
|
import { Adaptor } from '../../core/adaptor';
|
|
3
|
-
import {
|
|
3
|
+
import { getDataWhetherPercentage } from '../../utils/transform/percent';
|
|
4
4
|
import { ColumnOptions } from './types';
|
|
5
5
|
import { adaptor, meta } from './adaptor';
|
|
6
6
|
import { DEFAULT_OPTIONS } from './constants';
|
|
@@ -30,7 +30,7 @@ export class Column extends Plot<ColumnOptions> {
|
|
|
30
30
|
const { yField, xField, isPercent } = this.options;
|
|
31
31
|
const { chart, options } = this;
|
|
32
32
|
meta({ chart, options });
|
|
33
|
-
this.chart.changeData(
|
|
33
|
+
this.chart.changeData(getDataWhetherPercentage(data, yField, xField, yField, isPercent));
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
@@ -3,6 +3,7 @@ import { BrushCfg, Options, StyleAttr } from '../../types';
|
|
|
3
3
|
import { OptionWithConversionTag } from '../../adaptor/conversion-tag';
|
|
4
4
|
import { OptionWithConnectedArea } from '../../adaptor/connected-area';
|
|
5
5
|
import { IntervalGeometryOptions } from '../../adaptor/geometries/interval';
|
|
6
|
+
import { Transformations } from '../../types/coordinate';
|
|
6
7
|
|
|
7
8
|
type PartialIntervalGeometryOptions = Pick<IntervalGeometryOptions, 'dodgePadding' | 'intervalPadding'>;
|
|
8
9
|
|
|
@@ -84,4 +85,10 @@ export interface ColumnOptions
|
|
|
84
85
|
* @description 开启下钻交互,以及进行下钻交互的配置
|
|
85
86
|
*/
|
|
86
87
|
readonly brush?: BrushCfg;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @title 坐标转换
|
|
91
|
+
* @description 可以对坐标系进行转换,如: reflectX, reflectY, transpose 等
|
|
92
|
+
*/
|
|
93
|
+
readonly coordinate?: Transformations;
|
|
87
94
|
}
|
package/src/plots/mix/adaptor.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { each } from '@antv/util';
|
|
2
2
|
import { Geometry } from '@antv/g2';
|
|
3
3
|
import { geometry as geometryAdaptor } from '../../adaptor/geometries/base';
|
|
4
|
-
import { interaction, animation, theme, tooltip } from '../../adaptor/common';
|
|
4
|
+
import { interaction, animation, theme, tooltip, annotation } from '../../adaptor/common';
|
|
5
5
|
import { Params } from '../../core/adaptor';
|
|
6
6
|
import { PLOT_CONTAINER_OPTIONS } from '../../core/plot';
|
|
7
7
|
import { AXIS_META_CONFIG_KEYS } from '../../constant';
|
|
@@ -122,24 +122,41 @@ function multiView(params: Params<MixOptions>): Params<MixOptions> {
|
|
|
122
122
|
*/
|
|
123
123
|
function multiPlot(params: Params<MixOptions>): Params<MixOptions> {
|
|
124
124
|
const { chart, options } = params;
|
|
125
|
-
const { plots } = options;
|
|
125
|
+
const { plots, data = [] } = options;
|
|
126
126
|
|
|
127
127
|
each(plots, (plot) => {
|
|
128
|
-
const { type, region, options = {} } = plot;
|
|
128
|
+
const { type, region, options = {}, top } = plot;
|
|
129
129
|
const { tooltip } = options;
|
|
130
130
|
|
|
131
|
+
if (top) {
|
|
132
|
+
execPlotAdaptor(type, chart, { ...options, data });
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
131
136
|
const viewOfG2 = chart.createView({ region, ...pick(options, PLOT_CONTAINER_OPTIONS) });
|
|
132
137
|
if (tooltip) {
|
|
133
138
|
// 配置 tooltip 交互
|
|
134
139
|
viewOfG2.interaction('tooltip');
|
|
135
140
|
}
|
|
136
141
|
|
|
137
|
-
execPlotAdaptor(type, viewOfG2, options);
|
|
142
|
+
execPlotAdaptor(type, viewOfG2, { data, ...options });
|
|
138
143
|
});
|
|
139
144
|
|
|
140
145
|
return params;
|
|
141
146
|
}
|
|
142
147
|
|
|
148
|
+
/**
|
|
149
|
+
* 处理缩略轴的 adaptor (mix)
|
|
150
|
+
* @param params
|
|
151
|
+
*/
|
|
152
|
+
export function slider(params: Params<MixOptions>): Params<MixOptions> {
|
|
153
|
+
const { chart, options } = params;
|
|
154
|
+
|
|
155
|
+
chart.option('slider', options.slider);
|
|
156
|
+
|
|
157
|
+
return params;
|
|
158
|
+
}
|
|
159
|
+
|
|
143
160
|
/**
|
|
144
161
|
* 图适配器
|
|
145
162
|
* @param chart
|
|
@@ -153,7 +170,9 @@ export function adaptor(params: Params<MixOptions>) {
|
|
|
153
170
|
interaction,
|
|
154
171
|
animation,
|
|
155
172
|
theme,
|
|
156
|
-
tooltip
|
|
173
|
+
tooltip,
|
|
174
|
+
slider,
|
|
175
|
+
annotation()
|
|
157
176
|
// ... 其他的 adaptor flow
|
|
158
177
|
)(params);
|
|
159
178
|
}
|
package/src/plots/mix/types.ts
CHANGED
|
@@ -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
|
|
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
|
}
|
package/src/plots/mix/utils.ts
CHANGED
|
@@ -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
|
|
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,13 @@ 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';
|
|
34
|
+
import { Options } from '../../types';
|
|
32
35
|
|
|
33
36
|
/**
|
|
34
|
-
* 移除 options 中的 width、height
|
|
37
|
+
* 移除 options 中的 width、height 设置, 将 options 的 data 设置为可选
|
|
35
38
|
*/
|
|
36
|
-
type
|
|
39
|
+
type PlotOptions<T> = Omit<T, 'width' | 'height' | 'data'> & Partial<Pick<T extends Options ? T : never, 'data'>>;
|
|
37
40
|
|
|
38
41
|
/**
|
|
39
42
|
* multi-view 中的支持的 plots 类型(带 options 定义)
|
|
@@ -47,59 +50,63 @@ export type IPlotTypes =
|
|
|
47
50
|
/**
|
|
48
51
|
* plot 配置
|
|
49
52
|
*/
|
|
50
|
-
readonly options:
|
|
53
|
+
readonly options: PlotOptions<LineOptions>;
|
|
51
54
|
}
|
|
52
55
|
| {
|
|
53
56
|
readonly type: 'pie';
|
|
54
|
-
readonly options:
|
|
57
|
+
readonly options: PlotOptions<PieOptions>;
|
|
55
58
|
}
|
|
56
59
|
| {
|
|
57
60
|
readonly type: 'bar';
|
|
58
|
-
readonly options:
|
|
61
|
+
readonly options: PlotOptions<BarOptions>;
|
|
59
62
|
}
|
|
60
63
|
| {
|
|
61
64
|
readonly type: 'column';
|
|
62
|
-
readonly options:
|
|
65
|
+
readonly options: PlotOptions<ColumnOptions>;
|
|
63
66
|
}
|
|
64
67
|
| {
|
|
65
68
|
readonly type: 'area';
|
|
66
|
-
readonly options:
|
|
69
|
+
readonly options: PlotOptions<AreaOptions>;
|
|
67
70
|
}
|
|
68
71
|
| {
|
|
69
72
|
readonly type: 'gauge';
|
|
70
|
-
readonly options:
|
|
73
|
+
readonly options: PlotOptions<GaugeOptions>;
|
|
71
74
|
}
|
|
72
75
|
| {
|
|
73
76
|
readonly type: 'tiny-line';
|
|
74
|
-
readonly options:
|
|
77
|
+
readonly options: PlotOptions<TinyLineOptions>;
|
|
75
78
|
}
|
|
76
79
|
| {
|
|
77
80
|
readonly type: 'tiny-area';
|
|
78
|
-
readonly options:
|
|
81
|
+
readonly options: PlotOptions<TinyAreaOptions>;
|
|
79
82
|
}
|
|
80
83
|
| {
|
|
81
84
|
readonly type: 'tiny-column';
|
|
82
|
-
readonly options:
|
|
85
|
+
readonly options: PlotOptions<TinyColumnOptions>;
|
|
83
86
|
}
|
|
84
87
|
| {
|
|
85
88
|
readonly type: 'ring-progress';
|
|
86
|
-
readonly options:
|
|
89
|
+
readonly options: PlotOptions<RingProgressOptions>;
|
|
87
90
|
}
|
|
88
91
|
| {
|
|
89
92
|
readonly type: 'progress';
|
|
90
|
-
readonly options:
|
|
93
|
+
readonly options: PlotOptions<ProgressOptions>;
|
|
91
94
|
}
|
|
92
95
|
| {
|
|
93
96
|
readonly type: 'histogram';
|
|
94
|
-
readonly options:
|
|
97
|
+
readonly options: PlotOptions<HistogramOptions>;
|
|
95
98
|
}
|
|
96
99
|
| {
|
|
97
100
|
readonly type: 'scatter';
|
|
98
|
-
readonly options:
|
|
101
|
+
readonly options: PlotOptions<ScatterOptions>;
|
|
99
102
|
}
|
|
100
103
|
| {
|
|
101
104
|
readonly type: 'funnel';
|
|
102
|
-
readonly options:
|
|
105
|
+
readonly options: PlotOptions<FunnelOptions>;
|
|
106
|
+
}
|
|
107
|
+
| {
|
|
108
|
+
readonly type: 'stock';
|
|
109
|
+
readonly options: PlotOptions<StockOptions>;
|
|
103
110
|
};
|
|
104
111
|
|
|
105
112
|
/**
|
|
@@ -114,12 +121,13 @@ const PLOT_ADAPTORS = {
|
|
|
114
121
|
gauge: gaugeAdaptor,
|
|
115
122
|
'tiny-line': tinyLineAdaptor,
|
|
116
123
|
'tiny-column': tinyColumnAdaptor,
|
|
117
|
-
'tiny-area':
|
|
124
|
+
'tiny-area': tinyAreaAdaptor,
|
|
118
125
|
'ring-progress': ringProgressAdaptor,
|
|
119
126
|
progress: progressAdaptor,
|
|
120
127
|
scatter: scatterAdaptor,
|
|
121
128
|
histogram: histogramAdaptor,
|
|
122
129
|
funnel: funnelAdaptor,
|
|
130
|
+
stock: stockAdaptor,
|
|
123
131
|
};
|
|
124
132
|
|
|
125
133
|
/**
|
|
@@ -141,6 +149,7 @@ const PLOT_CONSTRUCTOR = {
|
|
|
141
149
|
scatter: Scatter,
|
|
142
150
|
histogram: Histogram,
|
|
143
151
|
funnel: Funnel,
|
|
152
|
+
stock: Stock,
|
|
144
153
|
};
|
|
145
154
|
|
|
146
155
|
/**
|
package/src/plots/pie/adaptor.ts
CHANGED
|
@@ -138,7 +138,7 @@ function label(params: Params<PieOptions>): Params<PieOptions> {
|
|
|
138
138
|
const angleScale = chart.getScaleByField(angleField);
|
|
139
139
|
const percent = angleScale?.scale(value);
|
|
140
140
|
return isFunction(content)
|
|
141
|
-
? // append
|
|
141
|
+
? // append percent (number) to data, users can get origin data from `dataum._origin`
|
|
142
142
|
content({ ...data, percent }, dataum, index)
|
|
143
143
|
: isString(content)
|
|
144
144
|
? template(content as string, {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transformations of coordinate
|
|
3
|
+
*/
|
|
4
|
+
export type Transformations = Array<
|
|
5
|
+
| {
|
|
6
|
+
/** send (x, y) to (-x, y) */
|
|
7
|
+
type: 'reflectX';
|
|
8
|
+
}
|
|
9
|
+
| {
|
|
10
|
+
/** send (x, y) to (x, -y) */
|
|
11
|
+
type: 'reflectY';
|
|
12
|
+
}
|
|
13
|
+
| {
|
|
14
|
+
/** send (x, y) to (y, x) */
|
|
15
|
+
type: 'transpose';
|
|
16
|
+
}
|
|
17
|
+
>;
|
|
@@ -85,7 +85,7 @@ export function getDeepPercent(data: Record<string, any>[], measure: string, fie
|
|
|
85
85
|
* 获取数据,如果是百分比,进行数据转换 (适用于面积图、柱状图、条形图)
|
|
86
86
|
* @param isPercent 是否百分比
|
|
87
87
|
*/
|
|
88
|
-
export function
|
|
88
|
+
export function getDataWhetherPercentage(
|
|
89
89
|
data: Record<string, any>[],
|
|
90
90
|
yField: string,
|
|
91
91
|
groupField: string,
|