-
Notifications
You must be signed in to change notification settings - Fork 604
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(box): 修复箱形图异常点view的label只能展示一个 (#2913)
* fix(box): 修复箱形图异常点view的label只能展示一个 * docs(box): 丰富 box plot demo * fix(box): box plot 单测修改
- Loading branch information
Showing
9 changed files
with
121 additions
and
19 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,30 @@ | ||
import { Box } from '@antv/g2plot'; | ||
|
||
const data = [ | ||
{ x: '职业 A', low: 20000, q1: 26000, median: 27000, q3: 32000, high: 38000, outliers: [50000, 52000] }, | ||
{ x: '职业 B', low: 40000, q1: 49000, median: 62000, q3: 73000, high: 88000, outliers: [32000, 29000, 106000] }, | ||
{ x: '职业 C', low: 52000, q1: 59000, median: 65000, q3: 74000, high: 83000, outliers: [91000] }, | ||
{ x: '职业 D', low: 58000, q1: 96000, median: 130000, q3: 170000, high: 200000, outliers: [42000, 210000, 215000] }, | ||
{ x: '职业 E', low: 24000, q1: 28000, median: 32000, q3: 38000, high: 42000, outliers: [48000] }, | ||
{ x: '职业 F', low: 47000, q1: 56000, median: 69000, q3: 85000, high: 100000, outliers: [110000, 115000, 32000] }, | ||
{ x: '职业 G', low: 64000, q1: 74000, median: 83000, q3: 93000, high: 100000, outliers: [110000] }, | ||
{ x: '职业 H', low: 67000, q1: 72000, median: 84000, q3: 95000, high: 110000, outliers: [57000, 54000] }, | ||
]; | ||
|
||
const outliersBoxPlot = new Box('container', { | ||
data, | ||
xField: 'x', | ||
yField: ['low', 'q1', 'median', 'q3', 'high'], | ||
outliersField: 'outliers', | ||
outliersStyle: { | ||
fill: '#f6f', | ||
}, | ||
label: { | ||
style: { | ||
textBaseline: 'top', | ||
}, | ||
layout: { type: 'hide-overlap' }, | ||
}, | ||
}); | ||
|
||
outliersBoxPlot.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,52 @@ | ||
import { Box } from '@antv/g2plot'; | ||
|
||
const data = [ | ||
{ x: '职业 A', low: 20000, q1: 26000, median: 27000, q3: 32000, high: 38000, outliers: [50000, 52000] }, | ||
{ x: '职业 B', low: 40000, q1: 49000, median: 62000, q3: 73000, high: 88000, outliers: [32000, 29000, 106000] }, | ||
{ x: '职业 C', low: 52000, q1: 59000, median: 65000, q3: 74000, high: 83000, outliers: [91000] }, | ||
{ x: '职业 D', low: 58000, q1: 96000, median: 130000, q3: 170000, high: 200000, outliers: [42000, 210000, 215000] }, | ||
{ x: '职业 E', low: 24000, q1: 28000, median: 32000, q3: 38000, high: 42000, outliers: [48000] }, | ||
{ x: '职业 F', low: 47000, q1: 56000, median: 69000, q3: 85000, high: 100000, outliers: [110000, 115000, 32000] }, | ||
{ x: '职业 G', low: 64000, q1: 74000, median: 83000, q3: 93000, high: 100000, outliers: [110000] }, | ||
{ x: '职业 H', low: 67000, q1: 72000, median: 84000, q3: 95000, high: 110000, outliers: [57000, 54000] }, | ||
]; | ||
|
||
const boxPlot = new Box('container', { | ||
width: 400, | ||
height: 500, | ||
data: data, | ||
xField: 'x', | ||
yField: ['low', 'q1', 'median', 'q3', 'high'], | ||
meta: { | ||
low: { | ||
alias: '最低值', | ||
}, | ||
q1: { | ||
alias: '下四分位数', | ||
}, | ||
median: { | ||
alias: '最低值', | ||
}, | ||
q3: { | ||
alias: '上四分位数', | ||
}, | ||
high: { | ||
alias: '最高值', | ||
}, | ||
outliers: { | ||
alias: '异常值', | ||
}, | ||
}, | ||
outliersField: 'outliers', | ||
tooltip: { | ||
fields: ['high', 'q3', 'median', 'q1', 'low', 'outliers'], | ||
}, | ||
boxStyle: { | ||
stroke: '#545454', | ||
fill: '#1890FF', | ||
fillOpacity: 0.3, | ||
}, | ||
animation: false, | ||
}); | ||
|
||
boxPlot.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