农科院农业物联网数据中心
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.
 
 
 

165 lines
3.6 KiB

/* eslint-disable max-len */
export const colors = ['#5470C6', '#91CC75', '#EE6666', '#5470C6', '#91CC75', '#EE6666', '#5470C6', '#91CC75'];
// 默认legend
export const defaultSelectedLegend = {
'钢腐蚀电流(nA)': true,
'铜腐蚀电流(nA)': true,
'铝腐蚀电流(nA)': true,
'锌腐蚀电流(nA)': true,
'SO2(ppb)': false,
'盐分阻抗(Ω)': false,
'环温(℃)': false,
'环湿(RH%)': false,
};
// y轴定义
export const yAxisData = [
{
type: 'value',
name: 'SO2(ppb)',
position: 'left',
show: false,
axisLine: {
show: true,
lineStyle: { color: colors[0] },
},
axisLabel: { formatter: '{value}ppb' },
},
{
type: 'value',
name: '盐分阻抗(Ω)',
show: false,
position: 'left',
offset: 70,
axisLine: {
show: true,
lineStyle: { color: colors[1] },
},
axisLabel: { formatter: '{value}Ω' },
},
{
type: 'value',
name: '环温(℃)',
show: false,
position: 'left',
offset: 135,
axisLine: {
show: true,
lineStyle: { color: colors[2] },
},
axisLabel: { formatter: '{value}°C' },
},
{
type: 'value',
name: '环湿(RH%)',
show: false,
position: 'left',
offset: 200,
axisLine: {
show: true,
lineStyle: { color: colors[3] },
},
axisLabel: { formatter: '{value}RH%' },
},
{
type: 'value',
name: '锌腐蚀电流(nA)',
position: 'right',
axisLine: {
show: true,
lineStyle: { color: colors[4] },
},
axisLabel: { formatter: '{value}' },
},
{
type: 'value',
name: '铜腐蚀电流(nA)',
offset: 100,
position: 'right',
axisLine: {
show: true,
lineStyle: { color: colors[5] },
},
axisLabel: { formatter: '{value}' },
},
{
type: 'value',
name: '铝腐蚀电流(nA)',
offset: 200,
position: 'right',
axisLine: {
show: true,
lineStyle: { color: colors[6] },
},
axisLabel: { formatter: '{value}' },
},
{
type: 'value',
name: '钢腐蚀电流(nA)',
offset: 300,
position: 'right',
axisLine: {
show: true,
lineStyle: { color: colors[7] },
},
axisLabel: { formatter: '{value}' },
},
];
/**
* 生成默认数据
* @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: 'SO2(ppb)',
type: 'line',
data: data.so2,
},
{
name: '盐分阻抗(Ω)',
type: 'line',
yAxisIndex: 1,
data: data.salt,
},
{
name: '环温(℃)',
type: 'line',
yAxisIndex: 2,
data: data.environmentTemperature,
},
{
name: '环湿(RH%)',
type: 'line',
yAxisIndex: 3,
data: data.environmentHumidity,
},
{
name: '锌腐蚀电流(nA)',
type: 'line',
yAxisIndex: 4,
data: data.corrosionXIN,
},
{
name: '铜腐蚀电流(nA)',
type: 'line',
yAxisIndex: 5,
data: data.corrosionTONG,
},
{
name: '铝腐蚀电流(nA)',
type: 'line',
yAxisIndex: 6,
data: data.corrosionLV,
},
{
name: '钢腐蚀电流(nA)',
type: 'line',
yAxisIndex: 7,
data: data.corrosionGANG,
},
];
}