Skip to content

Commit

Permalink
Deactivated error bars if stat option p10_minus_p90 is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
Øyvind Lind-Johansen committed Mar 16, 2023
1 parent 1323e59 commit 9aff078
Showing 1 changed file with 30 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import datetime
from typing import Any, Dict, List, Optional, Set, Union
from typing import Any, Dict, List, Optional, Set, Tuple, Union

import plotly.graph_objects as go
from dash import ALL, Input, Output, State, callback, callback_context
Expand Down Expand Up @@ -115,6 +115,16 @@ def _display_charttype_settings(
.to_string(),
"figure",
),
Output(
{
"id": self.settings_group_unique_id(
self.Ids.LAYOUT_OPTIONS,
WellOverviewLayoutOptions.Ids.CHARTTYPE_CHECKLIST,
),
"charttype": ChartType.BAR,
},
"options",
),
Input(
self.settings_group_unique_id(
self.Ids.SELECTIONS, WellOverviewSelections.Ids.ENSEMBLES
Expand Down Expand Up @@ -185,6 +195,16 @@ def _display_charttype_settings(
.to_string(),
"figure",
),
State(
{
"id": self.settings_group_unique_id(
self.Ids.LAYOUT_OPTIONS,
WellOverviewLayoutOptions.Ids.CHARTTYPE_CHECKLIST,
),
"charttype": ChartType.BAR,
},
"options",
),
)
@callback_typecheck
def _update_graph(
Expand All @@ -198,8 +218,9 @@ def _update_graph(
stattype_selected: StatType,
checklist_ids: List[Dict[str, str]],
current_fig_dict: Optional[Dict[str, Any]],
) -> Component:
# pylint: disable=too-many-arguments
barchart_layout_options: List[Dict[str, Any]],
) -> Tuple[Component, List[Dict[str, Any]]]:
# pylint: disable=too-many-arguments, too-many-locals
"""Updates the well overview graph with selected input (f.ex chart type)"""
ctx = callback_context.triggered[0]["prop_id"].split(".")[0]

Expand Down Expand Up @@ -257,4 +278,9 @@ def _update_graph(
prod_until_date=prod_until_date,
)

return fig_dict
# Disable error bars option if stat type is P10 minus P90.
for elem in barchart_layout_options:
if elem["value"] == "errorbars":
elem["disabled"] = stattype_selected == StatType.P10_MINUS_P90

return fig_dict, barchart_layout_options

0 comments on commit 9aff078

Please sign in to comment.