fixed cumulativeLineChart x-axis overcrowding

This commit is contained in:
Tyler Wolf 2012-11-13 18:28:33 -05:00
parent aa9d36e1f7
commit b1a98db4ec

View File

@ -304,9 +304,9 @@ nv.models.cumulativeLineChart = function() {
xAxis xAxis
.scale(x) .scale(x)
//If the ticks cannot fit on the chart tastefully, put in subticks for the dates that don't show //If the ticks cannot fit on the chart tastefully, put in subticks for the dates that don't show
.tickSubdivide( (data[0].values.length > (availableWidth/50)) ? true : false ) .tickSubdivide( (data[0].values.length > availableWidth/53) ? true : false )
//Suggest how many ticks based on the chart width and D3 should listen (50 is the optimal number for MM/DD/YY dates) //Suggest how many ticks based on the chart width and D3 should listen (70 is the optimal number for MM/DD/YY dates)
.ticks( Math.min(data[0].values.length,availableWidth/50) ) .ticks( Math.min(data[0].values.length,availableWidth/70) )
.tickSize(-availableHeight, 0); .tickSize(-availableHeight, 0);
g.select('.nv-x.nv-axis') g.select('.nv-x.nv-axis')