Skip to content
Snippets Groups Projects
Unverified Commit 20dea324 authored by Alexander Polyankin's avatar Alexander Polyankin Committed by GitHub
Browse files

Clip voronoi by X axis (#21186)

parent 9e534c8d
No related branches found
No related tags found
No related merge requests found
......@@ -171,6 +171,7 @@ function dispatchUIEvent(element, eventName) {
function onRenderVoronoiHover(chart) {
const parent = chart.svg().select("svg > g");
const dots = chart.svg().selectAll(".sub .dc-tooltip .dot")[0];
const axis = chart.svg().select(".axis.x");
if (dots.length === 0 || dots.length > VORONOI_MAX_POINTS) {
return;
......@@ -189,13 +190,12 @@ function onRenderVoronoiHover(chart) {
// HACK Atte Keinänen 8/8/17: For some reason the parent node is not present in Jest/Enzyme tests
// so simply return empty width and height for preventing the need to do bigger hacks in test code
const { width, height } = parent.node()
? parent.node().getBBox()
: { width: 0, height: 0 };
const axisRect = axis?.node()?.getBBox() ?? { width: 0, height: 0 };
const parentRect = parent.node()?.getBBox() ?? { width: 0, height: 0 };
const voronoi = d3.geom.voronoi().clipExtent([
[0, 0],
[width, height],
[parentRect.width, parentRect.height - axisRect.height],
]);
// circular clip paths to limit distance from actual point
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment