MCPcopy Create free account
hub / github.com/bqplot/bqplot / update_domains

Method update_domains

js/src/LinesModel.ts:294–350  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

292 }
293
294 update_domains() {
295 if (!this.mark_data) {
296 return;
297 }
298 const scales = this.getScales();
299 const x_scale = scales.x,
300 y_scale = scales.y;
301 const color_scale = scales.color;
302 const width_scale = scales.width;
303
304 if (!this.get('preserve_domain').x) {
305 x_scale.computeAndSetDomain(
306 this.x_data[0].slice(0, this.data_len),
307 this.model_id + '_x'
308 );
309 } else {
310 x_scale.delDomain([], this.model_id + '_x');
311 }
312
313 if (!this.get('preserve_domain').y) {
314 y_scale.computeAndSetDomain(
315 this.y_data[0].slice(0, this.data_len),
316 this.model_id + '_y'
317 );
318 } else {
319 y_scale.delDomain([], this.model_id + '_y');
320 }
321
322 if (color_scale !== null && color_scale !== undefined) {
323 if (!this.get('preserve_domain').color) {
324 color_scale.computeAndSetDomain(
325 this.mark_data.map((elem) => {
326 return elem.values.map((d) => {
327 return d.color;
328 });
329 }),
330 this.model_id + '_color'
331 );
332 } else {
333 color_scale.delDomain([], this.model_id + '_color');
334 }
335 }
336 if (width_scale !== null && width_scale !== undefined) {
337 if (!this.get('preserve_domain').width) {
338 width_scale.computeAndSetDomain(
339 this.mark_data.map((elem) => {
340 return elem.values.map((d) => {
341 return d.size;
342 });
343 }),
344 this.model_id + '_width'
345 );
346 } else {
347 width_scale.delDomain([], this.model_id + '_width');
348 }
349 }
350 }
351

Callers 1

update_dataMethod · 0.95

Calls 1

getScalesMethod · 0.45

Tested by

no test coverage detected