diff --git a/draftlogs/6944_change.md b/draftlogs/6944_change.md new file mode 100644 index 00000000000..21890229b0f --- /dev/null +++ b/draftlogs/6944_change.md @@ -0,0 +1,3 @@ +- Fix hover count in parcats trace [[#6944](https://github.com/plotly/plotly.js/pull/6944)], + with thanks to @weiweikee for the contribution! + diff --git a/src/traces/parcats/parcats.js b/src/traces/parcats/parcats.js index 44a23d20d8e..965cd93e3d6 100644 --- a/src/traces/parcats/parcats.js +++ b/src/traces/parcats/parcats.js @@ -921,7 +921,7 @@ function createHoverLabelForColorHovermode(gd, rootBBox, bandElement) { var pColorGivenCat = bandColorCount / catCount; var labels = { - countLabel: totalCount, + countLabel: bandColorCount, categoryLabel: catLabel, probabilityLabel: pColorAndCat.toFixed(3) }; diff --git a/test/image/mocks/parcats_hoveron_color.json b/test/image/mocks/parcats_hoveron_color.json index be40fe56d8d..499dca01514 100644 --- a/test/image/mocks/parcats_hoveron_color.json +++ b/test/image/mocks/parcats_hoveron_color.json @@ -3,7 +3,7 @@ {"type": "parcats", "domain": {"x": [0.125, 0.625],"y": [0.25, 0.75]}, "hoveron": "color", - "hoverinfo": "probability", + "hoverinfo": "count+probability", "dimensions":[ {"label": "One", "values": [1, 1, 2, 1, 2, 1, 1, 2, 1]}, {"label": "Two", "values": ["A", "B", "A", "B", "C", "C", "A", "B", "C"]},