Conformance: feature update ratio Percentage calculation formula.

This commit is contained in:
chiayin
2023-08-15 10:55:35 +08:00
parent 0f10ac6626
commit 59bbe77fa0

View File

@@ -304,16 +304,26 @@ export default {
let rate = ((data.counts.conforming / sum) * 100).toFixed(1);
let isNullTime = value => value === null ? null : getNumberLabel((value / 86400).toFixed(1));
let isNullCase = value => value === null ? null : getNumberLabel(value.toFixed(1));
let setListData = value => value.map(item => {
let setLoopData = value => value.map(item => {
return {
no: item.no,
label: item.description,
value: `width:${this.getPercentLabel(item.count / sum)}%;`,
value: `width:${this.getPercentLabel(item.count / data.counts.conforming)}%;`,
count: item.count,
ratio: this.getPercentLabel(item.count / sum),
ratio: this.getPercentLabel(item.count / data.counts.conforming),
}
});
let isNullLists = value => value === null ? null : setListData(value);
let setIssueData = value => value.map(item => {
return {
no: item.no,
label: item.description,
value: `width:${this.getPercentLabel(item.count / data.counts.not_conforming)}%;`,
count: item.count,
ratio: this.getPercentLabel(item.count / data.counts.not_conforming),
}
});
let isNullLoops = value => value === null ? null : setLoopData(value);
let isNullIsssue = value => value === null ? null : setIssueData(value);
let result = {
counts: {
@@ -352,8 +362,8 @@ export default {
difference: isNullCase(data.effect.tasks.conforming - data.effect.tasks.not_conforming),
},
},
loops: isNullLists(data.loops),
issues: isNullLists(data.issues),
loops: isNullLoops(data.loops),
issues: isNullIsssue(data.issues),
};
this.setRateChartData(result.charts.rate.data); // 建立圖表 Rate Chart.js
this.setCasesChartData(result.charts.cases.data.conforming, result.charts.cases.data.not_conforming, data.charts.cases.x_axis.max, data.charts.cases.x_axis.min); // 建立圖表 Cases Chart.js