Skip to content

Commit

Permalink
fix #3339 - typed arrays support for ohlc / candlestick traces
Browse files Browse the repository at this point in the history
  • Loading branch information
etpinard committed Dec 17, 2018
1 parent 9bbe295 commit 3141c47
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/traces/ohlc/calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function calcCommon(gd, trace, x, ya, ptFunc) {
}
}

trace._extremes[ya._id] = Axes.findExtremes(ya, l.concat(h), {padded: true});
trace._extremes[ya._id] = Axes.findExtremes(ya, Lib.concat(l, h), {padded: true});

if(cd.length) {
cd[0].t = {
Expand Down
31 changes: 31 additions & 0 deletions test/jasmine/tests/finance_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,37 @@ describe('finance charts updates:', function() {
.then(done);
});

it('should work with typed array', function(done) {
var mockTA = {
open: new Float32Array(mock0.open),
high: new Float32Array(mock0.high),
low: new Float32Array(mock0.low),
close: new Float32Array(mock0.close)
};

var dataTA = [
Lib.extendDeep({}, mockTA, {type: 'ohlc'}),
Lib.extendDeep({}, mockTA, {type: 'candlestick'}),
];

var data0 = [
Lib.extendDeep({}, mock0, {type: 'ohlc'}),
Lib.extendDeep({}, mock0, {type: 'candlestick'}),
];

Plotly.plot(gd, dataTA)
.then(function() {
expect(countOHLCTraces()).toBe(1, '# of ohlc traces');
expect(countBoxTraces()).toBe(1, '# of candlestick traces');
})
.then(function() { return Plotly.react(gd, data0); })
.then(function() {
expect(countOHLCTraces()).toBe(1, '# of ohlc traces');
expect(countBoxTraces()).toBe(1, '# of candlestick traces');
})
.catch(failTest)
.then(done);
});
});

describe('finance charts *special* handlers:', function() {
Expand Down

0 comments on commit 3141c47

Please sign in to comment.