Skip to content

Commit 3a1336f

Browse files
committed
Add docstrings for handleClick and handleTitleClick
1 parent 0cde808 commit 3a1336f

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/components/legend/handle_click.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ var helpers = require('./helpers');
77

88
var SHOWISOLATETIP = true;
99

10+
/**
11+
* Handles click actions on individual legend items.
12+
*
13+
* @param {object} g D3 selection of the legend item element
14+
* @param {object} gd graph div
15+
* @param {object} legendObj the legend object from fullLayout
16+
* @param {string} mode toggle mode for the current action: 'toggle' | 'toggleothers'
17+
* - 'toggle': Toggle visibility of this item (or group if groupclick is 'togglegroup')
18+
* - 'toggleothers': Show only this item, hide all others (isolation mode)
19+
*/
1020
exports.handleClick = function handleClick(g, gd, legendObj, mode) {
1121
var fullLayout = gd._fullLayout;
1222

@@ -263,6 +273,15 @@ exports.handleClick = function handleClick(g, gd, legendObj, mode) {
263273
}
264274
};
265275

276+
/**
277+
* Handles click actions on legend titles.
278+
*
279+
* @param {object} gd graph div (plot container)
280+
* @param {object} legendObj the legend object from fullLayout
281+
* @param {string} mode toggle mode for the current action: 'toggle' | 'toggleothers'
282+
* - 'toggle': show/hide all items in this legend
283+
* - 'toggleothers': isolate this legend (show its items, hide items in other legends)
284+
*/
266285
exports.handleTitleClick = function handleTitleClick(gd, legendObj, mode) {
267286
const fullLayout = gd._fullLayout;
268287
const fullData = gd._fullData;

0 commit comments

Comments
 (0)