Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mechanism to control application of .nice() #268

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/objects/axis/begin.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
this.fontFamily = "sans-serif";
// Help: http://github.com/PMSI-AlignAlytics/dimple/wiki/dimple.axis#wiki-autoRotateLabel
this.autoRotateLabel = (autoRotateLabel === null || autoRotateLabel === undefined ? true : autoRotateLabel);
// whether the tickCount (if specified) should be applied to call to .nice() when building the axis scale
this.forceTickCount = false;

// If this is a composite axis, store links to all slaves
this._slaves = [];
Expand Down
9 changes: 5 additions & 4 deletions src/objects/axis/methods/_update.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
remainder,
origin,
tickCount = this.ticks || 10,
niceTickCount = this.forceTickCount && this.ticks ? tickCount : undefined,
getOrderedCategories = function (self, axPos, oppPos) {
var category = self.categoryFields[0],
axisData = self._getAxisData(),
Expand Down Expand Up @@ -65,7 +66,7 @@
])
.clamp(this.clamp)
.base(this.logBase)
.nice();
.nice(niceTickCount);
} else if (this.measure === null || this.measure === undefined) {
distinctCats = getOrderedCategories(this, "x", "y");
// If there are any slaves process accordingly
Expand All @@ -82,7 +83,7 @@
.range([this.chart._xPixels(), this.chart._xPixels() + this.chart._widthPixels()])
.domain([this._min, this._max])
.clamp(this.clamp)
.nice();
.nice(niceTickCount);
}
// If it's visible, orient it at the top or bottom if it's first or second respectively
if (!this.hidden) {
Expand Down Expand Up @@ -121,7 +122,7 @@
])
.clamp(this.clamp)
.base(this.logBase)
.nice();
.nice(niceTickCount);
} else if (this.measure === null || this.measure === undefined) {
distinctCats = getOrderedCategories(this, "y", "x");
// If there are any slaves process accordingly
Expand All @@ -138,7 +139,7 @@
.range([this.chart._yPixels() + this.chart._heightPixels(), this.chart._yPixels()])
.domain([this._min, this._max])
.clamp(this.clamp)
.nice();
.nice(niceTickCount);
}
// if it's visible, orient it at the left or right if it's first or second respectively
if (!this.hidden) {
Expand Down