const data1=[
{ x: '周一', type: '早餐', y: 15 },
{ x: '周一', type: '午餐', y: 25 },
{ x: '周二', type: '早餐', y: 12 },
{ x: '周二', type: '午餐', y: 30 },
{ x: '周三', type: '早餐', y: 15 },
{ x: '周三', type: '午餐', y: 24 },
{ x: '周四', type: '早餐', y: 10 },
{ x: '周四', type: '午餐', y: 25 },
{ x: '周五', type: '早餐', y: 13 },
{ x: '周五', type: '午餐', y: 20 },
{ x: '周六', type: '早餐', y: 10 },
{ x: '周六', type: '午餐', y: 22 },
{ x: '周日', type: '早餐', y: 12 },
{ x: '周日', type: '午餐', y: 19 },
]
const data2=[
{ x: '周一', type: '早餐2', y: 15 },
{ x: '周一', type: '午餐2', y: 25 },
{ x: '周二', type: '早餐2', y: 12 },
{ x: '周二', type: '午餐2', y: 30 },
{ x: '周三', type: '早餐2', y: 15 },
{ x: '周三', type: '午餐2', y: 24 },
{ x: '周四', type: '早餐2', y: 10 },
{ x: '周四', type: '午餐2', y: 25 },
{ x: '周五', type: '早餐2', y: 13 },
{ x: '周五', type: '午餐2', y: 20 },
{ x: '周六', type: '早餐2', y: 10 },
{ x: '周六', type: '午餐2', y: 22 },
{ x: '周日', type: '早餐2', y: 12 },
{ x: '周日', type: '午餐2', y: 19 },
{ x: '周一', type: '饮料2', y: 22 },
{ x: '周二', type: '饮料2', y: 43 },
{ x: '周三', type: '饮料2', y: 33 },
{ x: '周四', type: '饮料2', y: 22 },
{ x: '周五', type: '饮料2', y: 10 },
{ x: '周六', type: '饮料2', y: 30 },
{ x: '周日', type: '饮料2', y: 50 }
]
const spec = {
animation:false,
type: 'common',
seriesField: 'color',
data: [
{
id: 'id0',
values: data1
},
],
seriesField: 'type',
legends:[
{
orient:"right",
visible:true,
data:(d)=>d
}
],
series: [
{
type: 'line',
id: 'bar',
dataIndex: 0,
xField: ['x'],
yField: 'y'
}
],
axes: [
{ orient: 'left', seriesIndex: [0] },
{ orient: 'bottom', label: { visible: true }, type: 'band' }
]
};
const vchart = new VChart(spec, { dom: CONTAINER_ID });
vchart.renderSync();
setTimeout(()=>{
const spec2={
...spec,
legends:[
{
orient:"right",
visible:true,
data:(d)=>d
}
],
data:[
{
id: 'id0',
values: data2
},
],
}
vchart.updateSpec(spec2,false,undefined,{reMake:false})
},1000)
// Just for the convenience of console debugging, DO NOT COPY!
window['vchart'] = vchart;
Version
2.0.22
Link to Minimal Reproduction
null
Steps to Reproduce
Current Behavior
spec.legends中如果有data函数,则调用updateSpec后,图例筛选失效
若updateSpec指定了reMake:true,则可以正常筛选
1.x不会出现此问题
Expected Behavior
updateSpec后图例能够正常筛选
Environment
Any additional comments?
No response