ajax 限制显示条数,echarts legend 限制规定显示个数

  • Post author:
  • Post category:其他


Document

var obj ={};var text_data = [‘http://www.baidu.com’, ‘https://www.sogou.com’, ‘http://www.333.com’,’http://www.444.com’, ‘http://www.555.com’, ‘http://www.666.com’, ‘http://www.777.com’,’http://www.888.com’, ‘http://www.999.com’, ‘外部链接总计’];for (var i = 0; i < text_data.length; i++) {if (i > 2 && (i < text_data.length – 1)) {

obj[text_data[i]]= false;

}else{

obj[text_data[i]]= true;

}

obj[text_data[text_data.length- 1]] = true;

}//console.log(obj)

var myChart = echarts.init(document.getElementById(‘all_line’));

myChart? myChart.clear() : “”;

myChart.setOption({

tooltip: {

trigger:’axis’,

backgroundColor:’rgba(255,255,255,0.8)’,

axisPointer: {//坐标轴指示器,坐标轴触发有效

type: ‘shadow’, //默认为直线,可选为:’line’ | ‘shadow’

shadowStyle: {

color:’rgba(150,150,150,0.2)’}

},

textStyle: {

color:’#666′,

fontSize:’14px’,

},

extraCssText:’width:220px;height:60%;padding:0;box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);”‘,

formatter:function(params) {var htmlStr = “”;for (var i = 0; i < params.lengt