Browse Source

Cull x axis ticks via css for more flexibility

pull/1724/head
Heliodor Jalba 9 years ago
parent
commit
9f2309f6aa
  1. 6
      src/core.js
  2. 3
      src/scss/axis.scss

6
src/core.js

@ -547,14 +547,14 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
break;
}
}
$$.svg.selectAll('.' + CLASS.axisX + ' .tick text').each(function (e) {
$$.svg.selectAll('.' + CLASS.axisX + ' .tick').each(function (e) {
var index = tickValues.indexOf(e);
if (index >= 0) {
d3.select(this).style('display', index % intervalForCulling ? 'none' : 'block');
d3.select(this).classed('culled', index % intervalForCulling);
}
});
} else {
$$.svg.selectAll('.' + CLASS.axisX + ' .tick text').style('display', 'block');
$$.svg.selectAll('.' + CLASS.axisX + ' .tick').classed('culled', false);
}
}

3
src/scss/axis.scss

@ -1,4 +1,7 @@
.c3-axis-x .tick {
&.culled text {
display: none;
}
}
.c3-axis-x-label {
}

Loading…
Cancel
Save