Skip to content

Commit

Permalink
Rename Scale._autoDomain to Scale._autoDomainAutomatically
Browse files Browse the repository at this point in the history
  • Loading branch information
teamdandelion committed Jun 9, 2014
1 parent f6cad37 commit 1cf6730
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
12 changes: 6 additions & 6 deletions plottable.js
Original file line number Diff line number Diff line change
Expand Up @@ -2004,7 +2004,7 @@ var Plottable;
*/
function Scale(scale) {
_super.call(this);
this._autoDomain = true;
this._autoDomainAutomatically = true;
this.rendererID2Perspective = {};
this.dataSourceReferenceCounter = new Plottable.Util.IDCounter();
this._autoNice = false;
Expand Down Expand Up @@ -2049,12 +2049,12 @@ var Plottable;
var dataSourceID = dataSource._plottableID;
if (this.dataSourceReferenceCounter.increment(dataSourceID) === 1) {
dataSource.registerListener(this, function () {
if (_this._autoDomain) {
if (_this._autoDomainAutomatically) {
_this.autoDomain();
}
});
}
if (this._autoDomain) {
if (this._autoDomainAutomatically) {
this.autoDomain();
}
return this;
Expand All @@ -2068,7 +2068,7 @@ var Plottable;
}

delete this.rendererID2Perspective[rendererIDAttr];
if (this._autoDomain) {
if (this._autoDomainAutomatically) {
this.autoDomain();
}
return this;
Expand All @@ -2088,7 +2088,7 @@ var Plottable;
if (values == null) {
return this._d3Scale.domain();
} else {
this._autoDomain = false;
this._autoDomainAutomatically = false;
this._setDomain(values);
return this;
}
Expand Down Expand Up @@ -2903,7 +2903,7 @@ var Plottable;

InterpolatedColor.prototype._resetScale = function () {
this._d3Scale = InterpolatedColor.getD3InterpolatedScale(this._colorRange, this._scaleType);
if (this._autoDomain) {
if (this._autoDomainAutomatically) {
this.autoDomain();
}
this._broadcast();
Expand Down
10 changes: 5 additions & 5 deletions src/core/scale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export module Abstract {
}
export class Scale extends Broadcaster {
public _d3Scale: D3.Scale.Scale;
public _autoDomain = true;
public _autoDomainAutomatically = true;
private rendererID2Perspective: {[rendererID: string]: IPerspective} = {};
private dataSourceReferenceCounter = new Util.IDCounter();
public _autoNice = false;
Expand Down Expand Up @@ -59,12 +59,12 @@ export module Abstract {
var dataSourceID = dataSource._plottableID;
if (this.dataSourceReferenceCounter.increment(dataSourceID) === 1 ) {
dataSource.registerListener(this, () => {
if (this._autoDomain) {
if (this._autoDomainAutomatically) {
this.autoDomain();
}
});
}
if (this._autoDomain) {
if (this._autoDomainAutomatically) {
this.autoDomain();
}
return this;
Expand All @@ -78,7 +78,7 @@ export module Abstract {
}

delete this.rendererID2Perspective[rendererIDAttr];
if (this._autoDomain) {
if (this._autoDomainAutomatically) {
this.autoDomain();
}
return this;
Expand Down Expand Up @@ -109,7 +109,7 @@ export module Abstract {
if (values == null) {
return this._d3Scale.domain();
} else {
this._autoDomain = false;
this._autoDomainAutomatically = false;
this._setDomain(values);
return this;
}
Expand Down
2 changes: 1 addition & 1 deletion src/scales/interpolatedColorScale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export module Scale {

private _resetScale(): any {
this._d3Scale = InterpolatedColor.getD3InterpolatedScale(this._colorRange, this._scaleType);
if (this._autoDomain) {
if (this._autoDomainAutomatically) {
this.autoDomain();
}
this._broadcast();
Expand Down
14 changes: 7 additions & 7 deletions test/scaleTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ describe("Scales", () => {
it("scale autoDomain flag is not overwritten without explicitly setting the domain", () => {
scale._addPerspective("1", dataSource, "foo");
scale.autoDomain().padDomain().nice();
assert.isTrue(scale._autoDomain, "the autoDomain flag is still set after autoranginging and padding and nice-ing");
assert.isTrue(scale._autoDomainAutomatically, "the autoDomain flag is still set after autoranginging and padding and nice-ing");
scale.domain([0, 5]);
assert.isFalse(scale._autoDomain, "the autoDomain flag is false after domain explicitly set");
assert.isFalse(scale._autoDomainAutomatically, "the autoDomain flag is false after domain explicitly set");
});

it("scale autorange works as expected with single dataSource", () => {
Expand All @@ -74,17 +74,17 @@ describe("Scales", () => {
});

it("scale perspectives can be removed appropriately", () => {
assert.isTrue(scale._autoDomain, "autoDomain enabled1");
assert.isTrue(scale._autoDomainAutomatically, "autoDomain enabled1");
scale._addPerspective("1x", dataSource, "foo");
scale._addPerspective("2x", dataSource, "bar");
assert.isTrue(scale._autoDomain, "autoDomain enabled2");
assert.isTrue(scale._autoDomainAutomatically, "autoDomain enabled2");
assert.deepEqual(scale.domain(), [-20, 5], "scale domain includes both perspectives");
assert.isTrue(scale._autoDomain, "autoDomain enabled3");
assert.isTrue(scale._autoDomainAutomatically, "autoDomain enabled3");
scale._removePerspective("1x");
assert.isTrue(scale._autoDomain, "autoDomain enabled4");
assert.isTrue(scale._autoDomainAutomatically, "autoDomain enabled4");
assert.deepEqual(scale.domain(), [-20, 1], "only the bar accessor is active");
scale._addPerspective("2x", dataSource, "foo");
assert.isTrue(scale._autoDomain, "autoDomain enabled5");
assert.isTrue(scale._autoDomainAutomatically, "autoDomain enabled5");
assert.deepEqual(scale.domain(), [0, 5], "the bar accessor was overwritten");
});
});
Expand Down
14 changes: 7 additions & 7 deletions test/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3036,9 +3036,9 @@ describe("Scales", function () {
it("scale autoDomain flag is not overwritten without explicitly setting the domain", function () {
scale._addPerspective("1", dataSource, "foo");
scale.autoDomain().padDomain().nice();
assert.isTrue(scale._autoDomain, "the autoDomain flag is still set after autoranginging and padding and nice-ing");
assert.isTrue(scale._autoDomainAutomatically, "the autoDomain flag is still set after autoranginging and padding and nice-ing");
scale.domain([0, 5]);
assert.isFalse(scale._autoDomain, "the autoDomain flag is false after domain explicitly set");
assert.isFalse(scale._autoDomainAutomatically, "the autoDomain flag is false after domain explicitly set");
});

it("scale autorange works as expected with single dataSource", function () {
Expand All @@ -3064,17 +3064,17 @@ describe("Scales", function () {
});

it("scale perspectives can be removed appropriately", function () {
assert.isTrue(scale._autoDomain, "autoDomain enabled1");
assert.isTrue(scale._autoDomainAutomatically, "autoDomain enabled1");
scale._addPerspective("1x", dataSource, "foo");
scale._addPerspective("2x", dataSource, "bar");
assert.isTrue(scale._autoDomain, "autoDomain enabled2");
assert.isTrue(scale._autoDomainAutomatically, "autoDomain enabled2");
assert.deepEqual(scale.domain(), [-20, 5], "scale domain includes both perspectives");
assert.isTrue(scale._autoDomain, "autoDomain enabled3");
assert.isTrue(scale._autoDomainAutomatically, "autoDomain enabled3");
scale._removePerspective("1x");
assert.isTrue(scale._autoDomain, "autoDomain enabled4");
assert.isTrue(scale._autoDomainAutomatically, "autoDomain enabled4");
assert.deepEqual(scale.domain(), [-20, 1], "only the bar accessor is active");
scale._addPerspective("2x", dataSource, "foo");
assert.isTrue(scale._autoDomain, "autoDomain enabled5");
assert.isTrue(scale._autoDomainAutomatically, "autoDomain enabled5");
assert.deepEqual(scale.domain(), [0, 5], "the bar accessor was overwritten");
});
});
Expand Down

0 comments on commit 1cf6730

Please sign in to comment.