Echarts显示百分比

Echarts显示百分比的配置

var option1 = {
        title: {
            text: '召回率变化',
            textAlign: 'right',
            x: 'right',
            y: 'top',
        },
        tooltip: {
            trigger: 'axis',
            formatter: '{b0}<br/>{a0}: {c0}%<br />{a1}: {c1}%<br />{a2}: {c2}%'  // 显示百分比
        },
        legend: {
            data: ['school recall', 'company recall', 'total recall']
        },

        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        toolbox: {
            feature: {
                saveAsImage: {}
            }
        },
        xAxis: {
            type: 'category',
            boundaryGap: true, // x轴不从0刻度开始
            data: dates  // 日期
        },
        yAxis: {
            type: 'value',
            axisLabel: {  // 显示百分比
                show: true,
                interval: 'auto',
                formatter: '{value} %'
            },
            show: true,
            scale: true  // Y轴起始值为数据的最小值
        },
        dataZoom: {
            show: true,

        },
        series: [
            {
                name: 'school recall',
                type: 'line',
                data: school_recall,
                itemStyle: {
                    normal: {
                        label: {
                            show: true,
                            formatter: function (a, b, c) {
                                return a.data + "%";
                            }
                        }
                    }
                },  // 显示每一个节点的数值,formatter规定节点数据加上%
            },
            {
                name: 'company recall',
                type: 'line',
                data: company_recall,
                itemStyle: {
                    normal: {
                        label: {
                            show: true,
                            formatter: function (a, b, c) {
                                return a.data + "%";
                            }
                        }
                    }
                },
            },
            {
                name: 'total recall',
                type: 'line',
                data: total_recall,
                itemStyle: {
                    normal: {
                        label: {
                            show: true,
                            formatter: function (a, b, c) {
                                return a.data + "%";
                            }
                        }
                    }
                },
            },
        ]
    };
echarts显示百分比.png
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。