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()