<template>
	<div>
		<jt-echarts style="width: 320rem;height: 200rem;margin:10rem;" :chartData="option"></jt-echarts>
	</div>
</template>

<script>
	// import * as echarts from "echarts";

	export default {
		data() {
			return {
				option: {}
			}
		},
		created() {},
		mounted() {
			this.typeCharts0()
		},
		methods: {

			typeCharts0() {
				this.option = this.getOption();
				// var chartDom = document.getElementById('echarts');
				// var myChart = echarts.init(chartDom);
				// myChart.setOption(option, true);
			},
			getOption(data) {
				let option = {
					color: ["#2B80FF", "#3DF3C4"],
					title: {
						text: ''
					},
					tooltip: {
						trigger: 'axis'
					},
					legend: {
						orient: 'horizontal',
						x: 'center',
						y: 'top',
						textStyle: {
							fontSize: 12,
						},
						data: [{
								name: '上年(kw/h)',
								textStyle: {
									color: "#2B80FF "
								}
							},
							{
								name: '本年(kw/h)',
								textStyle: {
									color: "#3DF3C4"
								}
							}
						],
						backgroundColor: 'rgba(0,0,0,0)',
						borderColor: '#ccc',
						borderWidth: 0,
						padding: 5,
						itemGap: 10,
						itemWidth: 20,
						itemHeight: 14,
					},
					grid: {
						left: '3%',
						right: '4%',
						bottom: '3%',
						containLabel: true
					},
					// toolbox: {
					// 	feature: {
					// 		saveAsImage: {}
					// 	}
					// },
					xAxis: {
						type: 'category',
						boundaryGap: false,
						data: ['一月', '二月', '三月', '四月', '五月', '六月'],
						axisLabel: {
							//x轴文字的配置
							show: true,
							textStyle: {
								color: "rgba(255,225,255,1)",
							},
						},
					},
					yAxis: {
						type: 'value',
						axisLabel: {
							//x轴文字的配置
							show: true,
							textStyle: {
								color: "rgba(255,225,255,1)",
							},
						},
					},
					series: [{
							name: '上年(kw/h)',
							type: 'line',
							// stack: 'Total',
							data: [1000, 1500, 1300, 1700, 1600, 1200]
						},
						{
							name: '本年(kw/h)',
							type: 'line',
							// stack: 'Total',
							data: [1200, 1800, 1400, 1350, 1100, 1500]
						},
					],
					
				};
				return option;
			}

		},

	}
</script>

<style scoped>
	#echarts {
		width: 320rem;
		height: 200rem;
		margin: 10rem;
	}
</style>
