<template>
	<div :id="elId" :style="style"></div>
</template>

<script>
	import axios from 'axios'
	const CHARTSTYPE = ["table","line","bar","ring","pie","radar"]
	export default {
		props: {
			height: {// 图表高度
		      type: String,
		      default: '100%'
		    },
		    width: {// 图表宽度
		      type: String,
		      default: '100%'
		    },
		    position: {// 图表的位置
		      type: String,
		      default: 'pie_1'
		    },
		},
		computed: {
		    style() {
		      return {
		        height: this.height,
		        width: this.width
		      }
		    }
		},
		data(){
			return {
				elId: '',
				
			}
		},
		mounted() {
		   
		    this.getData()
		},
		methods(){
			//根据position获取对应的basic数据
			getData(){
				let typeStr = this.position.lastIndexOf('_')
				let type = this.position.substring(0,typeStr)
				console.log(type)
				//
				const time = new Date()
			      const configP = axios.get(`/static/${type}Config.json?time=${time}`)
			      const sourceDataP = axios.get(`/static/${type}Data.json?time=${time}`)
			      Promise.all([configP, sourceDataP])
			        .then(res => {
			          const config = res[0].data
			          const sourceData = res[1].data
			        })
			}
		}
	}
</script>

<style>
</style>