Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #3339 - typed arrays support for ohlc / candlestick traces #3342

Merged
merged 1 commit into from
Dec 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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