Skip to content

Commit

Permalink
Merge pull request #404 from jthomassie/xaxis-spacing
Browse files Browse the repository at this point in the history
Add padding to x-axis label filter
  • Loading branch information
spenceralger committed Sep 26, 2014
2 parents 5bc3c3a + f15cd2a commit fd6a342
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/kibana/components/vislib/lib/x_axis.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,15 @@ define(function (require) {
var myX;
var myWidth;
var halfWidth;
var padding = 1.1;

return function (selection) {
selection.selectAll('.tick text')
.text(function (d, i) {
par = d3.select(this.parentNode).node();
myX = self.xScale(d);
myWidth = par.getBBox().width;
halfWidth = par.getBBox().width / 2;
myWidth = par.getBBox().width * padding;
halfWidth = myWidth / 2;
maxW = $(self.el).find('.x-axis-div').width();

if ((startX + halfWidth) < myX && maxW > (myX + halfWidth)) {
Expand Down

0 comments on commit fd6a342

Please sign in to comment.