农场 nuxt3实现的大屏界面
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

202 lines
4.2 KiB

/* eslint-disable max-len */
export const colors = [
'#FCD34D',
'#FDBA74',
'#F9A8D4',
'#FDA4AF',
'#F0ABFC',
'#67E8F9',
'#FCD34D',
'#93C5FD',
'#86EFAC',
];
export const itemColor = {
'室内温度(℃)': colors[5],
'室外温度(℃)': colors[6],
'土壤温度(℃)': colors[7],
'室内湿度(RH%)': colors[8],
'室外湿度(RH%)': colors[0],
'土壤湿度(RH%)': colors[1],
'风速(m/s)': colors[2],
'CO2(%)': colors[3],
'光照(klux)': colors[4],
};
export const legendData = [
{
name: '室外湿度(RH%)',
itemStyle: { color: colors[0] },
listStyle: { color: colors[0] },
},
{
name: '土壤湿度(RH%)',
itemStyle: { color: colors[1] },
listStyle: { color: colors[1] },
},
{
name: '风速(m/s)',
itemStyle: { color: colors[2] },
listStyle: { color: colors[2] },
},
{
name: 'CO2(%)',
itemStyle: { color: colors[3] },
listStyle: { color: colors[3] },
},
{
name: '光照(klux)',
itemStyle: { color: colors[4] },
listStyle: { color: colors[4] },
},
{
name: '室内温度(℃)',
itemStyle: { color: colors[5] },
listStyle: { color: colors[5] },
},
{
name: '室外温度(℃)',
itemStyle: { color: colors[6] },
listStyle: { color: colors[6] },
},
{
name: '土壤温度(℃)',
itemStyle: { color: colors[7] },
listStyle: { color: colors[7] },
},
{
name: '室内湿度(RH%)',
itemStyle: { color: colors[8] },
listStyle: { color: colors[8] },
},
];
// y轴定义
export const yAxisData = [
{
type: 'value',
name: '温度',
offset: 0,
position: 'left',
axisLine: {
show: true,
lineStyle: { color: colors[7] },
},
axisLabel: { formatter: '{value}' },
axisPointer: { show: false },
},
{
type: 'value',
name: '湿度',
offset: 70,
position: 'left',
axisLine: {
show: true,
lineStyle: { color: colors[1] },
},
axisLabel: { formatter: '{value}' },
axisPointer: { show: false },
},
{
type: 'value',
name: '风速',
offset: 0,
position: 'right',
axisLine: {
show: true,
lineStyle: { color: colors[2] },
},
axisLabel: { formatter: '{value}' },
axisPointer: { show: false },
},
{
type: 'value',
name: 'CO2',
position: 'right',
show: false,
offset: 80,
axisLine: {
show: true,
lineStyle: { color: colors[3] },
},
axisLabel: { formatter: '{value}' },
axisPointer: { show: false },
},
{
type: 'value',
name: '光照',
show: false,
position: 'right',
offset: 160,
axisLine: {
show: true,
lineStyle: { color: colors[4] },
},
axisLabel: { formatter: '{value}' },
axisPointer: { show: false },
},
];
/**
* 生成默认数据
* @param {Object} data
* @returns {[{data: (number|[]|string|*), name: string, type: string},{data: (number|[]|BufferSource|string|*), name: string, type: string, yAxisIndex: number},{data: ([]|string|*), name: string, type: string, yAxisIndex: number},{data: ([]|string|*), name: string, type: string, yAxisIndex: number},{data: [], name: string, type: string, yAxisIndex: number},null,null,null]}
*/
export function generateDefaultSeries(data) {
return [
{
name: '室内温度(℃)',
type: 'line',
yAxisIndex: 0,
data: data.roomT,
},
{
name: '室外温度(℃)',
type: 'line',
yAxisIndex: 0,
data: data.outT,
},
{
name: '土壤温度(℃)',
type: 'line',
yAxisIndex: 0,
data: data.soilT,
},
{
name: '室内湿度(RH%)',
type: 'line',
yAxisIndex: 0,
data: data.roomH,
},
{
name: 'CO2(%)',
type: 'line',
yAxisIndex: 1,
data: data.co2,
},
{
name: '风速(m/s)',
type: 'line',
yAxisIndex: 1,
data: data.windSpeed,
},
{
name: '光照(klux)',
type: 'line',
yAxisIndex: 2,
data: data.light,
},
{
name: '室外湿度(RH%)',
type: 'line',
yAxisIndex: 3,
data: data.outH,
},
{
name: '土壤湿度(RH%)',
type: 'line',
yAxisIndex: 4,
data: data.soilH,
},
];
}