MCPcopy Index your code
hub / github.com/bqplot/bqplot / clear_style

Method clear_style

js/src/GridHeatMap.ts:295–324  ·  view source on GitHub ↗
(style_dict, indices?, elements?)

Source from the content-addressed store, hash-verified

293 }
294
295 clear_style(style_dict, indices?, elements?) {
296 // Function to clear the style of a dict on some or all the elements of the
297 // chart. If indices is null, clears the style on all elements. If
298 // not, clears on only the elements whose indices are matching.
299 //
300 // If elements are passed, then indices are ignored and the style
301 // is cleared only on the elements that are passed.
302 //
303 // This can be used if we decide to accommodate more properties than
304 // those set by default. Because those have to cleared specifically.
305 //
306 if (Object.keys(style_dict).length === 0) {
307 // No style to clear
308 return;
309 }
310
311 if (!elements || elements.length === 0) {
312 if (indices) {
313 elements = this.filterCellsByNum(this.indicesToCellNums(indices));
314 } else {
315 elements = this.displayCells;
316 }
317 }
318
319 const clearing_style = {};
320 for (const key in style_dict) {
321 clearing_style[key] = null;
322 }
323 applyStyles(elements, clearing_style);
324 }
325
326 private filterCellsByNum(
327 cell_numbers: number[]

Callers 4

apply_stylesMethod · 0.95
resetSelectionMethod · 0.95

Calls 3

filterCellsByNumMethod · 0.95
indicesToCellNumsMethod · 0.95
applyStylesFunction · 0.90

Tested by

no test coverage detected