apache / apache/echarts

[Bug] Bar width is too wide and span accross other dates in x-axis when series has limited data points

Open
#20,552 3 comments 0 reactions 0 assignees View on GitHub
bug en pending
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### Version

5.2.2

### Link to Minimal Reproduction

https://tinyurl.com/mr3h2jyk

### Steps to Reproduce

Configuration
1. x-axis is set to "time".
2. x-axis is set with "min" and "max" value.
3. series has very limited available data points within the timeframe between "min" and "max" value.

The following example is to achieve showing 2 series in bars on 12:00 a.m. each day. The described defect is occured when there is only one data point ["2024-11-22", 1000] is available in the series while the x-axis is set to be shown from "2024-11-21" to "2024-11-28".

Possible solutions by manipulating the "barWidth" & "barMaxWidth" has been tried, but the "barWidth" will be too slim when series has sufficient data points (e.g. 4 data points within "2024-11-21" and "2024-11-28").

### Current Behavior

![1732889595124](https://github.com/user-attachments/assets/7ebdd3cf-0f4e-44d2-bca7-4957722517a2)

As shown in the chart, the bars on "2024-11-22" are too wide and span accross other dates in the x-axis. The x-axis is also no longer shown from "2024-11-21" to "2024-11-28" although the "min" and "max" (or "startValue" and "endValue") are set.

### Expected Behavior

![1732890109968](https://github.com/user-attachments/assets/17f07181-1a7b-4902-a698-1654efd437b1)

The expected behaviour is the bars with appropriate width are shown on "2024-11-22" and the x-axis shows the defined period "2024-11-21" to "2024-11-28".

### Environment

```markdown
- OS:
- Browser:
- Framework:
```

### Any additional comments?

_No response_

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.