调整绘制特性点
This commit is contained in:
@@ -73,6 +73,7 @@ const CHARACTERISTIC_POINT_COLOR = '#ff4d4f'
|
||||
|
||||
const chartPoints = ref<ChartPoint[]>([])
|
||||
const characteristicCurveData = ref<Array<[number, number]>>([])
|
||||
const drawnCharacteristicCurveData = ref<Array<[number, number]>>([])
|
||||
const characteristicCurveVisible = ref(false)
|
||||
const chartRef = ref<any>(null)
|
||||
|
||||
@@ -84,13 +85,6 @@ const selectedMappingText = computed(() => {
|
||||
return `变频器:${props.selectedMapping.freqConverterName || '-'}`
|
||||
})
|
||||
|
||||
const positiveDurations = computed(() => {
|
||||
return [
|
||||
...chartPoints.value.map(item => item.duration),
|
||||
...characteristicCurveData.value.map(item => item[0])
|
||||
].filter(item => Number.isFinite(item) && item > 0)
|
||||
})
|
||||
|
||||
const xAxisMin = computed(() => {
|
||||
return 0.001
|
||||
// if (!positiveDurations.value.length) {
|
||||
@@ -131,12 +125,23 @@ const sortedCharacteristicCurveData = computed(() => {
|
||||
})
|
||||
})
|
||||
|
||||
const sortedDrawnCharacteristicCurveData = computed(() => {
|
||||
return [...drawnCharacteristicCurveData.value].sort((a, b) => {
|
||||
if (a[0] !== b[0]) {
|
||||
return a[0] - b[0]
|
||||
}
|
||||
|
||||
return a[1] - b[1]
|
||||
})
|
||||
})
|
||||
|
||||
const solidCharacteristicCurveSeriesData = computed(() => {
|
||||
if (!characteristicCurveVisible.value) {
|
||||
return [] as Array<[number, number, string]>
|
||||
}
|
||||
|
||||
return sortedCharacteristicCurveData.value.map(item => [item[0], item[1], '特性曲线'])
|
||||
const curveSource = props.autoDrawCurve ? sortedCharacteristicCurveData.value : sortedDrawnCharacteristicCurveData.value
|
||||
return curveSource.map(item => [item[0], item[1], '特性曲线'])
|
||||
})
|
||||
|
||||
const characteristicCurvePointSeriesData = computed(() => {
|
||||
@@ -409,11 +414,13 @@ const updateCharacteristicCurveVisibility = () => {
|
||||
|
||||
const drawCharacteristicCurve = () => {
|
||||
if (!sortedCharacteristicCurveData.value.length) {
|
||||
drawnCharacteristicCurveData.value = []
|
||||
characteristicCurveVisible.value = false
|
||||
ElMessage.warning('暂无特性曲线点')
|
||||
return
|
||||
}
|
||||
|
||||
drawnCharacteristicCurveData.value = [...sortedCharacteristicCurveData.value]
|
||||
characteristicCurveVisible.value = true
|
||||
}
|
||||
|
||||
@@ -630,6 +637,7 @@ watch(
|
||||
() => props.autoDrawCurve,
|
||||
newValue => {
|
||||
characteristicCurveVisible.value = newValue ? characteristicCurveData.value.length > 0 : false
|
||||
drawnCharacteristicCurveData.value = newValue ? [...characteristicCurveData.value] : []
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
@@ -680,6 +688,7 @@ watch(
|
||||
() => {
|
||||
chartPoints.value = []
|
||||
characteristicCurveData.value = []
|
||||
drawnCharacteristicCurveData.value = []
|
||||
characteristicCurveVisible.value = false
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user