var data = [ { month: '1月', value: 4100, }, { month: '2月', value: 2800, }, { month: '3月', value: 3500, }, { month: '4月', value: 4500, }, { month: '5月', value: 4300, }, { month: '6月', value: 5300, }, { month: '7月', value: 5500, }, { month: '8月', value: 6100, }, { month: '9月', value: 6200, }, { month: '10月', value: 4900, }, { month: '11月', value: 6500, }, { month: '12月', value: 5400, }, ]; var xData = [], yData = []; var min = 50; data.map(function (a, b) { xData.push(a.month); if (a.value === 0) { yData.push(a.value + min); } else { yData.push(a.value); } }); option = { backgroundColor: '#111c4e', color: ['#3398DB'], tooltip: { trigger: 'axis', axisPointer: { type: 'line', lineStyle: { opacity: 0, }, }, formatter: function (prams) { if (prams[0].data === min) { return '活动分析:0%'; } else { return '活动分析:' + prams[0].data; } }, }, grid: { left: '8%', top: '7%', right: '5%', bottom: '12%', // containLabel: true, }, xAxis: [ { type: 'category', gridIndex: 0, data: xData, axisTick: { show: false, }, axisLine: { show: false, lineStyle: { color: '#0c3b71', }, }, axisLabel: { show: true, color: 'rgb(170,170,170)', fontSize: 14, }, }, ], yAxis: [ { type: 'value', // name:"单位:户", nameTextStyle: { color: 'rgb(170,170,170)', }, splitLine: { show: true, lineStyle: { color: 'rgba(255,255,255,0.2)', //网格线的颜色 type: 'dashed', }, }, // min: min, // max: 100, axisLine: { show: false, }, axisLabel: { color: 'rgb(170,170,170)', formatter: '{value}', }, }, ], series: [ { // 分隔 type: 'pictorialBar', itemStyle: { normal: { color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ { offset: 0, color: '#009cff', }, { offset: 1, color: '#00e4ff', }, ]), }, }, symbolRepeat: 'fixed', symbolMargin: 4, symbol: 'rect', symbolClip: true, symbolSize: [30, 8], symbolPosition: 'start', symbolOffset: [0, -1], data: yData, // width: 25, z: 0, zlevel: 8, }, ], };