Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

迷你面积图会超出设置的大小 #6064

Closed
YY88Xu opened this issue Jan 26, 2024 · 1 comment
Closed

迷你面积图会超出设置的大小 #6064

YY88Xu opened this issue Jan 26, 2024 · 1 comment

Comments

@YY88Xu
Copy link

YY88Xu commented Jan 26, 2024

问题描述

image 如图,面积图的小尖尖被盖住了

重现链接

No response

重现步骤

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

const data = [
264, 417, 438, 887, 309, 397, 550, 575, 563, 430, 525, 592, 492, 467, 513,
546, 983, 340, 539, 243, 226, 192,
];

const chart = new Chart({
container: 'container',
width: 207,
height: 40,
});

chart.data(data);

chart
.area()
.encode('x', (_, idx) => idx)
.encode('y', (d) => d)
.encode('shape', 'smooth')
.scale('y', { zero: true })
.style('fill', 'linear-gradient(-90deg, white 0%, darkgreen 100%)')
.style('fillOpacity', 0.6)
.animate('enter', { type: 'fadeIn' })
.axis(false);

chart
.line()
.encode('x', (_, idx) => idx)
.encode('y', (d) => d)
.encode('shape', 'smooth')
.style('strokeWidth', 3)

chart.interaction('tooltip', {
render: (e, { title, items }) => items[0].value,
})

chart.attr('padding', 0).attr('margin', 0).attr('paddingTop', '20')

chart.render();

预期行为

No response

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox]

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

@hustcc
Copy link
Member

hustcc commented Jan 26, 2024

直接 new Chart 的时候设置:

const chart = new Chart({
  container: 'container',
  width: 207,
  height: 40,
  padding: 4, // 👈🏻这里
  margin: 0,
});

@hustcc hustcc closed this as completed Jan 26, 2024
@antvis antvis locked and limited conversation to collaborators Jan 26, 2024
@hustcc hustcc converted this issue into discussion #6066 Jan 26, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants