echarts icon indicating copy to clipboard operation
echarts copied to clipboard

yAxis设置max在特殊数据下导致的IE11显示问题

Open CYvonne opened this issue 9 years ago • 2 comments

One-line summary [问题简述]

如题,当我设置了yAixis[1]的max为100(即变量y2Max),myData2 = [82,71,79,84,99,89,89];(存在一个值大于92的项)时,在IE11会报错"意外地调用了方法或属性...",并且图表显示错误。可以把下面代码放到IE11下的官方示例在线运行看一下。

在chrome下没问题。

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]:
  • Browser version [浏览器类型和版本]:
  • OS Version [操作系统类型和版本]:

Expected behaviour [期望结果]

正常显示

ECharts option [ECharts配置项]


 var y1Max = 100, y2Max = 100;
 var myxAxisData = ['05-11','05-12','05-13','05-14','05-15','05-16','05-17'];
 var myData1 = [28,25,27,26,33,33,33];
 var myData2 = [82,71,79,84,99,89,89];

option = {
	 title: {
		text: '最近一周趋势',
		textStyle: {
			fontWeight: 'bold',
			fontSize: 12
		},
		padding: [15, 0, 0, 0]
	},
	legend: {
		data: ['数量', '比例'],
		right: 0,
		padding: [15, 0, 0, 0]
	},
	xAxis: {
		data: myxAxisData,
		axisLabel: {
			textStyle: {
				color: '#000'
			}
		},
		axisTick: {
			show: true
		},
		axisLine: {
			show: true
		},
		z: 10
	},
	yAxis: [{
		type: 'value',
		name: '数量',
		min: 0,
		max: y1Max,
		position: 'left',
		splitLine: {
			show: false
		}
	}, {
		type: 'value',
		name: '比例',
		min: 0,
		max: y2Max,
		position: 'right',
		axisLabel: {
			formatter: '{value}%'
		},
		offset: -6,
		splitLine: {
			show: false
		}
	}],
	series: [{
		name: '数量',
		type: 'bar',
		barWidth: 18,
		yAxisIndex: 0,
		label: {
			normal: {
				color: '#73cafd',
				show: true,
				position: 'top'
			}
		},
		itemStyle: {
			normal: {
				color: '#73cafd'
			}
		},
		data: myData1
	}, {
		name: '比例',
		type: 'line',
		yAxisIndex: 1,
		label: {
			normal: {
				textStyle: {
					color: '#999',
				},
				show: true,
				position: 'top',
				formatter: '{c}%'
			}
		},
		lineStyle: {
			normal: {
				color: '#999',
				width: 3,
				shadowColor: 'rgba(0,0,0,0.4)',
				shadowBlur: 10,
				shadowOffsetY: 10
			}
		},
		data: myData2
	}]
}

Other comments [其他信息]

e jpg

CYvonne avatar May 18 '17 10:05 CYvonne

ie11 的 canvas 中,clip 和 shadow 同时使用的时候,在完全 clip 的时候可能抛出这个异常。 暂时避开方式:

series: [{
    ...
}, {
    name: '比例',
    type: 'line',
    animationDuration: 0,  // 加上这句
    ...
}]

后续在 ie11 下兼容下这个问题。

100pah avatar Jul 10 '17 08:07 100pah

确实,给series[1]去掉shadow或者设置clipOverflow:false都能正常显示。不过你们解决得太慢了,项目都做完了;-)

CYvonne avatar Jul 17 '17 06:07 CYvonne