plotly.js
Version:
The open source javascript graphing library that powers plotly
28 lines (22 loc) • 1 kB
JavaScript
/**
* Copyright 2012-2020, 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.
*/
;
module.exports = function handleContourDefaults(traceIn, traceOut, coerce, coerce2) {
var contourStart = coerce2('contours.start');
var contourEnd = coerce2('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');
};