Duplicate labels on a time(year format) xAxis
- Dominant language
- TypeScript
- Stars
- 67.3k
- Forks
- 19.8k
- Avg merge
- 11d 14h
- Merged PRs (30d)
- 8
Description
## General Questions
## Issue Type
- [ ] I have a question to ask about *how to use ECharts to ...*;我想提问如何使用 ECharts 实现某功能
- [x] I have a bug to report;我想要报 bug
- [ ] I have a feature to request, e.g.: *I'd like a new feature that ...*;我需要一个新功能
- [ ] I have a feature to enhance, e.g.: *The current feature should be improved in the way that ...*;我希望改进某个功能
- [ ] There's something wrong with the documents;文档有些问题
- [ ] Others, or I'm not sure which issue types to choose here;其他,或我不知道应该选什么类型
## Issue Details
I want to use a year format on a timeAxis, but formatting the axisLabel ends up with duplicate labels.
### Expected Behavior

There shouldn't be any duplicate labels if it's a time axis.
### Current Behavior

The points seem to be plotted and formatted afterwards. This means that points in the same year, are all formatted to the same label.
### Online Example
Fiddle link: https://jsfiddle.net/5jyu4t6w/5/
```
option = {
"xAxis" : [
{
"type" : "time",
"axisLabel" : {
formatter : function(x) {
return echarts.format.formatTime('yyyy', x);
}
},
"splitLine" : {
"show" : false
},
"max" : "dataMax",
"scale" : true,
"offset" : 0
}
],
"yAxis" : [
{
"type" : "value",
"axisLabel" : {
formatter : function(x) {
return (x*100) + "%";
}
},
"splitLine" : {
"lineStyle" : {
"type" : "dashed"
}
},
"offset" : 0
}
],
"series" : [
{
"name" : "Example line",
"type" : "line",
"data" : [
[
1577829599999,
0.01
],
[
1609451999999,
0.02
],
[
1640987999999,
0.3
]
]
},
]
}
```
## Topics
## Anything Else We Need to Know
Setting the axis type to 'category' is something we considered but it's not correct
## Environment
- ECharts version;ECharts 版本: Latest version (4.2)
- [ ] It happens only on certain browsers or operating systems. 对于特定浏览器或操作系统才会出现的问题,请提供相应环境信息:{BROWSER_VERSION_OR_OS_INFORMATION_HERE}
Contributor guide
Assessment
This issue has not been assessed yet.