Browse Source

Fix tooltip position when it's on the bottom - #635

pull/703/head
Masayuki Tanaka 10 years ago
parent
commit
0944f4a47e
  1. 5
      c3.js
  2. 2
      c3.min.js
  3. 5
      src/tooltip.js

5
c3.js

@ -3589,10 +3589,13 @@
if (tooltipRight > chartRight) { if (tooltipRight > chartRight) {
tooltipLeft -= tooltipRight - chartRight; tooltipLeft -= tooltipRight - chartRight;
} }
if (tooltipTop + tHeight > $$.currentHeight && tooltipTop > tHeight + 30) { if (tooltipTop + tHeight > $$.currentHeight) {
tooltipTop -= tHeight + 30; tooltipTop -= tHeight + 30;
} }
} }
if (tooltipTop < 0) {
tooltipTop = 0;
}
// Set tooltip // Set tooltip
$$.tooltip $$.tooltip
.style("top", tooltipTop + "px") .style("top", tooltipTop + "px")

2
c3.min.js vendored

File diff suppressed because one or more lines are too long

5
src/tooltip.js

@ -83,10 +83,13 @@ c3_chart_internal_fn.showTooltip = function (selectedData, mouse) {
if (tooltipRight > chartRight) { if (tooltipRight > chartRight) {
tooltipLeft -= tooltipRight - chartRight; tooltipLeft -= tooltipRight - chartRight;
} }
if (tooltipTop + tHeight > $$.currentHeight && tooltipTop > tHeight + 30) { if (tooltipTop + tHeight > $$.currentHeight) {
tooltipTop -= tHeight + 30; tooltipTop -= tHeight + 30;
} }
} }
if (tooltipTop < 0) {
tooltipTop = 0;
}
// Set tooltip // Set tooltip
$$.tooltip $$.tooltip
.style("top", tooltipTop + "px") .style("top", tooltipTop + "px")

Loading…
Cancel
Save