Echarts ---- 折线图常用配置

export const dateEcConfig = function (ecid) {
	return {
		ecid,
		data: {
			title:{
				text: ""
			},
			animation: false,
			// title: {
			// 	text: '产量',
			// 	top: '3%',
			// 	left: 'center',
			// 	textStyle: {
			// 		fontSize: 14,
			// 		color: '#a3c4f7',
			// 	},
			// },
			tooltip: {
				trigger: 'axis',
				confine: true,
				// formatter: function (params) {
				// 	return (
				// 		params[0].value.time.split(' ')[0] + '<br />' + '打包数量 : ' + (params[0].value.packing_qty_diff || 0)
				// 	);
				// },
				axisPointer: {
					type: 'line',
					label: {
						backgroundColor: 'rgba(106, 121, 133, 0.8)',
					},
				},
			},
			grid: {
				top: '10%',
				left: '6%',
				right: '1%',
				bottom: '18%',
				containLabel: false,
			},
			xAxis: {
				type: 'time',
				boundaryGap: false,
				axisTick: {
					show: true,
				},
				axisLine: {
					lineStyle: {
						color: '#ccc',
					},
				},
				axisLabel: {
					color: '#fff',
				},
			},
			yAxis: {
				min: 'dataMin', //取最小值为最小刻度
				max: 'dataMax', //取最大值为最大刻度
				splitLine: {
					show: true,
					lineStyle: {
						color: '#305997',
					},
				},
				type: 'value',
				axisLabel: {
					color: '#fff',
				},
				axisLine: {
					show: false,
				},
				axisTick: {
					show: true,
				},
			},
			dataset: {
				source: [],
			},
			series: {
				// name: "总耗电量:",
				type: 'bar',
				smooth: true,

				encode: {
					x: 'time',
					y: 'packing_qty_diff',
				},
				// xAxisIndex: 0,
				// yAxisIndex: 0,

				// markPoint: {
				// 	data: [
				// 		{
				// 			type: 'max',
				// 			name: '最大值',
				// 			symbol: 'pin',
				// 			symbolSize: 15,
				// 			silent: false,
				// 			label: {
				// 				color: '#d6d6d6',
				// 				offset: [10, 0],
				// 			},
				// 			itemStyle: {
				// 				color: 'transparent',
				// 			},
				// 		},
				// 	],
				// },
				barWidth: 5,
				itemStyle: {
					color: '#fff',
					borderColor: '#fff',
				},
			},
		},
	};
};



/**
 * 电表数据采集
 */
export const ammeterConfigFn = function(k = []) {
	return {
		title: [{
				text: "电压数据",
				left: "24%",
				textStyle: {
					color: '#d6d6d6',
				}
			}, {
				text: "电流数据",
				left: "73%",
				textStyle: {
					color: '#d6d6d6',
				}
			},
			{
				text: "累计电表读数",
				left: "15%",
				top: "56%",
				textStyle: {
					color: '#d6d6d6',
				}
			},
			{
				text: "能耗数据",
				left: "47%",
				top: "56%",
				textStyle: {
					color: '#d6d6d6',
				}
			},
			{
				text: "功率因数",
				left: "81%",
				top: "56%",
				textStyle: {
					color: '#d6d6d6',
				}
			},
		],
		tooltip: {
			trigger: "axis",
		},
		legend: [{
				orient: 'horizontal', //horizontal, vertical
				top: "8%",
				left: "0%",
				itemHeight: 18, // 修改icon图形大小
				itemGap: 50, // 修改间距
				textStyle: {
					fontSize: 15,
					padding: [0, 0, 0, 2], // 修改文字和图标距离
					color: '#d6d6d6',
				},
				data: ["A相电压", "B相电压", "C相电压"],

			},
			{
				orient: 'horizontal',
				top: "8%",
				left: "50%",
				itemHeight: 18,
				itemGap: 50,
				textStyle: {
					fontSize: 15,
					padding: [0, 0, 0, 2],
					color: '#d6d6d6',
				},
				data: ["A相电流", "B相电流", "C相电流"]
			}
		],
		grid: [{
				top: "18%",
				left: "3%",
				width: "44%",
				height: "33%",
				containLabel: true,
				color: '#d6d6d6',
			},
			{
				top: "18%",
				left: "53%",
				right: "2%",
				height: "33%",
				containLabel: true,
				color: '#d6d6d6',
			},
			{
				top: "65%",
				bottom: "5%",
				left: "3%",
				width: "28%",
				containLabel: true,
				color: '#d6d6d6',
			},
			{
				top: "65%",
				bottom: "5%",
				left: "34%",
				width: "32%",
				containLabel: true,
				color: '#d6d6d6',
			},
			{
				top: "65%",
				bottom: "5%",
				left: "70%",
				right: "2%",
				containLabel: true,
				color: '#d6d6d6',
			}
		],
		// animation: false,
		dataset: {
			source: k
		},
		dataZoom: [{ // 第一个 dataZoom 组件
				xAxisIndex: 0,
				type: "inside",
				disabled: false,
				orient: "horizontal"
			},
			{
				xAxisIndex: 1,
				type: "inside",
				disabled: false,
				orient: "horizontal"
			},
			{
				xAxisIndex: 2,
				type: "inside",
				disabled: false,
				orient: "horizontal"
			},
			{
				xAxisIndex: 3,
				type: "inside",
				disabled: false,
				orient: "horizontal"
			},
			{
				xAxisIndex: 4,
				type: "inside",
				disabled: false,
				orient: "horizontal"
			}
		],
		xAxis: [{
				type: "time",
				gridIndex: 0,
				axisLabel: {
					color: '#d6d6d6',
				},
			},
			{
				type: "time",
				gridIndex: 1,
				axisLabel: {
					color: '#d6d6d6',
				},
			},
			{
				type: "time",
				gridIndex: 2,
				axisLabel: {
					color: '#d6d6d6',
				},
			},
			{
				type: "time",
				gridIndex: 3,
				axisLabel: {
					color: '#d6d6d6',
				},
			},
			{
				type: "time",
				gridIndex: 4,
				axisLabel: {
					color: '#d6d6d6',
				},
			},
		],
		yAxis: [{
				type: "value",
				gridIndex: 0,
				axisLabel: {
					formatter: "{value} V",
					color: '#d6d6d6',
				}
			},
			{
				type: "value",
				gridIndex: 1,
				axisLabel: {
					formatter: "{value} A",
					color: '#d6d6d6',
				}
			},
			//
			{
				type: "value",
				gridIndex: 2,
				axisLabel: {
					formatter: "{value} KW",
					color: '#d6d6d6',
				}
			},
			{
				type: "value",
				gridIndex: 3,
				axisLabel: {
					formatter: "{value}",
					color: '#d6d6d6',
				}
			},
			{
				type: "value",
				gridIndex: 4,
				axisLabel: {
					formatter: "{value}",
					color: '#d6d6d6',
				}
			},
		],
		series: [{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "A相电压",
				encode: {
					x: "time",
					y: "aphase_voltage"
				},
				xAxisIndex: 0,
				yAxisIndex: 0,
			},
			{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "B相电压",
				encode: {
					x: "time",
					y: "bphase_voltage"
				},
				xAxisIndex: 0,
				yAxisIndex: 0,
			},
			{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "C相电压",
				encode: {
					x: "time",
					y: "cphase_voltage"
				},
				xAxisIndex: 0,
				yAxisIndex: 0,
			},
			{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "A相电流",
				encode: {
					x: "time",
					y: "aphase_current"
				},
				xAxisIndex: 1,
				yAxisIndex: 1,
			},
			{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "B相电流",
				encode: {
					x: "time",
					y: "bphase_current"
				},
				xAxisIndex: 1,
				yAxisIndex: 1,
			},
			{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "C相电流",
				encode: {
					x: "time",
					y: "cphase_current"
				},
				xAxisIndex: 1,
				yAxisIndex: 1,
			},
			//
			{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "累计电表读数",
				encode: {
					x: "time",
					y: "total_active_energy"
				},
				xAxisIndex: 2,
				yAxisIndex: 2,
			},
			{
				type: "bar",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "能耗",
				barMinWidth: 3,
				barMaxWidth: 8,
				encode: {
					x: "time",
					y: "total_active_energy_diff"
				},
				xAxisIndex: 3,
				yAxisIndex: 3,
			},
			{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "功率因数",
				encode: {
					x: "time",
					y: "total_power_factor"
				},
				xAxisIndex: 4,
				yAxisIndex: 4,
			}
		]
	}
};



/**
 * 打包机PLC
 */
export const collPLCConfigFn = function(k = []) {
	return {
		title: [{
				text: "压力",
				left: "22%",
				textStyle: {
					color: '#d6d6d6',
				}
			},
			{
				text: "转速",
				left: "74%",
				textStyle: {
					color: '#d6d6d6',
				}
			},
			{
				text: "累时器",
				left: "21%",
				top: "60%",
				textStyle: {
					color: '#d6d6d6',
				}
			},
			{
				text: "打包数量",
				left: "72%",
				top: "60%",
				textStyle: {
					color: '#d6d6d6',
				}
			}
		],
		tooltip: {
			trigger: "axis"
		},
		legend: [{
				orient: 'horizontal', //horizontal, vertical
				top: "7%",
				left: "0%",
				itemHeight: 18, // 修改icon图形大小
				itemGap: 40, // 修改间距
				textStyle: {
					fontSize: 15,
					padding: [0, 0, 0, 2], // 修改文字和图标距离
					color: '#d6d6d6',
				},
				data: ["主缸进压力", "主缸退压力", "实际压力", "侧缸进压力"]
			},
			{
				orient: 'horizontal',
				top: "14%",
				left: "50%",
				itemHeight: 18,
				itemGap: 70,
				textStyle: {
					fontSize: 15,
					padding: [0, 0, 0, 2],
					color: '#d6d6d6',
				},
				data: ["门盖转速", "翻包转速", "电机高速"]
			},
		],
		grid: [{
				top: "24%",
				left: "3%",
				width: "44%",
				height: "33%",
				containLabel: true
			},
			{
				top: "24%",
				left: "53%",
				right: "2%",
				height: "33%",
				containLabel: true
			},
			// 
			{
				top: "68%",
				bottom: "3%",
				left: "3%",
				width: "44%",
				containLabel: true
			},
			{
				top: "68%",
				bottom: "3%",
				left: "53%",
				right: "2%",
				containLabel: true
			}
		],
		// animation: false,
		dataset: {
			source: k
		},
		dataZoom: [{
				xAxisIndex: 0,
				type: "inside",
				disabled: false,
				orient: "horizontal"
			},
			{
				xAxisIndex: 1,
				type: "inside",
				disabled: false,
				orient: "horizontal"
			},
			{
				xAxisIndex: 2,
				type: "inside",
				disabled: false,
				orient: "horizontal"
			},
			{
				xAxisIndex: 3,
				type: "inside",
				disabled: false,
				orient: "horizontal"
			}
		],
		xAxis: [{
			type: "time",
			boundaryGap: false, // 不留白,从原点开始
			gridIndex: 0,
			axisLabel: {
				color: '#d6d6d6'
			},
		}, {
			type: "time",
			boundaryGap: false,
			gridIndex: 1,
			axisLabel: {
				color: '#d6d6d6'
			},
		}, {
			type: "time",
			boundaryGap: false,
			gridIndex: 2,
			axisLabel: {
				color: '#d6d6d6'
			},
		}, {
			type: "time",
			boundaryGap: false,
			gridIndex: 3,
			axisLabel: {
				color: '#d6d6d6'
			},
		}],
		yAxis: [{
				type: "value",
				gridIndex: 0,
				axisLabel: {
					formatter: "{value}",
					color: '#d6d6d6'
				}
			},
			{
				type: "value",
				gridIndex: 1,
				axisLabel: {
					formatter: "{value}",
					color: '#d6d6d6'
				}
			},
			// 
			{
				type: "value",
				gridIndex: 2,
				axisLabel: {
					formatter: "{value}",
					color: '#d6d6d6'
				}
			},
			{
				type: "value",
				gridIndex: 3,
				axisLabel: {
					formatter: "{value}",
					color: '#d6d6d6'
				}
			},
		],
		series: [{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "实际压力",
				encode: {
					x: "time",
					y: "actual_pressure"
				},
				xAxisIndex: 0,
				yAxisIndex: 0,
			},
			{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "主缸进压力",
				encode: {
					x: "time",
					y: "main_cylinder_inp"
				},
				xAxisIndex: 0,
				yAxisIndex: 0,
			},
			{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "主缸退压力",
				encode: {
					x: "time",
					y: "main_cylinder_retp"
				},
				xAxisIndex: 0,
				yAxisIndex: 0,
			},
			{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "侧缸进压力",
				encode: {
					x: "time",
					y: "side_cylinder_inp"
				},
				xAxisIndex: 0,
				yAxisIndex: 0,
			},
			{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "门盖转速",
				encode: {
					x: "time",
					y: "door_cover_speed"
				},
				xAxisIndex: 1,
				yAxisIndex: 1,
			},
			{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "翻包转速",
				encode: {
					x: "time",
					y: "turn_over_speed"
				},
				xAxisIndex: 1,
				yAxisIndex: 1,
			},
			{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "电机高速",
				encode: {
					x: "time",
					y: "motor_high_speed"
				},
				xAxisIndex: 1,
				yAxisIndex: 1,
			},
			{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "累时器",
				encode: {
					x: "time",
					y: "time_totalizer_diff"
				},
				xAxisIndex: 2,
				yAxisIndex: 2,
			},
			{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "打包数量",
				encode: {
					x: "time",
					y: "packing_qty_diff"
				},
				xAxisIndex: 3,
				yAxisIndex: 3,
			}
		]
	}
};


/**
 * 驱动器
 */
export const collvfdDriveConfigFn = function(k = []) {
	return {
		title: [{
				text: "温度",
				left: "18%",
				textStyle: {
					color: '#d6d6d6',
				}
			},
			{
				text: "速度",
				left: "50%",
				textStyle: {
					color: '#d6d6d6',
				}
			},
			{
				text: "压力",
				left: "82%",
				textStyle: {
					color: '#d6d6d6',
				}
			},
			{
				text: "电流反馈",
				left: "17%",
				top: "61%",
				textStyle: {
					color: '#d6d6d6',
				}
			},
			{
				text: "转矩设定",
				left: "49%",
				top: "61%",
				textStyle: {
					color: '#d6d6d6',
				}
			},
			{
				text: "流量设定",
				left: "81%",
				top: "61%",
				textStyle: {
					color: '#d6d6d6',
				}
			},
		],
		tooltip: {
			trigger: "axis"
		},
		legend: [{
				orient: 'horizontal', //horizontal, vertical
				top: "8%",
				left: "0%",
				itemHeight: 18, // 修改icon图形大小
				itemGap: 37, // 修改间距
				textStyle: {
					fontSize: 15,
					padding: [0, 0, 0, 2], // 修改文字和图标距离
					color: '#d6d6d6'
				},
				data: ["IGBT温度", "电机温度"]
			},
			{
				orient: 'horizontal',
				top: "8%",
				left: "30%",
				itemHeight: 18,
				itemGap: 37,
				textStyle: {
					fontSize: 15,
					padding: [0, 0, 0, 2],
					color: '#d6d6d6'
				},
				data: ["速度设定", "速度反馈"]
			},
			{
				orient: 'horizontal',
				top: "8%",
				left: "60%",
				itemHeight: 18,
				itemGap: 37,
				textStyle: {
					fontSize: 15,
					padding: [0, 0, 0, 2],
					color: '#d6d6d6'
				},
				data: ["压力设定", "压力反馈"]
			},
		],
		grid: [{
				top: "18%",
				left: "3%",
				width: "29%",
				height: "38%",
				containLabel: true
			},
			{
				top: "18%",
				left: "36%",
				width: "30%",
				height: "38%",
				containLabel: true
			},
			{
				top: "16%",
				left: "70%",
				right: "2%",
				height: "38%",
				containLabel: true
			},
			{
				top: "68%",
				left: "3%",
				width: "29%",
				bottom: "2%",
				containLabel: true
			},
			{
				top: "68%",
				left: "36%",
				width: "30%",
				bottom: "2%",
				containLabel: true
			},
			{
				top: "68%",
				left: "70%",
				right: "2%",
				bottom: "2%",
				containLabel: true
			},
		],
		// animation: false,
		dataset: {
			source: k
		},
		dataZoom: [{
				xAxisIndex: 0,
				type: "inside",
				disabled: false,
				orient: "horizontal"
			},
			{
				xAxisIndex: 1,
				type: "inside",
				disabled: false,
				orient: "horizontal"
			},
			{
				xAxisIndex: 2,
				type: "inside",
				disabled: false,
				orient: "horizontal"
			},
			{
				xAxisIndex: 3,
				type: "inside",
				disabled: false,
				orient: "horizontal"
			},
			{
				xAxisIndex: 4,
				type: "inside",
				disabled: false,
				orient: "horizontal"
			},
			{
				xAxisIndex: 5,
				type: "inside",
				disabled: false,
				orient: "horizontal"
			}
		],
		xAxis: [{
				type: "time",
				boundaryGap: false, // 不留白,从原点开始
				gridIndex: 0,
				axisLabel: {
					color: '#d6d6d6'
				},
			}, {
				type: "time",
				boundaryGap: false,
				gridIndex: 1,
				axisLabel: {
					color: '#d6d6d6'
				},
			}, {
				type: "time",
				boundaryGap: false,
				gridIndex: 2,
				axisLabel: {
					color: '#d6d6d6'
				},
			}, {
				type: "time",
				boundaryGap: false,
				gridIndex: 3,
				axisLabel: {
					color: '#d6d6d6'
				},
			},
			{
				type: "time",
				boundaryGap: false,
				gridIndex: 4,
				axisLabel: {
					color: '#d6d6d6'
				},
			},
			{
				type: "time",
				boundaryGap: false,
				gridIndex: 5,
				axisLabel: {
					color: '#d6d6d6'
				},
			}
		],
		yAxis: [{
				type: "value",
				gridIndex: 0,
				axisLabel: {
					formatter: "{value} °C",
					color: '#d6d6d6'
				}
			},
			{
				type: "value",
				gridIndex: 1,
				axisLabel: {
					formatter: "{value}",
					color: '#d6d6d6'
				}
			},
			// 
			{
				type: "value",
				gridIndex: 2,
				axisLabel: {
					formatter: "{value}",
					color: '#d6d6d6'
				}
			},
			{
				type: "value",
				gridIndex: 3,
				axisLabel: {
					formatter: "{value} A",
					color: '#d6d6d6'
				}
			},
			{
				type: "value",
				gridIndex: 4,
				axisLabel: {
					formatter: "{value}",
					color: '#d6d6d6'
				}
			},
			{
				type: "value",
				gridIndex: 5,
				axisLabel: {
					formatter: "{value}",
					color: '#d6d6d6'
				}
			},
		],
		series: [{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "IGBT温度",
				encode: {
					x: "time",
					y: "lgbt_temp",
				},
				xAxisIndex: 0,
				yAxisIndex: 0,
			},
			{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "电机温度",
				encode: {
					x: "time",
					y: "motor_temp"
				},
				xAxisIndex: 0,
				yAxisIndex: 0,
			},
			{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "速度设定",
				encode: {
					x: "time",
					y: "speed_setting"
				},
				xAxisIndex: 1,
				yAxisIndex: 1,
			},
			{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "速度反馈",
				encode: {
					x: "time",
					y: "velocity_feedback"
				},
				xAxisIndex: 1,
				yAxisIndex: 1,
			},
			{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "压力设定",
				encode: {
					x: "time",
					y: "stress_setting"
				},
				xAxisIndex: 2,
				yAxisIndex: 2,
			},
			{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "压力反馈",
				encode: {
					x: "time",
					y: "stress_feedback"
				},
				xAxisIndex: 2,
				yAxisIndex: 2,
			},
			{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "电流反馈",
				encode: {
					x: "time",
					y: "current_feedback"
				},
				xAxisIndex: 3,
				yAxisIndex: 3,
			},
			{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "转矩设定",
				encode: {
					x: "time",
					y: "torque_setting"
				},
				xAxisIndex: 4,
				yAxisIndex: 4,
			},
			{
				type: "line",
				showSymbol: false,
				lineStyle: {
					with: 1
				},
				name: "流量设定",
				encode: {
					x: "time",
					y: "flow_rate_setting"
				},
				xAxisIndex: 5,
				yAxisIndex: 5,
			}
		]
	}
};


posted @ 2024-11-01 15:44  河图s  阅读(43)  评论(0)    收藏  举报