Second round of code cleanup.

This commit is contained in:
lwark
2024-10-30 07:34:39 -05:00
parent 1f83b61c81
commit ba1b3e5cf3
19 changed files with 176 additions and 110 deletions

View File

@@ -2,9 +2,6 @@
Functions for constructing irida controls graphs using plotly.
"""
from pprint import pformat
from plotly.graph_objs import FigureWidget, Scatter
from . import CustomFigure
import plotly.express as px
import pandas as pd
@@ -13,30 +10,23 @@ import logging
logger = logging.getLogger(f"submissions.{__name__}")
# NOTE: For click events try (haven't got working yet) ipywidgets >=7.0.0 required for figurewidgets:
# https://plotly.com/python/click-events/
class PCRFigure(CustomFigure):
def __init__(self, df: pd.DataFrame, modes: list, ytitle: str | None = None, parent: QWidget | None = None,
months: int = 6):
super().__init__(df=df, modes=modes)
logger.debug(f"DF: {self.df}")
# logger.debug(f"DF: {self.df}")
self.construct_chart(df=df)
def hello(self):
print("hello")
def construct_chart(self, df: pd.DataFrame):
logger.debug(f"PCR df:\n {df}")
# logger.debug(f"PCR df:\n {df}")
try:
express = px.scatter(data_frame=df, x='submitted_date', y="ct",
scatter = px.scatter(data_frame=df, x='submitted_date', y="ct",
hover_data=["name", "target", "ct", "reagent_lot"],
color="target")
except ValueError:
express = px.scatter()
scatter = FigureWidget([datum for datum in express.data])
scatter = px.scatter()
self.add_traces(scatter.data)
self.update_traces(marker={'size': 15})