Skip to content

Commit

Permalink
In tooltip x align calculation take into account caretSize
Browse files Browse the repository at this point in the history
Truncation up to caretSize pixels could happen if label text produced tooltip element with size width:
* left side tooltip: width < x and width > x - caretSize
* right side tooltip: width < chartWidth - x and width > chartWidth - x - caretSize
Default caretSize = 5, so with default configuration truncation up to 5 pixels could happen.
  • Loading branch information
kaidohallik committed Mar 8, 2017
1 parent 1ca0ffb commit a6473fa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/core.tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,10 @@ module.exports = function(Chart) {
}

olf = function(x) {
return x + size.width > chart.width;
return x + size.width + model.caretSize > chart.width;
};
orf = function(x) {
return x - size.width < 0;
return x - size.width - model.caretSize < 0;
};
yf = function(y) {
return y <= midY ? 'top' : 'bottom';
Expand Down

0 comments on commit a6473fa

Please sign in to comment.