Construct source code for the Figure and FigureWidget classes and write to graph_objs/_figure.py and graph_objs/_figurewidget.py respectively Parameters ---------- outdir : str Root outdir in which the graph_objs package should reside trace_node : PlotlyNode
(
outdir,
trace_node,
data_validator,
layout_validator,
frame_validator,
subplot_nodes,
layout_array_nodes,
)
| 705 | |
| 706 | |
| 707 | def write_figure_classes( |
| 708 | outdir, |
| 709 | trace_node, |
| 710 | data_validator, |
| 711 | layout_validator, |
| 712 | frame_validator, |
| 713 | subplot_nodes, |
| 714 | layout_array_nodes, |
| 715 | ): |
| 716 | """ |
| 717 | Construct source code for the Figure and FigureWidget classes and |
| 718 | write to graph_objs/_figure.py and graph_objs/_figurewidget.py |
| 719 | respectively |
| 720 | |
| 721 | Parameters |
| 722 | ---------- |
| 723 | outdir : str |
| 724 | Root outdir in which the graph_objs package should reside |
| 725 | trace_node : PlotlyNode |
| 726 | Root trace node (the node that is the parent of all of the |
| 727 | individual trace nodes like bar, scatter, etc.) |
| 728 | data_validator : BaseDataValidator |
| 729 | DataValidator instance |
| 730 | layout_validator : CompoundValidator |
| 731 | LayoutValidator instance |
| 732 | frame_validator : CompoundArrayValidator |
| 733 | FrameValidator instance |
| 734 | subplot_nodes: list of PlotlyNode |
| 735 | List of names of all of the layout subplot properties |
| 736 | layout_array_nodes: list of PlotlyNode |
| 737 | List of array nodes under layout that can be positioned using xref/yref |
| 738 | Returns |
| 739 | ------- |
| 740 | None |
| 741 | """ |
| 742 | |
| 743 | # Validate inputs |
| 744 | if trace_node.node_path: |
| 745 | raise ValueError( |
| 746 | f"Expected root trace node.\n" |
| 747 | f"Received node with path '{trace_node.path_str}'" |
| 748 | ) |
| 749 | |
| 750 | # Loop over figure types |
| 751 | base_figures = [ |
| 752 | ("basewidget", "BaseFigureWidget", "FigureWidget"), |
| 753 | ("basedatatypes", "BaseFigure", "Figure"), |
| 754 | ] |
| 755 | |
| 756 | for base_package, base_classname, fig_classname in base_figures: |
| 757 | # Build figure source code string |
| 758 | figure_source = build_figure_py( |
| 759 | trace_node, |
| 760 | base_package, |
| 761 | base_classname, |
| 762 | fig_classname, |
| 763 | data_validator, |
| 764 | layout_validator, |
no test coverage detected