Improve tick culling: always leave last text shown

parent cb918fd1
......@@ -113,6 +113,16 @@ function c3_axis(d3, params, $$) {
for(i = 0; i < l; i++){
if(i % cullStep){
if(i === l-1){
// Last rectangle should always be present, so if this is last but one rect
// and last one should be culled, we remove this one instead of last
var x = i-1;
do {
rects[x] = null;
x--;
} while(x > 0 && (rects[x] === null || hasIntersection(rects[i], rects[x])));
break;
}
rects[i] = null;
}
}
......@@ -360,8 +370,8 @@ function c3_axis(d3, params, $$) {
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;
// Small additional padding between texts
rect.width += 2;
return rect;
});
......
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