Skip to content

Commit 3614972

Browse files
committed
feat(legend): 图例支持多行分页
1 parent d33f2ee commit 3614972

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

docs/common/legend-cfg.en.md

+6
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ Background box configuration item. _LegendBackgroundCFG_ is configured as follow
5353

5454
Apply to <tag color="green" text="Classification legend">Classification legend</tag>,whether to page when there are too many legend items. (⚠️ 暂不支持多行展示分页)
5555

56+
### maxRow
57+
58+
<description> _number_ **optional** </description>
59+
60+
Apply to <tag color="green" text="Classification legend">Classification legend</tag>. You can set the maximum number of rows when legend items is flip-paged, (only applicable to 'layout:' horizontal '),default: 1.
61+
5662
##### pageNavigator
5763

5864
<description>**optional** _object_ </description>

docs/common/legend-cfg.zh.md

+6
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@
5555

5656
适用于 <tag color="green" text="分类图例">分类图例</tag>,当图例项过多时是否进行分页。(⚠️ 暂不支持多行展示分页)
5757

58+
### maxRow
59+
60+
<description> _number_ **optional** </description>
61+
62+
适用于 <tag color="green" text="分类图例">分类图例</tag>,当图例项过多分页时,可以设置最大行数(仅适用于 `layout: 'horizontal'`),默认为:1。
63+
5864
##### pageNavigator
5965

6066
<description>**optional** _object_ </description>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Column } from '@antv/g2plot';
2+
3+
fetch('https://gw.alipayobjects.com/os/antfincdn/P14mCvkybz/large-datra.json')
4+
.then((data) => data.json())
5+
.then((data) => {
6+
const plot = new Column('container', {
7+
data,
8+
xField: 'product_box',
9+
yField: 'value',
10+
seriesField: 'province',
11+
isGroup: 'true',
12+
legend: {
13+
flipPage: true,
14+
maxRow: 2,
15+
},
16+
});
17+
18+
plot.render();
19+
});

examples/component/legend/demo/meta.json

+8
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@
3636
"en": "Default unselected legend tem"
3737
},
3838
"screenshot": "https://gw.alipayobjects.com/zos/antfincdn/KL9rDFTlDt/64abafb6-8e4e-48ff-9a79-cb84883a3bef.png"
39+
},
40+
{
41+
"filename": "legend-flippage.ts",
42+
"title": {
43+
"zh": "图例项分页设置",
44+
"en": "Configuration of legend when flip-page"
45+
},
46+
"screenshot": "https://gw.alipayobjects.com/zos/antfincdn/KL9rDFTlDt/64abafb6-8e4e-48ff-9a79-cb84883a3bef.png"
3947
}
4048
]
4149
}

0 commit comments

Comments
 (0)