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
Showing
17 changed files
with
4,479 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { StackArea } from '@antv/g2plot'; | ||
|
||
fetch('../data/emissions.json') | ||
.then((res) => res.json()) | ||
.then((data) => { | ||
const plot = new StackArea(document.getElementById('container'), { | ||
title: { | ||
visible: true, | ||
text: 'The causes of CO2 emissions', | ||
}, | ||
width: 600, | ||
height: 600, | ||
padding: 'auto', | ||
data, | ||
xField: 'year', | ||
yField: 'value', | ||
seriesField: 'category', | ||
xAxis: { | ||
type: 'time', | ||
}, | ||
yAxis: { | ||
label: { | ||
// 数值格式化为千分位 | ||
formatter: (v) => `${v}`.replace(/\d{1,3}(?=(\d{3})+$)/g, (s) => `${s},`), | ||
}, | ||
}, | ||
responsive: true, | ||
}); | ||
|
||
plot.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
Oops, something went wrong.