New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add centerPointLabels option for linear radial scale #9949
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation for the new properties and typings are also still missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the points @LeeLenaleee pointed need to be changed before we can approve this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation and test looks good to me.
There are couple of things to do still:
- add to documentation [1]
- add to types [2]
- add a sample (optional, but would be good)
Chart.js/docs/axes/radial/linear.md
Lines 119 to 128 in 5bea389
| Name | Type | Scriptable | Default | Description | |
| ---- | ---- | ------- | ------- | ----------- | |
| `backdropColor` | [`Color`](../../general/colors.md) | `true` | `undefined` | Background color of the point label. | |
| `backdropPadding` | [`Padding`](../../general/padding.md) | | `2` | Padding of label backdrop. | |
| `display` | `boolean` | | `true` | if true, point labels are shown. | |
| `callback` | `function` | | | Callback function to transform data labels to point labels. The default implementation simply returns the current string. | |
| `color` | [`Color`](../../general/colors.md) | Yes | `Chart.defaults.color` | Color of label. | |
| `font` | `Font` | Yes | `Chart.defaults.font` | See [Fonts](../../general/fonts.md) | |
| `padding` | `number` | Yes | 5 | Padding between chart and point labels. | |
Line 3315 in 5bea389
pointLabels: { |
@kurkle |
Easyest way to add a sample for this is to copy paste this file and name it something like: After that you enable the point labels in the options (config block). Then you can add that sample in the navbar by adding it beneath the link for the default polar area sample here. That should make it work. You can then test it by running If it doesn't work I will make the sample after this pr gets merged so no big deal |
@LeeLenaleee if you have the time to create a sample for this, it would be great! |
Thanks @t-mangoe |
I added code to automatically center the point labels when using a polar graph.
This solves the issue of #9662