Commit 8fd122c4 authored by Masayuki Tanaka's avatar Masayuki Tanaka

Fix rotated when multiple xs

parent cfa41d1e
...@@ -1633,7 +1633,7 @@ ...@@ -1633,7 +1633,7 @@
max = _max ? _max : values.length - 1, max = _max ? _max : values.length - 1,
med = Math.floor((max - min) / 2) + min, med = Math.floor((max - min) / 2) + min,
value = values[med], value = values[med],
diff = x(value.x) - pos[0], diff = x(value.x) - pos[__axis_rotated ? 1 : 0],
candidates; candidates;
// Update range for search // Update range for search
...@@ -1992,8 +1992,10 @@ ...@@ -1992,8 +1992,10 @@
} }
function dist(data, pos) { function dist(data, pos) {
var yScale = getAxisId(data.id) === 'y' ? y : y2; var yScale = getAxisId(data.id) === 'y' ? y : y2,
return Math.pow(x(data.x) - pos[0], 2) + Math.pow(yScale(data.value) - pos[1], 2); xIndex = __axis_rotated ? 1 : 0,
yIndex = __axis_rotated ? 0 : 1;
return Math.pow(x(data.x) - pos[xIndex], 2) + Math.pow(yScale(data.value) - pos[yIndex], 2);
} }
function endall(transition, callback) { function endall(transition, callback) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment