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

分面使用slider,当窗口发生变化时,slider不会跟随窗口变化而自适应 #3592

Closed
keke195 opened this issue Aug 26, 2021 · 6 comments

Comments

@keke195
Copy link

keke195 commented Aug 26, 2021

分面使用slider后,当窗口发生变化时,slider不会跟随窗口变化而自适应
image
image

感觉就是最初始状态的slider是多长,不论窗口怎么变化sliler都不会变化而自适应一直都是最初始状态的长度

代码如下:
chart.facet('mirror', {
fields: ['mold'],
showTitle: false, // 显示标题
padding: [10, 0, 45, 80],
eachView: function eachView(view, facet) {
var colValue = facet.rowValue,
data = facet.data;
view.data(data);
view.scale(that._defineProperty({}, '' + colValue, {
alias: colValue == 'used' ? unit : '可用百分比(%)'
}));
view.axis(colValue, {
title: {
autoRotate: false,
offset: -10,
position: 'end',
textStyle: {
fill: '#aaaaaa',
textAlign: 'start'
}
},
});
view.option('slider', {
start: 0,
end: 1,
padding: [0, 0, -5, 0],
trendCfg: {
isArea: false,
},
});
view.line().position('time*' + colValue).tooltip('time*' + colValue +
"type",
function(time, value,type) { // tooltip的第一个参数写上需要显示的字段'item1
item2*...';第二个参数为一个函数,该函数的参数为需要显示的字段。
return {
name: type,
subTitle: type != firstType ? "" : (colValue == 'used' ? unit :
'可用百分比(%)'),
value: value + (colValue == 'used' ? unit.substring(unit.indexOf(
"(") + 1, unit.indexOf(")")) : '%')
}
}).color("type");
view.point().position("time*" + colValue).color("type").shape("circle")
.tooltip(false);
}
});
chart.render();

Environment Info
g2 4.1.24
System -
Browser -
@YYL1999
Copy link

YYL1999 commented Aug 26, 2021

写个codesandbox看看 兄弟

@keke195
Copy link
Author

keke195 commented Aug 26, 2021

写个codesandbox看看 兄弟

https://codesandbox.io/s/stupefied-stonebraker-ycubm?file=/index.html

@YYL1999
Copy link

YYL1999 commented Aug 26, 2021

写个codesandbox看看 兄弟

https://codesandbox.io/s/stupefied-stonebraker-ycubm?file=/index.html

看到了 resize后slider没有变化

@keke195
Copy link
Author

keke195 commented Aug 26, 2021

写个codesandbox看看 兄弟

https://codesandbox.io/s/stupefied-stonebraker-ycubm?file=/index.html

看到了 resize后slider没有变化

是的,有解决办法么

@hustcc
Copy link
Member

hustcc commented Aug 22, 2023

Sorry, due to problems in the program's architecture design, we are unable to effectively fix the issues. But it fixed in G2 5.0, you can have a try.

@hustcc hustcc closed this as completed Aug 22, 2023
@caizhisheng
Copy link

@keke195 请问最终解决这个问题了吗?在不升级版本的情况下。 我也遇到同样的问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants