echarts 当横纵轴类型均为value时,设置stack后数据异常

64jmpszr  于 2022-10-26  发布在  Echarts
关注(0)|答案(2)|浏览(220)

Version

4.9.0

Steps to reproduce

option = {
	xAxis: {
		type: 'value'
	},
	yAxis: {
		type: 'value'
	},
	dataset: [{
		source: [{
			"time": 0,
			"survival": 1,
			"lower": 1,
			"upper": 1,
			"diff": 0,
			"offset": 0,
			"nrisk": 224
		}, {
			"time": 0.0025,
			"survival": 1,
			"lower": 1,
			"upper": 1,
			"diff": 0,
			"offset": 0,
			"nrisk": 223
		}, {
			"time": 0.016666666666666666,
			"survival": 1,
			"lower": 1,
			"upper": 1,
			"diff": 0,
			"offset": 0,
			"nrisk": 222
		}],
		dimensions: ['time', 'survival', 'lower', 'upper', 'nrisk', 'diff', 'offset']
	}],
	series: [{
		datasetIndex: 0,
		name: 'groupName_L',
		type: 'line',
		step: 'start',
		encode: {
			x: 'time',
			y: 'lower'
		},
		itemStyle: {
			color: '#333'
		},
		areaStyle: {
			color: '#333'
		},
		stack: 'groupName',
		symbol: 'none'
	}, {
		datasetIndex: 0,
		name: 'groupName _U',
		type: 'line',
		step: 'start',
		encode: {
			x: 'time',
			y: 'upper'
		},
		itemStyle: {
			color: '#ccc'
		},
		lineStyle: {
			opacity: 0
		},
		areaStyle: {
			color: '#ccc'
		},
		stack: 'groupName',
		symbol: 'none'
	}]
};

What is expected?

绘制上下两条线,之间的区域染成指定颜色,应与xAxis.type='catrgory'的结果类似

What is actually happening?

后叠加的数据同时变动了x和y的值,导致原本同一个x值对应的两个点不在同一个垂直线上

v64noz0r

v64noz0r1#

Hi! We've received your issue and please be patient to get responded. 🎉
The average response time is expected to be within one day for weekdays.

In the meanwhile, please make sure thatyou have posted enough image to demo your request. You may also check out the API and chart option to get the answer.

If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to dev@echarts.apache.org . Please attach the issue link if it's a technical question.

If you are interested in the project, you may also subscribe our mailing list .

Have a nice day! 🍵

mlmc2os5

mlmc2os52#

@qwerty920125 It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people, we'd like to suggest using English next time. 🤗

TRANSLATED

TITLE

When the horizontal longitudinal axis type is Value, the data exception after setting Stack is set.

BODY

Version

4.9.0

Steps to reproduce

option = {
	xAxis: {
		type: 'value'
	},
	yAxis: {
		type: 'value'
	},
	dataset: [{
		source: [{
			"time": 0,
			"survival": 1,
			"lower": 1,
			"upper": 1,
			"diff": 0,
			"offset": 0,
			"nrisk": 224
		}, {
			"time": 0.0025,
			"survival": 1,
			"lower": 1,
			"upper": 1,
			"diff": 0,
			"offset": 0,
			"nrisk": 223
		}, {
			"time": 0.016666666666666666,
			"survival": 1,
			"lower": 1,
			"upper": 1,
			"diff": 0,
			"offset": 0,
			"nrisk": 222
		}],
		dimensions: ['time', 'survival', 'lower', 'upper', 'nrisk', 'diff', 'offset']
	}],
	series: [{
		datasetIndex: 0,
		name: 'groupName_L',
		type: 'line',
		step: 'start',
		encode: {
			x: 'time',
			y: 'lower'
		},
		itemStyle: {
			color: '#333'
		},
		areaStyle: {
			color: '#333'
		},
		stack: 'groupName',
		symbol: 'none'
	}, {
		datasetIndex: 0,
		name: 'groupName _U',
		type: 'line',
		step: 'start',
		encode: {
			x: 'time',
			y: 'upper'
		},
		itemStyle: {
			color: '#ccc'
		},
		lineStyle: {
			opacity: 0
		},
		areaStyle: {
			color: '#ccc'
		},
		stack: 'groupName',
		symbol: 'none'
	}]
};

What is expected?

Draw the upper and lower two lines, and the area between them is dyed a specified color, which should be similar to the result of xAxis.type.'catrgory'
! (Expected results) ( https://user-images.githubusercontent.com/4928881/110914130-ee166700-8350-11eb-9493-26498996424d.png )

What is actually happening?

The data that is superimposed changes the values of x and y at the same time, causing the two points that would otherwise correspond to the same x value to not be on the same vertical line
! (Current results) ( https://user-images.githubusercontent.com/4928881/110914113-e6ef5900-8350-11eb-8c81-35b4c5db261e.png )

相关问题