sonar medium

This commit is contained in:
Cindy Chang
2024-08-01 11:35:18 +08:00
parent 311c98f57f
commit 719501dc4b
4 changed files with 32 additions and 16 deletions

View File

@@ -2,8 +2,6 @@
<div class="bg-neutral-10 border border-neutral-300 rounded-xl px-4 w-full h-full">
<div class="flex justify-between items-center my-2 flex-wrap">
<p class="h2">{{ tableTitle }}&nbsp({{ tableData.length }})</p>
<!-- Search -->
<!-- <Search></Search> -->
</div>
<!-- Table -->
<div class="overflow-y-auto overflow-x-auto scrollbar -mx-2 h-[calc(100%_-_64px)]">

View File

@@ -2,8 +2,6 @@
<div class="bg-neutral-10 border border-neutral-300 rounded-xl px-4 h-full">
<div class="flex justify-between items-center my-2">
<p class="h2">{{ tableTitle }}&nbsp({{ data.length }})</p>
<!-- Search -->
<!-- <Search></Search> -->
</div>
<!-- Table -->
<div class="overflow-y-auto overflow-x-auto scrollbar -mx-2 h-[calc(100%_-_64px)]">

View File

@@ -185,9 +185,12 @@ export default {
attRangeTotal: function() {
const type = this.selectedAttName.type;
return !this.classTypes.includes(type) ? null
: this.attRangeData ? `(${this.attRangeData.length})`
: null;
let result = null; // Initialize the result variable with null
if (this.classTypes.includes(type) && this.attRangeData) {
result = `(${this.attRangeData.length})`; // Assign the length of attRangeData if it exists
}
return result;
},
attRangeData: function() {
let data = [];
@@ -206,7 +209,12 @@ export default {
occ_ratio: this.getPercentLabel(ratio),
freq: item.freq
};
result.label = type !== 'boolean' ? null : item.value ? 'Yes' : 'No';
result.label = null;
if (type === 'boolean') {
result.label = item.value ? 'Yes' : 'No';
} else {
result.label = null;
}
return result;
})
return data.sort((x, y) => y.freq - x.freq);
@@ -400,7 +408,7 @@ export default {
break;
}
// 傳給後端
this.attValueTypeStartEnd;
// this.attValueTypeStartEnd; 是否有要呼叫函數? sonar-qube
// 建立圖表
this.createChart();
}
@@ -476,9 +484,15 @@ export default {
break;
case 'float':
setLabels = data.map((item, index) => {
let x = index === 0 ? Math.floor(item.x * 100) / 100 :
index === data.length - 1 ? item.x = Math.ceil(item.x * 100) / 100 :
Math.round(item.x * 100) / 100;
let x;
if (index === 0) {
x = Math.floor(item.x * 100) / 100;
} else if (index === data.length - 1) {
item.x = Math.ceil(item.x * 100) / 100;
x = item.x;
} else {
x = Math.round(item.x * 100) / 100;
}
return x
});
break;
@@ -640,7 +654,7 @@ export default {
// 重新算圖
this.resizeMask(this.chartComplete);
// 執行 timeFrameStartEnd 才會改變數據
this.attValueTypeStartEnd;
// this.attValueTypeStartEnd; 是否有要呼叫函數? sonar-qube
},
/**
* 選取開始或結束時間時,要改變滑塊跟圖表
@@ -668,7 +682,13 @@ export default {
this.selectArea = closestIndexes;
// 重新設定 start end 日曆選取範圍
if(!isDateType) inputValue = Number(e.value.replace(/,/g, '')) ;
if(direction === 'start') isDateType ? this.endMinDate = e : this.valueEndMin = inputValue;
if(direction === 'start') {
if(isDateType){
this.endMinDate = e;
} else {
this.valueEndMin = inputValue;
}
}
else if(direction === 'end') isDateType ? this.startMaxDate = e : this.valueStartMax = inputValue;
// 重新算圖
if(!isNaN(closestIndexes[0]) && !isNaN(closestIndexes[1])) this.resizeMask(this.chartComplete);

View File

@@ -441,7 +441,7 @@ console.log("TODO:", datasetsPrimary, )
let yDataPrimary;
let labelPrimary = chartData.data[0].label;
let datasetsSecondary = chartData.data[1].data;
let xDataSecondary;
// let xDataSecondary;
let yDataSecondary;
let labelSecondary = chartData.data[1].label;
let primeVueSetData = {};
@@ -462,7 +462,7 @@ console.log("TODO:", datasetsPrimary, )
y: value.y === null ? null : value.y * 100
}
});
xDataSecondary = datasetsSecondary.map(i => i.x);
// xDataSecondary = datasetsSecondary.map(i => i.x);
yDataSecondary = datasetsSecondary.map(i => i.y);
primeVueSetData = {