Browse Source

Added api axis.cullingMax

pull/1400/head
Partha Pal 9 years ago
parent
commit
7caa946456
  1. 24
      spec/api.axis-spec.js
  2. 18
      src/api.axis.js

24
spec/api.axis-spec.js

@ -51,4 +51,28 @@ describe('c3 api axis', function () {
});
});
describe('axis.cullingMax',function(){
it('should set max culling',function(){
chart.axis.cullingMax(2);
var tickCount = 0;
var ticks = document.querySelector('.c3-axis').querySelectorAll('.c3-axis-x .tick ');
for(var i=0;i<ticks.length;i++){
var tickText = ticks[i].querySelector('text');
if(tickText && tickText.style){
if(tickText.style.display === 'block'){
tickCount++;
}
}
}
expect(tickCount).toBe(2);
});
it('should return max culling',function(){
chart.axis.cullingMax(1);
expect(chart.axis.cullingMax()).toBe(1);
});
});
});

18
src/api.axis.js

@ -58,3 +58,21 @@ c3_chart_fn.axis.range = function (range) {
};
}
};
c3_chart_fn.axis.cullingMax = function(max){
var $$ = this.internal, config = $$.config;
if(arguments.length){
if(isValue(max)){
config.axis_x_tick_culling_max = max;
$$.redraw({
withUpdateXAxis:true,
withY: false,
withSubchart: false,
withEventRect: false,
withTransitionForAxis: false
});
}
}else{
return config.axis_x_tick_culling_max;
}
};

Loading…
Cancel
Save