diff --git a/pyAmakIHM/classes/controleur.py b/pyAmakIHM/classes/controleur.py index 61e975c07b7c74bb8b20c888ef20786c93283c57..7c629936623219e3a9bb1bfbe2131527cd44814f 100644 --- a/pyAmakIHM/classes/controleur.py +++ b/pyAmakIHM/classes/controleur.py @@ -124,6 +124,9 @@ class Controleur: def addPlotChart(self, name : str) -> int: return self.__fenetre.addPlotChart(name) + def addLimitedPlotChart(self, name : str, limit) -> int: + return self.__fenetre.addLimitedPlotChart(name, limit) + """ Set the drawing policy to the curve of the plot chart identified by idCurve and id """ diff --git a/pyAmakIHM/classes/fenetre.py b/pyAmakIHM/classes/fenetre.py index 076b177a2314d0aa996944c92aefcda1a280ae2d..0d637c4077773bc7091be358756c11be05a2a9d1 100644 --- a/pyAmakIHM/classes/fenetre.py +++ b/pyAmakIHM/classes/fenetre.py @@ -11,6 +11,7 @@ from pyAmakIHM.classes.panelCommandes import PanelCommandes from pyAmakIHM.classes.panelVue import PanelVue from pyAmakIHM.classes.panelBarChart import PanelBarChart from pyAmakIHM.classes.panelPlotChart import PanelPlotChart +from pyAmakIHM.classes.panelLimitedPlotChart import PanelLimitedPlotChart from tkinter import ttk, Tk @@ -163,6 +164,15 @@ class Fenetre : self.__onglet.add(self.__panelGraphiques[length],text = name) return (length) + def addLimitedPlotChart(self, name : str, limit) -> int: + length = len(self.__panelGraphiques) + self.__panelGraphiques.append(PanelLimitedPlotChart(self.__onglet,length, limit)) + + self.__panelGraphiques[length].attach(self) + self.__onglet.add(self.__panelGraphiques[length],text = name) + return (length) + + """ Set the drawing policy to the curve of the plot chart identified by idCurve and id """ diff --git a/pyAmakIHM/classes/panelLimitedPlotChart.py b/pyAmakIHM/classes/panelLimitedPlotChart.py new file mode 100644 index 0000000000000000000000000000000000000000..d14178d4896e16f24e8d5b9fce37477d5a56ff6f --- /dev/null +++ b/pyAmakIHM/classes/panelLimitedPlotChart.py @@ -0,0 +1,38 @@ +""" +Class PanelLimitedPlotChart +""" + +from pyAmakIHM.classes.panelPlotChart import PanelPlotChart + +class PanelLimitedPlotChart(PanelPlotChart): + """ + Class PanelLimitedPlotChart + """ + + def __init__( + self, + root, + id, + limit + ) : + super().__init__(root, id) + + self.__limit = limit + self.__limited = False + + def addPoint(self, id : int, x : int, y : int): + self.__axis.clear() + self.__xAxis[id].append(x) + self.__yAxis[id].append(y) + + if(self.__limited): + del self.__xAxis[0] + del self.__yAxis[0] + + else: + self.__limited = self.isLimited() + + self.__rebuild() + + def isLimited(self): + return len(self.__xAxis) > self.__limit