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 = {
tooltip: {
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: {
@ -81,13 +81,13 @@ const option: any = {
},
xAxis: {
type: 'value',
name: 'KW',
name: 'm/s',
splitLine: {
show: false,
},
},
yAxis: {
name: 'm/s',
name: 'KW',
splitLine: {
show: false,
},
@ -112,11 +112,11 @@ onMounted(() => {
chart.value.setOption({
xAxis: {
type: 'category',
name: 'KW',
name: 'm/s',
},
yAxis: {
type: 'category',
name: 'm/s',
name: 'KW',
},
series: [
{
@ -242,11 +242,15 @@ const historyDataReq = (data: any) => {
const iGenPower = resData['iGenPower']['values']
const iWindSpeed = resData['iWindSpeed']['values']
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 = {
type: 'scatter',
type: 'line',
data: seriesData,
smooth: true,
}
option.series.push(series)