Start AND End Anchor for a Floating Bar Chart. #239
-
Unless I am reading the docs wrong, there are only three options for anchoring the data labels: center, start, and end. I am making a few floating bar charts where I would like the start and end points labeled, but I can't figure out how to position the labels individually; they are always stacked on top of each other. I am basically just looking for a combination of the start and end anchors, one for each respective point. Did I miss something, or does this feature not currently exist? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
@Aliervo do you need something like the following? |
Beta Was this translation helpful? Give feedback.
-
I don't know about @Aliervo , but this is exactly what I need! :) |
Beta Was this translation helpful? Give feedback.
-
@Aliervo @jasonlfunk you have to define multiple labels as explained in the docs: plugins: {
datalabels: {
labels: {
start: {
anchor: 'start',
formatter: (v) => v[0]
},
end: {
anchor: 'end',
formatter: (v) => v[1]
}
}
}
} See this jsfiddle example. |
Beta Was this translation helpful? Give feedback.
-
@simonbrunel Hi, by any chance you can help on this? I managed to display the label with the code you gave but i want to display number as comma separated. how do I add another formatter? |
Beta Was this translation helpful? Give feedback.
@Aliervo @jasonlfunk you have to define multiple labels as explained in the docs:
See this jsfiddle example.