Skip to content
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
7 changes: 5 additions & 2 deletions src/plots/cartesian/axis_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,13 @@ function getBoxPosLetter(trace) {
}

function isBoxWithoutPositionCoords(trace, axLetter) {
var posLetter = getBoxPosLetter(trace);
var posLetter = getBoxPosLetter(trace),
isBox = Registry.traceIs(trace, 'box'),
isCandlestick = Registry.traceIs(trace._fullInput || {}, 'candlestick');

return (
Registry.traceIs(trace, 'box') &&
isBox &&
!isCandlestick &&
axLetter === posLetter &&
trace[posLetter] === undefined &&
trace[posLetter + '0'] === undefined
Expand Down
2 changes: 1 addition & 1 deletion src/traces/candlestick/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
moduleType: 'trace',
name: 'candlestick',
basePlotModule: require('../../plots/cartesian'),
categories: ['cartesian', 'showLegend'],
categories: ['cartesian', 'showLegend', 'candlestick'],
meta: {
description: [
'The candlestick is a style of financial chart describing',
Expand Down
7 changes: 7 additions & 0 deletions test/jasmine/tests/finance_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,13 @@ describe('finance charts defaults:', function() {
expect(fullTrace.xcalendar).toBe(i < 2 ? 'hebrew' : 'julian');
});
});

it('should make empty candlestick traces autotype to *linear* (as opposed to real box traces)', function() {
var trace0 = { type: 'candlestick' };
var out = _supply([trace0], { xaxis: {} });

expect(out._fullLayout.xaxis.type).toEqual('linear');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before this patch, this assertions resulted in 'category'.

});
});

describe('finance charts calc transforms:', function() {
Expand Down