美文网首页
echarts 相关label配置

echarts 相关label配置

作者: 一个好昵称X | 来源:发表于2018-11-30 15:55 被阅读0次

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: []

        }

]

}

相关文章

网友评论

      本文标题:echarts 相关label配置

      本文链接:https://www.haomeiwen.com/subject/yozzfftx.html