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

Method selector_changed

js/src/Bars.ts:247–268  ·  view source on GitHub ↗
(point_selector, rect_selector)

Source from the content-addressed store, hash-verified

245 }
246
247 selector_changed(point_selector, rect_selector) {
248 if (point_selector === undefined) {
249 this.model.set('selected', null);
250 this.touch();
251 return [];
252 }
253 const pixels = this.pixelCoords;
254 const indices = new Uint32Array(_.range(pixels.length));
255 // Here we only select bar groups. It shouldn't be too hard to select
256 // individual bars, the `selected` attribute would then be a list of pairs.
257 const selected_groups = indices.filter((index) => {
258 const bars = pixels[index];
259 for (let i = 0; i < bars.length; i++) {
260 if (rect_selector(bars[i])) {
261 return true;
262 }
263 }
264 return false;
265 });
266 this.model.set('selected', selected_groups);
267 this.touch();
268 }
269
270 private updateSelected() {
271 this.selected_indices = this.model.get('selected');

Callers

nothing calls this directly

Calls 2

rect_selectorFunction · 0.85
rangeMethod · 0.80

Tested by

no test coverage detected