apache / apache/echarts

[Bug] Incorrect display of dates on the time axis

Open
#21,343 5 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

6.0.0

### Link to Minimal Reproduction

https://codepen.io/Mimoza19/pen/ByorrNv

### Steps to Reproduce

Hello.

After upgrading from version 5 to version 6, the customValues: [...ds] property in the xAxis configuration stopped working:

xAxis[i].axisLabel = {
...xAxis[i].axisLabel,
hideOverlap: true,
customValues: [...ds],
formatter: (value) => formatDateAxis(xAxis, value, i),
};

This property was essential for my time-type axis because, without it, the axis labels corresponding to the dates in my dataset are not displayed. For example, my data looks like this:

data = [
{ category: '2024-01-05', value1: 90, value2: 42, value3: 78, value4: 1055 },
{ category: '2024-02-07', value1: null, value2: 0, value3: 45, value4: 1189 },
{ category: '2024-03-09', value1: 64, value2: 34, value3: 58, value4: 1034 },
{ category: '2024-04-12', value1: 0, value2: 40, value3: null, value4: 1268 },
{ category: '2024-05-15', value1: 72, value2: 31, value3: 85, value4: 1076 },
{ category: '2024-06-17', value1: 15, value2: 0, value3: 85, value4: 1055 },
{ category: '2024-07-20', value1: 63, value2: null, value3: 48, value4: 1165 },
{ category: '2024-08-21', value1: 0, value2: 35, value3: 87, value4: 1145 }
]
Currently, only a single number like 1 or 17 appears on the axis, which is incorrect and misleading. How can I ensure that the exact dates from my dataset are displayed on the axis?

And if I keep this property, an error occurs:
Uncaught TypeError: Cannot read properties of undefined (reading 'level')
at leveledFormat (echarts.js?v=e1b83090:15415:24)
at TimeScale2.getFormattedLabel (echarts.js?v=e1b83090:28354:14)

Image

### Current Behavior

-

### Expected Behavior

Is there any way to fix this so that I can still display the exact date values that come from my dataset on the time-type axis?

### 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.