diff --git a/nv.d3.js b/nv.d3.js index fb994c3..11fb647 100644 --- a/nv.d3.js +++ b/nv.d3.js @@ -10573,13 +10573,15 @@ nv.models.pie = function() { , startAngle = false , endAngle = false , donutRatio = 0.5 - , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout') + , duration = 250 + , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout', 'renderEnd') ; //============================================================ - + var renderWatch = nv.utils.renderWatch(dispatch); function chart(selection) { + renderWatch.reset(); selection.each(function(data) { var availableWidth = width - margin.left - margin.right, availableHeight = height - margin.top - margin.bottom, @@ -10748,7 +10750,7 @@ nv.models.pie = function() { return Math.floor(coordinates[0]/avgWidth) * avgWidth + ',' + Math.floor(coordinates[1]/avgHeight) * avgHeight; }; - pieLabels.transition() + pieLabels.watchTransition(renderWatch,'pie labels') .attr('transform', function(d) { if (labelSunbeamLayout) { d.outerRadius = arcRadius + 10; // Set Outer Coordinate @@ -10819,6 +10821,7 @@ nv.models.pie = function() { }); + renderWatch.renderEnd('pie immediate'); return chart; } @@ -10952,6 +10955,13 @@ nv.models.pie = function() { labelThreshold = _; return chart; }; + + chart.duration = function(_) { + if (!arguments.length) return duration; + duration = _; + renderWatch.reset(duration); + return chart; + }; //============================================================ @@ -10980,6 +10990,7 @@ nv.models.pieChart = function() { , state = {} , defaultState = null , noData = "No Data Available." + , duration = 250 , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState','renderEnd') ; @@ -11006,6 +11017,8 @@ nv.models.pieChart = function() { function chart(selection) { renderWatch.reset(); + renderWatch.models(pie); + selection.each(function(data) { var container = d3.select(this), that = this; @@ -11247,6 +11260,14 @@ nv.models.pieChart = function() { return chart; }; + chart.duration = function(_) { + if (!arguments.length) return duration; + duration = _; + renderWatch.reset(duration); + pie.duration(duration); + return chart; + }; + //============================================================ diff --git a/src/models/pie.js b/src/models/pie.js index fa2d436..eaa68c0 100644 --- a/src/models/pie.js +++ b/src/models/pie.js @@ -23,13 +23,15 @@ nv.models.pie = function() { , startAngle = false , endAngle = false , donutRatio = 0.5 - , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout') + , duration = 250 + , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout', 'renderEnd') ; //============================================================ - + var renderWatch = nv.utils.renderWatch(dispatch); function chart(selection) { + renderWatch.reset(); selection.each(function(data) { var availableWidth = width - margin.left - margin.right, availableHeight = height - margin.top - margin.bottom, @@ -198,7 +200,7 @@ nv.models.pie = function() { return Math.floor(coordinates[0]/avgWidth) * avgWidth + ',' + Math.floor(coordinates[1]/avgHeight) * avgHeight; }; - pieLabels.transition() + pieLabels.watchTransition(renderWatch,'pie labels') .attr('transform', function(d) { if (labelSunbeamLayout) { d.outerRadius = arcRadius + 10; // Set Outer Coordinate @@ -269,6 +271,7 @@ nv.models.pie = function() { }); + renderWatch.renderEnd('pie immediate'); return chart; } @@ -402,6 +405,13 @@ nv.models.pie = function() { labelThreshold = _; return chart; }; + + chart.duration = function(_) { + if (!arguments.length) return duration; + duration = _; + renderWatch.reset(duration); + return chart; + }; //============================================================ diff --git a/src/models/pieChart.js b/src/models/pieChart.js index 0f34c8a..c04328a 100644 --- a/src/models/pieChart.js +++ b/src/models/pieChart.js @@ -21,6 +21,7 @@ nv.models.pieChart = function() { , state = {} , defaultState = null , noData = "No Data Available." + , duration = 250 , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState','renderEnd') ; @@ -47,6 +48,8 @@ nv.models.pieChart = function() { function chart(selection) { renderWatch.reset(); + renderWatch.models(pie); + selection.each(function(data) { var container = d3.select(this), that = this; @@ -288,6 +291,14 @@ nv.models.pieChart = function() { return chart; }; + chart.duration = function(_) { + if (!arguments.length) return duration; + duration = _; + renderWatch.reset(duration); + pie.duration(duration); + return chart; + }; + //============================================================