Skip to content

Commit c23ef6c

Browse files
authored
feat(chord): 和弦图增加 state 通道 & 文档移除 color 配置 (#2527)
1 parent 6ae79bb commit c23ef6c

File tree

6 files changed

+15
-10
lines changed

6 files changed

+15
-10
lines changed

docs/common/chord.zh.md

-3
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ order: 28
4747

4848
弦图边样式的配置。
4949

50-
`markdown:docs/common/color.zh.md`
51-
5250
#### nodeWidthRatio
5351

5452
<description>**optional** _number_</description>
@@ -61,7 +59,6 @@ order: 28
6159

6260
弦图节点之间的间距,0 ~ 1,参考画布的高度,默认为 `0.1`
6361

64-
6562
### Plot Event
6663

6764
`markdown:docs/common/events.zh.md`

docs/common/theme.en.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,6 @@ In addition, G2 provides a custom topic mechanism to define a new topic structur
100100

101101
<playground path="general/theme/demo/register-theme.ts" rid="rect-register-theme"></playground>
102102

103-
Go [DEMO](/en/examples/general/theme#register-theme)
103+
🌰 Customize theme [DEMO](/zh/examples/general/theme#register-theme)
104+
💄 Online theme constructor [AntV ThemeSet](https://theme-set.antv.vision)
105+

docs/common/theme.zh.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,6 @@ plot.update({ theme: { defaultColor: '#FF6B3B' } })
8787

8888
<playground path="general/theme/demo/register-theme.ts" rid="rect-register-theme"></playground>
8989

90-
前往 [DEMO](/zh/examples/general/theme#register-theme)
90+
🌰 自定义主题 [DEMO](/zh/examples/general/theme#register-theme) 示例
91+
💄 在线主题构建工具 [AntV ThemeSet](https://theme-set.antv.vision)
9192

src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export type { RingProgressOptions } from './plots/ring-progress';
8181
export { Heatmap } from './plots/heatmap';
8282
export type { HeatmapOptions } from './plots/heatmap';
8383

84-
// 箱线图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ)
84+
// 箱线图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ), [visiky](https://github.com/visiky)
8585
export { Box } from './plots/box';
8686
export type { BoxOptions } from './plots/box';
8787

@@ -129,7 +129,7 @@ export type { TreemapOptions } from './plots/treemap';
129129
export { Sankey } from './plots/sankey';
130130
export type { SankeyOptions } from './plots/sankey';
131131

132-
// 弦图及类型定义 | author by [MrSmallLiu](https://github.com/MrSmallLiu)
132+
// 弦图及类型定义 | author by [MrSmallLiu](https://github.com/MrSmallLiu), [visiky](https://github.com/visiky)
133133
export { Chord } from './plots/chord';
134134
export type { ChordOptions } from './plots/chord';
135135

src/plots/chord/adaptor.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { interaction, animation, theme } from '../../adaptor/common';
1+
import { interaction, animation, theme, state } from '../../adaptor/common';
22
import { Params } from '../../core/adaptor';
33
import { flow } from '../../utils';
44
import { polygon, edge } from '../../adaptor/geometries';
@@ -177,6 +177,7 @@ function edgeGeometry(params: Params<ChordOptions>): Params<ChordOptions> {
177177
export function adaptor(params: Params<ChordOptions>) {
178178
// flow 的方式处理所有的配置到 G2 API
179179
return flow(
180+
theme,
180181
transformData,
181182
coordinate,
182183
scale,
@@ -186,7 +187,7 @@ export function adaptor(params: Params<ChordOptions>) {
186187
edgeGeometry,
187188
nodeGeometry,
188189
interaction,
189-
animation,
190-
theme
190+
state,
191+
animation
191192
)(params);
192193
}

src/utils/transform/chord.ts

+4
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ type ChordLayoutOutputData = {
5656
readonly nodes: OutputNode[];
5757
readonly links: OutputLink[];
5858
};
59+
5960
/**
6061
* 处理节点的value、edges
6162
* @param nodeById
@@ -80,6 +81,7 @@ function processGraph(nodeById, edges, options) {
8081
});
8182
});
8283
}
84+
8385
/**
8486
* 节点排序
8587
* @param nodes
@@ -201,9 +203,11 @@ function locatingEdges(nodeById, edges, options): OutputLink[] {
201203
}
202204
return edges;
203205
}
206+
204207
export function getDefaultOptions(options: ChordLayoutOptions): ChordLayoutOptions {
205208
return assign({}, DEFAULT_OPTIONS, options);
206209
}
210+
207211
export function chordLayout(
208212
chordLayoutOptions: ChordLayoutOptions,
209213
chordLayoutInputData: NodeLinkData

0 commit comments

Comments
 (0)