gpt4 book ai didi

javascript - 如何在图表js donut chart 表中添加华氏符号

转载 作者:行者123 更新时间:2023-12-04 10:43:14 26 4
gpt4 key购买 nike

我想将 FAHRENHEIT 符号添加到图表 js 圆环图,目前,我的半圆环图如下所示:

enter image description here

我想在“50”之后添加 FAHRENHEIT 符号,我该怎么做?

这是我的代码:

var chartColors = {
hf_data : '#fba66c',
themecolor: '#62c799'
};

var hf_data = 12;
var myChart = new Chart('hf_data ', {
type: 'doughnut',
data: {
labels: ['hf_data '],
datasets: [{
label: 'Temperature',
data: [hf_data , hf_data +25],
backgroundColor: [chartColors.hf_data , chartColors.themecolor],
borderColor: [chartColors.hf_data , chartColors.themecolor],
borderWidth: 1
}]
},
options: {
responsive:true,
circumference: Math.PI,
rotation:Math.PI,
cutoutPercentage:60,
title: {
display: true,
text: '50' ,
position: 'bottom',
verticalAlign: 'middle',
align: 'center',
y: 20,
},
legend: {
position: 'top'
},
tooltips: {
enabled: false
},
animation: {
animateScale: true,
animateRotate: true
},
}
});

最佳答案

你有没有尝试直接添加到符号°F

 text: '50°F' 

如果不起作用,请使用 Unicode 十六进制数

关于javascript - 如何在图表js donut chart 表中添加华氏符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59834481/

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