-
Notifications
You must be signed in to change notification settings - Fork 647
docs: 更新饼图&图例官网例子 #2134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
docs: 更新饼图&图例官网例子 #2134
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,26 @@ | ||
| /** @jsx jsx */ | ||
| import { Canvas, Chart, Interval, jsx, Legend } from '@antv/f2'; | ||
|
|
||
| const context = document.getElementById('container').getContext('2d'); | ||
|
|
||
| const multiLineData = [ | ||
| { genre: '债券基金', sold: 275, a: '1' }, | ||
| { genre: '申万宏源固守+基金指数', sold: 115, a: '1' }, | ||
| { genre: '基金指数', sold: 120, a: '1' }, | ||
| { genre: '股票基金', sold: 300, a: '1' }, | ||
| { genre: '混合基金', sold: 180, a: '1' }, | ||
| { genre: '货币基金', sold: 90, a: '1' }, | ||
| { genre: 'QDII基金', sold: 60, a: '1' }, | ||
| ]; | ||
|
|
||
| const { props } = ( | ||
| <Canvas context={context} pixelRatio={window.devicePixelRatio}> | ||
| <Chart data={multiLineData}> | ||
| <Legend layoutMode="adaptive" /> | ||
| <Interval x="genre" y="sold" color="genre" /> | ||
| </Chart> | ||
| </Canvas> | ||
| ); | ||
|
|
||
| const canvas = new Canvas(props); | ||
| canvas.render(); | ||
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ order: 1 | |
|
|
||
| ### 基础示例 | ||
|
|
||
| - [基础图例](./demo/legend.jsx):展示基本的图例组件。 | ||
| - 基础图例:展示基本的图例组件。 | ||
|
|
||
| ```jsx | ||
| import { jsx, Canvas, Chart, Legend } from '@antv/f2'; | ||
|
|
@@ -29,10 +29,26 @@ const { props } = ( | |
| ); | ||
| ``` | ||
|
|
||
| ### 布局方式 | ||
|
|
||
| - [基础图例](./demo/legend.jsx):展示基本的图例组件。 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| ```jsx | ||
| import { jsx, Canvas, Chart, Legend } from '@antv/f2'; | ||
|
|
||
| const { props } = ( | ||
| <Canvas context={context}> | ||
| <Chart data={data}> | ||
| <Legend position="bottom" layoutMode="adaptive" /> | ||
| </Chart> | ||
| </Canvas> | ||
| ); | ||
| ``` | ||
|
|
||
| ### 进阶用法 | ||
|
|
||
| - [自定义图例](./demo/custom.jsx):自定义样式和布局的图例。 | ||
| - [可交互图例](./demo/interactive.jsx):支持点击交互的图例组件。 | ||
| - [可交互图例](./demo/layoutMode.jsx):两种布局方式。 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| ## 使用场景 | ||
|
|
||
|
|
||
This file contains hidden or 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 |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| --- | ||
| title: Shape 组件与图形标签 | ||
| title: 图形标签 | ||
| order: 2 | ||
| --- | ||
|
|
||
|
|
||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
示例数据
multiLineData中的a: '1'属性在<Interval />组件中并未使用。为了保持示例代码的简洁和清晰,建议移除这个未使用的属性。