コード例 #1
0
    def __init__(self, parent=None, host=None, title="Plot"):
        """
        Constructor
        """
        #super class constructor
        super(PlotWidgetController, self).__init__(parent)
        
        
        self.setupUi(self)
        self.setWindowTitle(title)

        self._initialize()

        self.timeUnit = "a.u." #default ?
        self.speciesUnit = "a.u." #default ?
        self.speciesLabel = "Concentration" #default ?
        if host:
            self.timeUnit = str(host.optionTimeUnit)
            self.speciesUnit = str(host.optionSpeciesUnit)
            self.speciesLabel = str(host.optionSpeciesLabel)

        #options: time unit, logarithmic y-axis and 'show legend'
        # 24.2.2015 td 
        #options: species label, species unit 
        self.options = {
            OPTION_LABEL_X: "Time [%s]" % (self.timeUnit), #default
            OPTION_LABEL_Y: "%s [%s]" % (self.speciesLabel,self.speciesUnit), #default
            OPTION_LOG_Y_AXIS: self.checkBoxLogYAxis.isChecked(),
            OPTION_SHOW_LEGEND: self.checkBoxShowLegend.isChecked()
        }

        self.host = host
        self.title = title

        self.data = None
        self.labels = None

        self.fig = None
        self.canvas = None
        self.axes = None
        self.mpl_toolbar = None
        self.dpi = None
        
        self.useGrayColor = False
        
        self.plotStyleManager = PlotStyleManager()
        if self.title!='Plot': self.plotStyleManager.setDataType(self.title)

        self.plotStyle = {
            0: PLOT_LINE} #default plot style; if there are more elements, each numbered element corresponds to one data source
        self.plotColors = {}    # will be filled with colors on the first plot