gpt4 book ai didi

html - highchart center align tspan inside text 标签

转载 作者:太空宇宙 更新时间:2023-11-03 22:29:05 25 4
gpt4 key购买 nike

我想在 highchart 的 text 标签内对齐 tspan 中心。

我创建了一个 jsfiddle:here

代码

Highcharts.chart('container', {
chart: {
type: 'pyramid'
},
title: {
text: 'Sales pyramid',
x: -50
},
plotOptions: {
series: {
dataLabels: {
enabled: true,
format: '<b>{point.name}</b><br/>{point.y:,.0f}',
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black',
softConnector: true
},
center: ['40%', '50%'],
width: '80%'
}
},
legend: {
enabled: false
},
series: [{
name: 'Unique users',
data: [
['Website visits', 15654],
['Downloads', 4064],
['Requested price list', 1987],
['Invoice sent', 976],
['Finalized', 846]
]
}]
});

as you can see

如您所见,“Finalized”和“846”左对齐,有没有办法将“846”与“Finalized”文本居中对齐?

最佳答案

img更新您的 dataLabels

plotOptions: {
series: {
dataLabels: {
useHTML:true,
enabled: true,
format: '<b>{point.name}</b><br/><div align="center">{point.y:,.0f}</div>',
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black',
softConnector: true
},
center: ['40%', '50%'],
width: '80%'
}
},

fiddle演示

关于html - highchart center align tspan inside text 标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49500391/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com