forked from plotly/plotly.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathohlc_defaults.js
36 lines (24 loc) · 887 Bytes
/
ohlc_defaults.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* Copyright 2012-2018, 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 Registry = require('../../registry');
module.exports = function handleOHLC(traceIn, traceOut, coerce, layout) {
var x = coerce('x');
var open = coerce('open');
var high = coerce('high');
var low = coerce('low');
var close = coerce('close');
coerce('hoverlabel.split');
var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleTraceDefaults');
handleCalendarDefaults(traceIn, traceOut, ['x'], layout);
if(!(open && high && low && close)) return;
var len = Math.min(open.length, high.length, low.length, close.length);
if(x) len = Math.min(len, x.length);
traceOut._length = len;
return len;
};