-
Notifications
You must be signed in to change notification settings - Fork 605
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(column): 柱状图支持圆角 & 添加图表指引 (#2215)
* feat(column): 柱状图支持圆角 & 添加图表指引 close: #2157 * feat(bar): 条形图支持圆角柱子 & 添加图表指引
- Loading branch information
Showing
8 changed files
with
148 additions
and
2 deletions.
There are no files selected for viewing
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
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
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
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
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,71 @@ | ||
import { Bar } from '@antv/g2plot'; | ||
|
||
const data = [ | ||
{ | ||
label: 'Mon.', | ||
type: 'series1', | ||
value: 2800, | ||
}, | ||
{ | ||
label: 'Mon.', | ||
type: 'series2', | ||
value: 2260, | ||
}, | ||
{ | ||
label: 'Tues.', | ||
type: 'series1', | ||
value: 1800, | ||
}, | ||
{ | ||
label: 'Tues.', | ||
type: 'series2', | ||
value: 1300, | ||
}, | ||
{ | ||
label: 'Wed.', | ||
type: 'series1', | ||
value: 950, | ||
}, | ||
{ | ||
label: 'Wed.', | ||
type: 'series2', | ||
value: 900, | ||
}, | ||
{ | ||
label: 'Thur.', | ||
type: 'series1', | ||
value: 500, | ||
}, | ||
{ | ||
label: 'Thur.', | ||
type: 'series2', | ||
value: 390, | ||
}, | ||
{ | ||
label: 'Fri.', | ||
type: 'series1', | ||
value: 170, | ||
}, | ||
{ | ||
label: 'Fri.', | ||
type: 'series2', | ||
value: 100, | ||
}, | ||
]; | ||
|
||
const stackedBarPlot = new Bar('container', { | ||
data, | ||
isGroup: true, | ||
xField: 'value', | ||
yField: 'label', | ||
seriesField: 'type', | ||
marginRatio: 0, | ||
label: { | ||
// 可手动配置 label 数据标签位置 | ||
position: 'right', // 'left', 'middle', 'right' | ||
offset: 4, | ||
}, | ||
barStyle: { radius: [2, 2, 0, 0] }, | ||
}); | ||
|
||
stackedBarPlot.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
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,18 @@ | ||
import { Column } from '@antv/g2plot'; | ||
|
||
fetch('https://gw.alipayobjects.com/os/antfincdn/PC3daFYjNw/column-data.json') | ||
.then((data) => data.json()) | ||
.then((data) => { | ||
const column = new Column('container', { | ||
data, | ||
xField: 'city', | ||
yField: 'value', | ||
seriesField: 'type', | ||
isGroup: 'true', | ||
columnStyle: { | ||
radius: [20, 20, 0, 0], | ||
}, | ||
}); | ||
|
||
column.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