<template>
    <div>
        <div id="analysisChartTopLeft" style="width:6rem;height:4rem;margin:35px auto;"></div>
    </div>
</template>

<script>
import echartMixins from "@/utils/resizeMixins";
export default {
    props:['xDataTopLeft','yDataTopLeft'],
    data() {
        return {
        chart: null,
        }
    },
    mixins: [echartMixins],
    mounted() {
        this.init();
    },
    methods: {
        init() {
            this.chart = this.echarts.init(document.getElementById("analysisChartTopLeft"));
            let option = {
                title: {
                    text: '设备 1',
                    fontSize: 20,
                    textStyle: {
                        fontWeight: 'bold',
                        color: '#DCDCDC'
                    },
                    x: 'center'
                },
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {
                    type: 'shadow'
                    }
                },
                legend: {},
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis: {
                    type: 'value',
                    boundaryGap: [0, 0.01],
                    axisLabel: {
                        fontSize: 14,
                        textStyle: {
                            fontWeight: 'bold',
                            color: '#DCDCDC'
                        }
                    },
                    nameTextStyle: {
                        fontSize: 14,
                        fontWeight: 'bold',
                            color: '#DCDCDC'
                    }
                },
                yAxis: {
                    type: 'category',
                    data: this.yDataTopLeft,
                    axisLabel: {
                        fontSize: 14,
                        textStyle: {
                            fontWeight: 'bold',
                            color: '#DCDCDC'
                        }
                    },
                    nameTextStyle: {
                        fontSize: 14,
                        fontWeight: 'bold',
                        color: '#DCDCDC'
                    }
                },
                series: [
                    {
                        type: 'bar',
                        data: this.xDataTopLeft,
                        
                    }
                ]
            };
            this.chart.setOption(option);
        }
    },
    destroyed() {
        window.onresize = null;
    }
}
</script>

<style>

</style>