Skip to content

OHLC and Candlestick trace types #1020

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Oct 13, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e915a29
relax requirement for re-calc
etpinard Oct 7, 2016
cf5da9b
plots: pass user layout to transforms
etpinard Oct 7, 2016
7864fa8
first pass ohlc trace type
etpinard Sep 9, 2016
44f2bec
first pass candlestick trace type
etpinard Sep 9, 2016
df24552
add ohlc and candlestick to main plotly.js lib index
etpinard Sep 9, 2016
6cac3fe
[maybe?] add 'finance' partial bundle
etpinard Sep 9, 2016
0f17423
fixup user-defined transform test
etpinard Oct 7, 2016
61c72cc
finance: replace attribute 't' -> 'x'
etpinard Oct 7, 2016
a9eb7c5
candlestick: rename 'tickwidth' -> 'whiskerwidth' + make it 1 per trace
etpinard Oct 7, 2016
ede8ee2
ohlc: make 'tickwidth' 1 per trace
etpinard Oct 7, 2016
f6c33f2
finance: 2nd iteration
etpinard Oct 7, 2016
96e129a
fix groupby when `enabled: false
etpinard Oct 7, 2016
e32b60f
findArrayAttributes: include array attribute in fullInput module
etpinard Oct 7, 2016
d61afb9
test: first pass finance suite
etpinard Oct 7, 2016
dc8aaea
finace: ensure supplyDefaults is idempotent
etpinard Oct 11, 2016
5c94c05
finance: add re-calc attributes to restyle lists
etpinard Oct 11, 2016
1f574f2
finance: ensure that restyling visible works
etpinard Oct 11, 2016
7b19b74
finance: improve dflt colors
etpinard Oct 11, 2016
2b1918c
finance: improve inc / dec 'name' / 'showlegend' logic
etpinard Oct 11, 2016
fbb299b
legend: add logic for 'ohlc' and 'candlestick' in legend name edits
etpinard Oct 11, 2016
caf390b
doc: add comments about non-trivial logic in ohlc / candlestick
etpinard Oct 11, 2016
672d517
finance: pass trace 'xaxis' & 'yaxis' to generated traces
etpinard Oct 12, 2016
ea3c5a1
finance: make sure computed tickWidth is always positive
etpinard Oct 12, 2016
a892b26
olhc: add custom hover text
etpinard Oct 12, 2016
7e0a382
finance: ensure that user data isn't mutated in Plots.supplyDefaults
etpinard Oct 12, 2016
f6f072f
utils: add filterUnique helper
etpinard Oct 12, 2016
6036045
ohlc: don't force hovermode: 'closest'
etpinard Oct 12, 2016
d26a4b4
ohlc: bump tickwidth dflt to 0.1
etpinard Oct 12, 2016
3803005
finance: add common 'line' style container
etpinard Oct 12, 2016
facbf3d
test: add finance mocks
etpinard Oct 12, 2016
b98835c
ohlc: bump tickwidth dflt to 0.3
etpinard Oct 13, 2016
c9de6c8
test: add finance trace module bundle test
etpinard Oct 13, 2016
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/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ module.exports = {
valType: 'number',
min: 0,
max: 0.5,
dflt: 0.05,
dflt: 0.1,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I might actually vote for quite a bit higher - like 0.3 perhaps?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

at 0.1

image

at 0.3

image

at 0.2

image

I'd vote for 0.2.

@chriddyp @cldougl any objections?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sure, either 0.2 or 0.3 is OK. I still sort of prefer 0.3... but having never used these charts myself it's not a very informed opinion.

Copy link
Contributor

Choose a reason for hiding this comment

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

0.3 from me 3️⃣

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in b98835c

role: 'style',
description: [
'Sets the width of the open/close tick marks',
Expand Down
20 changes: 11 additions & 9 deletions test/jasmine/tests/finance_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,16 +304,16 @@ describe('finance charts calc transforms:', function() {
var out = _calc([trace0, trace1]);

expect(out[0].x).toEqual([
-0.05, 0, 0, 0, 0, 0.05, null,
2.95, 3, 3, 3, 3, 3.05, null,
4.95, 5, 5, 5, 5, 5.05, null,
6.95, 7, 7, 7, 7, 7.05, null
-0.1, 0, 0, 0, 0, 0.1, null,
2.9, 3, 3, 3, 3, 3.1, null,
4.9, 5, 5, 5, 5, 5.1, null,
6.9, 7, 7, 7, 7, 7.1, null
]);
expect(out[1].x).toEqual([
0.95, 1, 1, 1, 1, 1.05, null,
1.95, 2, 2, 2, 2, 2.05, null,
3.95, 4, 4, 4, 4, 4.05, null,
5.95, 6, 6, 6, 6, 6.05, null
0.9, 1, 1, 1, 1, 1.1, null,
1.9, 2, 2, 2, 2, 2.1, null,
3.9, 4, 4, 4, 4, 4.1, null,
5.9, 6, 6, 6, 6, 6.1, null
]);
expect(out[2].x).toEqual([
0, 0, 0, 0, 0, 0,
Expand Down Expand Up @@ -384,6 +384,7 @@ describe('finance charts calc transforms:', function() {
it('should work with *filter* transforms', function() {
var trace0 = Lib.extendDeep({}, mock1, {
type: 'ohlc',
tickwidth: 0.05,
transforms: [{
type: 'filter',
operation: '>',
Expand Down Expand Up @@ -450,6 +451,7 @@ describe('finance charts calc transforms:', function() {

var trace0 = Lib.extendDeep({}, mock1, {
type: 'ohlc',
tickwidth: 0.05,
transforms: [opts]
});

Expand Down Expand Up @@ -561,7 +563,7 @@ describe('finance charts updates:', function() {
var path0;

Plotly.plot(gd, [trace0]).then(function() {
expect(gd.calcdata[0][0].x).toEqual(-0.05);
expect(gd.calcdata[0][0].x).toEqual(-0.1);
expect(gd.calcdata[0][0].y).toEqual(33.01);

return Plotly.restyle(gd, 'tickwidth', 0.5);
Expand Down