angular - Angular:如何自定义 Canvas 条形图标签?
问题描述
我在底部尝试了短名称,在标签中尝试了全名
这是画布 .html 视图
<canvas baseChart
[datasets]="chartDataSet"
[labels]="shortName"
[chartType]="chartType"
[options]="options"
[colors]="chartColors"
>
</canvas>
价值观
chartType = 'bar';
chartColors = [
{backgroundColor: "#4CAF50"},{backgroundColor: "#A9D18E"},{backgroundColor: "#F48E95"},
{backgroundColor: "#FCC400"}, {backgroundColor: "#FF5252"},{ backgroundColor: "#FFEB3B"}
];
shortName = ['HOD', 'CEO'];
fullName = ['Head of Department', 'Chief Executive Officer'];
chartDataSet = [
{data: [1, 4], label: 'Closed', stack: 'a'}
{data: [5, 7], label: 'Not Due', stack: 'a'}
{data: [6, 8], label: 'Target Date Revised', stack: 'a'}
{data: [9, 4], label: 'Due', stack: 'a'}
{data: [2, 5], label: 'Overdue', stack: 'a'}
{data: [1, 7], label: 'Under IA Review', stack: 'a'}
];
options = {
responsive: true,
scales: {xAxes: [{}], yAxes: [{}]},
plugins: {
datalabels: {
anchor: 'end',
align: 'end',
}
}
我们如何在 x 路径中使用短名称并在工具提示中使用全名?
解决方案
推荐阅读
- asp.net - DevExpress Legacy ASPxGridView:如何让列标题复选框全部选中或全部清除;也有个别行 CheckBoxes 影响标题 CheckBox?
- iis - 如何修复在 vps windows server 2019 上没有 www 时无法加载的网站
- python - 如何查询一对多相关对象的字段?
- android - 冲突的版本
- python-3.x - Python:找到一列的最大值并在同一行中提取其他列的值
- c++ - c++ std::vector 在 foreach 循环中修改行为
- google-cloud-platform - 谷歌云和密钥管理
- reactjs - 使用 Reactjs 从客户端上的文件数组中渲染图像
- mysql - Mysql按多个表计数分组
- linux - 在 C 程序中调用 pppd 会阻塞线程