'use strict'; var Lib = require('../../lib'); var Registry = require('../../registry'); module.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) { var x = coerce('x'); var y = coerce('y'); var len; var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleTraceDefaults'); handleCalendarDefaults(traceIn, traceOut, ['x', 'y'], layout); if(x) { var xlen = Lib.minRowLength(x); if(y) { len = Math.min(xlen, Lib.minRowLength(y)); } else { len = xlen; coerce('y0'); coerce('dy'); } } else { if(!y) return 0; len = Lib.minRowLength(y); coerce('x0'); coerce('dx'); } traceOut._length = len; return len; };