-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Handle rangebreak gaps in candlestick
& ohlc
#4814
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
Conversation
"data": [ | ||
{ | ||
"type": "candlestick", | ||
"x": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this mock, it would be great to see some data in the next visible range, like after 9am the next day, just to capture some of the tick labelling etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/lib/search.js
Outdated
var first; | ||
for(first = 0; first < vals.length; first++) { | ||
if(vals[first] !== BADNUM) break; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh interesting, I wouldn't have guessed that the problem traced back to distinctVals
, nice find!
TIL:
all undefined elements are sorted to the end of the array, with no call to
compareFunction
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
So perhaps all we need is the loop to find last
and the rest of this can stay as it was, as we'll never have undefined
anywhere else after a sort
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe worth testing this in IE before relying on it. I've confirmed in Chrome, FF, Safari on my mac so seems robust on modern browsers.
If it were to fail on IE, I wouldn't trust that sorting works at all then with interspersed undefined
values, and better would be to filter these out before even starting (instead of the slice()
call)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexcjohnson good catch! Not working on IE11.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexcjohnson Correction. It appear to be working on IE11.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexcjohnson correction number 2: It is sometimes working and sometime not.
So let's fix that for IE11.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. The logic is modified by 2f3b098 & tested in IE11 and it works.
Also we should possibly addess #4818 in this PR which seems related to applying |
The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks for checking on IE11. 💃
Fixes #4742 and fixes #4795 by hangling gaps in
distinctVals
function.Demo1: Before | After
Demo2: Before | After
@plotly/plotly_js