| 610 | } |
| 611 | |
| 612 | async create_figure_scales() { |
| 613 | // Creates the absolute scales for the figure: default domain is [0,1], range is [0,width] and [0,height]. |
| 614 | // See the scale_x and scale_y attributes of the python Figure |
| 615 | await this.create_child_view(this.model.get('scale_x')).then((view) => { |
| 616 | this.scale_x = view as WidgetView as Scale; |
| 617 | ( |
| 618 | this.scale_x.scale as |
| 619 | | d3.ScaleLinear<number, number> |
| 620 | | d3.ScaleTime<Date, number> |
| 621 | | d3.ScaleLogarithmic<number, number> |
| 622 | ).clamp(true); |
| 623 | this.scale_x.setRange([0, this.plotareaWidth]); |
| 624 | }); |
| 625 | |
| 626 | await this.create_child_view(this.model.get('scale_y')).then((view) => { |
| 627 | this.scale_y = view as WidgetView as Scale; |
| 628 | ( |
| 629 | this.scale_y.scale as |
| 630 | | d3.ScaleLinear<number, number> |
| 631 | | d3.ScaleTime<Date, number> |
| 632 | | d3.ScaleLogarithmic<number, number> |
| 633 | ).clamp(true); |
| 634 | this.scale_y.setRange([this.plotareaHeight, 0]); |
| 635 | }); |
| 636 | } |
| 637 | |
| 638 | padded_range( |
| 639 | direction: 'x' | 'y', |