apache / apache/echarts

Label position does not reasonable when both positive and negative value stacked together.

Open
#15,572 0 comments 0 reactions 0 assignees View on GitHub
bug en
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
15h 17m
Merged PRs (30d)
5

Description

### Version
5.1.2

### Steps to reproduce
```js

var option = {
xAxis: {
type: 'category',
data: ['a', 'b', 'c']
},
yAxis: {
inverse: true
},
legend: {
},
series: [{
type: 'bar',
stack: 'all',
data: [
10, 20, 30
],
label: {
show: true,
fontSize: 30
},
name: 'positive'
}, {
type: 'bar',
stack: 'all',
label: {
show: true,
fontSize: 30
},
data: [
-10, 0, -15
],
name: 'negative'
}]
};
```

Screen Shot 2021-08-22 at 2 05 24 AM

Key points of reproduce:
+ `yAxis.inverse: true`
+ The two series are stacked and the one has positive values and the other has negative values.

When value is 0, we count it as "positive stack". But we may make it more wise that determine it by other values in the same series. (If other values are negative, then 0 should belongs to "negative stack").

Test case:

Contributor guide

Open the contributing guide

Research direction

Start with test/bar-stack.html and reproduce the stacked bar case using an inverse yAxis, positive values, negative values, and a zero value. Check how the test currently renders labels for the zero value; done means the label position is reasonable when the zero belongs with the negative stack, without regressing positive-stack labels.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.