fixed FF getBBox() issue (UI-19), extended line chart right margin +3px

This commit is contained in:
Tyler Wolf 2012-11-06 18:49:45 -05:00
parent 0de0ea9ab6
commit 68e8121721
4 changed files with 31 additions and 15 deletions

View File

@ -583,10 +583,17 @@ nv.models.axis = function() {
var maxMinRange = [];
wrap.selectAll('g.nv-axisMaxMin')
.each(function(d,i) {
if (i) // i== 1, max position
maxMinRange.push(scale(d) - this.getBBox().width - 4) //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case)
else // i==0, min position
maxMinRange.push(scale(d) + this.getBBox().width + 4)
try {
if (i) // i== 1, max position
maxMinRange.push(scale(d) - this.getBBox().width - 4) //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case)
else // i==0, min position
maxMinRange.push(scale(d) + this.getBBox().width + 4)
}catch (err) {
if (i) // i== 1, max position
maxMinRange.push(scale(d) - 4) //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case)
else // i==0, min position
maxMinRange.push(scale(d) + 4)
}
});
g.selectAll('g') // the g's wrapping each tick
.each(function(d,i) {
@ -3632,7 +3639,8 @@ nv.models.lineChart = function() {
, legend = nv.models.legend()
;
var margin = {top: 30, right: 20, bottom: 50, left: 60}
//set margin.right to 23 to fit dates on the x-axis within the chart
var margin = {top: 30, right: 23, bottom: 50, left: 60}
, color = nv.utils.defaultColor()
, width = null
, height = null

10
nv.d3.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -263,10 +263,17 @@ nv.models.axis = function() {
var maxMinRange = [];
wrap.selectAll('g.nv-axisMaxMin')
.each(function(d,i) {
if (i) // i== 1, max position
maxMinRange.push(scale(d) - this.getBBox().width - 4) //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case)
else // i==0, min position
maxMinRange.push(scale(d) + this.getBBox().width + 4)
try {
if (i) // i== 1, max position
maxMinRange.push(scale(d) - this.getBBox().width - 4) //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case)
else // i==0, min position
maxMinRange.push(scale(d) + this.getBBox().width + 4)
}catch (err) {
if (i) // i== 1, max position
maxMinRange.push(scale(d) - 4) //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case)
else // i==0, min position
maxMinRange.push(scale(d) + 4)
}
});
g.selectAll('g') // the g's wrapping each tick
.each(function(d,i) {

View File

@ -11,7 +11,8 @@ nv.models.lineChart = function() {
, legend = nv.models.legend()
;
var margin = {top: 30, right: 20, bottom: 50, left: 60}
//set margin.right to 23 to fit dates on the x-axis within the chart
var margin = {top: 30, right: 23, bottom: 50, left: 60}
, color = nv.utils.defaultColor()
, width = null
, height = null