echarts 柱狀圖給y軸最大值加橫線

 

option = {
    color: ['#3398DB'],
    tooltip : {
        trigger: 'axis',
        axisPointer : {            // 座標軸指示器,座標軸觸發有效
            type : 'shadow'        // 默認爲直線,可選爲:'line' | 'shadow'
        }
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis : [
        {
            type : 'category',
            data : ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
            axisTick: {
                alignWithLabel: true
            }
        }
    ],
    yAxis : [
        {
            type : 'value'
        }
    ],
    series : [
        {
            name:'直接訪問',
            type:'bar',
            markLine: {
                symbol: ['none', 'none'],//去掉箭頭
                itemStyle: {
                    normal: { 
                        lineStyle: {
                            width: 1.5,
                            type: 'dashed',
                            color:'#666666'
                        },
                        label: { 
                            color:'#666666',
                            show: true, 
                            position:'end' 
                        } 
                    }
                },
                data: [{
                    type: 'max'
                },]
            },
            barWidth: '60%',
            data:[10, 52, 200, 334, 390, 330, 220]
        }
    ]
};

參考資料:https://www.echartsjs.com/zh/option.html#series-bar.markLine

發佈了91 篇原創文章 · 獲贊 97 · 訪問量 23萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章