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