antvis/G2

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

keke195 posted onGitHub

分面使用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 -

写个codesandbox看看 兄弟

posted by YYL1999 over 3 years ago
posted by keke195 over 3 years ago

写个codesandbox看看 兄弟

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

看到了 resize后slider没有变化

posted by YYL1999 over 3 years ago

写个codesandbox看看 兄弟

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

看到了 resize后slider没有变化

是的,有解决办法么

posted by keke195 over 3 years ago

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.

posted by hustcc over 1 year ago

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

posted by caizhisheng over 1 year ago

Fund this Issue

$0.00
Funded

Pull requests