|
|
@ -311,6 +311,7 @@ nv.models.axis = function() {
|
|
|
|
, highlightZero = true
|
|
|
|
, highlightZero = true
|
|
|
|
, rotateLabels = 0
|
|
|
|
, rotateLabels = 0
|
|
|
|
, rotateYLabel = true
|
|
|
|
, rotateYLabel = true
|
|
|
|
|
|
|
|
, staggerLabels = false
|
|
|
|
, ticks = null
|
|
|
|
, ticks = null
|
|
|
|
;
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
@ -401,8 +402,8 @@ nv.models.axis = function() {
|
|
|
|
case 'bottom':
|
|
|
|
case 'bottom':
|
|
|
|
var xLabelMargin = 30;
|
|
|
|
var xLabelMargin = 30;
|
|
|
|
var maxTextWidth = 30;
|
|
|
|
var maxTextWidth = 30;
|
|
|
|
|
|
|
|
var xTicks = g.selectAll('g').select("text");
|
|
|
|
if (rotateLabels%360) {
|
|
|
|
if (rotateLabels%360) {
|
|
|
|
var xTicks = g.selectAll('g').select("text");
|
|
|
|
|
|
|
|
//Calculate the longest xTick width
|
|
|
|
//Calculate the longest xTick width
|
|
|
|
xTicks.each(function(d,i){
|
|
|
|
xTicks.each(function(d,i){
|
|
|
|
var width = this.getBBox().width;
|
|
|
|
var width = this.getBBox().width;
|
|
|
@ -445,6 +446,10 @@ nv.models.axis = function() {
|
|
|
|
return 'translate(' + scale.range()[i] + ',0)'
|
|
|
|
return 'translate(' + scale.range()[i] + ',0)'
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (staggerLabels)
|
|
|
|
|
|
|
|
xTicks
|
|
|
|
|
|
|
|
.attr('transform', function(d,i) { return 'translate(0,' + (i % 2 == 0 ? '0' : '12') + ')' });
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'right':
|
|
|
|
case 'right':
|
|
|
|
axisLabel.enter().append('text').attr('class', 'nv-axislabel')
|
|
|
|
axisLabel.enter().append('text').attr('class', 'nv-axislabel')
|
|
|
@ -640,6 +645,13 @@ nv.models.axis = function() {
|
|
|
|
return chart;
|
|
|
|
return chart;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
chart.staggerLabels = function(_) {
|
|
|
|
|
|
|
|
if (!arguments.length) return staggerLabels;
|
|
|
|
|
|
|
|
staggerLabels = _;
|
|
|
|
|
|
|
|
return chart;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================
|
|
|
|
//============================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|