echart 运用小结

一、legend

1、隐蔽特定类目

有时候愿望默许选中特定类目,作废选中特定类目,那末能够如许做:

legend: {
    data: ['2011年', '2012年'],
    selected: {
        '2011年':false
    }
}

只需要将不想显现的项设置为false即可。

2、设置图标外形

legend: {
    icon: 'roundRect' // circle, 
}

概况:https://www.echartsjs.com/opt…

二、series

1、曲线腻滑:

series: [
    { smooth: true;}
]

2、去掉折线中的小圆点:

series: [
    {symbol: 'none';}
]

汇总

option = {
    title: {
        text: '天下人口总量',
        subtext: '数据来自收集'
    },
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'shadow'
        }
    },
    legend: {
        data: ['2011年', '2012年'],
        selected: {
            '2011年':false
        }
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis: {
        type: 'value',
        boundaryGap: [0, 0.01]
    },
    yAxis: {
        type: 'category',
        data: ['巴西','印尼','美国','印度','中国','天下人口(万)']
    },
    series: [
        {
            name: '2011年',
            type: 'bar',
            smooth: true;
            symbol: 'none';
            data: [18203, 23489, 29034, 104970, 131744, 630230]
        },
        {
            name: '2012年',
            type: 'bar',
            symbol: 'none';
            smooth: true;
            data: [19325, 23438, 31000, 121594, 134141, 681807]
        }
    ]
};

详见demo(需自行添加设置):https://echarts.baidu.com/exa…

延续更新中

    原文作者:seven
    原文地址: https://segmentfault.com/a/1190000018501460
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞