apache / apache/echarts

[Feature] Want to access tickInterval in the y-axis formatter

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

Description

### What problem does this feature solve?

When formatting the values on the y-axis, I want to be able to take into account the y-axis minimum and y-axis maximum.

Why? When I am showing values on the y-axis, I want to know the precision needed to distinguish between each value, and format each value with exactly that much precision. For example, if the y-axis values are [1, 0.98, 0.96, 0.94, 0.92, 0.9], then I want to format as [1.00, 0.98, 0.96, 0.94, 0.92, 0.90].

### What does the proposed API look like?

```
formatter: (value, index, range) => {
// Use range.mix and range.max to decide how to format value
}
```
____
# Edit

I'd actually benefit more from knowing the tick interval (i.e. the difference between consecutive tick lines). I'd prefer:

```
formatter: (value, index, tickInterval) => {
// Use tickInterval to decide how to format value
}
```

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.