'use strict'; var Lib = require('../../lib'); var subTypes = require('../scatter/subtypes'); var handleRThetaDefaults = require('../scatterpolar/defaults').handleRThetaDefaults; var handleMarkerDefaults = require('../scatter/marker_defaults'); var handleLineDefaults = require('../scatter/line_defaults'); var handleTextDefaults = require('../scatter/text_defaults'); var handleFillColorDefaults = require('../scatter/fillcolor_defaults'); var PTS_LINESONLY = require('../scatter/constants').PTS_LINESONLY; var attributes = require('./attributes'); module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { function coerce(attr, dflt) { return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); } var len = handleRThetaDefaults(traceIn, traceOut, layout, coerce); if(!len) { traceOut.visible = false; return; } coerce('thetaunit'); coerce('mode', len < PTS_LINESONLY ? 'lines+markers' : 'lines'); coerce('text'); coerce('hovertext'); if(traceOut.hoveron !== 'fills') coerce('hovertemplate'); if(subTypes.hasMarkers(traceOut)) { handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce, {noAngleRef: true, noStandOff: true}); } if(subTypes.hasLines(traceOut)) { handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce); coerce('connectgaps'); } if(subTypes.hasText(traceOut)) { coerce('texttemplate'); handleTextDefaults(traceIn, traceOut, layout, coerce, { noFontShadow: true, noFontLineposition: true, noFontTextcase: true, }); } coerce('fill'); if(traceOut.fill !== 'none') { handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce); } Lib.coerceSelectionMarkerOpacity(traceOut, coerce); };