Data Labels of bar charts centered #29527
Unanswered
samuelhuerga
asked this question in
Q&A / Help
Replies: 1 comment 1 reply
-
Hey @samuelhuerga! I'm here to assist you with any bugs, questions, or contributions. Let's tackle this together! To center the data labels in the middle of the bars in an Apache ECharts stacked bar chart, you need to set the const barSeries: BarSeriesOption[] = [
{
...seriesProps,
name: ASSIST_MARK,
data: assistData,
},
{
...seriesProps,
name: LEGEND.INCREASE,
label: {
show: showValue,
position: 'inside', // Change position to 'inside'
formatter: seriesformatter,
},
itemStyle: {
color: rgbToHex(increaseColor.r, increaseColor.g, increaseColor.b),
},
data: increaseData,
},
{
...seriesProps,
name: LEGEND.DECREASE,
label: {
show: showValue,
position: 'inside', // Change position to 'inside'
formatter: seriesformatter,
},
itemStyle: {
color: rgbToHex(decreaseColor.r, decreaseColor.g, decreaseColor.b),
},
data: decreaseData,
},
{
...seriesProps,
name: LEGEND.TOTAL,
label: {
show: showValue,
position: 'inside', // Change position to 'inside'
formatter: seriesformatter,
},
itemStyle: {
color: rgbToHex(totalColor.r, totalColor.g, totalColor.b),
},
data: totalData,
},
]; This will center the data labels inside the bars instead of having them on top [1]. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there any option that can make the labels of bar charts centered in the middle of the bar, instead of on top of it?
https://echarts.apache.org/examples/en/editor.html?c=bar-stack-normalization
In Superset it always show like this:
Beta Was this translation helpful? Give feedback.
All reactions