<template>
    <div class="container">
        <!-- EBuySellNum 销售统计-->
        <div id="EBuySellNum" style="height:330px;"></div>
    </div>
</template>

<script>
export default {
    name: "EBuySellNum",
    data() {
        return {};
    },
    mounted() {
        this.drawChart();
    },
    methods: {
        drawChart() {
            // 基于准备好的dom，初始化echarts实例
            let myChart = this.$echarts.init(
                document.getElementById("EBuySellNum")
            );
            // 指定图表的配置项和数据
            let option = {
                title: {
                    text: "采购与销售数量",
                    left: "center",
                    bottom: 0
                },
                color: ["#7c92f7"],
                tooltip: {
                    trigger: "axis",
                    axisPointer: {
                        // 坐标轴指示器，坐标轴触发有效
                        type: "shadow" // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                grid: {
                    left: "8%",
                    right: "4%",
                    bottom: "10%",
                    containLabel: true
                },
                xAxis: [
                    {
                        type: "category",
                        data: ["采购数量", "销售数量"],
                        axisTick: {
                            alignWithLabel: true
                        }
                    }
                ],
                yAxis: [
                    {
                        type: "value"
                    }
                ],
                series: [
                    {
                        name: "数量",
                        type: "bar",
                        barWidth: "40%",
                        data: [828, 512]
                    }
                ]
            };
            // 使用刚指定的配置项和数据显示图表。
            myChart.setOption(option);
        }
    }
};
</script>

<style lang="scss" scoped>

</style>