I am using the SPC module to collect samples of this tag. I would like to make 2 graphs in the reporting module. The first would be like this script and I am looking to show upper set limits and lower set limits too.
The second graph is a histogram, and I am looking for some code to display the count of samples that were in each bin where I can set the bin to be to the nearest degree and show the standard deviation bell curve too. How can I accomplish this?
definition = "SQLTag-Solder Pot Temperature" attribute = "DegreesF" filters = "Location=Luvata Waterbury\Wire In Channel\Solder\Solder Line 1,FromDate=2017-08-14 07:00:00 -0800,ToDate=2017-08-14 8:00:00 -0800" controlLimits = "Individual LCL,Individual UCL" signals = "Individual Outside" dataformat = "Individual" spcSettings = system.quality.spc.settings.createSettings(definition, attribute, filters, controlLimits, signals, dataformat) spcSettings.setOptionalParams('RowLimit=100') # limit the dataset while testing # get the analysis results spcResults = system.quality.spc.getSPCResults(spcSettings) # get the table data spcData = spcResults.getTableResults() # Create a new column that will hold any value that is out of range # cycle through the rows in the dataset and determine the new column values # if the value is outside the limits then it will have a value and can be plotted as a point # if it is not outside then we must set it to be Not A Number colCount=spcData.getColumnCount() columnName="isOutside" columnData= for row in range(spcData.getRowCount()): isOut = spcData.getValueAt(row, 'Individual Outside') #uclVal = spcData.getValueAt(row, 'Individual UCL') # this value will plot if isOut==True: measVal = spcData.getValueAt(row, 'Measurement 1') # this value will plot #uclVal = float('NaN') # this value will plot #system.quality.spc.controllimit.calcControlLimitValue else: measVal = float('NaN') # this value will not plot #uclVal = spcData.getValueAt(row, 'Individual UCL') # this value will plot columnData.append(measVal) #columnData.append(clVal) #uclVal = spcData.getValueAt(row, 'Individual UCL') # this value will plot #columnData.append(uclVal) # create a new dataset with the new column added newData = system.dataset.addColumn(spcData, colCount, columnData, columnName, float) data['myKey']=newData