Skip to content

Commit 47fb8e2

Browse files
use a variable for _lastValue
rather than annotating some random DOM element
1 parent f31f9b7 commit 47fb8e2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/number-display.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ dc.numberDisplay = function (parent, chartGroup) {
2020
var _formatNumber = d3.format('.2s');
2121
var _chart = dc.baseMixin({});
2222
var _html = {one: '', some: '', none: ''};
23+
var _lastValue;
2324

2425
// dimension not required
2526
_chart._mandatoryAttributes(['group']);
@@ -100,9 +101,9 @@ dc.numberDisplay = function (parent, chartGroup) {
100101
.ease('quad-out-in')
101102
.tween('text', function () {
102103
// [XA] don't try and interpolate from Infinity, else this breaks.
103-
var interpStart = isFinite(this.lastValue) ? this.lastValue : 0;
104+
var interpStart = isFinite(_lastValue) ? _lastValue : 0;
104105
var interp = d3.interpolateNumber(interpStart || 0, newValue);
105-
this.lastValue = newValue;
106+
_lastValue = newValue;
106107
return function (t) {
107108
var html = null, num = _chart.formatNumber()(interp(t));
108109
if (newValue === 0 && (_html.none !== '')) {

0 commit comments

Comments
 (0)