Skip to content

Commit

Permalink
add label demos
Browse files Browse the repository at this point in the history
  • Loading branch information
paleface001 committed Nov 15, 2019
1 parent 2773f4f commit fbe84a4
Show file tree
Hide file tree
Showing 16 changed files with 178 additions and 6 deletions.
13 changes: 13 additions & 0 deletions examples/general/label/API.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: API
---

API.

- Modern browsers and Internet Explorer 9+ (with [polyfills](https:// ant.design/docs/react/getting-started#Compatibility))
- Server-side Rendering
- [Electron](http:// electron.atom.io/)

| [src as img="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http:// godban.github.io/browsers-support-badges/)</br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Safari | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/opera/opera_48x48.png" alt="Opera" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Opera | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/electron/electron_48x48.png" alt="Electron" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Electron |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| IE9, IE10, IE11, Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
13 changes: 13 additions & 0 deletions examples/general/label/API.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: API
---

API 信息。

- Modern browsers and Internet Explorer 9+ (with [polyfills](https:// ant.design/docs/react/getting-started#Compatibility))
- Server-side Rendering
- [Electron](http:// electron.atom.io/)

| [src as img="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http:// godban.github.io/browsers-support-badges/)</br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Safari | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/opera/opera_48x48.png" alt="Opera" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Opera | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/electron/electron_48x48.png" alt="Electron" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Electron |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| IE9, IE10, IE11, Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
34 changes: 34 additions & 0 deletions examples/general/label/demo/label-formatter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Line } from '@antv/g2plot';

fetch('https://gw.alipayobjects.com/os/antvdemo/assets/data/salesTrend.json')
.then((res) => res.json())
.then((data) => {
const linePlot = new Line(document.getElementById('container'), {
title: {
visible: true,
text: '图形标签文本格式化',
},
forceFit: true,
data,
padding: 'auto',
xField: 'date',
yField: 'buyin',
xAxis: {
visible: true,
type: 'dateTime',
tickCount: 5,
},
yAxis: {
visible: true,
},
label: {
visible: true,
formatter: (val) => {
return val + '万';
},
},
responsive: true,
});

linePlot.render();
});
35 changes: 35 additions & 0 deletions examples/general/label/demo/label-offset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Line } from '@antv/g2plot';

fetch('https://gw.alipayobjects.com/os/antvdemo/assets/data/salesTrend.json')
.then((res) => res.json())
.then((data) => {
const linePlot = new Line(document.getElementById('container'), {
title: {
visible: true,
text: '图形标签文本偏移量',
},
forceFit: true,
data,
padding: 'auto',
xField: 'date',
yField: 'buyin',
xAxis: {
visible: true,
type: 'dateTime',
tickCount: 5,
},
yAxis: {
visible: true,
},
label: {
visible: true,
offset: 20,
style: {
fill: '#0b53b0',
},
},
responsive: true,
});

linePlot.render();
});
34 changes: 34 additions & 0 deletions examples/general/label/demo/label-style.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Line } from '@antv/g2plot';

fetch('https://gw.alipayobjects.com/os/antvdemo/assets/data/salesTrend.json')
.then((res) => res.json())
.then((data) => {
const linePlot = new Line(document.getElementById('container'), {
title: {
visible: true,
text: '图形标签文本样式',
},
forceFit: true,
data,
padding: 'auto',
xField: 'date',
yField: 'buyin',
xAxis: {
visible: true,
type: 'dateTime',
tickCount: 5,
},
yAxis: {
visible: true,
},
label: {
visible: true,
style: {
fill: '#0b53b0',
},
},
responsive: true,
});

linePlot.render();
});
23 changes: 23 additions & 0 deletions examples/general/label/demo/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"title": {
"zh": "中文分类",
"en": "Category"
},
"demos": [
{
"filename": "label-formatter.js",
"title": "图形标签文本格式化",
"screenshot": "https://gw.alipayobjects.com/mdn/rms_d314dd/afts/img/A*R6NWS4aNqPMAAAAAAAAAAABkARQnAQ"
},
{
"filename": "label-style.js",
"title": "图形标签文本样式",
"screenshot": "https://gw.alipayobjects.com/mdn/rms_d314dd/afts/img/A*R6NWS4aNqPMAAAAAAAAAAABkARQnAQ"
},
{
"filename": "label-offset.js",
"title": "图形标签文本偏移量",
"screenshot": "https://gw.alipayobjects.com/mdn/rms_d314dd/afts/img/A*R6NWS4aNqPMAAAAAAAAAAABkARQnAQ"
}
]
}
5 changes: 5 additions & 0 deletions examples/general/label/design.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: 设计规范
---

设计规范
5 changes: 5 additions & 0 deletions examples/general/label/design.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: 设计规范
---

设计规范
6 changes: 6 additions & 0 deletions examples/general/label/index.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Lable
order: 3
---

Description about this component.
4 changes: 4 additions & 0 deletions examples/general/label/index.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: 图形标签
order: 3
---
2 changes: 1 addition & 1 deletion examples/general/padding/index.en.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Set Padding
order: 3
order: 4
---

Description about this component.
2 changes: 1 addition & 1 deletion examples/general/padding/index.zh.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
title: 设置图表出血
order: 3
order: 4
---
2 changes: 1 addition & 1 deletion examples/general/state/demo/set-active1.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ columnPlot.render();
columnPlot.setActive(
{ name: 'year', exp: '1994' },
{
fillStyle: '#C11008',
fillStyle: '#5AD8A6',
fillOpacity: 0.8,
}
);
2 changes: 1 addition & 1 deletion examples/general/state/demo/set-active2.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ columnPlot.setActive(
},
},
{
fillStyle: '#C11008',
fillStyle: '#5AD8A6',
fillOpacity: 0.8,
}
);
2 changes: 1 addition & 1 deletion examples/general/state/index.en.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Set State
order: 4
order: 5
---

Description about this component.
2 changes: 1 addition & 1 deletion examples/general/state/index.zh.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
title: 设置图表状态量
order: 4
order: 5
---

0 comments on commit fbe84a4

Please sign in to comment.