Skip to content

Commit

Permalink
docs: change position doc for mark (#5963)
Browse files Browse the repository at this point in the history
* Update mark.zh.md

替换mark绝对定位示例代码

* Update mark.en.md

Replace the absolute positioning example code under Mark in the document
  • Loading branch information
321095741 authored Dec 21, 2023
1 parent c424eab commit 019e984
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
13 changes: 6 additions & 7 deletions site/docs/manual/core/mark.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -417,16 +417,15 @@ In addition to data-driven positioning, G2 also provides non-data-driven positio
.encode('y', 'sold')
.encode('color', 'genre');

// Relative positioning
// Absolute positioning
chart.text().style({
x: '50%', // percentage
y: '50%', // percentage
x: 290, // Pixel coordinates
y: 200, // Pixel coordinates
text: 'hello',
textAlign: 'center',
fontSize: 60,
textBaseline: 'middle',
});

chart.render();

return chart.getContainer();
Expand All @@ -453,10 +452,10 @@ In addition to data-driven positioning, G2 also provides non-data-driven positio
.encode('y', 'sold')
.encode('color', 'genre');

// Absolute positioning
// Relative positioning
chart.text().style({
x: 290, // Pixel coordinates
y: 200, // Pixel coordinates
x: '50%', // percentage
y: '50%', // percentage
text: 'hello',
textAlign: 'center',
fontSize: 60,
Expand Down
14 changes: 7 additions & 7 deletions site/docs/manual/core/mark.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,16 +415,16 @@ Select 标记转换提供了从一组图形中选择图形的能力。比如在
.encode('y', 'sold')
.encode('color', 'genre');

// 相对定位

// 绝对定位
chart.text().style({
x: '50%', // 百分比
y: '50%', // 百分比
x: 290, // 像素坐标
y: 200, // 像素坐标
text: 'hello',
textAlign: 'center',
fontSize: 60,
textBaseline: 'middle',
});

chart.render();

return chart.getContainer();
Expand All @@ -451,10 +451,10 @@ Select 标记转换提供了从一组图形中选择图形的能力。比如在
.encode('y', 'sold')
.encode('color', 'genre');

// 绝对定位
// 相对定位
chart.text().style({
x: 290, // 像素坐标
y: 200, // 像素坐标
x: '50%', // 百分比
y: '50%', // 百分比
text: 'hello',
textAlign: 'center',
fontSize: 60,
Expand Down

0 comments on commit 019e984

Please sign in to comment.