Skip to content
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

Fixed hover behaviour for multicategory plots #6360

Merged
merged 15 commits into from
Nov 16, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/components/fx/hover.js
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,17 @@ function createHoverText(hoverData, opts) {
var xa = c0.xa;
var ya = c0.ya;
var axLetter = hovermode.charAt(0);
var t0 = c0[axLetter + 'Label'];
var axLabel = axLetter + 'Label';
var t0 = c0[axLabel];

// search in array for the label
if(t0 === undefined && xa.type === 'multicategory') {
for(var q = 0; q < hoverData.length; q++) {
t0 = hoverData[q][axLabel];
if(t0 !== undefined) break;
}
}

var outerContainerBB = getBoundingClientRect(gd, outerContainer);
var outerTop = outerContainerBB.top;
var outerWidth = outerContainerBB.width;
Expand Down Expand Up @@ -2067,7 +2077,7 @@ function getCoord(axLetter, winningPoint, fullLayout) {

var cd0 = winningPoint.cd[0];

if(ax.type === 'category') val = ax._categoriesMap[val];
if(ax.type === 'category' || ax.type === 'multicategory') val = ax._categoriesMap[val];
else if(ax.type === 'date') {
var periodalignment = winningPoint.trace[axLetter + 'periodalignment'];
if(periodalignment) {
Expand Down
Binary file added test/image/baselines/zz-multicategory_series.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.