antvis / antvis/G2Plot

🐛 [BUG] 柱图label显示不全

Open
#3,721 1 comment 0 reactions 0 assignees 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
```ts
import { Column } from '@antv/g2plot';

const data = [
{
ID: 3,

x: "吉林",
y: 9.44,
},
{
ID: 3,

x: "北京",
y: 9.9,
},
{
ID: 3,
x: "江苏",
y: 8.16,
},
{
ID: 3,
x: "广东",
y: 7.53,
},
{
ID: 3,
x: "上海",
y: 6.67,
},
];

const columnPlot = new Column('container', {
data,
xAxis: {
line: {
style: {
strokeWidth: 1,
lineWidth: 1,
stroke: "#FFFFFF",
opacity: 1,
},
},
grid: null,
tickLine: null,
title: false,
visible: true,
label: {
style: {
fontSize: 16,
fontWeight: "normal",
fontFamily: "Microsoft YaHei",
},
autoHide: true,
formatter: null,
},
tickInterval: null,
},
yAxis: {
line: {
style: {
strokeWidth: 1,
lineWidth: 1,
stroke: "#FFFFFF",
opacity: 1,
},
},
grid: {
visible: true,
line: {
style: {
strokeWidth: 2,
lineDash: [4, 4],
lineWidth: 0.5,
stroke: "#9a9a9a",
opacity: 0.8,
},
},
},
tickLine: null,
title: false,
visible: true,
label: {
style: {
fontSize: 16,
fontWeight: "normal",
fontFamily: "Microsoft YaHei",
},
autoHide: true,
formatter: null,
},
},
label: {
position: "top",
style: {
fill: "#000",
fontSize: 16,
fontWeight: "normal",
opacity: 1,
},
},
legend: false,

minColumnWidth: 9,
maxColumnWidth: 9,
columnStyle: {
radius: 0,
fill: "rgba(0,255,130,1)",
fillOpacity: 0.6,
stroke: "rgba(0,255,130,1)",
lineWidth: 2,
},
renderer: "canvas",
xField: "x",
yField: "y",
supportCSSTransform: true,
});

columnPlot.render();
```

### 🏞 Expected result
能够正常显示

### 🚑 Any additional [like screenshots]
![image](https://github.com/antvis/G2Plot/assets/29876424/58b697dd-d052-464e-967e-e5631401ea77)

* **G2Plot Version**: latest
* **Platform**: windows

Contributor guide

Open the contributing guide

Research direction

Start with the Column chart reproduction in the issue, focusing on the xAxis label configuration and the label settings used with the provided data. Compare the rendered labels with the expected result and trace the label layout behavior. Done means all category labels display correctly in this example without unintended truncation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.