(Translated by https://www.hiragana.jp/)
自定义图例的 itemMarker 为圆角 · Issue #6075 · antvis/G2 · GitHub
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

てい义图れいてき itemMarker 为圆かく #6075

Closed
YY88Xu opened this issue Jan 30, 2024 · 9 comments · Fixed by #6388
Closed

てい义图れいてき itemMarker 为圆かく #6075

YY88Xu opened this issue Jan 30, 2024 · 9 comments · Fixed by #6388
Assignees

Comments

@YY88Xu
Copy link

YY88Xu commented Jan 30, 2024

问题描述

import { Chart } from '@antv/g2';

const data = [
{ name: 'London', つき份: 'Jan.', つきひとし降雨こううりょう: 18.9 },
{ name: 'London', つき份: 'Feb.', つきひとし降雨こううりょう: 28.8 },
{ name: 'London', つき份: 'Mar.', つきひとし降雨こううりょう: 39.3 },
{ name: 'London', つき份: 'Apr.', つきひとし降雨こううりょう: 81.4 },
{ name: 'London', つき份: 'May', つきひとし降雨こううりょう: 47 },
{ name: 'London', つき份: 'Jun.', つきひとし降雨こううりょう: 20.3 },
{ name: 'London', つき份: 'Jul.', つきひとし降雨こううりょう: 24 },
{ name: 'London', つき份: 'Aug.', つきひとし降雨こううりょう: 35.6 },
{ name: 'Berlin', つき份: 'Jan.', つきひとし降雨こううりょう: 12.4 },
{ name: 'Berlin', つき份: 'Feb.', つきひとし降雨こううりょう: 23.2 },
{ name: 'Berlin', つき份: 'Mar.', つきひとし降雨こううりょう: 34.5 },
{ name: 'Berlin', つき份: 'Apr.', つきひとし降雨こううりょう: 99.7 },
{ name: 'Berlin', つき份: 'May', つきひとし降雨こううりょう: 52.6 },
{ name: 'Berlin', つき份: 'Jun.', つきひとし降雨こううりょう: 35.5 },
{ name: 'Berlin', つき份: 'Jul.', つきひとし降雨こううりょう: 37.4 },
{ name: 'Berlin', つき份: 'Aug.', つきひとし降雨こううりょう: 42.4 },
];

const chart = new Chart({
container: 'container',
autoFit: true,
});

chart
.interval()
.data(data)
.encode('x', 'つき份')
.encode('y', 'がつひとし降雨こううりょう')
.encode('color', 'name')
.transform({ type: 'dodgeX' })
.interaction('elementHighlight', { background: true })
.legend('color', { position: 'top', layout: { justifyContent: 'center' }})
chart.render();
image
そう设置图例てき itemMarker 正方形せいほうけい为圆かくりょう图例全部ぜんぶてい义,以只てい义 itemMarker 为自てい义的 div 吗

じゅう现链せっ

No response

じゅう现步骤

No response

预期ぎょう

No response

平台ひらだい

  • 操作そうさけい统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览: [Google Chrome, Safari, Firefox]

へいまく截图ある视频(选)

No response

补充说明(选)

No response

@Runtus
Copy link
Contributor

Runtus commented Jul 11, 2024

わがらい处理

@pearmini
Copy link
Member

@Runtus ぼう!这个さん一个中级任务。

@Runtus
Copy link
Contributor

Runtus commented Jul 25, 2024

Hiろう@pearmini ,这个issueわがそう确认いちおもえようてい义itemMarker吗,いん为我りょうかんかたぶん档,现在itemMarker以自てい义样しき啥的

@pearmini
Copy link
Member

@Runtus 如果以的话,以在编辑验证いちしかきさきかい复到这个 issue さとめん。如果你觉とくゆう必要ひつよう,也可以添加てんかいち个案れい!😄

@Runtus
Copy link
Contributor

Runtus commented Jul 25, 2024

如果よう设置圆角,以通过itemMarker设置,だい码如

import { Chart } from '@antv/g2';

const data = [
  { name: 'London', つき: 'Jan.', つきひとし降雨こううりょう: 18.9 },
  { name: 'London', つき: 'Feb.', つきひとし降雨こううりょう: 28.8 },
  { name: 'London', つき: 'Mar.', つきひとし降雨こううりょう: 39.3 },
  { name: 'London', つき: 'Apr.', つきひとし降雨こううりょう: 81.4 },
  { name: 'London', つき: 'May', つきひとし降雨こううりょう: 47 },
  { name: 'London', つき: 'Jun.', つきひとし降雨こううりょう: 20.3 },
  { name: 'London', つき: 'Jul.', つきひとし降雨こううりょう: 24 },
  { name: 'London', つき: 'Aug.', つきひとし降雨こううりょう: 35.6 },
  { name: 'Berlin', つき: 'Jan.', つきひとし降雨こううりょう: 12.4 },
  { name: 'Berlin', つき: 'Feb.', つきひとし降雨こううりょう: 23.2 },
  { name: 'Berlin', つき: 'Mar.', つきひとし降雨こううりょう: 34.5 },
  { name: 'Berlin', つき: 'Apr.', つきひとし降雨こううりょう: 99.7 },
  { name: 'Berlin', つき: 'May', つきひとし降雨こううりょう: 52.6 },
  { name: 'Berlin', つき: 'Jun.', つきひとし降雨こううりょう: 35.5 },
  { name: 'Berlin', つき: 'Jul.', つきひとし降雨こううりょう: 37.4 },
  { name: 'Berlin', つき: 'Aug.', つきひとし降雨こううりょう: 42.4 },
];

const chart = new Chart({
  container: 'container',
  autoFit: true,
});

chart
  .interval()
  .data(data)
  .encode('x', 'つき份')
  .encode('y', 'がつひとし降雨こううりょう')
  .encode('color', 'name')
  .transform({ type: 'stackY' })
  .interaction('elementHighlight', { background: true })
  .legend({
    color: {
      itemMarker: 'circle'
    }
  })
  ;

chart.render();

72c87b20fabd98d4c3ff26d2eb94bf50

さら详细使用しよう以查阅文档:https://g2.antv.antgroup.com/spec/component/legend#%E5%9B%BE%E4%BE%8B%E9%A1%B9

@pearmini
Copy link
Member

@Runtus わがかん@YY88Xu 可能かのう需要じゅよう设置矩形くけいてき圆角,而不直接ちょくせつ设置为圆がた过这个 PR ごう并之きさき以通过自てい义 symbol かい决问题:#6381

@wangxingkang
Copy link
Contributor

@pearmini #6388

@Runtus
Copy link
Contributor

Runtus commented Jul 26, 2024

ok, @pearmini ろう哥,わが另一个老哥 @wangxingkang やめ经修复这个问题了,わが就暂时不かんりょう

@pearmini
Copy link
Member

@Runtus 嗯嗯,こう啦 🤣

@pearmini pearmini linked a pull request Jul 26, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants