-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
401dd68
commit da75312
Showing
8 changed files
with
121 additions
and
18 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
title: API | ||
order: 7 | ||
--- | ||
|
||
<embed src="@/docs/common/custom/dataCellCallback.en.md"></embed> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
title: API | ||
order: 7 | ||
--- | ||
<embed src="@/docs/common/custom/customTreeItem.zh.md"></embed> |
77 changes: 77 additions & 0 deletions
77
s2-site/examples/custom/custom-plugins/demo/custom-plugins.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { PivotSheet, S2Options } from '@antv/s2'; | ||
import { Plugin as PluginRoughCanvasRenderer } from '@antv/g-plugin-rough-canvas-renderer'; | ||
import { Plugin as PluginA11y } from '@antv/g-plugin-a11y'; | ||
|
||
fetch( | ||
'https://gw.alipayobjects.com/os/bmw-prod/cd9814d0-6dfa-42a6-8455-5a6bd0ff93ca.json', | ||
) | ||
.then((res) => res.json()) | ||
.then((res) => { | ||
const container = document.getElementById('container'); | ||
const s2DataConfig = { | ||
fields: { | ||
rows: ['province', 'city'], | ||
columns: ['type', 'sub_type'], | ||
values: ['number'], | ||
}, | ||
data: res.data, | ||
meta: [ | ||
{ | ||
field: 'number', | ||
name: '数量', | ||
}, | ||
{ | ||
field: 'province', | ||
name: '省份', | ||
}, | ||
{ | ||
field: 'city', | ||
name: '城市', | ||
}, | ||
{ | ||
field: 'type', | ||
name: '类别', | ||
}, | ||
{ | ||
field: 'sub_type', | ||
name: '子类别', | ||
}, | ||
], | ||
}; | ||
|
||
const s2Options: S2Options = { | ||
width: 800, | ||
height: 600, | ||
interaction: { | ||
brushSelection: { | ||
rowCell: true, | ||
colCell: true, | ||
dataCell: true, | ||
}, | ||
}, | ||
transformCanvasConfig(renderer) { | ||
renderer.registerPlugin(new PluginRoughCanvasRenderer()); | ||
renderer.registerPlugin( | ||
new PluginA11y({ | ||
enableExtractingText: true, | ||
}), | ||
); | ||
|
||
console.log( | ||
'当前已注册插件:', | ||
renderer.getPlugins(), | ||
renderer.getConfig(), | ||
); | ||
|
||
return { | ||
supportsCSSTransform: true, | ||
devicePixelRatio: 2, | ||
cursor: 'crosshair', | ||
}; | ||
}, | ||
}; | ||
|
||
const s2 = new PivotSheet(container, s2DataConfig, s2Options); | ||
|
||
s2.render(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"title": { | ||
"zh": "G 5.0 插件", | ||
"en": "G 5.0 plugins" | ||
}, | ||
"demos": [ | ||
{ | ||
"filename": "custom-g-plugins.ts", | ||
"title": { | ||
"zh": "自定义 AntV/G 5.0 插件和配置", | ||
"en": "custom AntV/G 5.0 plugins and config" | ||
}, | ||
"screenshot": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*Ag6SSYgDpeYAAAAAAAAAAAAADmJ7AQ/original" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
title: custom tree | ||
order: 7 | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
title: 自定义目录树 | ||
order: 7 | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters