Uh oh!
There was an error while loading. Please reload this page.
Bug fix - do not display empty bars when line.width is zero - #4056
Conversation
Uh oh!
There was an error while loading. Please reload this page.
| "type": "bar", | ||
| "marker": { | ||
| "line": { | ||
| "width": [10, 0, 10, 0, 10] |
There was a problem hiding this comment.
Looks like this mock only has array marker.line.width value. Could you add one trace that test scaler marker.line.width?
Maybe you can leave this mock alone and simply add another mock using https://codepen.io/MojtabaSamimi/pen/bXbmba , so that we also test the relative-stacked case.
etpinard
commented
Jul 17, 2019
Thanks for taking this one @archmoj - I made two minor comments. |
move getLineWidth function to helpers and reuse it in hover also fixing 4057
archmoj
commented
Jul 17, 2019
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| return value; | ||
| }; | ||
| exports.getLineWidth = function(trace, di) { |
There was a problem hiding this comment.
Bars don't have line.width, but still calling this getMarkerLineWidth would be better.
Uh oh!
There was an error while loading. Please reload this page.
| for(var i = 0; i < imax; i++) cd[i][cdAttr] = isNumber ? +traceAttr[i] : traceAttr[i]; | ||
| for(var i = 0; i < imax; i++) { | ||
| var v = traceAttr[i]; | ||
| cd[i][cdAttr] = hasFn ? fn(v) : v; |
There was a problem hiding this comment.
I wonder what's faster
varhasFn=typeoffn==='function';for(vari=0;i<N;i++){arrayOut[i]=hasFn ? fn(arrayIn[i]) : arrayIn[i];}or
fn=typeoffn==='function' ? fn : Lib.noop;for(vari=0;i<N;i++){arrayOut[i]=fn(arrayIn[i]);}No need to change anything, I'm just thinking out-loud.
There was a problem hiding this comment.
Interesting question. And I like the minimalist version with Lib.noop!
That may depend on the browser.
Having two loops may also be fast.
vari=0;if(typeoffn==='function'){for(;i<N;++i)arrayOut[i]=fn(arrayIn[i]);}else{for(;i<N;++i)arrayOut[i]=arrayIn[i];}etpinard
commented
Jul 18, 2019
Nicely done 💃 Thanks for the fixes! |
Fixes#4047.
Empty
barandfunnelrectangles should not be displayed when marker.line.width is set to zero.Codepen after
Also addressing #4057 for bars in this PR.
Codepen after
@plotly/plotly_js