Skip to content

Commit d10c30e

Browse files
committed
feat(funnel): 漏斗图增加关闭分面 title 的展示
1 parent 426340a commit d10c30e

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

docs/api/plots/funnel.en.md

+6
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ the min size of graphic,is between 0 and 1, default 0。
7272

7373
Tip: when set dynamicHeight to be true, this field is invalid
7474

75+
#### showFacetTitle
76+
77+
<description>**optional** _boolean_ _default:_ `true`</description>
78+
79+
是否展示漏斗分面的标题。适用于存在多组漏斗的情形,如:分组漏斗图、对比漏斗图
80+
7581
#### funnelStyle
7682

7783
<description>**optional** _object_</description>

docs/api/plots/funnel.zh.md

+6
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ order: 9
7272

7373
注:因动态高度漏斗图将值映射为高度,因此声明 dynamicHeight: true 时,该字段无效
7474

75+
#### showFacetTitle
76+
77+
<description>**optional** _boolean_ _default:_ `true`</description>
78+
79+
是否展示漏斗分面的标题。适用于存在多组漏斗的情形,如:分组漏斗图、对比漏斗图
80+
7581
#### funnelStyle
7682

7783
<description>**可选** _object_</description>

src/plots/funnel/geometries/compare.ts

+2
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,15 @@ function geometry(params: Params<FunnelOptions>): Params<FunnelOptions> {
4646
label,
4747
funnelStyle,
4848
state,
49+
showFacetTitle,
4950
} = options;
5051

5152
chart.facet('mirror', {
5253
fields: [compareField],
5354
// 漏斗图的转置规则与分面相反,默认是垂直布局
5455
transpose: !isTransposed,
5556
padding: isTransposed ? 0 : [32, 0, 0, 0],
57+
showTitle: showFacetTitle,
5658
eachView(view, facet) {
5759
const index = isTransposed ? facet.rowIndex : facet.columnIndex;
5860

src/plots/funnel/geometries/facet.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@ function field(params: Params<FunnelOptions>): Params<FunnelOptions> {
2626
*/
2727
function geometry(params: Params<FunnelOptions>): Params<FunnelOptions> {
2828
const { chart, options } = params;
29-
const { seriesField, isTransposed } = options;
29+
const { seriesField, isTransposed, showFacetTitle } = options;
3030

3131
chart.facet('rect', {
3232
fields: [seriesField],
3333
padding: [isTransposed ? 0 : 32, 10, 0, 10],
34+
showTitle: showFacetTitle,
3435
eachView(view, facet) {
3536
basicFunnel(
3637
deepAssign({}, params, {

src/plots/funnel/types.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ export interface FunnelOptions extends Options {
5454
* @title 漏斗图样式
5555
*/
5656
readonly funnelStyle?: StyleAttr;
57-
57+
/**
58+
* @title 漏斗分面标题
59+
* @description 是否关闭漏斗的标题展示,适用于存在多组漏斗的情形,如:分组漏斗图、对比漏斗图。
60+
*/
61+
readonly showFacetTitle?: boolean;
5862
// 组件
5963
/**
6064
* @title 转化率信息

0 commit comments

Comments
 (0)