export function useaddA(datav, arr) {
	var colorList = ['#7915F5', '#377E7F', '#DE858E', '#4D6CC1', '#C2B7D5', '#82ED7D']
	var seriesData = datav.map((item, index) => {
		return {
			...item,
			actValue: item.value,
			label: {
				show: true,
				position: 'outside',
				borderRadius: 5,
				padding: [5, 5, 5, 5],
				color: colorList[index],
				textStyle: {
					fontSize: 14,
					lineHeight: 20
				},
				formatter: '{b}\n{c}\n{d}%'
			}
		}
	})
	return {
		grid: {
			top: 0,
			bottom: 0,
			left: 0,
			right: 0
		},
		title: {
			text: '',
			x: 'center'
		},
		tooltip: {
			trigger: 'item',
			formatter: '{a} <br/>{b} : {c} ({d}%)',
			textStyle: {
				fontSize: 12
			}
		},
		legend: {
			show: true,
			// orient: 'vertical',
			left: 'center',
			bottom: 0,
			data: arr
		},
		series: [
			{
				color: ['#7915F5', '#377E7F', '#DE858E', '#4D6CC1', '#C2B7D5', '#82ED7D'],
				name: '粮食等级分类',
				type: 'pie',
				radius: '65%',
				center: ['50%', '50%'],
				label: {
					show: true,
					// formatter: '{b} {d}%',
					formatter: '{d}%'
				},
				// itemStyle: {
				//   //饼图之间颜色
				//   normal: {
				//     borderColor: "#fff",
				//     borderWidth: 4,
				//   },
				// },
				labelLine: {
					length: 30, //视觉引导线第一段的长度
					length2: 30 //视觉引导线第二段的长度
				},
				data: seriesData
			}
		]
	}
}

export function useaddB(datav, arr) {
	// var colorList = ['#FFFF54', '#AE7731', '#ABF04B', '#75FBFD']
	var seriesData = datav.map((item, index) => {
		return {
			...item,
			actValue: item.value,
			label: {
				show: true,
				position: 'inner',
				// position: 'outside',
				borderRadius: 5,
				padding: [5, 5, 5, 5],
				color: '#464646',
				textStyle: {
					fontSize: 14,
					lineHeight: 20
				},
				formatter: '{b}\n{c}\n{d}%'
			}
		}
	})
	return {
		grid: {
			top: 0,
			bottom: 0,
			left: 0,
			right: 0
		},
		title: {
			text: '',
			x: 'center'
		},
		tooltip: {
			trigger: 'item',
			formatter: '{a} <br/>{b} : {c} ({d}%)',
			textStyle: {
				fontSize: 12
			}
		},
		legend: {
			show: true,
			// orient: 'vertical',
			left: 'center',
			bottom: 0,
			data: arr
		},
		series: [
			{
				color: ['#FFFF54', '#AE7731', '#ABF04B', '#75FBFD'],
				name: '分地区库存统计',
				type: 'pie',
				radius: '65%',
				center: ['50%', '50%'],
				label: {
					show: true,
					// formatter: '{b} {d}%',
					formatter: '{d}%'
				},
				// itemStyle: {
				//   //饼图之间颜色
				//   normal: {
				//     borderColor: "#fff",
				//     borderWidth: 4,
				//   },
				// },
				labelLine: {
					length: 10, //视觉引导线第一段的长度
					length2: 10 //视觉引导线第二段的长度
				},
				data: seriesData
			}
		]
	}
}

export function useaddC(datav, arr) {
	return {
		title: {
			text: '分地区库存统计',
			left: 'left'
		},
		tooltip: {}, //详情提示
		legend: {
			show: false,
			data: ['销量'],
			top: 10
		},
		grid: {
			top: 40
		},
		xAxis: {
			type: 'value', //值轴
			min: 0,
			max: 10000,
			axisLine: { show: true }, // 显示 y 轴的轴线
			// 分割七段
			splitNumber: 7,
			splitLine: {
				lineStyle: {
					// type: 'solid', // 将横线设置为虚线
					color: ['#ccc', '#ccc', '#ccc', '#ccc', '#ccc', 'blue', 'green', 'red']
				}
			},
			name: '数量/吨',
			nameTextStyle: {
				color: '#262626',
				fontSize: 14,
				fontWeight: 'bold'
			}
		},
		yAxis: {
			type: 'category', //类目轴
			data: arr
		},
		color: ['#5A9CF8'],
		series: [
			{
				name: '',
				type: 'bar',
				data: datav
			}
		]
	}
}

export function useaddD(datav, nameArr, delArr) {
	return {
		backgroundColor: '#fff',
		title: {
			text: ''
			// top: 10,
			// left: 15
			// textStyle: {
			// 	color: '#262626',
			// 	fontSize: 16,
			// 	fontWeight: 'normal'
			// }
		},
		tooltip: {
			trigger: 'axis'
		},
		// grid: {
		// 	left: '3%',
		// 	right: '4%',
		// 	bottom: '3%',
		// 	top: 60,
		// 	containLabel: true
		// },
		grid: {
			top: 40
			// containLabel: true
		},
		legend: {
			icon: 'rect',
			// left: 'center',
			right: 120,
			top: 13,
			itemWidth: 80,
			itemHeight: 5,
			data: nameArr,
			textStyle: {
				color: '#262626'
			},
			splitLine: {
				lineStyle: {
					color: ['#ccc', '#ccc', '#ccc', '#ccc', '#ccc', 'blue', 'green', 'red']
				}
			}
		},
		xAxis: {
			type: 'category',
			data: delArr,
			axisLabel: {
				//坐标轴字体颜色
				textStyle: {
					color: '#262626'
				}
			},
			axisLine: {
				lineStyle: {
					color: '#e5e5e5'
				}
			},
			axisTick: {
				//y轴刻度线
				show: false
			},
			splitLine: {
				//网格
				show: false
			},
			boundaryGap: true
		},
		yAxis: {
			type: 'value',
			axisLabel: {
				//坐标轴字体颜色
				textStyle: {
					color: '#262626'
				}
			},
			axisLine: {
				show: false
			},
			axisTick: {
				//y轴刻度线
				show: false
			},
			splitLine: {
				//网格
				show: true,
				lineStyle: {
					color: '#dadde4',
					type: 'solid' //solid
				}
			}
		},

		series: [
			{
				name: '入库数量',
				type: 'line',
				smooth: true,
				symbol: 'circle',
				symbolSize: 8,
				itemStyle: {
					color: 'rgb(87, 120, 225)'
				},
				lineStyle: {
					normal: {
						color: 'rgb(87, 120, 225)'
					}
				},
				data: datav.A
			},
			{
				name: '出库数量',
				type: 'line',
				smooth: true,
				symbol: 'circle',
				symbolSize: 8,
				itemStyle: {
					color: 'rgb(55, 200, 143)',
					borderColor: '#fff',
					borderWidth: 1
				},
				lineStyle: {
					normal: {
						color: 'rgb(55, 200, 143)'
					}
				},
				data: datav.B
			}
		]
	}
}
