chartjs / chartjs/chartjs-plugin-datalabels

Get label positions

Open
#144 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
920
Forks
507
PR merge metrics
No merged PRs in 30d

Description

First I want to thanks for this plugin cause it helped me a lot for a project.

## The problem : HTML labels

I read some issues where people want HTML tooltip and I have the same problem but I think it's out of the scope of this plugin. A callback or a way to get label positions could help solving this issue.

## First Idea

Expose the "labels" offset position, something more accessible than :

```
chart.$datalabels._labels[1]._el.getCenterPoint()
```

## Second Idea

Maybe a third parameter to the formatter that would give the anchor position (x, y) so it could be used as a starting point to build custom HTML label (with absolute positioning it could work)

```
datalabels: {
anchor: 'end',
align: 'top',
offset: 2,
backgroundColor: '#FFF',
borderRadius: 4,
formatter: function (data, chart, anchorposition) {

}
}
```

But it won't solve the resize problem :(

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.