Commit built files

parent abbeb175
......@@ -8452,6 +8452,38 @@
tickTextCharSize = size;
return size;
}
function hasIntersection (rect1, rect2) {
var r1x2 = rect1.x + rect1.width;
var r2x2 = rect2.x + rect2.width;
var r1y2 = rect1.y + rect1.height;
var r2y2 = rect2.y + rect2.height;
return (rect1.x < r2x2 && r1x2 > rect2.x &&
rect1.y < r2y2 && r1y2 > rect2.y);
}
function cullRects(rects){
if(rects.length < 2) return;
var cullGap = 0;
var i, j, l = rects.length;
for(i = 1, j = 0 ; i < l; i++){
if(hasIntersection(rects[i], rects[j])){
cullGap = Math.max(cullGap, i-j);
} else {
j = i;
}
}
if(!cullGap) return;
var cullStep = cullGap+1;
for(i = 0; i < l; i++){
if(i % cullStep){
rects[i] = null;
}
}
}
function axis(g) {
g.each(function () {
var g = d3.select(this);
......@@ -8539,16 +8571,6 @@
return dy;
}
function hasIntersection (rect1, rect2) {
var r1x2 = rect1.x + rect1.width;
var r2x2 = rect2.x + rect2.width;
var r1y2 = rect1.y + rect1.height;
var r2y2 = rect2.y + rect2.height;
return (rect1.x < r2x2 && r1x2 > rect2.x &&
rect1.y < r2y2 && r1y2 > rect2.y);
}
function tickSize(d) {
return innerTickSize;
}
......@@ -8570,13 +8592,6 @@
tspan.exit().remove();
var axisId = $$.isXAxis(orient) ? 'x' : 'y';
var textClass = '.c3-axis-' + axisId + ' .tick'
var textRects = text.data().map(function(data) {
var rect = $$.getTextRect(textFormatted(data), textClass);
// Smaal additional padding between texts
rect.width += 10;
return rect;
});
var fontSize = parseFloat(getStyleValue($$, '.c3-axis-y .tick', 'font-size'));
......@@ -8709,26 +8724,22 @@
break;
}
var last = textRects.length - 1;
rectPositionFn(textRects[0], text.data()[0]);
rectPositionFn(textRects[last], text.data().pop());
var addedTextRects = [textRects[0], textRects[last]];
text.style('display', function(d, i){
if(i === 0 || i === last) return 'block';
var textClass = '.c3-axis-' + axisId + ' .tick';
var textRects = text.data().map(function(data) {
var rect = $$.getTextRect(textFormatted(data), textClass);
// Smaal additional padding between texts
rect.width += 10;
return rect;
});
var rect = textRects[i];
rectPositionFn(rect, d);
var visible = !addedTextRects.some(function(added){
return hasIntersection(rect, added);
});
text.each(function(d, i){
rectPositionFn(textRects[i], d);
});
if(visible){
addedTextRects.push(rect);
}
cullRects(textRects);
return visible ? 'block' : 'none';
text.style('display', function(d, i){
return textRects[i] === null ? 'none' : 'block';
});
});
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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