Пример #1
0
def page_layout(api):
    everest_export = api.everest_csv
    if everest_export is not None:
        plots = [
            _crossplot_doc,
            {
                "Crossplot": {
                    "data_path": everest_export,
                },
            },
        ]

        indexed_controls = identify_indexed_controls(api.control_names)
        if len(indexed_controls) > 0:
            plots.extend([
                _crossplot_indexed_doc,
                {
                    "CrossplotIndexed": {
                        "data_path": everest_export,
                    }
                },
            ])

        return {
            "title": "Cross plots",
            "content": plots,
        }
    return ""
Пример #2
0
    def layout(self):
        df = get_data(self.data_path)
        dropdown_options = list(
            identify_indexed_controls(df.columns.unique()).keys())
        realizations = df.index.values
        axis_type = [(i, i) for i in ["Linear", "Log"]]
        axis_options = ["Normal", "Cumulative"]
        interp_types = [
            ("None", None),
            ("Linear", "linear"),
            ("High value", "hv"),
            ("Low value", "vh"),
        ]

        side_bar_config = [
            (
                "radio",
                {
                    "title": "X-axis",
                    "item_id": self.axis_type_x_id,
                    "options": axis_type,
                },
            ),
            (
                "radio",
                {
                    "item_id": self.axis_options_x_id,
                    "options": axis_options
                },
            ),
            (
                "dropdown",
                {
                    "item_id": self.dropdown_x_id,
                    "options": dropdown_options
                },
            ),
            (
                "radio",
                {
                    "title": "Y-axis",
                    "item_id": self.axis_type_y_id,
                    "options": axis_type,
                },
            ),
            (
                "radio",
                {
                    "item_id": self.axis_options_y_id,
                    "options": axis_options
                },
            ),
            (
                "dropdown",
                {
                    "item_id": self.dropdown_y_id,
                    "options": dropdown_options
                },
            ),
            (
                "radio",
                {
                    "title": "Interpolation type",
                    "item_id": self.interpolation_id,
                    "options": interp_types,
                },
            ),
            (
                "dropdown",
                {
                    "item_id": self.dropdown_realization_id,
                    "options": realizations,
                    "multi": True,
                },
            ),
        ]

        return html.Div([
            html.H1(children=self.title, style={"textAlign": "center"}),
            html.Div([
                html.Div(
                    [get_sidebar_layout(side_bar_config)],
                    style={
                        "width": "29%",
                        "display": "inline-block",
                        "vertical-align": "top",
                    },
                ),
                html.Div(
                    [
                        dcc.Graph(
                            id=self.graph_id,
                            config={
                                "displaylogo": False,
                                "toImageButtonOptions": {
                                    "filename": "indexed_crossplot"
                                },
                            },
                        )
                    ],
                    style={
                        "width": "69%",
                        "display": "inline-block"
                    },
                ),
            ]),
        ])
Пример #3
0
 def update_dropwdown_y(selected_control):
     df = get_data(self.data_path)
     indexed_controls = identify_indexed_controls(df.columns.unique())
     return dropdown_callback(selected_control, indexed_controls)
Пример #4
0
def test_get_indexed_controls(test_input, expected):
    result = identify_indexed_controls(test_input)
    assert result == expected