鍍金池/ 問答/網絡安全  HTML/ Echart如何實現下圖的樣式?

Echart如何實現下圖的樣式?

clipboard.png

有個項目很急,搞了很久,
現在不明白的地方是,
1.我只會把y軸全取消掉,怎么能把字段(總數,博士,碩士,高級)保留出來?
2.怎么讓柱狀圖上的旁邊怎么顯示數字?

求熟悉Echart的大神來幫我T_T

回答
編輯回答
心上人

1.設置Y軸的axisLine/splitline/axisTick為隱藏

2.設置serieslabel顯示,position設為right

源代碼,記得在4.0以上版本運行,低版本請自行修改配置

app.title = '世界人口總量 - 條形圖';

option = {
    title: {
        text: '世界人口總量',
        subtext: '數據來自網絡'
    },
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'shadow'
        }
    },
    legend: {
        data: ['2012年']
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis: {
        type: 'value',
        boundaryGap: [0, 0.01],
        splitLine: {
            show: false
        }
    },
    yAxis: {
        type: 'category',
        data: ['巴西', '印尼', '美國', '印度', '中國', '世界人口(萬)'],
        axisLine: {
            show: false
        },
        splitLine: {
            show: false
        },
        axisTick: {
            show: false
        },
    },
    series: [
        {
            name: '2012年',
            type: 'bar',
            label: {
                show: true,
                position: 'right'
            },
            data: [19325, 23438, 31000, 121594, 134141, 681807]
        }
    ]
};
2017年10月1日 01:17
編輯回答
涼心人

這個用Echarts干啥 用div 做背景色填充就行了嘛

2018年5月3日 14:03
編輯回答
絯孑氣

顏色變一下就行了
http://gallery.echartsjs.com/...

2018年2月3日 15:20