/** * Construct a QwtWorkspaceSpectrumData object with a source workspace * @param workspace The workspace containing the data * @param wsIndex Index of the spectrum to plot * @param logScaleY If true, plot a log scale * @param plotAsDistribution If true and the data is histogram and not already a * distribution then plot the Y values/X bin-width */ QwtWorkspaceSpectrumData::QwtWorkspaceSpectrumData( const Mantid::API::MatrixWorkspace &workspace, int wsIndex, const bool logScaleY, const bool plotAsDistribution) : MantidQwtMatrixWorkspaceData(logScaleY), m_wsIndex(wsIndex), m_X(workspace.readX(wsIndex)), m_Y(workspace.readY(wsIndex)), m_E(workspace.readE(wsIndex)), m_xTitle(), m_yTitle(), m_isHistogram(workspace.isHistogramData()), m_dataIsNormalized(workspace.isDistribution()), m_binCentres(false), m_isDistribution(false) { // Actual plotting based on what type of data we have setAsDistribution(plotAsDistribution && !m_dataIsNormalized); // takes into account if this is a // histogram and sets m_isDistribution m_xTitle = MantidQt::API::PlotAxis(workspace, 0).title(); m_yTitle = MantidQt::API::PlotAxis((m_dataIsNormalized || m_isDistribution), workspace).title(); // Calculate the min and max values calculateYMinAndMax(); }