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軸起始值為數(shù)據(jù)的最小值
        },
        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 + "%";
                            }
                        }
                    }
                },  // 顯示每一個(gè)節(jié)點(diǎn)的數(shù)值,formatter規(guī)定節(jié)點(diǎn)數(shù)據(jù)加上%
            },
            {
                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
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容