Skip to content

Commit 1890e77

Browse files
committed
simplification for bar
1 parent 4d2961d commit 1890e77

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

Diff for: src/traces/bar/cross_trace_calc.js

-8
Original file line numberDiff line numberDiff line change
@@ -436,20 +436,12 @@ function setBarCenterAndWidth(pa, sieve) {
436436
var barwidth = t.barwidth;
437437
var barwidthIsArray = Array.isArray(barwidth);
438438

439-
var trace = calcTrace[0].trace;
440-
var isPeriod = !!trace[pLetter + 'periodalignment'];
441-
442439
for(var j = 0; j < calcTrace.length; j++) {
443440
var calcBar = calcTrace[j];
444441

445442
// store the actual bar width and position, for use by hover
446443
var width = calcBar.w = barwidthIsArray ? barwidth[j] : barwidth;
447444
calcBar[pLetter] = calcBar.p + (poffsetIsArray ? poffset[j] : poffset) + width / 2;
448-
449-
if(isPeriod) {
450-
calcBar.wPeriod =
451-
calcBar[pLetter + 'End'] - calcBar[pLetter + 'Start'];
452-
}
453445
}
454446
}
455447
}

Diff for: src/traces/bar/hover.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function hoverOnBars(pointData, xval, yval, hovermode, opts) {
7070
var minPos = isClosest ?
7171
thisBarMinPos : period ?
7272
function(di) {
73-
return di.p + periodLength(di) / 2 - di.wPeriod;
73+
return di.p - periodLength(di) / 2;
7474
} :
7575
function(di) {
7676
/*

0 commit comments

Comments
 (0)