fixed how x_axis checks widths to apply rotate

This commit is contained in:
Juan Thomassie 2014-08-19 14:02:12 -05:00
parent 6d30475744
commit 264e29b75f
3 changed files with 5 additions and 12 deletions

View file

@ -31,17 +31,13 @@ define(function (require) {
// check widths to apply rotate // check widths to apply rotate
var bbox = selection.selectAll('.tick text').node().getBBox(); var bbox = selection.selectAll('.tick text').node().getBBox();
var tickN = selection.selectAll('.tick text')[0].length; var tickN = selection.selectAll('.tick text')[0].length;
var ticksLength = bbox.width * 1.05 * tickN;
if (ticksLength > width) {
self.rotateAxisLabels(selection);
}
var lbls = selection.selectAll('.tick text')[0]; var lbls = selection.selectAll('.tick text')[0];
console.log('ticks n', tickN, lbls); var maxW = width / tickN;
for (var i = 0; i < tickN; i++) { for (var i = 0; i < tickN; i++) {
console.log(i, lbls[i]); if (lbls[i].clientWidth > maxW) {
//if (bbox[i]) { self.rotateAxisLabels(selection);
//} break;
}
} }
// check widths to apply filter // check widths to apply filter

View file

@ -25,7 +25,6 @@ define(function (require) {
}; };
YAxis.prototype.appendSVG = function (self) { YAxis.prototype.appendSVG = function (self) {
console.log(self);
return function (selection) { return function (selection) {
selection.each(function () { selection.each(function () {
var div = d3.select(this); var div = d3.select(this);

View file

@ -103,8 +103,6 @@ define(function (require) {
} }
}); });
console.log(this);
this.checkSize('.chart'); this.checkSize('.chart');
}; };