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

update scaling api #249

Merged
merged 4 commits into from
Jan 27, 2017
Merged

update scaling api #249

merged 4 commits into from
Jan 27, 2017

Conversation

parikhshiv
Copy link
Contributor

Related to #247 - updated structure of scaling option for y-axis (and updated tests). The following jsfiddle shows the use of this option (affects zeroAnchor, smartAxis and centeredAxis) - http://jsfiddle.net/a5L7x0c5/4/

@parikhshiv
Copy link
Contributor Author

@narenranjit, would you mind reviewing this PR when you get a chance? No rush.

Its related to your comments on #247 .

axisType = 'smart';
}

if (axisType === 'linear' && (options.yAxis.centeredAxis || options.yAxis.scaling.centeredAxis)) {
if (axisType === 'linear' && (options.yAxis.centeredAxis || options.yAxis.scaling.type === 'centered')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should support . centeredAxis -- we should still support smartAxis for legacy reasons, but going forward mandate everything else should be set through scaling.type.

@@ -17,7 +17,7 @@
/*jshint eqnull:true */
var options = this.options.yAxis;
var domain = this.domain;
var zeroAnchor = options.zeroAnchor || options.scaling.zeroAnchor;
var zeroAnchor = (typeof options.zeroAnchor !== 'undefined') ? options.zeroAnchor : options.scaling.options.zeroAnchor;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This catches undefineds, but not nulls. I think options.zeroAnchor != null may be a better check

@@ -117,22 +118,23 @@

_getYScaledDomain: function (domain, options) {
var opts = this.options.yAxis;
var absMin = (opts.zeroAnchor || opts.scaling.zeroAnchor) && domain && domain[0] > 0 ? 0 : undefined;
var zeroAnchor = (typeof opts.zeroAnchor !== 'undefined') ? opts.zeroAnchor : opts.scaling.opts.zeroAnchor;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above for null check comment

} else if (opts.centeredAxis || opts.scaling.centeredAxis) {
} else if (opts.smartAxis || opts.scaling.type === 'smart') {
return d3.extent(zeroAnchor || opts.min != null ? [min].concat(domain) : domain);
} else if (opts.centeredAxis || opts.scaling.type === 'centered') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above for removing centered axis comment

@parikhshiv
Copy link
Contributor Author

Changes from @narenranjit's review have been pushed. PR is ready for merge.

@narenranjit
Copy link
Contributor

This looks good, but has merge conflicts. Can you resolve repush?

@narenranjit narenranjit merged commit 2a0742d into master Jan 27, 2017
@narenranjit narenranjit deleted the y-axis-scaling-api branch January 27, 2017 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants