]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Merge branch 'jha/CurvePlot_barplot_stemplot' into jha/CurvePlot_barplot_stemplot_9_12
authorjh777916 <juba.hamma@cea.fr>
Thu, 23 May 2024 09:00:22 +0000 (11:00 +0200)
committerjh777916 <juba.hamma@cea.fr>
Thu, 23 May 2024 09:01:59 +0000 (11:01 +0200)
23 files changed:
1  2 
tools/CurvePlot/CMakeLists.txt
tools/CurvePlot/src/cpp/CMakeLists.txt
tools/CurvePlot/src/cpp/CurvePlot.cxx
tools/CurvePlot/src/cpp/CurvePlot.hxx
tools/CurvePlot/src/cpp/test/test_curveplot.cxx
tools/CurvePlot/src/python/controller/PlotController.py
tools/CurvePlot/src/python/controller/__init__.py
tools/CurvePlot/src/python/controller/utils.py.in
tools/CurvePlot/src/python/model/CMakeLists.txt
tools/CurvePlot/src/python/model/CurveModel.py
tools/CurvePlot/src/python/model/Model.py
tools/CurvePlot/src/python/model/PlotManager.py
tools/CurvePlot/src/python/model/XYPlotSetModel.py
tools/CurvePlot/src/python/test/CMakeLists.txt
tools/CurvePlot/src/python/test/PlotTestBase.py
tools/CurvePlot/src/python/test/TestDesktop.py
tools/CurvePlot/src/python/test/plot_test.py
tools/CurvePlot/src/python/ui/CurveTreeDockWidget.py
tools/CurvePlot/src/python/ui/PlotSettings.py
tools/CurvePlot/src/python/ui/PlotWidget.py
tools/CurvePlot/src/python/views/CMakeLists.txt
tools/CurvePlot/src/python/views/CurveView.py
tools/CurvePlot/src/python/views/XYView.py

Simple merge
Simple merge
Simple merge
index c69c7491d7f8a2f5e59cccb764baea156dc76983,c2a619fd7142b924eafdef33097e17d8f473a477..9bb3bf2f66cb1578c02b56d53e81266dde82f852
@@@ -727,3 -817,113 +817,113 @@@ class PlotController(object)
      self.setModelListener(cm, xyview)
  
      return cm.getID(),cps.getID()
 -    return sm.getID(),cps.getID()
+   def plotBarPlotFromTable(self, table,
+                             x_col_index=0, height_col_index=1, width_col_index=2,
+                              curve_label="", append=True):
+     """
+     :returns: a tuple containing the unique curve ID and the plot set ID 
+     """
+     # Regardless of 'append', we must create a view if none there:
+     if self._plotManager.getCurrentPlotSet() is None or not append:
+       ps = self._plotManager.createXYPlotSet()
+       self.setModelListener(ps, self._curveBrowserView)
+       # For curve picking, controller must listen:
+       self.setModelListener(ps, self)
+       cps_title = table.getTitle()
+     else:
+       cps_title = None
+     cps = self._plotManager.getCurrentPlotSet()
+     bm = BarModel(self, table, height_col_index, width_col_index)
+     bm.setXAxisIndex(x_col_index)
+     # X axis label
+     tix = table.getColumnTitle(x_col_index)
+     if tix != "":
+       cps.setXLabel(tix)
+     # Curve label
+     if curve_label != "":
+       bm.setTitle(curve_label)
+     else:
+       ti = table.getColumnTitle(height_col_index)
+       if ti != "":
+         bm.setTitle(ti)
+     # Plot set title
+     if cps_title != "" and cps_title is not None:
+       Logger.Debug("about to set title to: " + cps_title)
+       cps.setTitle(cps_title)
+     cps.addCurve(bm)
+     mp = self._curveTabsView.mapModId2ViewId()
+     xyview_id = mp[cps.getID()]
+     xyview = self._curveTabsView._XYViews[xyview_id]
+     if cps_title is None:  # no plot set was created above
+       self._plotManager.setCurrentPlotSet(cps.getID())
+     # Make CurveBrowser and CurveView depend on changes in the curve itself:
+     self.setModelListener(bm, self._curveBrowserView)
+     self.setModelListener(bm, xyview._curveViews[bm.getID()]) # TAG CHECK
+     # Upon change on the curve also update the full plot, notably for the auto-fit and the legend:
+     self.setModelListener(bm, xyview)
+     return bm.getID(),cps.getID()
+   def plotStemPlotFromTable(self, table, x_col_index=0, y_col_index=1, curve_label="", append=True):
+     """
+     :returns: a tuple containing the unique curve ID and the plot set ID 
+     """
+     # Regardless of 'append', we must create a view if none there:
+     if self._plotManager.getCurrentPlotSet() is None or not append:
+       ps = self._plotManager.createXYPlotSet()
+       self.setModelListener(ps, self._curveBrowserView)
+       # For curve picking, controller must listen:
+       self.setModelListener(ps, self)
+       cps_title = table.getTitle()
+     else:
+       cps_title = None
+     cps = self._plotManager.getCurrentPlotSet()
+     sm = StemModel(self, table, y_col_index)
+     sm.setXAxisIndex(x_col_index)
+     # X axis label
+     tix = table.getColumnTitle(x_col_index)
+     if tix != "":
+       cps.setXLabel(tix)
+     # Curve label
+     if curve_label != "":
+       sm.setTitle(curve_label)
+     else:
+       ti = table.getColumnTitle(y_col_index)
+       if ti != "":
+         sm.setTitle(ti)
+     # Plot set title
+     if cps_title != "" and cps_title is not None:
+       Logger.Debug("about to set title to: " + cps_title)
+       cps.setTitle(cps_title)
+     cps.addCurve(sm)
+     mp = self._curveTabsView.mapModId2ViewId()
+     xyview_id = mp[cps.getID()]
+     xyview = self._curveTabsView._XYViews[xyview_id]
+     if cps_title is None:  # no plot set was created above
+       self._plotManager.setCurrentPlotSet(cps.getID())
+     # Make CurveBrowser and CurveView depend on changes in the curve itself:
+     self.setModelListener(sm, self._curveBrowserView)
+     self.setModelListener(sm, xyview._curveViews[sm.getID()])
+     # Upon change on the curve also update the full plot, notably for the auto-fit and the legend:
+     self.setModelListener(sm, xyview)
++    return sm.getID(),cps.getID()