apache / apache/echarts

[Feature] Configurable priority level for displaying X axis labels

Open
#21,181 0 comments 0 reactions 0 assignees View on GitHub
new-feature
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### What problem does this feature solve?

In some charts, certain labels, e.g the start of the year or month should be prioritized to show over others.

Image

### What does the proposed API look like?

`xAxis.axisLabel.interval` : `(index:number, value: string) => number`

The higher the number, the higher the priority to show over lower priority ones when `hideOverlap: true`.
e.g.

```ts
const options = {
xAxis: {
type: "category",
interval: (index, value) => {
if (firstDayOfYear(value)) {
return 2
}
if (firstDayOfMonth(value)) {
return 1
}
return 0
},
}
...
}
```

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.