antvis / antvis/G2Plot

🐛 [BUG] gauge.axis 显示异常

Open
#3,120 3 comments 0 reactions 1 assignee Claimed by @connono View on GitHub
Bug
Dominant language
TypeScript
Stars
2.7k
Forks
591
PR merge metrics
No merged PRs in 30d

Description

### 🐛 Bug description [Please make everyone to understand it]

> Please provide a link by forking these links [G2Plot](https://codesandbox.io/s/g2plot-issue-template-gzfdq?file=/index.ts) or GitHub repo, a minimal reproduction.

* _Required_ **Link to minimal reproduction**:

### 📷 Step to reproduce
```js
import { Gauge } from '@antv/g2plot';

const gauge = new Gauge('container', {
percent: 0.75,
range: {
color: '#30BF78',
},
indicator: {
pointer: {
style: {
stroke: '#D0D0D0',
},
},
pin: {
style: {
stroke: '#D0D0D0',
},
},
},
axis: {
label: {
formatter(v) {
return Number(v) * 100;
},
},
subTickLine: {
count: 3,
},
},
statistic: {
content: {
formatter: ({ percent }) => `Rate: ${(percent * 100).toFixed(0)}%`,
style: {
color: 'rgba(0,0,0,0.65)',
fontSize: 48,
},
},
},
});

gauge.render();

setTimeout(()=>{
gauge.update({axis:false})
},1000)
setTimeout(()=>{
gauge.update({axis:{}})
},5000)
```
### 🏞 Expected result

轴线切换显示隐藏能更正常

### 🚑 Any additional [like screenshots]
![image](https://user-images.githubusercontent.com/29876424/154013968-3ed19d6f-6365-4929-b031-ea299a67aa39.png)
![image](https://user-images.githubusercontent.com/29876424/154013987-96a03237-83e3-4b3d-93ce-11f65e1d9020.png)

* **G2Plot Version**: latest
* **Platform**: win

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.