有时候但愿默认选中特定类目,取消选中特定类目,那么能够这样作:
legend: { data: ['2011年', '2012年'], selected: { '2011年':false } }
只须要将不想显示的项设置为false便可。html
legend: { icon: 'roundRect' // circle, }
详情:https://www.echartsjs.com/opt...网络
series: [ { smooth: true;} ]
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] } ] };
持续更新中echarts