angular - ChartJs - 饼图 - 如何删除饼图上的标签
问题描述
我chart.js
在我的应用程序中使用饼图进行可视化。我正在使用一个插件chartjs-plugin-piechart-outlabels
来将标签显示为饼图中的外段。
一切正常,除了标签存在于饼图上,这是我不想要的,因为我将标签显示为外段。
我查看了文档并找不到解决方案,还查看了一些示例。
public static readonly pieChartOptions: ChartOptions = {
responsive: true,
maintainAspectRatio: false,
legend: {
display: false
},
tooltips: {
enabled: true
},
layout: {
padding: {
left: 0,
right: 0,
top: 70,
bottom: 0
}
},
plugins: {
outlabels: {
display: true,
borderWidth: 2,
lineWidth: 2,
padding: 3,
textAlign: 'center',
stretch: 15,
font: {
resizable: true,
minSize: 12,
maxSize: 18
},
valuePrecision: 1,
percentPrecision: 2
}
}
};
解决方案
您需要关闭示例标签,如下所示:
options: {
plugins: {
datalabels: {
display: false
}
outlabels: {
display: true
}
}
}
推荐阅读
- antlr - 在 Xtext/ANTLR 中终止多行文本块
- flutter - 如何使用颤振将图标放在小吃店内
- nuget - Visual Studio 2019 恢复完成的 nuget 循环
- php - Laravel Eloquent:一对多访问器
- python - 从一个列表创建多个组合框并接收每个组合框的结果?
- swift - 我试图让我的 SCNNode 旋转,但我似乎无法让它工作
- javascript - Discord.js v12 的角色特定命令
- c# - 使用 MSAL 从 Xamarin.ios 授权时出现 SecurityTokenInvalidSignatureException
- google-apps-script - 如果单元格值包含某些文本,如何发送电子邮件?
- expression - 如何获取tmap中列的值的总和?