fix: donut chart, single data point bug

This commit is contained in:
Shivam Mishra 2021-04-18 10:39:21 +00:00 committed by GitHub
parent ed8f97efd5
commit fa559cc8bd
2 changed files with 13 additions and 3 deletions

View File

@ -25,6 +25,12 @@ export default class DonutChart extends PieChart {
: this.center.y - this.strokeWidth / 2;
}
resetHover(path, color) {
transform(path,'translate3d(0,0,0)');
this.tip.hideTip();
path.style.stroke = color;
}
setupComponents() {
let s = this.state;

View File

@ -131,12 +131,16 @@ export default class PieChart extends AggregationChart {
this.tip.setValues(x, y, { name: title, value: percent + "%" });
this.tip.showTip();
} else {
transform(path, 'translate3d(0,0,0)');
this.tip.hideTip();
path.style.fill = color;
this.resetHover(path, color)
}
}
resetHover(path, color) {
transform(path, 'translate3d(0,0,0)');
this.tip.hideTip();
path.style.fill = color;
}
bindTooltip() {
this.container.addEventListener('mousemove', this.mouseMove);
this.container.addEventListener('mouseleave', this.mouseLeave);