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

多类型图在chart.changeData后数据分色问题 #318

Closed
lemonsuny opened this issue Sep 10, 2018 · 1 comment
Closed

多类型图在chart.changeData后数据分色问题 #318

lemonsuny opened this issue Sep 10, 2018 · 1 comment
Assignees
Labels
Milestone

Comments

@lemonsuny
Copy link

柱状图与两条线形图的组合图形,原始状态分为三种颜色,chart.changeData后,线形图不能保持开始的颜色。代码如下:$('#btn')是刷新按钮
var data = [{
name: 'Jon',
score: 282,
avgScore: 94,
value: 75
}, {
name: 'Aaron',
score: 208,
avgScore: 41.6,
value: 32
}, {
name: 'Warren',
score: 186,
avgScore: 46.5,
value: 88
}, {
name: 'David',
score: 184,
avgScore: 30.67,
value: 60
}, {
name: 'Joel',
score: 177,
avgScore: 44.25,
value: 70
}];

var chart = new F2.Chart({
id: 'mountNode',
pixelRatio: window.devicePixelRatio,
padding: ['auto', 'auto', 90, 'auto']
});

chart.source(data, {
score: {
tickInterval: 50,
alias: '个人分数'
},
avgScore: {
ticks: [0, 17, 33, 50, 67, 83, 100],
alias: '平均分数'
},
value: {
ticks: [0, 17, 33, 50, 67, 83, 100],
alias: '历史分数'
}
});
chart.axis('avgScore', {
grid: null
});
chart.axis('value', {
grid: null
});

chart.interval().position('namescore').color('#0cc');
chart.line().position('name
value').color('#ffc26a');
chart.line().position('name*avgScore').color('#ff7f8d');
chart.render();
$('#btn').click(function() {
var res = [{
name: 'Jon',
score: 282,
avgScore: 94,
value: 60
}, {
name: 'Aaron',
score: 208,
avgScore: 41.6,
value: 60
}, {
name: 'Warren',
score: 186,
avgScore: 46.5,
value: 60
}, {
name: 'David',
score: 184,
avgScore: 30.67,
value: 60
}, {
name: 'Joel',
score: 177,
avgScore: 44.25,
value: 60
}, {
name: 'Kyle',
score: 150,
avgScore: 50,
value: 60
}, {
name: 'Jordan',
score: 148,
avgScore: 24.67,
value: 80
}, {
name: 'Jack',
score: 138,
avgScore: 34.5,
value: 60
}, {
name: 'Kuldeep',
score: 130,
avgScore: 32.5,
value: 60
}, {
name: 'Max',
score: 128,
avgScore: 32,
value: 60
}, {
name: 'Angus',
score: 127,
avgScore: 62.5,
value: 60
}];
chart.changeData(res);
});
请问如何解决呢?

@simaQ simaQ self-assigned this Sep 11, 2018
@simaQ simaQ added the bug label Sep 11, 2018
@simaQ simaQ closed this as completed in ea7adc9 Sep 11, 2018
simaQ added a commit that referenced this issue Sep 11, 2018
fix: Optimized geometry shape's id generation strategy. Closed #318.
@simaQ
Copy link
Contributor

simaQ commented Sep 11, 2018

@antv/f2@3.2.3-beta.1 版本修复了这个问题!

@simaQ simaQ added this to the 3.2.3 milestone Sep 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants