-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Histogram2dcontour relayout fix #1520
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* Copyright 2012-2017, Plotly, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
var Lib = require('../../lib'); | ||
var attributes = require('./attributes'); | ||
|
||
module.exports = function handleContourDefaults(traceIn, traceOut, coerce) { | ||
var contourStart = Lib.coerce2(traceIn, traceOut, attributes, 'contours.start'); | ||
var contourEnd = Lib.coerce2(traceIn, traceOut, attributes, 'contours.end'); | ||
var missingEnd = (contourStart === false) || (contourEnd === false); | ||
|
||
// normally we only need size if autocontour is off. But contour.calc | ||
// pushes its calculated contour size back to the input trace, so for | ||
// things like restyle that can call supplyDefaults without calc | ||
// after the initial draw, we can just reuse the previous calculation | ||
var contourSize = coerce('contours.size'); | ||
var autoContour; | ||
|
||
if(missingEnd) autoContour = traceOut.autocontour = true; | ||
else autoContour = coerce('autocontour', false); | ||
|
||
if(autoContour || !contourSize) coerce('ncontours'); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
var Lib = require('../../lib'); | ||
|
||
var handleSampleDefaults = require('../histogram2d/sample_defaults'); | ||
var handleContoursDefaults = require('../contour/contours_defaults'); | ||
var handleStyleDefaults = require('../contour/style_defaults'); | ||
var attributes = require('./attributes'); | ||
|
||
|
@@ -30,5 +31,6 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout | |
if(autocontour) coerce('ncontours'); | ||
else coerce('contours.size'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this line get the 🔪 ? It looks like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh oops. Good call! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's subtle though. Sometimes these things do need re-coercing depending on the coupling between parameter defaults. But this one look like it's maybe redundant. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done in b163ad2 |
||
|
||
handleContoursDefaults(traceIn, traceOut, coerce); | ||
handleStyleDefaults(traceIn, traceOut, coerce, layout); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. Perhaps I'll need to merge/use this in carpet.