jgfl.vue 3.17 KB
<template>
    <div class="jgfl">
        <div class="home-title">
            <span class="title-name">监管分类</span>
            <span class="title-more">更多>></span>
        </div>
        <div class="home-content">
            <div id="jgfl-myChart" class="chart"></div>
        </div>
    </div>
</template>

<script>
export default {
    name: "jgfl",
    components: {},
    data () {
        return {
            data: [20118, 416232, 224447, 32, 48842],
        };
    },
    mounted () {
        this.echartInit();
    },
    methods: {
        echartInit () {
            let _this = this;
            // 基于准备好的dom,初始化echarts实例
            let myChart = this.$echarts.init(
                document.getElementById("jgfl-myChart")
            );
            // 绘制图表
            myChart.setOption({
                title: {
                    text: "(单位: 件)",
                    textStyle: {
                        fontSize: 16,
                        color: "#606266",
                        fontWeight: "normal",
                    },
                },
                color: "red",
                radar: {
                    indicator: [
                        { name: "原则监管", max: 22000 },
                        { name: "时效监管", max: 420000 },
                        { name: "证书监管", max: 230000 },
                        { name: "年限监管", max: 38000 },
                        { name: "内容监管", max: 50000 },
                    ],
                    name: {
                        color: "#606266",
                        formatter: function (value, indicator) {
                            if (value == "原则监管") {
                                return value + " " + _this.data[0];
                            } else if (value == "时效监管") {
                                return value + " " + _this.data[1];
                            } else if (value == "证书监管") {
                                return value + " " + _this.data[2];
                            } else if (value == "年限监管") {
                                return value + " " + _this.data[3];
                            } else if (value == "内容监管") {
                                return value + " " + _this.data[4];
                            }
                        },
                    },
                    splitLine: {
                        lineStyle: {
                            color: "#0F93F6",
                        },
                    },
                    splitArea: {
                        show: false
                    }
                },
                series: [
                    {
                        type: "radar",
                        data: [
                            {
                                value: _this.data,
                            },
                        ],
                    },
                ],
            });
        },
    },
};
</script>
<style scoped lang="scss">
@import "./home.scss";

.jgfl {
    width: 100%;
    height: 100%;

    .chart {
        width: 100%;
        height: calc(100% - 10px);
        margin-top: 10px;
    }
}
</style>