orangeqs.juice.dashboard.widgets.history_plot#

History charts of fridge sensor readings, loaded from InfluxDB2 and live-updated.

Module Contents#

Classes#

HistoryChart

One line chart of the history of a component’s sensors.

HistoryPanel

History charts side by side, under one “Show data since:” dropdown.

Functions#

to_display_value

Convert a reading to the chart’s unit, or None if it can’t be plotted.

chart_grid

Lay charts out in rows of PLOTS_PER_ROW.

Data#

MBAR_PER_UNIT

Pressure units a PressurePoint may carry, as a factor to mbar.

BAR_PER_UNIT

Pressure units a PressurePoint may carry, as a factor to bar.

MMOL_PER_S_PER_UNIT

Flow units a FlowratePoint may carry, as a factor to mmol/s.

HistoryPoint

API#

orangeqs.juice.dashboard.widgets.history_plot.MBAR_PER_UNIT#

None

Pressure units a PressurePoint may carry, as a factor to mbar.

orangeqs.juice.dashboard.widgets.history_plot.BAR_PER_UNIT#

None

Pressure units a PressurePoint may carry, as a factor to bar.

orangeqs.juice.dashboard.widgets.history_plot.MMOL_PER_S_PER_UNIT#

None

Flow units a FlowratePoint may carry, as a factor to mmol/s.

orangeqs.juice.dashboard.widgets.history_plot.HistoryPoint#

None

orangeqs.juice.dashboard.widgets.history_plot.to_display_value(value: float, unit: str, unit_factors: dict[str, float] | None, max_value: float, min_value: float = 0.0) → float | None#

Convert a reading to the chart’s unit, or None if it can’t be plotted.

unit_factors maps a reading’s unit (lower case) to its factor to the chart’s unit; None means readings carry no unit and are plotted as-is. Unknown units, non-finite values and values outside (min_value, max_value) are not plottable: by default zero or less can’t sit on a log axis or be a pressure or absolute temperature, and values at or above max_value are sensor-fault sentinels.

class orangeqs.juice.dashboard.widgets.history_plot.HistoryChart(*, title: str, point_type: type[orangeqs.juice.dashboard.widgets.history_plot.HistoryPoint], component_id: str, sensors: dict[str, str], service_name: str, unit_label: str, unit_factors: dict[str, float] | None, max_value: float, min_value: float = 0.0, log_axis: bool = False)#

One line chart of the history of a component’s sensors.

async load(timerange_s: int) → None#

Replace the chart’s data with the last timerange_s seconds of history.

A load that is overtaken by a newer one discards its result, and live points that arrive while the query runs are kept.

add_point(event: orangeqs.juice.dashboard.widgets.history_plot.HistoryPoint) → None#

Append a live reading if it belongs to this chart.

Readings older than the selected time range are dropped from the chart.

orangeqs.juice.dashboard.widgets.history_plot.chart_grid(charts: list[Any]) → list[panel.layout.Row]#

Lay charts out in rows of PLOTS_PER_ROW.

With several rows, the short last row is padded so its charts stay as wide as those above. A single row is not padded: its charts share the full width.

class orangeqs.juice.dashboard.widgets.history_plot.HistoryPanel(charts: list[orangeqs.juice.dashboard.widgets.history_plot.HistoryChart])#

History charts side by side, under one “Show data since:” dropdown.

Live readings are fed in by the owner through add_point, so the owner’s existing subscription is reused instead of opening a second one.

async initial_update() → None#

Load the selected time range of history into every chart.

add_point(event: orangeqs.juice.dashboard.widgets.history_plot.HistoryPoint) → None#

Append a live reading to the charts it belongs to.