export default {
    data() {
        return {
            myChart: null,
            value: [],
        };
    },
    mounted() {
        window.addEventListener('resize', this.resize);
    },
    methods: {
        resize() {
            if (this.myChart) {
                this.myChart.resize();
            }
        },
        initChat(myChart) {
            var option = {
                grid: {
                    top: 20,
                    bottom: 20,
                    left: 60,
                    right: 40,
                },
                xAxis: {
                    type: 'category',
                    boundaryGap: false,
                },
                yAxis: {
                    type: 'value',
                },
                tooltip: {
                    trigger: 'axis',
                },
            };

            myChart.setOption(option);
        },
        labelLayout: (params) => {
            return {
                x: params.rect.x > 0 ? params.rect.x : 5,
                y: params.labelRect.y > 0 ? params.labelRect.y : 5,
                align: 'center',
            };
        },
    },
};
