我尝试创建水平条,但是我不怎么在标签“是”,“否”和“也许”之间添加空格并添加条的圆度。请帮我。 我的代码:
ctx5 = document.getElementById('groupBarChart')。getContext('2d'); var groupBarChart = new Chart(ctx5,{ 类型:“ horizontalBar”, 数据: { 标签:[['是','否','也许'],['是','否','也许'],['是','否','也许']]], 数据集:[ { 数据:[80,50,90], bar厚度:17 backgroundColor:'#d20000', }, { 数据:[20,20,20], bar厚度:17 backgroundColor:'#d20000', }, { 数据:[60,60,60], bar厚度:17 backgroundColor:'#d20000', }, ], }, 插件:[ChartDataLabels], 选项:{ maintenanceAspectRatio:否, 秤:{ y轴:[{ 滴答声:{ 填充:10, fontColor:'#707683', }, 网格线: { 显示:false,
}
}],
xAxes: [{
ticks: {
min: 0,
max: 100,
padding: 10,
fontColor: '#707683',
fontFamily: "'Roboto', sans-serif"
},
gridLines: {
color: '#D3D8DD',
borderDash: [10, 10],
drawTicks: false,
},
}],
},
legend: {
display: false,
},
tooltips: {
enabled: false
},
plugins: {
datalabels: {
font: {
family: "'Roboto', sans-serif",
},
color: '#6A707E',
align: 'right',
anchor: 'end',
padding: {
bottom: -10
},
formatter: function (value, context) {
return Math.round(value) + '%';
}
}
},
},
});