[Bug] Bar chart yaxis min/max not working with too few series data items
- Dominant language
- TypeScript
- Stars
- 67.3k
- Forks
- 19.8k
- Avg merge
- 11d 14h
- Merged PRs (30d)
- 8
Description
### Version
5.3.0
### Link to Minimal Reproduction
https://jsfiddle.net/3dag9oen/
### Steps to Reproduce
Using https://echarts.apache.org/examples/en/editor.html?c=bar-simple :
--- bad case ---
```js
option = {
xAxis: {
type: 'time',
min: '2022-01-01',
max: '2022-12-31'
},
yAxis: { type: 'value', },
series: [ {
type:'bar',
data: [
['2022-01-15',100.00],
['2022-02-15',100.00],
] } ]
};
```
--- good case ---
```js
option = {
xAxis: {
type: 'time',
min: '2022-01-01',
max: '2022-12-31'
},
yAxis: { type: 'value', },
series: [ {
type:'bar',
data: [
["2022-01-15","100.00"],
["2022-02-15","100.00"],
["2022-12-15","100.00"],
] } ]
};
```
### Current Behavior
With just one or two items in series.data, the date range on the x-axis is incorrect, the axis should go from 2022-01-01 to 2022-12-31 (but is shown 2021-01-01 to 2024-12-31).
From three items in series.data, the axis range shown is correct.
### Expected Behavior
x-axis should be plotted according to the min/max definition
### Environment
```markdown
- OS: Windows
- Browser: Opera
- Framework: plain PHP, jquery and echarts 5.3.0
```
### Any additional comments?
_No response_
Contributor guide
Research direction
Start with the linked JSFiddle and the ECharts bar-simple example, reproducing the time-axis behavior with one, two, and three data items. Trace how the bar chart handles x-axis min/max values for sparse series data. Done means the axis remains 2022-01-01 through 2022-12-31 in the one- and two-item cases as well as the three-item case.
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
- 42/100