From e746867a7899bb6867315f1780ae16224a158d2e Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Wed, 18 Jun 2025 19:58:57 -0400 Subject: [PATCH 01/12] implement layout.showarrow attribute --- src/components/fx/attributes.js | 1 + src/components/fx/hover.js | 33 ++++++++++++++---------- src/components/fx/hoverlabel_defaults.js | 1 + src/components/fx/layout_attributes.js | 9 +++++++ 4 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/components/fx/attributes.js b/src/components/fx/attributes.js index a2548f9eccd..c4b49a3d55b 100644 --- a/src/components/fx/attributes.js +++ b/src/components/fx/attributes.js @@ -21,6 +21,7 @@ module.exports = { }), align: extendFlat({}, hoverLabelAttrs.align, {arrayOk: true}), namelength: extendFlat({}, hoverLabelAttrs.namelength, {arrayOk: true}), + showarrow: extendFlat({}, hoverLabelAttrs.showarrow, {arrayOk: true}), editType: 'none' } }; diff --git a/src/components/fx/hover.js b/src/components/fx/hover.js index 80fc4a07cf3..0794a0b5470 100644 --- a/src/components/fx/hover.js +++ b/src/components/fx/hover.js @@ -913,7 +913,7 @@ function _hover(gd, evt, subplot, noHoverEvent, eventTarget) { if(!helpers.isUnifiedHover(hovermode)) { hoverAvoidOverlaps(hoverLabels, rotateLabels, fullLayout, hoverText.commonLabelBoundingBox); - alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY); + alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY, fullLayout.hoverlabel.showarrow); } // TODO: tagName hack is needed to appease geo.js's hack of using eventTarget=true // we should improve the "fx" API so other plots can use it without these hack. if(eventTarget && eventTarget.tagName) { @@ -1903,7 +1903,7 @@ function getTextShiftX(hoverLabel) { }; } -function alignHoverText(hoverLabels, rotateLabels, scaleX, scaleY) { +function alignHoverText(hoverLabels, rotateLabels, scaleX, scaleY, showArrow) { var pX = function(x) { return x * scaleX; }; var pY = function(y) { return y * scaleY; }; @@ -1923,19 +1923,26 @@ function alignHoverText(hoverLabels, rotateLabels, scaleX, scaleY) { var isMiddle = anchor === 'middle'; - g.select('path') - .attr('d', isMiddle ? + var pathStr; + if(isMiddle) { // middle aligned: rect centered on data - ('M-' + pX(d.bx / 2 + d.tx2width / 2) + ',' + pY(offsetY - d.by / 2) + - 'h' + pX(d.bx) + 'v' + pY(d.by) + 'h-' + pX(d.bx) + 'Z') : + pathStr = 'M-' + pX(d.bx / 2 + d.tx2width / 2) + ',' + pY(offsetY - d.by / 2) + + 'h' + pX(d.bx) + 'v' + pY(d.by) + 'h-' + pX(d.bx) + 'Z'; + } else if(showArrow !== false) { // left or right aligned: side rect with arrow to data - ('M0,0L' + pX(horzSign * HOVERARROWSIZE + offsetX) + ',' + pY(HOVERARROWSIZE + offsetY) + - 'v' + pY(d.by / 2 - HOVERARROWSIZE) + - 'h' + pX(horzSign * d.bx) + - 'v-' + pY(d.by) + - 'H' + pX(horzSign * HOVERARROWSIZE + offsetX) + - 'V' + pY(offsetY - HOVERARROWSIZE) + - 'Z')); + pathStr = 'M0,0L' + pX(horzSign * HOVERARROWSIZE + offsetX) + ',' + pY(HOVERARROWSIZE + offsetY) + + 'v' + pY(d.by / 2 - HOVERARROWSIZE) + + 'h' + pX(horzSign * d.bx) + + 'v-' + pY(d.by) + + 'H' + pX(horzSign * HOVERARROWSIZE + offsetX) + + 'V' + pY(offsetY - HOVERARROWSIZE) + + 'Z'; + } else { + // left or right aligned: side rect without arrow + pathStr = 'M' + pX(horzSign * HOVERARROWSIZE + offsetX) + ',' + pY(offsetY - d.by / 2) + + 'h' + pX(horzSign * d.bx) + 'v' + pY(d.by) + 'h' + pX(-horzSign * d.bx) + 'Z'; + } + g.select('path').attr('d', pathStr); var posX = offsetX + shiftX.textShiftX; var posY = offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD; diff --git a/src/components/fx/hoverlabel_defaults.js b/src/components/fx/hoverlabel_defaults.js index 043758e740a..0a0b87ac5c3 100644 --- a/src/components/fx/hoverlabel_defaults.js +++ b/src/components/fx/hoverlabel_defaults.js @@ -36,6 +36,7 @@ module.exports = function handleHoverLabelDefaults(contIn, contOut, coerce, opts coerce('hoverlabel.bgcolor', opts.bgcolor); coerce('hoverlabel.bordercolor', opts.bordercolor); coerce('hoverlabel.namelength', opts.namelength); + coerce('hoverlabel.showarrow', opts.showarrow); Lib.coerceFont(coerce, 'hoverlabel.font', opts.font); coerce('hoverlabel.align', opts.align); }; diff --git a/src/components/fx/layout_attributes.js b/src/components/fx/layout_attributes.js index 0cb8750605b..825b02af289 100644 --- a/src/components/fx/layout_attributes.js +++ b/src/components/fx/layout_attributes.js @@ -165,6 +165,15 @@ module.exports = { '`namelength - 3` characters and add an ellipsis.' ].join(' ') }, + showarrow: { + valType: 'boolean', + dflt: true, + editType: 'none', + description: [ + 'Sets whether or not to show the hover label arrow/triangle', + 'pointing to the data point.' + ].join(' ') + }, editType: 'none' }, From 60f57188630312bfd0d2e2db66da2174a8b181c0 Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Wed, 18 Jun 2025 19:59:16 -0400 Subject: [PATCH 02/12] add tests for layout.showarrow --- test/jasmine/tests/hover_label_test.js | 97 ++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/test/jasmine/tests/hover_label_test.js b/test/jasmine/tests/hover_label_test.js index a9af59100c0..24109f4947d 100644 --- a/test/jasmine/tests/hover_label_test.js +++ b/test/jasmine/tests/hover_label_test.js @@ -7038,3 +7038,100 @@ describe('hover on traces with (x|y)hoverformat', function() { .then(done, done.fail); }); }); + +describe('hoverlabel.showarrow', function() { + 'use strict'; + + var gd; + + beforeEach(function() { + gd = createGraphDiv(); + }); + + afterEach(destroyGraphDiv); + + function _hover(x, y) { + mouseEvent('mousemove', x, y); + Lib.clearThrottle(); + } + + function getHoverPath() { + var hoverLabels = d3SelectAll('g.hovertext'); + if (hoverLabels.size() === 0) return null; + return hoverLabels.select('path').attr('d'); + } + + it('should show hover arrow by default', function(done) { + Plotly.newPlot(gd, [{ + x: [1, 2, 3], + y: [1, 2, 1], + type: 'scatter', + mode: 'markers' + }], { + width: 400, + height: 400, + margin: {l: 50, t: 50, r: 50, b: 50} + }) + .then(function() { + _hover(200, 200); // Hover over middle point + }) + .then(delay(HOVERMINTIME * 1.1)) + .then(function() { + var pathD = getHoverPath(); + expect(pathD).not.toBeNull('hover path should exist'); + // Arrow paths contain 'L' commands for the triangular pointer + expect(pathD).toMatch(/M0,0L/, 'path should contain arrow (L command from origin)'); + }) + .then(done, done.fail); + }); + + it('should hide hover arrow when showarrow is false', function(done) { + Plotly.newPlot(gd, [{ + x: [1, 2, 3], + y: [1, 2, 1], + type: 'scatter', + mode: 'markers' + }], { + width: 400, + height: 400, + margin: {l: 50, t: 50, r: 50, b: 50}, + hoverlabel: { showarrow: false } + }) + .then(function() { + _hover(200, 200); // Hover over middle point + }) + .then(delay(HOVERMINTIME * 1.1)) + .then(function() { + var pathD = getHoverPath(); + expect(pathD).not.toBeNull('hover path should exist'); + // No-arrow paths should be simple rectangles (no 'L' commands from origin) + expect(pathD).not.toMatch(/M0,0L/, 'path should not contain arrow'); + expect(pathD).toMatch(/^M-/, 'path should start with rectangle (M- for left edge)'); + }) + .then(done, done.fail); + }); + + it('should work at trace level', function(done) { + Plotly.newPlot(gd, [{ + x: [1, 2, 3], + y: [1, 2, 1], + type: 'scatter', + mode: 'markers', + hoverlabel: { showarrow: false } + }], { + width: 400, + height: 400, + margin: {l: 50, t: 50, r: 50, b: 50} + }) + .then(function() { + _hover(200, 200); // Hover over middle point + }) + .then(delay(HOVERMINTIME * 1.1)) + .then(function() { + var pathD = getHoverPath(); + expect(pathD).not.toBeNull('hover path should exist'); + expect(pathD).not.toMatch(/M0,0L/, 'trace-level showarrow:false should hide arrow'); + }) + .then(done, done.fail); + }); +}); From db048964ca7646db0893005459466abb0f72f092 Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Tue, 22 Jul 2025 13:23:28 -0400 Subject: [PATCH 03/12] fix hoverlabel.showarrow behavior for individual traces --- src/components/fx/calc.js | 1 + src/components/fx/hover.js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/fx/calc.js b/src/components/fx/calc.js index 9854947a42f..5934a57efaf 100644 --- a/src/components/fx/calc.js +++ b/src/components/fx/calc.js @@ -40,6 +40,7 @@ module.exports = function calc(gd) { fillFn(trace.hoverlabel.font.variant, cd, 'htv'); fillFn(trace.hoverlabel.namelength, cd, 'hnl'); fillFn(trace.hoverlabel.align, cd, 'hta'); + fillFn(trace.hoverlabel.showarrow, cd, 'htsa'); } }; diff --git a/src/components/fx/hover.js b/src/components/fx/hover.js index 0794a0b5470..6b252c6b82e 100644 --- a/src/components/fx/hover.js +++ b/src/components/fx/hover.js @@ -913,7 +913,7 @@ function _hover(gd, evt, subplot, noHoverEvent, eventTarget) { if(!helpers.isUnifiedHover(hovermode)) { hoverAvoidOverlaps(hoverLabels, rotateLabels, fullLayout, hoverText.commonLabelBoundingBox); - alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY, fullLayout.hoverlabel.showarrow); + alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY); } // TODO: tagName hack is needed to appease geo.js's hack of using eventTarget=true // we should improve the "fx" API so other plots can use it without these hack. if(eventTarget && eventTarget.tagName) { @@ -1903,7 +1903,7 @@ function getTextShiftX(hoverLabel) { }; } -function alignHoverText(hoverLabels, rotateLabels, scaleX, scaleY, showArrow) { +function alignHoverText(hoverLabels, rotateLabels, scaleX, scaleY) { var pX = function(x) { return x * scaleX; }; var pY = function(y) { return y * scaleY; }; @@ -1922,6 +1922,7 @@ function alignHoverText(hoverLabels, rotateLabels, scaleX, scaleY, showArrow) { var offsetY = offsets.y; var isMiddle = anchor === 'middle'; + var showArrow = d.trace.hoverlabel.showarrow; var pathStr; if(isMiddle) { From 63e44ab0c38a3bd72f16835f3a3ac3c91806a49e Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Tue, 22 Jul 2025 13:27:13 -0400 Subject: [PATCH 04/12] fix hover label showarrow test --- test/jasmine/tests/hover_label_test.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/jasmine/tests/hover_label_test.js b/test/jasmine/tests/hover_label_test.js index 24109f4947d..d89f482f9b1 100644 --- a/test/jasmine/tests/hover_label_test.js +++ b/test/jasmine/tests/hover_label_test.js @@ -7073,14 +7073,14 @@ describe('hoverlabel.showarrow', function() { margin: {l: 50, t: 50, r: 50, b: 50} }) .then(function() { - _hover(200, 200); // Hover over middle point + _hover(200, 70); // Hover over middle point }) .then(delay(HOVERMINTIME * 1.1)) .then(function() { var pathD = getHoverPath(); expect(pathD).not.toBeNull('hover path should exist'); - // Arrow paths contain 'L' commands for the triangular pointer - expect(pathD).toMatch(/M0,0L/, 'path should contain arrow (L command from origin)'); + // Arrow paths contain 'L' commands starting from 0,0 + expect(pathD).toMatch(/^M0,0L/, 'path should contain arrow (L command from 0,0)'); }) .then(done, done.fail); }); @@ -7098,15 +7098,15 @@ describe('hoverlabel.showarrow', function() { hoverlabel: { showarrow: false } }) .then(function() { - _hover(200, 200); // Hover over middle point + _hover(200, 70); // Hover over middle point }) .then(delay(HOVERMINTIME * 1.1)) .then(function() { var pathD = getHoverPath(); expect(pathD).not.toBeNull('hover path should exist'); - // No-arrow paths should be simple rectangles (no 'L' commands from origin) - expect(pathD).not.toMatch(/M0,0L/, 'path should not contain arrow'); - expect(pathD).toMatch(/^M-/, 'path should start with rectangle (M- for left edge)'); + // No-arrow paths should be simple rectangles (no 'L' commands starting at 0,0)) + expect(pathD).not.toMatch(/^M0,0L/, 'path should not start at 0,0'); + expect(pathD).toMatch(/^M[\d.-]+,[\d.-]+h/, 'path should start with some numeric point and move horizontally'); }) .then(done, done.fail); }); @@ -7124,13 +7124,13 @@ describe('hoverlabel.showarrow', function() { margin: {l: 50, t: 50, r: 50, b: 50} }) .then(function() { - _hover(200, 200); // Hover over middle point + _hover(200, 70); // Hover over middle point }) .then(delay(HOVERMINTIME * 1.1)) .then(function() { var pathD = getHoverPath(); expect(pathD).not.toBeNull('hover path should exist'); - expect(pathD).not.toMatch(/M0,0L/, 'trace-level showarrow:false should hide arrow'); + expect(pathD).not.toMatch(/^M0,0L/, 'trace-level showarrow:false should hide arrow'); }) .then(done, done.fail); }); From d0652171c158bf400cbc8062c5b5e466706aeb3b Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Tue, 22 Jul 2025 13:57:26 -0400 Subject: [PATCH 05/12] update plot-schema --- test/plot-schema.json | 648 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 603 insertions(+), 45 deletions(-) diff --git a/test/plot-schema.json b/test/plot-schema.json index 5e1c74f3793..9fad9e2c6df 100644 --- a/test/plot-schema.json +++ b/test/plot-schema.json @@ -3021,7 +3021,13 @@ "min": -1, "valType": "integer" }, - "role": "object" + "role": "object", + "showarrow": { + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + } }, "hovermode": { "description": "Determines the mode of hover interactions. If *closest*, a single hoverlabel will appear for the *closest* point within the `hoverdistance`. If *x* (or *y*), multiple hoverlabels will appear for multiple points at the *closest* x- (or y-) coordinate within the `hoverdistance`, with the caveat that no more than one hoverlabel will appear per trace. If *x unified* (or *y unified*), a single hoverlabel will appear multiple points at the closest x- (or y-) coordinate within the `hoverdistance` with the caveat that no more than one hoverlabel will appear per trace. In this mode, spikelines are enabled by default perpendicular to the specified axis. If false, hover interactions are disabled.", @@ -16767,7 +16773,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -18966,7 +18984,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -20548,7 +20578,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hoveron": { "description": "Do the hover effects highlight individual boxes or sample points or both?", @@ -22086,6 +22128,18 @@ "valType": "string" }, "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + }, "split": { "description": "Show hover information (open, close, high, low) in separate labels.", "dflt": false, @@ -25121,7 +25175,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -26402,7 +26468,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -27679,7 +27757,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -28989,7 +29079,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -30550,7 +30652,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hoverongaps": { "description": "Determines whether or not gaps (i.e. {nan} or missing values) in the `z` data have hover labels associated with them.", @@ -33373,7 +33487,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -34588,7 +34714,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -35253,7 +35391,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -37281,7 +37431,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -39112,7 +39274,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hoverongaps": { "description": "Determines whether or not gaps (i.e. {nan} or missing values) in the `z` data have hover labels associated with them.", @@ -40273,7 +40447,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -42914,7 +43100,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -44604,7 +44802,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -45530,7 +45740,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -47616,7 +47838,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -50142,7 +50376,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -51683,7 +51929,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -52511,6 +52769,18 @@ "valType": "string" }, "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + }, "split": { "description": "Show hover information (open, close, high, low) in separate labels.", "dflt": false, @@ -55966,7 +56236,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -57396,7 +57678,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "calc", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "ids": { "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", @@ -57830,7 +58124,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "calc", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -58195,7 +58501,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "calc", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -59070,7 +59388,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hoveron": { "description": "Do the hover effects highlight individual points (markers or line points) or do they highlight filled regions? If the fill is *toself* or *tonext* and there are no markers or text, then the default is *fills*, otherwise it is *points*.", @@ -61808,7 +62138,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -64252,7 +64594,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hoveron": { "description": "Do the hover effects highlight individual points (markers or line points) or do they highlight filled regions? If the fill is *toself* or *tonext* and there are no markers or text, then the default is *fills*, otherwise it is *points*.", @@ -66536,7 +66890,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -68978,7 +69344,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -71301,7 +71679,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -72838,7 +73228,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -74320,7 +74722,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hoveron": { "description": "Do the hover effects highlight individual points (markers or line points) or do they highlight filled regions? If the fill is *toself* or *tonext* and there are no markers or text, then the default is *fills*, otherwise it is *points*.", @@ -76630,7 +77044,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -78774,7 +79200,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hoveron": { "description": "Do the hover effects highlight individual points (markers or line points) or do they highlight filled regions? If the fill is *toself* or *tonext* and there are no markers or text, then the default is *fills*, otherwise it is *points*.", @@ -81083,7 +81521,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hoveron": { "description": "Do the hover effects highlight individual points (markers or line points) or do they highlight filled regions? If the fill is *toself* or *tonext* and there are no markers or text, then the default is *fills*, otherwise it is *points*.", @@ -83393,7 +83843,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -85989,7 +86451,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -86800,7 +87274,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -89599,7 +90085,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -90914,7 +91412,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "ids": { "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", @@ -91430,7 +91940,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -93591,7 +94113,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hoveron": { "description": "Do the hover effects highlight individual violins or sample points or the kernel density estimate or any combination of them?", @@ -95705,7 +96239,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, @@ -96656,7 +97202,19 @@ "editType": "none", "valType": "string" }, - "role": "object" + "role": "object", + "showarrow": { + "arrayOk": true, + "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", + "dflt": true, + "editType": "none", + "valType": "boolean" + }, + "showarrowsrc": { + "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", + "editType": "none", + "valType": "string" + } }, "hovertemplate": { "arrayOk": true, From 579992e0a7784df1db34c0796747616a43e8ccf4 Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Tue, 22 Jul 2025 16:32:19 -0400 Subject: [PATCH 06/12] update fx_test for new showarrow attr --- test/jasmine/tests/fx_test.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/jasmine/tests/fx_test.js b/test/jasmine/tests/fx_test.js index 3f757713445..d123999e265 100644 --- a/test/jasmine/tests/fx_test.js +++ b/test/jasmine/tests/fx_test.js @@ -179,7 +179,8 @@ describe('Fx defaults', function() { shadow: 'auto', }, align: 'auto', - namelength: 15 + namelength: 15, + showarrow: true, }); expect(out.data[1].hoverlabel).toEqual({ @@ -197,7 +198,8 @@ describe('Fx defaults', function() { shadow: 'auto', }, align: 'auto', - namelength: 15 + namelength: 15, + showarrow: true, }); expect(out.layout.annotations[0].hoverlabel).toEqual({ From b3258fcfc01eb9aeeabb5345d1fb8b17cc96b98e Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Tue, 22 Jul 2025 16:32:54 -0400 Subject: [PATCH 07/12] handle case where trace.hoverlabel is undefined --- src/components/fx/hover.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/fx/hover.js b/src/components/fx/hover.js index 6b252c6b82e..0796e1ea75c 100644 --- a/src/components/fx/hover.js +++ b/src/components/fx/hover.js @@ -1922,7 +1922,7 @@ function alignHoverText(hoverLabels, rotateLabels, scaleX, scaleY) { var offsetY = offsets.y; var isMiddle = anchor === 'middle'; - var showArrow = d.trace.hoverlabel.showarrow; + var showArrow = d.trace.hoverlabel?.showarrow; var pathStr; if(isMiddle) { From 23a8f8aa5f9e7a72b7433a63d2e880b8fb382697 Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Tue, 22 Jul 2025 18:49:57 -0400 Subject: [PATCH 08/12] remove arrayOk --- src/components/fx/attributes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/fx/attributes.js b/src/components/fx/attributes.js index c4b49a3d55b..dc5f867b3a6 100644 --- a/src/components/fx/attributes.js +++ b/src/components/fx/attributes.js @@ -21,7 +21,7 @@ module.exports = { }), align: extendFlat({}, hoverLabelAttrs.align, {arrayOk: true}), namelength: extendFlat({}, hoverLabelAttrs.namelength, {arrayOk: true}), - showarrow: extendFlat({}, hoverLabelAttrs.showarrow, {arrayOk: true}), + showarrow: extendFlat({}, hoverLabelAttrs.showarrow), editType: 'none' } }; From 61d949ed3ed658828ae5b365b7fa75137862f3dd Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Tue, 22 Jul 2025 19:03:44 -0400 Subject: [PATCH 09/12] update plot-schema --- test/plot-schema.json | 276 ------------------------------------------ 1 file changed, 276 deletions(-) diff --git a/test/plot-schema.json b/test/plot-schema.json index 9fad9e2c6df..4e265992144 100644 --- a/test/plot-schema.json +++ b/test/plot-schema.json @@ -16775,16 +16775,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -18986,16 +18980,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -20580,16 +20568,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hoveron": { @@ -22129,17 +22111,11 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" - }, "split": { "description": "Show hover information (open, close, high, low) in separate labels.", "dflt": false, @@ -25177,16 +25153,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -26470,16 +26440,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -27759,16 +27723,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -29081,16 +29039,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -30654,16 +30606,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hoverongaps": { @@ -33489,16 +33435,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -34716,16 +34656,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -35393,16 +35327,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -37433,16 +37361,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -39276,16 +39198,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hoverongaps": { @@ -40449,16 +40365,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -43102,16 +43012,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -44804,16 +44708,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -45742,16 +45640,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -47840,16 +47732,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -50378,16 +50264,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -51931,16 +51811,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -52770,17 +52644,11 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" - }, "split": { "description": "Show hover information (open, close, high, low) in separate labels.", "dflt": false, @@ -56238,16 +56106,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -57680,16 +57542,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "calc", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "ids": { @@ -58126,16 +57982,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "calc", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -58503,16 +58353,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "calc", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -59390,16 +59234,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hoveron": { @@ -62140,16 +61978,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -64596,16 +64428,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hoveron": { @@ -66892,16 +66718,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -69346,16 +69166,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -71681,16 +71495,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -73230,16 +73038,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -74724,16 +74526,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hoveron": { @@ -77046,16 +76842,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -79202,16 +78992,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hoveron": { @@ -81523,16 +81307,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hoveron": { @@ -83845,16 +83623,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -86453,16 +86225,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -87276,16 +87042,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -90087,16 +89847,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -91414,16 +91168,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "ids": { @@ -91942,16 +91690,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -94115,16 +93857,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hoveron": { @@ -96241,16 +95977,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { @@ -97204,16 +96934,10 @@ }, "role": "object", "showarrow": { - "arrayOk": true, "description": "Sets whether or not to show the hover label arrow/triangle pointing to the data point.", "dflt": true, "editType": "none", "valType": "boolean" - }, - "showarrowsrc": { - "description": "Sets the source reference on Chart Studio Cloud for `showarrow`.", - "editType": "none", - "valType": "string" } }, "hovertemplate": { From 7c75cd2d2672ae9bc948f57e900351711695933c Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Wed, 23 Jul 2025 10:03:36 -0400 Subject: [PATCH 10/12] add draftlog --- draftlogs/7451_add.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 draftlogs/7451_add.md diff --git a/draftlogs/7451_add.md b/draftlogs/7451_add.md new file mode 100644 index 00000000000..53c30477b4d --- /dev/null +++ b/draftlogs/7451_add.md @@ -0,0 +1 @@ +- Add `layout.hoverlabel.showarrow` (and `trace.hoverlabel.showarrow`) attribute to allow hiding the triangular carat that appears on the hover label box [[#7451](https://github.com/plotly/plotly.js/pull/7451)] From aac31fd8f6330112996f70868c30d426af1cf9ed Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Fri, 25 Jul 2025 16:47:14 -0400 Subject: [PATCH 11/12] typo Co-authored-by: Cameron DeCoster --- draftlogs/7451_add.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/draftlogs/7451_add.md b/draftlogs/7451_add.md index 53c30477b4d..cac0f4747ec 100644 --- a/draftlogs/7451_add.md +++ b/draftlogs/7451_add.md @@ -1 +1 @@ -- Add `layout.hoverlabel.showarrow` (and `trace.hoverlabel.showarrow`) attribute to allow hiding the triangular carat that appears on the hover label box [[#7451](https://github.com/plotly/plotly.js/pull/7451)] +- Add `layout.hoverlabel.showarrow` (and `trace.hoverlabel.showarrow`) attribute to allow hiding the triangular caret that appears on the hover label box [[#7451](https://github.com/plotly/plotly.js/pull/7451)] From e382d2f51e096220d4f49895f4b9e085c2e10d80 Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Fri, 25 Jul 2025 17:21:38 -0400 Subject: [PATCH 12/12] clearer handling of showarrow attr when hoverlabel undefined --- src/components/fx/hover.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/fx/hover.js b/src/components/fx/hover.js index 0796e1ea75c..cc2bf4e63bb 100644 --- a/src/components/fx/hover.js +++ b/src/components/fx/hover.js @@ -1922,14 +1922,16 @@ function alignHoverText(hoverLabels, rotateLabels, scaleX, scaleY) { var offsetY = offsets.y; var isMiddle = anchor === 'middle'; - var showArrow = d.trace.hoverlabel?.showarrow; + // Get 'showarrow' attribute value from trace hoverlabel settings; + // if trace has no hoverlabel settings, we should show the arrow by default + var showArrow = 'hoverlabel' in d.trace ? d.trace.hoverlabel.showarrow : true; var pathStr; if(isMiddle) { // middle aligned: rect centered on data pathStr = 'M-' + pX(d.bx / 2 + d.tx2width / 2) + ',' + pY(offsetY - d.by / 2) + 'h' + pX(d.bx) + 'v' + pY(d.by) + 'h-' + pX(d.bx) + 'Z'; - } else if(showArrow !== false) { + } else if(showArrow) { // left or right aligned: side rect with arrow to data pathStr = 'M0,0L' + pX(horzSign * HOVERARROWSIZE + offsetX) + ',' + pY(HOVERARROWSIZE + offsetY) + 'v' + pY(d.by / 2 - HOVERARROWSIZE) +