diff --git a/nv.d3.js b/nv.d3.js index 5b156e9..190cbbd 100644 --- a/nv.d3.js +++ b/nv.d3.js @@ -36,10 +36,13 @@ if (nv.dev) { // Public Core NV functions // Logs all arguments, and returns the last so you can test things in place +// Note: in IE8 console.log is an object not a function, and if modernizr is used +// then calling Function.prototype.bind with with anything other than a function +// causes a TypeError to be thrown. nv.log = function() { if (nv.dev && console.log && console.log.apply) console.log.apply(console, arguments) - else if (nv.dev && console.log && Function.prototype.bind) { + else if (nv.dev && typeof console.log == "function" && Function.prototype.bind) { var log = Function.prototype.bind.call(console.log, console); log.apply(console, arguments); } diff --git a/src/core.js b/src/core.js index e2b876e..d51ff7c 100755 --- a/src/core.js +++ b/src/core.js @@ -35,10 +35,13 @@ if (nv.dev) { // Public Core NV functions // Logs all arguments, and returns the last so you can test things in place +// Note: in IE8 console.log is an object not a function, and if modernizr is used +// then calling Function.prototype.bind with with anything other than a function +// causes a TypeError to be thrown. nv.log = function() { if (nv.dev && console.log && console.log.apply) console.log.apply(console, arguments) - else if (nv.dev && console.log && Function.prototype.bind) { + else if (nv.dev && typeof console.log == "function" && Function.prototype.bind) { var log = Function.prototype.bind.call(console.log, console); log.apply(console, arguments); } diff --git a/src/models/axis.js b/src/models/axis.js index eeb15e4..e132a57 100644 --- a/src/models/axis.js +++ b/src/models/axis.js @@ -123,7 +123,7 @@ nv.models.axis = function() { //Rotate all xTicks xTicks .attr('transform', function(d,i,j) { return 'rotate(' + rotateLabels + ' 0,0)' }) - .attr('text-anchor', rotateLabels%360 > 0 ? 'start' : 'end'); + .style('text-anchor', rotateLabels%360 > 0 ? 'start' : 'end'); } axisLabel.enter().append('text').attr('class', 'nv-axislabel'); var w = (scale.range().length==2) ? scale.range()[1] : (scale.range()[scale.range().length-1]+(scale.range()[1]-scale.range()[0])); @@ -146,7 +146,7 @@ nv.models.axis = function() { .attr('dy', '.71em') .attr('y', axis.tickPadding()) .attr('transform', function(d,i,j) { return 'rotate(' + rotateLabels + ' 0,0)' }) - .attr('text-anchor', rotateLabels ? (rotateLabels%360 > 0 ? 'start' : 'end') : 'middle') + .style('text-anchor', rotateLabels ? (rotateLabels%360 > 0 ? 'start' : 'end') : 'middle') .text(function(d,i) { var v = fmt(d); return ('' + v).match('NaN') ? '' : v; @@ -166,7 +166,7 @@ nv.models.axis = function() { case 'right': axisLabel.enter().append('text').attr('class', 'nv-axislabel'); axisLabel - .attr('text-anchor', rotateYLabel ? 'middle' : 'begin') + .style('text-anchor', rotateYLabel ? 'middle' : 'begin') .attr('transform', rotateYLabel ? 'rotate(90)' : '') .attr('y', rotateYLabel ? (-Math.max(margin.right,width) + 12) : -10) //TODO: consider calculating this based on largest tick width... OR at least expose this on chart .attr('x', rotateYLabel ? (scale.range()[0] / 2) : axis.tickPadding()); @@ -184,7 +184,7 @@ nv.models.axis = function() { .attr('dy', '.32em') .attr('y', 0) .attr('x', axis.tickPadding()) - .attr('text-anchor', 'start') + .style('text-anchor', 'start') .text(function(d,i) { var v = fmt(d); return ('' + v).match('NaN') ? '' : v; @@ -208,7 +208,7 @@ nv.models.axis = function() { */ axisLabel.enter().append('text').attr('class', 'nv-axislabel'); axisLabel - .attr('text-anchor', rotateYLabel ? 'middle' : 'end') + .style('text-anchor', rotateYLabel ? 'middle' : 'end') .attr('transform', rotateYLabel ? 'rotate(-90)' : '') .attr('y', rotateYLabel ? (-Math.max(margin.left,width) + 12) : -10) //TODO: consider calculating this based on largest tick width... OR at least expose this on chart .attr('x', rotateYLabel ? (-scale.range()[0] / 2) : -axis.tickPadding()); diff --git a/src/models/lineWithFocusChart.js b/src/models/lineWithFocusChart.js index 3985ffa..b75679e 100644 --- a/src/models/lineWithFocusChart.js +++ b/src/models/lineWithFocusChart.js @@ -1,4 +1,3 @@ - nv.models.lineWithFocusChart = function() { "use strict"; //============================================================ @@ -553,6 +552,12 @@ nv.models.lineWithFocusChart = function() { y2Axis.tickFormat(_); return chart; }; + + chart.brushExtent = function(_) { + if (!arguments.length) return brushExtent; + brushExtent = _; + return chart; + }; chart.transitionDuration = function(_) { if (!arguments.length) return transitionDuration; diff --git a/src/models/multiBarChart.js b/src/models/multiBarChart.js index 833a9ea..38e0251 100644 --- a/src/models/multiBarChart.js +++ b/src/models/multiBarChart.js @@ -276,7 +276,7 @@ nv.models.multiBarChart = function() { xTicks .selectAll('.tick text') .attr('transform', 'rotate(' + rotateLabels + ' 0,0)') - .attr('text-anchor', rotateLabels > 0 ? 'start' : 'end'); + .style('text-anchor', rotateLabels > 0 ? 'start' : 'end'); g.select('.nv-x.nv-axis').selectAll('g.nv-axisMaxMin text') .style('opacity', 1); @@ -293,6 +293,7 @@ nv.models.multiBarChart = function() { .call(yAxis); } + //------------------------------------------------------------ diff --git a/src/models/stackedAreaChart.js b/src/models/stackedAreaChart.js index 3bbf6c7..da060d8 100644 --- a/src/models/stackedAreaChart.js +++ b/src/models/stackedAreaChart.js @@ -461,13 +461,13 @@ nv.models.stackedAreaChart = function() { }; chart.width = function(_) { - if (!arguments.length) return getWidth; + if (!arguments.length) return width; width = _; return chart; }; chart.height = function(_) { - if (!arguments.length) return getHeight; + if (!arguments.length) return height; height = _; return chart; }; diff --git a/src/utils.js b/src/utils.js index 5f9694f..165a589 100644 --- a/src/utils.js +++ b/src/utils.js @@ -30,6 +30,7 @@ nv.utils.windowSize = function() { // Easy way to bind multiple functions to window.onresize // TODO: give a way to remove a function after its bound, other than removing all of them nv.utils.windowResize = function(fun){ + if (fun === undefined) return; var oldresize = window.onresize; window.onresize = function(e) {