我是SQL Server的新手,所以不知道我在做什么.我有两个表,可能看起来像这样:
表格1
| ID | customer | Date |
| 1 | company1 | 01/08/2014 |
| 2 | company2 | 10/08/2014 |
| 3 | company3 | 25/08/2014 |
Run Code Online (Sandbox Code Playgroud)
表2
| ID | Status | Days |
| 1 | New | 6 |
| 1 | In Work | 25 |
| 2 | New | 17 |
| 3 | New | 14 |
| 3 | In Work | 72 |
| 3 | Complete …Run Code Online (Sandbox Code Playgroud) 我使用带有扩展程序的 ChartJS 图表js-gauge,它基本上是一个定制的甜甜圈,用于创建仪表样式图表。我添加了Chartjs-plugin-datalabels 插件,以便我可以自定义标签。
饼图和圆环图中的标签通常用于显示该段的值,但由于它已被自定义为显示为仪表,我想将数据标签放置在每个段的末尾,以便它显示该点的值,例如所以:
虽然可以使用锚定、对齐和偏移来移动标签,但它们允许围绕一个点进行有限的移动,我无法找到一种方法来实现我所需要的。我可以锚定到“结束”以将标签置于仪表之外,然后我想也许我可以结合对齐和偏移将标签推到段的末尾,但不幸的是这些命令似乎基于整体的轴仪表而不是弧形部分。
这是我用来设置选项和数据的代码。这是在 Salesforce Aura 组件内,因此 ChartJsGaugeInstance 从控制器获取值:
let chartJsGaugeInstance = component.get("v.dataInstance");
let type = chartJsGaugeInstance.type;
let target = chartJsGaugeInstance.targetValue;
let firstDivide = target * 0.33;
let secondDivide = target * 0.66;
let data = {
datasets : [{
backgroundColor: ["#0fdc63", "#fd9704", "#ff7143"],
data: [firstDivide, secondDivide, target],
value: chartJsGaugeInstance.dataValues,
datalabels: {
anchor: 'center',
align: 'center',
offset: 0
}
}]
};
let options = {
responsive: true,
title: {
display: true,
text: chartJsGaugeInstance.title …Run Code Online (Sandbox Code Playgroud)