我想创建两个或多个共享单个图例的图表。在任何图表上选择扇区时,相应的图例项应突出显示。怎么做?
pie2 = r.piechart(545, 440, 25, [0, 22.22, 22.22, 11.11, 44.44]);
pie = r.piechart(490, 540, 25, [0, 0, 12.5, 25, 62.5], {
legend: ["-20%", "21 - 40 %", "41 - 60 %", "61 - 80 %",
"81 - 100 %"
],
colors: ["#475664", "#8C5F66", "#DB7369", "#F29961", "#F0B165"],
legendpos: "west",
legendothers: "Others",
});
pie.hover(function() {
this.sector.stop();
this.sector.scale(1.1, 1.1, this.cx, this.cy);
if (this.label) {
this.label[0].stop();
this.label[0].attr({
r: 7.5
});
this.label[1].attr({
"font-weight": 800
});
}
}, function() {
this.sector.animate({
transform: 's1 1 ' + this.cx + ' ' + this.cy
}, 500, "bounce");
if (this.label) {
this.label[0].animate({
r: 5
}, 500, "bounce");
this.label[1].attr({
"font-weight": 400
});
}
});
pie2.hover(function() {
this.sector.stop();
this.sector.scale(1.1, 1.1, pie2.cx, pie2.cy);
//?????
pie.labels[1].stop();
pie.labels[1].attr({
r: 7.5
});
pie.labels[1].attr({
"font-weight": 800
});
}, function() {
this.sector.animate({
transform: 's1 1 ' + pie2.cx + ' ' + pie2.cy
}, 500, "bounce");
//??????
pie.labels[1].animate({
r: 5
}, 500, "bounce");
pie.labels[1].attr({
"font-weight": 400
});
});