From 66a59a1d518144fef2747124281ad70674504d6c Mon Sep 17 00:00:00 2001 From: Jdrezen <jeremie.drezen@gmail.com> Date: Tue, 11 May 2021 13:00:35 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20d'un=20autre=20plot=20chart=20pour=20mo?= =?UTF-8?q?ntrer=20les=20possibilit=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controleurPhilosophersExample.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/philosopher_example/controleurPhilosophersExample.py b/philosopher_example/controleurPhilosophersExample.py index 46757e8..c1be855 100644 --- a/philosopher_example/controleurPhilosophersExample.py +++ b/philosopher_example/controleurPhilosophersExample.py @@ -11,8 +11,11 @@ class ControleurPhilosophersExample(Controleur): self.__numberPhilosopher = 10 self.__barChart = [] self.__barChart.append(self.addBarChart('Eaten Pastas')) - self.__barChart.append(self.addBarChart('Hours of tkinking')) + self.__barChart.append(self.addPlotChart('Hours of tkinking')) + self.setPolicy(self.__barChart[1],0,"ro") + self.__barChart.append(self.addPlotChart('Hours of hunger')) + self.addCurve(self.__barChart[2],'g+-') def initialisation(self): @@ -53,10 +56,9 @@ class ControleurPhilosophersExample(Controleur): nom = 'Mr ' + str(i) self.addColumn(self.__barChart[0],nom) - self.addColumn(self.__barChart[1],nom) - self.addPoint(self.__barChart[2],0,x,y) - self.addCurve(self.__barChart[2],'go') - self.addPoint(self.__barChart[2],1,x-10,y-10) + self.addPoint(self.__barChart[1],0,x-10,y-10) + self.addPoint(self.__barChart[2],0,i*50,y) + self.addPoint(self.__barChart[2],1,i*50,y-50) def updateCycle(self, env, amas): agents = amas.get_Agents_Sorted() @@ -69,11 +71,9 @@ class ControleurPhilosophersExample(Controleur): elif state == State.HUNGRY: self.change_color(self.__philosophers[i], 'red') - self.increaseValue(self.__barChart[2],i, 1) else: self.change_color(self.__philosophers[i], 'blue') - self.increaseValue(self.__barChart[1],i, 1) coords = self.get_coords_element(self.__philosophers[i]) if agents[i].get_Left_Fork().owned(agents[i]): -- GitLab