This commit is contained in:
高云鹏 2024-11-07 13:31:17 +08:00
commit cd833aab5b

View File

@ -69,7 +69,7 @@ const chartContainer = ref<HTMLElement | null>(null)
const option: any = { const option: any = {
tooltip: { tooltip: {
formatter: function (params: any) { formatter: function (params: any) {
return '功率:' + params.value[0] + 'KW ' + ' <br/>' + '风速' + params.value[1] + 'm/s' return '风速:' + params.value[0] + 'm/s ' + ' <br/>' + '功率' + params.value[1] + 'KW'
}, },
}, },
legend: { legend: {
@ -81,13 +81,13 @@ const option: any = {
}, },
xAxis: { xAxis: {
type: 'value', type: 'value',
name: 'KW', name: 'm/s',
splitLine: { splitLine: {
show: false, show: false,
}, },
}, },
yAxis: { yAxis: {
name: 'm/s', name: 'KW',
splitLine: { splitLine: {
show: false, show: false,
}, },
@ -112,11 +112,11 @@ onMounted(() => {
chart.value.setOption({ chart.value.setOption({
xAxis: { xAxis: {
type: 'category', type: 'category',
name: 'KW', name: 'm/s',
}, },
yAxis: { yAxis: {
type: 'category', type: 'category',
name: 'm/s', name: 'KW',
}, },
series: [ series: [
{ {
@ -242,11 +242,15 @@ const historyDataReq = (data: any) => {
const iGenPower = resData['iGenPower']['values'] const iGenPower = resData['iGenPower']['values']
const iWindSpeed = resData['iWindSpeed']['values'] const iWindSpeed = resData['iWindSpeed']['values']
const seriesData = iGenPower.map((item: any, index: number) => { const seriesData = iGenPower.map((item: any, index: number) => {
return [item, iWindSpeed[index]] return [iWindSpeed[index], item]
})
seriesData.sort((a, b) => {
return a[0] - b[0]
}) })
const series = { const series = {
type: 'scatter', type: 'line',
data: seriesData, data: seriesData,
smooth: true,
} }
option.series.push(series) option.series.push(series)