Skip to content
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

docs(demo): 补充组合图表 demo & 增加一个插件图表 #2448

Merged
merged 1 commit into from
Mar 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/manual/plots/pie.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ With G2Plot, you can set the `innerRadius` to create concentric ring.

### Fan chart

By setting `startAngle` and `endAngle`,we can turn a pie plot into a fan chart.
By setting startAngle` and endAngle, we can turn a pie plot into a fan chart.
Copy link
Member

@pearmini pearmini Mar 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

startAngle` 后面那个反引号应该也去掉?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

使用 `` 不是挺好嘛


<playground path='pie/basic/demo/quarter-circle.ts' rid='rect3'></playground>

Expand Down
2 changes: 1 addition & 1 deletion docs/manual/plots/pie.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ piePlot.render();

### 扇形图

通过设置饼图的 `startAngle` (开始角度) 和 `endAngle` (结束角度),我们可以将饼图变成扇形图
通过设置饼图的 startAngle (开始角度) 和 endAngle (结束角度),我们可以将饼图变成扇形图

<playground path='pie/basic/demo/quarter-circle.ts' rid='rect3'></playground>

Expand Down
1 change: 1 addition & 0 deletions docs/manual/plugin.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ The main process is divided into the following steps:
| [G2Plot-QRCode](https://github.com/hustcc/G2Plot-QRCode) | [Go](https://git.hust.cc/G2Plot-QRCode) | Draw a QRCode with G2Plot. | [![npm](https://img.shields.io/npm/v/g2plot-qrcode.svg)](https://www.npmjs.com/package/g2plot-qrcode) |
| [G2Plot-Column](https://github.com/yujs/G2Plot-Column) | [Go](https://yujs.github.io/G2Plot-Column/) | Customize Column with G2Plot. | [![npm](https://img.shields.io/npm/v/g2plot-column.svg)](https://www.npmjs.com/package/g2plot-column) |
| [G2Plot-Lollipop](https://github.com/MrSmallLiu/G2Plot-Lollipop) | [Go](https://mrsmallliu.github.io/G2Plot-Lollipop/) | Welcome to G2Plot-Lollipop 👋 | [![npm](https://img.shields.io/npm/v/g2plot-lollipop.svg)](https://www.npmjs.com/package/g2plot-lollipop) |
| [G2Plot-Calendar](https://github.com/visiky/G2Plot-Calendar) | [Go](https://visiky.github.io/g2plot-calendar/) | A component like GitHub-contribution-calendar with G2Plot 📅 | [![npm](https://img.shields.io/npm/v/g2plot-calendar.svg)](https://www.npmjs.com/package/g2plot-calendar) |

## Technology stack packages

Expand Down
1 change: 1 addition & 0 deletions docs/manual/plugin.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ plot.render();
| [G2Plot-QRCode](https://github.com/hustcc/G2Plot-QRCode) | [前往](https://git.hust.cc/G2Plot-QRCode) | Draw a QRCode with G2Plot. | [![npm](https://img.shields.io/npm/v/g2plot-qrcode.svg)](https://www.npmjs.com/package/g2plot-qrcode) |
| [G2Plot-Column](https://github.com/yujs/G2Plot-Column) | [前往](https://yujs.github.io/G2Plot-Column/) | Customize Column with G2Plot. | [![npm](https://img.shields.io/npm/v/g2plot-column.svg)](https://www.npmjs.com/package/g2plot-column) |
| [G2Plot-Lollipop](https://github.com/MrSmallLiu/G2Plot-Lollipop) | [前往](https://mrsmallliu.github.io/G2Plot-Lollipop/) | Welcome to G2Plot-Lollipop 👋 | [![npm](https://img.shields.io/npm/v/g2plot-lollipop.svg)](https://www.npmjs.com/package/g2plot-lollipop) |
| [G2Plot-Calendar](https://github.com/visiky/G2Plot-Calendar) | [前往](https://visiky.github.io/g2plot-calendar/) | A component like GitHub-contribution-calendar with G2Plot 📅 | [![npm](https://img.shields.io/npm/v/g2plot-calendar.svg)](https://www.npmjs.com/package/g2plot-calendar) |

## 技术栈封装

Expand Down
131 changes: 131 additions & 0 deletions examples/plugin/multi-view/demo/combo-plot.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
import { MultiView } from '@antv/g2plot';

const averageData = [
{ date: '2015-02', value: 21168 },
{ date: '2015-08', value: 21781 },
{ date: '2016-01', value: 23818 },
{ date: '2017-02', value: 25316 },
{ date: '2018-01', value: 26698 },
{ date: '2018-08', value: 27890 },
];

const plot = new MultiView('container', {
appendPadding: 8,
tooltip: { shared: true },
syncViewPadding: true,
plots: [
{
type: 'column',
options: {
data: [
{ date: '2015-02', value: 160 },
{ date: '2015-08', value: 245 },
{ date: '2016-01', value: 487 },
{ date: '2017-02', value: 500 },
{ date: '2018-01', value: 503 },
{ date: '2018-08', value: 514 },
],
xField: 'date',
yField: 'value',
yAxis: {
type: 'log',
max: 100000,
},
meta: {
date: {
sync: true,
},
value: {
alias: '店数(间)',
},
},
label: {
position: 'middle',
},
},
},
{
type: 'line',
options: {
data: averageData,
xField: 'date',
yField: 'value',
xAxis: false,
yAxis: {
type: 'log',
max: 100000,
},
label: {
offsetY: -8,
},
meta: {
value: {
alias: '平均租金(元)',
},
},
color: '#FF6B3B',
annotations: averageData.map((d) => {
return {
type: 'dataMarker',
position: d,
point: {
style: {
stroke: '#FF6B3B',
lineWidth: 1.5,
},
},
};
}),
},
},
{
type: 'line',
options: {
data: [
{ date: '2015-02', value: null },
{ date: '2015-08', value: 0.029 },
{ date: '2016-01', value: 0.094 },
{ date: '2017-02', value: 0.148 },
{ date: '2018-01', value: 0.055 },
{ date: '2018-08', value: 0.045 },
],
xField: 'date',
yField: 'value',
xAxis: false,
yAxis: {
line: null,
grid: null,
position: 'right',
max: 0.16,
tickCount: 8,
},
meta: {
date: {
sync: 'date',
},
value: {
alias: '递增',
formatter: (v) => `${(v * 100).toFixed(1)}%`,
},
},
smooth: true,
label: {
callback: (value) => {
return {
offsetY: value === 0.148 ? 36 : value === 0.055 ? 0 : 20,
style: {
fill: '#1AAF8B',
fontWeight: 700,
stroke: '#fff',
lineWidth: 1,
},
};
},
},
color: '#1AAF8B',
},
},
],
});

plot.render();
8 changes: 8 additions & 0 deletions examples/plugin/multi-view/demo/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@
},
"screenshot": "https://gw.alipayobjects.com/mdn/rms_f5c722/afts/img/A*19AdR6-BjRgAAAAAAAAAAABkARQnAQ"
},
{
"filename": "combo-plot.ts",
"title": {
"zh": "组合图表",
"en": "Combo plot"
},
"screenshot": "https://gw.alipayobjects.com/zos/antfincdn/GMzV%24DSDAX/68a9190b-a4eb-4ad4-be3b-4fef31595a3f.png"
},
{
"filename": "nobel-prize.ts",
"title": {
Expand Down