New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

旭日图设置渐变时bug #7569

Closed
zetakv opened this Issue Jan 23, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@zetakv

zetakv commented Jan 23, 2018

One-line summary [问题简述]

设置data[i].itemStyle.color为渐变时(线性、径向)都会出现bug,图型初始生成无问题,但当鼠标悬停于有渐变属性的块时图型则出现渲染错误,并且控制台报如下BUG:
echarts.js:6554 Uncaught TypeError: Failed to execute 'addColorStop' on 'CanvasGradient': The provided float value is non-finite.
at Style.getGradient (echarts.js:6554)
at Sub.brush (echarts.js:13850)
at Painter._doPaintEl (echarts.js:9076)
at Painter._doPaintList (echarts.js:8996)
at Painter._paintList (echarts.js:8927)
at Painter.refresh (echarts.js:8818)
at ZRender.refreshImmediately (echarts.js:10675)
at ZRender.flush (echarts.js:10700)
at Object.update (echarts.js:605)
at Animation._update (echarts.js:9892)

Version & Environment [版本及环境]

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

Expected behaviour [期望结果]

希望尽快修复或有没简单的修复方案?

ECharts option [ECharts配置项]

option = {
series: {
					type: 'sunburst',
					data: data,
					radius: [0, '90%'],
					highlightPolicy: 'none',
					label: {
						rotate: '0',
					},
				}
}
`const data = [
  {
name: '111',
value: 1,
    itemStyle: {					
										color: {
											type: 'linear',
											x: 0,
											y: 0,
											x2: 1,
											y2: 1,
											colorStops: [{
												offset: 0, color: '#3e0317'
											}, {
												offset: 0.5, color: '#3e0317'
											}, {
												offset: 0.5, color: 'white'
											}, {
												offset: 1, color: 'white'
											}]
										}
									}
  }
]
`

Other comments [其他信息]

@Ovilia

This comment has been minimized.

Contributor

Ovilia commented Jan 23, 2018

@zetakv 这个问题是由于渐变色的插值引起的,因为底层不支持渐变色的插值(考虑到如果渐变颜色数不同的话,这个插值实现起来也比较麻烦)。现在的解决办法是,如果是渐变色就不使用插值动画,直接改变颜色。如果想要完全关闭动画,可以通过设置 series.animation = false 实现。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment