Debugged reports.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Construct turnaround time charts
|
||||
Construct BC control concentration charts
|
||||
"""
|
||||
from pprint import pformat
|
||||
from . import CustomFigure
|
||||
@@ -21,17 +21,15 @@ class ConcentrationsChart(CustomFigure):
|
||||
super().__init__(df=df, modes=modes, settings=settings)
|
||||
self.df = df
|
||||
self.construct_chart()
|
||||
# if threshold:
|
||||
# self.add_hline(y=threshold)
|
||||
self.update_layout(showlegend=False)
|
||||
|
||||
def construct_chart(self, df: pd.DataFrame | None = None):
|
||||
if df:
|
||||
self.df = df
|
||||
# logger.debug(f"Constructing concentration chart with df:\n{self.df}")
|
||||
try:
|
||||
self.df = self.df[self.df.concentration.notnull()]
|
||||
self.df = self.df.sort_values(['submitted_date', 'submission'], ascending=[True, True]).reset_index(drop=True)
|
||||
self.df = self.df.sort_values(['submitted_date', 'submission'], ascending=[True, True]).reset_index(
|
||||
drop=True)
|
||||
self.df = self.df.reset_index().rename(columns={"index": "idx"})
|
||||
# logger.debug(f"DF after changes:\n{self.df}")
|
||||
scatter = px.scatter(data_frame=self.df, x='submission', y="concentration",
|
||||
@@ -41,8 +39,6 @@ class ConcentrationsChart(CustomFigure):
|
||||
except (ValueError, AttributeError) as e:
|
||||
logger.error(f"Error constructing chart: {e}")
|
||||
scatter = px.scatter()
|
||||
# logger.debug(f"Scatter data: {scatter.data}")
|
||||
# self.add_traces(scatter.data)
|
||||
# NOTE: For some reason if data is allowed to sort itself it leads to wrong ordering of x axis.
|
||||
traces = sorted(scatter.data, key=itemgetter("name"))
|
||||
for trace in traces:
|
||||
@@ -60,6 +56,9 @@ class ConcentrationsChart(CustomFigure):
|
||||
tickmode='array',
|
||||
tickvals=tickvals,
|
||||
ticktext=ticklabels,
|
||||
),
|
||||
yaxis=dict(
|
||||
rangemode="nonnegative"
|
||||
)
|
||||
)
|
||||
self.update_traces(marker={'size': 15})
|
||||
|
||||
Reference in New Issue
Block a user