apache / apache/echarts

[Feature] Add option for dynamically calculated label position for bar type

Open
#19,779 1 comment 1 reaction 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?

Currently there is no way of showing labels inside or outside of bars depending on their size. This leads to the following:

![image](https://github.com/apache/echarts/assets/32216320/728180f0-ec99-4122-a7fb-5f0c559bed64)

If there was an option to return label properties dynamically it could help make it more visually appealing.

### What does the proposed API look like?

add a function type option for the [position property in label](https://echarts.apache.org/en/option.html#series-bar.label.position)

position: (bar: RectLike, textRect: RectLike, text: string) =>

having the bar rect and the the textRect will allow the user to do any calculations desired in order to decide the final position of the label

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.