mirror of
https://codeberg.org/langfingaz/bbb-status
synced 2024-11-21 20:23:17 +01:00
sort BbbStatus before plotting
This commit is contained in:
parent
8a652852a9
commit
aa62d31c29
@ -58,6 +58,17 @@ class BbbStatus(object):
|
|||||||
and (TODO) it's CPU utilization and network usage.
|
and (TODO) it's CPU utilization and network usage.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
pointOfTime: datetime = None
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def getKey(bbbStatus):
|
||||||
|
"""
|
||||||
|
Returns the date of this object as key for sorting.
|
||||||
|
|
||||||
|
:return: Key that can be used for sorting
|
||||||
|
"""
|
||||||
|
return bbbStatus.pointOfTime
|
||||||
|
|
||||||
def __init__(self, meetings: List[Meeting], pointOfTime: datetime = None):
|
def __init__(self, meetings: List[Meeting], pointOfTime: datetime = None):
|
||||||
"""
|
"""
|
||||||
:param meetings: All current meetings
|
:param meetings: All current meetings
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List
|
from typing import List
|
||||||
import numpy
|
import matplotlib.pyplot as pyplot
|
||||||
import matplotlib.pyplot as plt # TODO
|
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
from langfingaz import loadData
|
from langfingaz import loadData
|
||||||
from langfingaz import parseMeetings
|
from langfingaz import parseMeetings
|
||||||
@ -22,6 +20,7 @@ def plotMeetings(dataDir: Path = fileUtil.getProjectBaseDir().joinpath("data")):
|
|||||||
dataStr, t = loadData.loadData(file)
|
dataStr, t = loadData.loadData(file)
|
||||||
meetings: List[Meeting] = parseMeetings.parseMeetingsData(dataStr)
|
meetings: List[Meeting] = parseMeetings.parseMeetingsData(dataStr)
|
||||||
bbbStati.append(parseMeetings.BbbStatus(meetings, t))
|
bbbStati.append(parseMeetings.BbbStatus(meetings, t))
|
||||||
|
sorted(bbbStati, key=BbbStatus.getKey)
|
||||||
|
|
||||||
image: Path = doPlotMeetings(bbbStati)
|
image: Path = doPlotMeetings(bbbStati)
|
||||||
print("saved image at " + str(image))
|
print("saved image at " + str(image))
|
||||||
@ -40,10 +39,10 @@ def doPlotMeetings(bbbStati: List[BbbStatus]) -> Path:
|
|||||||
voices.append(bbbStatus.voiceParticipantCount)
|
voices.append(bbbStatus.voiceParticipantCount)
|
||||||
|
|
||||||
# Note that even in the OO-style, we use `.pyplot.figure` to create the figure.
|
# Note that even in the OO-style, we use `.pyplot.figure` to create the figure.
|
||||||
_a, _b = plt.subplots() # Create a figure and an axes.
|
_a, _b = pyplot.subplots() # Create a figure and an axes.
|
||||||
fig: plt.Figure = _a
|
fig: pyplot.Figure = _a
|
||||||
ax = _b # of type plt.axes.Axes ??
|
ax = _b # of type plt.axes.Axes ??
|
||||||
if not (issubclass(type(fig), plt.Figure)):
|
if not (issubclass(type(fig), pyplot.Figure)):
|
||||||
raise ValueError("expected Figure")
|
raise ValueError("expected Figure")
|
||||||
|
|
||||||
ax.plot(time, participants, label='participants') # Plot some data on the axes.
|
ax.plot(time, participants, label='participants') # Plot some data on the axes.
|
||||||
|
Loading…
Reference in New Issue
Block a user