Skip to content
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] 扩展mark执行动画时某些数据下会跳帧 #1760

Closed
neuqzxy opened this issue Dec 14, 2023 · 0 comments
Closed

[Bug] 扩展mark执行动画时某些数据下会跳帧 #1760

neuqzxy opened this issue Dec 14, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@neuqzxy
Copy link
Contributor

neuqzxy commented Dec 14, 2023

Version

1.7.2

Link to Minimal Reproduction

1.7.2

Steps to Reproduce

function testChart() {
const vchart = new VChart({
"type": "bar",
"title": {
"visible": true,
"align": "center",
"text": "2022年世界国家和地区GDP总量",
"subtext": "数据来源:国际货币基金组织(IMF)2023年4月发布",
"textStyle": {
"fill": "#FDFDFD",
"lineHeight": 28,
"fontSize": 22,
"fontFamily": "PingFangSC-Regular",
"fontWeight": "bolder"
},
"subtextStyle": {
"fill": "#BBBDC3",
"lineHeight": 16,
"fontSize": 12,
"fontFamily": "PingFangSC-Regular",
"fontWeight": "bolder"
},
},
"xField": "GDP",
"yField": "Country Name CN",
"animationUpdate": {
"bar": [
{
"type": "update",
"options": {
"excludeChannels": [
"x",
"y"
]
},
"duration": 431.0344827586207,
"easing": "linear"
},
{
"channel": [
"x",
"y"
],
"options": {
"excludeChannels": [
"width"
]
},
"duration": 431.0344827586207,
"easing": "linear"
}
],
"axis": {
"duration": 431.0344827586207,
"easing": "linear"
}
},
"direction": "horizontal",
"axes": [
{
"animation": true,
"orient": "bottom",
"type": "linear",
"visible": true,
"title": {
"visible": false,
"style": {
"fill": "#FFFFFF"
}
},
"label": {
"style": {
"fill": "#888C93",
"fontFamily": "PingFangSC-Regular",
"fontSize": 12,
"fontWeight": "bolder"
}
},
"domainLine": {
"visible": true,
"style": {
"stroke": "#404349",
"lineWidth": 1
}
},
"grid": {
"visible": true,
"style": {
"lineDash": [
3,
3
],
"stroke": "#404349"
}
}
},
{
"animation": true,
"id": "axis-left",
"orient": "left",
"type": "band",
"tick": {
"visible": false
},
"title": {
"visible": false,
"style": {
"fill": "#FFFFFF"
}
},
"label": {
"style": {
"fill": "#888C93",
"fontFamily": "PingFangSC-Regular",
"fontSize": 12,
"fontWeight": "bolder"
}
},
"domainLine": {
"visible": true,
"style": {
"stroke": "#404349",
"lineWidth": 1
}
},
"grid": {
"visible": false,
"style": {
"lineDash": [
3,
3
],
"stroke": "#404349"
}
}
}
],
"data": [
{
"id": "id",
"values": [
{
"Country Name": "United States",
"Country Name CN": "美国",
"Country Code": "USA",
"Year": "1974",
"GDP": "1548825000000"
},
// {
// "Country Name": "Japan",
// "Country Name CN": "日本",
// "Country Code": "JPN",
// "Year": "1974",
// "GDP": "477155786487.722"
// },
// {
// "Country Name": "France",
// "Country Name CN": "法国",
// "Country Code": "FRA",
// "Year": "1974",
// "GDP": "286526186579.378"
// },
// {
// "Country Name": "United Kingdom",
// "Country Name CN": "英国",
// "Country Code": "GBR",
// "Year": "1974",
// "GDP": "206131369798.971"
// },
// {
// "Country Name": "Italy",
// "Country Name CN": "意大利",
// "Country Code": "ITA",
// "Year": "1974",
// "GDP": "198906210777.017"
// },
// {
// "Country Name": "Canada",
// "Country Name CN": "加拿大",
// "Country Code": "CAN",
// "Year": "1974",
// "GDP": "160408697648.262"
// },
// {
// "Country Name": "China",
// "Country Name CN": "中国",
// "Country Code": "CHN",
// "Year": "1974",
// "GDP": "144182133387.722"
// },
// {
// "Country Name": "Brazil",
// "Country Name CN": "巴西",
// "Country Code": "BRA",
// "Year": "1974",
// "GDP": "105136007528.76"
// },
// {
// "Country Name": "India",
// "Country Name CN": "印度",
// "Country Code": "IND",
// "Year": "1974",
// "GDP": "98198276856.9136"
// },
// {
// "Country Name": "Australia",
// "Country Name CN": "澳大利亚",
// "Country Code": "AUS",
// "Year": "1974",
// "GDP": "88906411201.1791"
// }
]
}
],
"barWidth": "50%",
"bar": {
"style": {}
},
extensionMark: [
{
type: 'symbol',
dataIndex: 0,
visible: true,
animationAppear: {
duration: 600,
easing: 'linear',
},
animationUpdate: {
symbol: [
{
channel: ['x', 'y'],
duration: 600,
easing: 'linear',
},
],
},
style: {
// flag path
symbolType: 'circle',
x: (datum: any, ctx: any) => {
debugger;
console.log(ctx.valueToX([datum['GDP']]));
// return Math.max(ctx.valueToX([datum['GDP']]), 1111.311334);
return ctx.valueToX([datum['GDP']]);
},
dx: 20,
dy: (datum: any, ctx: any) => {
return ctx.yBandwidth() / 2;
},
y: (datum: any, ctx: any) => ctx.valueToY([datum['Country Name CN']]),
background: (datum: any) => {
console.log('abc')
return 'red'
},
// fill: 'transparent',
size: (datum: any, ctx: any) => {
return 20;
},
},
}
],
"color": {
"domain": [
"中国",
"美国",
"日本",
"巴西",
"印度",
"英国",
"法国",
"澳大利亚",
"加拿大",
"意大利"
],
"range": [
{
"gradient": "linear",
"x0": 0,
"y0": 0,
"x1": 1,
"y1": 0,
"stops": [
{
"offset": 0,
"color": "rgba(255, 0, 110, 0)"
},
{
"offset": 1,
"color": "rgba(255, 0, 110, 1)"
}
]
},
{
"gradient": "linear",
"x0": 0,
"y0": 0,
"x1": 1,
"y1": 0,
"stops": [
{
"offset": 0,
"color": "rgba(10, 197, 239, 0)"
},
{
"offset": 1,
"color": "rgba(10, 197, 239, 1)"
}
]
},
{
"gradient": "linear",
"x0": 0,
"y0": 0,
"x1": 1,
"y1": 0,
"stops": [
{
"offset": 0,
"color": "rgba(131, 56, 236, 0)"
},
{
"offset": 1,
"color": "rgba(131, 56, 236, 1)"
}
]
},
{
"gradient": "linear",
"x0": 0,
"y0": 0,
"x1": 1,
"y1": 0,
"stops": [
{
"offset": 0,
"color": "rgba(255, 190, 12, 0)"
},
{
"offset": 1,
"color": "rgba(255, 190, 12, 1)"
}
]
},
{
"gradient": "linear",
"x0": 0,
"y0": 0,
"x1": 1,
"y1": 0,
"stops": [
{
"offset": 0,
"color": "rgba(255, 60, 60, 0)"
},
{
"offset": 1,
"color": "rgba(255, 60, 60, 1)"
}
]
},
{
"gradient": "linear",
"x0": 0,
"y0": 0,
"x1": 1,
"y1": 0,
"stops": [
{
"offset": 0,
"color": "rgba(119, 255, 96, 0)"
},
{
"offset": 1,
"color": "rgba(119, 255, 96, 1)"
}
]
},
{
"gradient": "linear",
"x0": 0,
"y0": 0,
"x1": 1,
"y1": 0,
"stops": [
{
"offset": 0,
"color": "rgba(240, 51, 127, 0)"
},
{
"offset": 1,
"color": "rgba(240, 51, 127, 1)"
}
]
},
{
"gradient": "linear",
"x0": 0,
"y0": 0,
"x1": 1,
"y1": 0,
"stops": [
{
"offset": 0,
"color": "rgba(103, 65, 177, 0)"
},
{
"offset": 1,
"color": "rgba(103, 65, 177, 1)"
}
]
},
{
"gradient": "linear",
"x0": 0,
"y0": 0,
"x1": 1,
"y1": 0,
"stops": [
{
"offset": 0,
"color": "rgba(21, 255, 171, 0)"
},
{
"offset": 1,
"color": "rgba(21, 255, 171, 1)"
}
]
},
{
"gradient": "linear",
"x0": 0,
"y0": 0,
"x1": 1,
"y1": 0,
"stops": [
{
"offset": 0,
"color": "rgba(219, 3, 242, 0)"
},
{
"offset": 1,
"color": "rgba(219, 3, 242, 1)"
}
]
}
]
},
"seriesField": "Country Name CN",
"background": "transparent",
"label": {
"visible": true,
"overlap": false,
"animation": {
"duration": 431.0344827586207,
"easing": "linear"
},
"style": {
"fill": "#FFFFFF",
"stroke": false,
"dx": 30
}
}
}, {dom: 'root'});
vchart.renderSync();
const data = [
{
"id": "id",
"values": [
{
"Country Name": "United States",
"Country Name CN": "美国",
"Country Code": "USA",
"Year": "1973",
"GDP": "1428549000000"
},
// {
// "Country Name": "Japan",
// "Country Name CN": "日本",
// "Country Code": "JPN",
// "Year": "1973",
// "GDP": "429857320166.565"
// },
// {
// "Country Name": "France",
// "Country Name CN": "法国",
// "Country Code": "FRA",
// "Year": "1973",
// "GDP": "265381555686.506"
// },
// {
// "Country Name": "United Kingdom",
// "Country Name CN": "英国",
// "Country Code": "GBR",
// "Year": "1973",
// "GDP": "192537971582.558"
// },
// {
// "Country Name": "Italy",
// "Country Name CN": "意大利",
// "Country Code": "ITA",
// "Year": "1973",
// "GDP": "174913182331.451"
// },
// {
// "Country Name": "China",
// "Country Name CN": "中国",
// "Country Code": "CHN",
// "Year": "1973",
// "GDP": "138544284708.957"
// },
// {
// "Country Name": "Canada",
// "Country Name CN": "加拿大",
// "Country Code": "CAN",
// "Year": "1973",
// "GDP": "131321859214.079"
// },
// {
// "Country Name": "India",
// "Country Name CN": "印度",
// "Country Code": "IND",
// "Year": "1973",
// "GDP": "84374541625.3338"
// },
// {
// "Country Name": "Brazil",
// "Country Name CN": "巴西",
// "Country Code": "BRA",
// "Year": "1973",
// "GDP": "79279057730.829"
// },
// {
// "Country Name": "Australia",
// "Country Name CN": "澳大利亚",
// "Country Code": "AUS",
// "Year": "1973",
// "GDP": "63782190903.2671"
// }
]
},
{
"id": "id",
"values": [
{
"Country Name": "United States",
"Country Name CN": "美国",
"Country Code": "USA",
"Year": "1975",
"GDP": "1688923000000"
},
// {
// "Country Name": "Japan",
// "Country Name CN": "日本",
// "Country Code": "JPN",
// "Year": "1975",
// "GDP": "518855814542.728"
// },
// {
// "Country Name": "France",
// "Country Name CN": "法国",
// "Country Code": "FRA",
// "Year": "1975",
// "GDP": "362000917852.226"
// },
// {
// "Country Name": "United Kingdom",
// "Country Name CN": "英国",
// "Country Code": "GBR",
// "Year": "1975",
// "GDP": "241756637168.142"
// },
// {
// "Country Name": "Italy",
// "Country Name CN": "意大利",
// "Country Code": "ITA",
// "Year": "1975",
// "GDP": "226944777283.511"
// },
// {
// "Country Name": "Canada",
// "Country Name CN": "加拿大",
// "Country Code": "CAN",
// "Year": "1975",
// "GDP": "173834029787.652"
// },
// {
// "Country Name": "China",
// "Country Name CN": "中国",
// "Country Code": "CHN",
// "Year": "1975",
// "GDP": "163431551779.761"
// },
// {
// "Country Name": "Brazil",
// "Country Name CN": "巴西",
// "Country Code": "BRA",
// "Year": "1975",
// "GDP": "123709376567.89"
// },
// {
// "Country Name": "Australia",
// "Country Name CN": "澳大利亚",
// "Country Code": "AUS",
// "Year": "1975",
// "GDP": "97226546497.3372"
// },
// {
// "Country Name": "India",
// "Country Name CN": "印度",
// "Country Code": "IND",
// "Year": "1975",
// "GDP": "97159222028.3357"
// }
]
}
];
setTimeout(() => {
vchart.updateData('id', data[1].values)
}, 5000)
}

Current Behavior

updateData后,动画会跳帧

Expected Behavior

updateData后,动画不跳帧

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

@neuqzxy neuqzxy added the bug Something isn't working label Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant