![](https://img.kancloud.cn/a4/cf/a4cf920d00ff58ac2bb0ccc9f0e5a986_750x355.gif) ``` // 指定图表的配置项和数据 var option = { title: { }, tooltip: {}, color: '#00FF00', legend: { data:['销量'] }, xAxis: { data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"] }, visualMap: { show: false, pieces: [ { lte: 15, //这儿设置基线上下颜色区分 基线 15下面为绿色 color: '#00FF00' }, { gt: 15, lte: 30, //这儿设置基线上下颜色区分 基线 15~30下面为黄色 color: '#FFBB00' }, { gt: 30, //这儿设置基线上下颜色区分 基线 30上面为红色 color: '#FF0000' }] }, yAxis: { splitLine:{ show: false } }, series: [{ name: '销量', type: 'bar', data: [5, 20, 36, 10, 10, 20], markLine: { silent: true, //基线显示 隐藏 lineStyle: { normal: { color: '#FF00FF' // 这儿设置安全基线颜色 } }, data: [{ yAxis: 15 // 安全基线 1 }, { yAxis: 30 // 安全基线 2 }] } }] }; var option1 = { title: { }, tooltip: {}, color: '#00FF00', legend: { data:['销量'] }, visualMap: { show: false, pieces: [ { lte: 15, //这儿设置基线上下颜色全部为绿色 color: '#00FF00' }, { gt: 15, lte: 30, color: '#00FF00' }, { gt: 30, color: '#00FF00' }] }, xAxis: { data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"] }, yAxis: { splitLine:{ show: false } }, series: [{ name: '销量', type: 'bar', data: [5, 20, 36, 10, 10, 20] }] }; var count = 0; //定义一个变量用于判断 setInterval(function(){ if(count%2==0){ chartInstance.setOption(option); //交替setOption }else{ chartInstance.setOption(option1); } count+=1; },1500); return option; ```