From 019e9843fc2854af45754c8da4530114b5c0aecf Mon Sep 17 00:00:00 2001 From: 321095741 <76716829+321095741@users.noreply.github.com> Date: Thu, 21 Dec 2023 11:01:32 +0800 Subject: [PATCH] docs: change position doc for mark (#5963) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update mark.zh.md 替换mark绝对定位示例代码 * Update mark.en.md Replace the absolute positioning example code under Mark in the document --- site/docs/manual/core/mark.en.md | 13 ++++++------- site/docs/manual/core/mark.zh.md | 14 +++++++------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/site/docs/manual/core/mark.en.md b/site/docs/manual/core/mark.en.md index d77b3b7d19..5816a3123d 100644 --- a/site/docs/manual/core/mark.en.md +++ b/site/docs/manual/core/mark.en.md @@ -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(); @@ -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, diff --git a/site/docs/manual/core/mark.zh.md b/site/docs/manual/core/mark.zh.md index 7a96d7049e..a7a77f0f1c 100644 --- a/site/docs/manual/core/mark.zh.md +++ b/site/docs/manual/core/mark.zh.md @@ -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(); @@ -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,