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

Method padded_range

js/src/Figure.ts:638–672  ·  view source on GitHub ↗
(
    direction: 'x' | 'y',
    scale_model: ScaleModel
  )

Source from the content-addressed store, hash-verified

636 }
637
638 padded_range(
639 direction: 'x' | 'y',
640 scale_model: ScaleModel
641 ): [number, number] {
642 // Functions to be called by mark which respects padding.
643 // Typically all marks do this. Axis do not do this.
644 // Also, if a mark does not set the domain, it can potentially call
645 // the unpadded ranges.
646 if (!scale_model.get('allow_padding')) {
647 return this.range(direction);
648 }
649 const scale_id = scale_model.model_id;
650
651 if (direction === 'x') {
652 const scale_padding =
653 this.xPaddingArr[scale_id] !== undefined
654 ? this.xPaddingArr[scale_id]
655 : 0;
656 const fig_padding = this.plotareaWidth * this.figure_padding_x;
657 return [
658 fig_padding + scale_padding,
659 this.plotareaWidth - fig_padding - scale_padding,
660 ];
661 } else if (direction === 'y') {
662 const scale_padding =
663 this.yPaddingArr[scale_id] !== undefined
664 ? this.yPaddingArr[scale_id]
665 : 0;
666 const fig_padding = this.plotareaHeight * this.figure_padding_y;
667 return [
668 this.plotareaHeight - scale_padding - fig_padding,
669 scale_padding + fig_padding,
670 ];
671 }
672 }
673
674 range(direction: 'x' | 'y'): [number, number] {
675 if (direction === 'x') {

Callers 15

set_rangesMethod · 0.80
set_rangesMethod · 0.80
update_scale_domainMethod · 0.80
update_axis_domainMethod · 0.80
set_rangesMethod · 0.80
set_rangesMethod · 0.80
set_rangesMethod · 0.80
set_rangesFunction · 0.80
set_rangesMethod · 0.80
update_scale_domainFunction · 0.80
update_xscale_domainFunction · 0.80

Calls 1

rangeMethod · 0.95

Tested by

no test coverage detected