Commit 217d9838 authored by Masayuki Tanaka's avatar Masayuki Tanaka

Fix svgLeft - #52

parent 8656efac
...@@ -296,8 +296,9 @@ ...@@ -296,8 +296,9 @@
innerRadius = hasDonutType(c3.data.targets) ? radius * 0.6 : 0; innerRadius = hasDonutType(c3.data.targets) ? radius * 0.6 : 0;
} }
function getSvgLeft() { function getSvgLeft() {
var svgLeft = svg.property('offsetLeft'); var svgRect = d3.select('.y.axis').node().getBoundingClientRect(),
return svgLeft ? svgLeft : 0; chartRect = d3.select(__bindto).node().getBoundingClientRect();
return svgRect.right - chartRect.left - getCurrentPaddingLeft();
} }
function getCurrentWidth() { function getCurrentWidth() {
return __size_width ? __size_width : getParentWidth(); return __size_width ? __size_width : getParentWidth();
...@@ -1064,7 +1065,8 @@ ...@@ -1064,7 +1065,8 @@
tHeight = tooltip.property('offsetHeight'); tHeight = tooltip.property('offsetHeight');
// Determin tooltip position // Determin tooltip position
if (__axis_rotated) { if (__axis_rotated) {
tooltipLeft = mouse[0] + 100; svgLeft = getSvgLeft();
tooltipLeft = svgLeft + mouse[0] + 100;
tooltipRight = tooltipLeft + tWidth; tooltipRight = tooltipLeft + tWidth;
chartRight = getCurrentWidth() - getCurrentPaddingRight(); chartRight = getCurrentWidth() - getCurrentPaddingRight();
tooltipTop = x(dataToShow[0].x) + 20; tooltipTop = x(dataToShow[0].x) + 20;
......
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