echarts 相关label配置

eacarts API  配置项:echart API

echart option配置项

let option = {

    title : {

        text: 'title',

        show: false,

    },

    tooltip : {

        trigger: 'axis'

    },

    grid: {

        left: '1%',

        right: '8%',

        bottom: '1%',

        containLabel: true

    },

    legend: {

        data: [value1, value2],

        textStyle: {

            fontSize: 14,

            color: '#000',

            fontWeight: 600,

            fontFamily: 'Microsoft YaHei',

        }

    },

    toolbox: {

        left: 'right',

        feature: {

            dataZoom: {

                yAxisIndex: 'none'

             },

            restore: {},

            saveAsImage: {}

        }

    },

    calculable : true,

    xAxis : [

        {

            name : 'xAxisName',

            type : 'category',

            data : xAxis1,

            // nameLocation: 'center',

            axisLabel: {

                textStyle: {

                fontSize: 14,

                    color: '#000',

                    fontWeight: 600,

                    fontFamily: 'Microsoft YaHei',

                }

            },

            nameTextStyle: {

                fontSize: 14,

                color: '#000',

                fontWeight: 600,

                fontFamily: 'Microsoft YaHei',

            },

        }

    ],

    yAxis : [

        {

            name : 'yAxisName',

            type : 'value',

            min: 0,

            max: 50,

            nameTextStyle: {

                fontSize: 14,

                color: '#000',

                fontWeight: 600,

                fontFamily: 'Microsoft YaHei',

            },

            axisLabel: {

                textStyle: {

                    fontSize: 14,

                    color: '#000',

                    fontWeight: 600,

                    fontFamily: 'Microsoft YaHei',

                }

            },

        }

],

    series : [

        {

            name: ' barName',

            type:'bar',

            label: {

                normal: {

                    show: true,

                    position: 'top',

                    formatter: '{c}%',

                    textStyle: {

                        fontSize: 14,

                        color: '#000',

                        fontWeight: 600,

                        fontFamily: 'Microsoft YaHei',

                    }

                }

            },

            data: []

        },

        {

            name: 'barName2',

            type:'bar',

            label: {

                normal: {

                    show: true,

                    position: 'top',

                    formatter: function (value: any) {

                        if(value.data > 0){

                            return value.data + '%';

                        }else {

                            return value.data;

                        }

                    },

                    textStyle: {

                        fontSize: 14,

                        color: '#000',

                        fontWeight: 600,

                        fontFamily: 'Microsoft YaHei',

                    }

                },

            },

            itemStyle: {

                normal:{

                    color: '#49A9EE'

                }

            },

            data: []

        }

]

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容