• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

echarts 创建多图表

武飞扬头像
明耀
帮助1

<template>
	<div class="monitor-3">
		<div>
		</div>
		<div v-for="item in dataList">
			<div class="chart" :id="'echart-' item.deviceId"></div>
		</div>

	</div>
</template>


<script>
	import http from "../../js/http/http.js";
	import api from "../../js/http/api.js";
	import CommonUtils from "../../js/common/common-utils.js";
	import * as echarts from 'echarts';

	export default {
		data() {
			return {
				deviceId: null,
				createTime: new Date(),
				chartShow: false,
				dataList: []
			};
		},
		methods: {
			getCraftPowerReport() {
				http.post(api.GET_CRAFT_POWER_REPORT, {
					craft: '前后片贴口袋',
					styleId: 52
				}, data => {
					this.dataList = data.data;
					for (var item of this.dataList) {
						var xData = [];
						var yData = [];
						var powerList = item.powerList;
						for (var i = 0; i < powerList.length; i  ) {
							xData.push(i   's');
							yData.push(powerList[i]);
						}
						this.initEchart('echart-'   item.deviceId, xData, yData);
					}
				});
			},

			dateChange() {
				this.getCraftPowerReport();
			},

			initEchart(chartId, xData, yData) {
				this.$nextTick(() => {
					var myChart = echarts.init(document.getElementById(chartId));
					var option = CommonUtils.initLineChartOption('缝纫曲线', xData, yData);
					myChart.setOption(option);
				});
			},
			refreshClick() {
				this.getCraftPowerReport();
			}
		},
		created() {
			this.chartShow = true;
			this.deviceId = CommonUtils.getParam(this, 'deviceId', 'setDeviceId');
			this.getCraftPowerReport();
		},
		destroyed() {
			this.chartShow = false;
		}
	};
</script>

<style lang="scss" scoped>
	.monitor-3 {
		>div {
			display: flex;
			flex-direction: row;
			align-items: center;
			margin-top: 20px;
			background-color: #ffffff;
			padding: 20px;
			border-radius: 5px;

			.chart {
				height: 250px;
				width: 100%;
			}
		}


		>div:nth-of-type(1) {
			display: flex;
			flex-direction: row;
			align-items: center;
			margin-top: 20px;
			background-color: #ffffff;
			padding: 20px;
			border-radius: 5px;

			.div-handle-right {
				flex: 1;
				flex-direction: row-reverse;
				text-align: right;
				display: flex;
				align-items: center;

				>input:nth-of-type(1) {
					border: 1px solid #eeeeee;
					font-size: 15px;
					width: 150px;
					padding: 5px 8px;
					outline: none;
				}

				>button {
					color: #A866FF;
					margin-left: 10px;
					padding: 4px 20px;
				}
			}
		}



	}
</style>

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhifbfbk
系列文章
更多 icon
同类精品
更多 icon
继续加载