option = { title: { text: '2018年度签约分析', textStyle: { color: '#000', fontSize: 16, fontWeight: 'lighter' }, x: 'center', y: '3%' }, // 图形位置 grid: { left: '10%', right: '10%', bottom: '15%' }, // 图例 legend: { bottom: '2%' }, // 提示框 tooltip: { trigger: 'axis', axisPointer: { type: 'cross' } }, xAxis: { type: 'category', nameLocation: 'end', nameTextStyle: { align: 'left' }, // 刻度 axisTick: { show: true, length: 3 }, axisLabel: { interval: 0, margin: 8, rotate: 20 }, splitLine: { show: false }, data: this.XData }, yAxis: [ { type: 'value', name: '金额', // 名称位置 nameLocation: 'center', nameGap: 45, axisTick: { show: false }, axisLine: { show: false }, max: function (value) { if (value.max === 0) { return 100 } else { // 在这里怎么让max自动分配(与不设置max时一样),而不是不显示 return null } }, axisLabel: { formatter: '{value}W' } }, { type: 'value', name: '完成率', // 名称位置 nameLocation: 'center', nameRotate: 270, nameGap: 45, axisTick: { show: false }, axisLine: { show: false }, splitLine: { show: false }, splitNumber: 5, axisLabel: { formatter: '{value}%' } } ], series: [ { name: '计划签约', barWidth: '29%', type: 'bar', itemStyle: { color: '#ffa075' }, // 数据全部为空时,max设置的最大刻度也无法显示出来 data: [] }, { name: '实际签约', barWidth: '29%', type: 'bar', itemStyle: { color: '#589ad4' }, data: [] }, { name: '完成率', smooth: true, yAxisIndex: 1, type: 'line', itemStyle: { color: '#60d4d1' }, data: [] } ] }