Skip to content

Commit

Permalink
Re #9762. Added the error bar option.
Browse files Browse the repository at this point in the history
  • Loading branch information
mantid-roman committed Jun 26, 2014
1 parent ebeab29 commit 15d927a
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Code/Mantid/MantidPlot/src/ApplicationWindow.cpp
Expand Up @@ -5247,6 +5247,7 @@ void ApplicationWindow::readSettings()
defaultCurveLineWidth = settings.value("/LineWidth", 1).toDouble();
defaultSymbolSize = settings.value("/SymbolSize", 3).toInt();
applyCurveStyleToMantid = settings.value("/ApplyMantid", true).toBool();
drawAllErrors = settings.value("/DrawAllErrors", false).toBool();
settings.endGroup(); // Curves

settings.beginGroup("/Ticks");
Expand Down Expand Up @@ -5627,6 +5628,7 @@ void ApplicationWindow::saveSettings()
settings.setValue("/LineWidth", defaultCurveLineWidth);
settings.setValue("/SymbolSize", defaultSymbolSize);
settings.setValue("/ApplyMantid", applyCurveStyleToMantid);
settings.setValue("/DrawAllErrors", drawAllErrors);
settings.endGroup(); // Curves

settings.beginGroup("/Ticks");
Expand Down
3 changes: 3 additions & 0 deletions Code/Mantid/MantidPlot/src/ApplicationWindow.h
Expand Up @@ -1297,6 +1297,9 @@ public slots:
int majTicksLength, minTicksLength, defaultPlotMargin;
int defaultCurveStyle, defaultSymbolSize;
bool applyCurveStyleToMantid; ///< if true defaultCurveStyle, defaultSymbolSize are applyed to MantidCurves
/// if true all errors are drawn on new plots with error bars, for a particular graph can be overridden
/// form Add Error bars dialog
bool drawAllErrors;
QFont appFont, plot3DTitleFont, plot3DNumbersFont, plot3DAxesFont;
QFont tableTextFont, tableHeaderFont, plotAxesFont, plotLegendFont, plotNumbersFont, plotTitleFont;
QColor tableBkgdColor, tableTextColor, tableHeaderColor;
Expand Down
7 changes: 6 additions & 1 deletion Code/Mantid/MantidPlot/src/ConfigDialog.cpp
Expand Up @@ -1524,7 +1524,11 @@ void ConfigDialog::initCurvesPage()
}
curvesBoxLayout->addWidget(cbApplyToMantid, 3, 1);

curvesBoxLayout->setRowStretch( 4, 1 );
cbDrawAllErrors = new QCheckBox("Draw all errors");
cbDrawAllErrors->setChecked( app->drawAllErrors );
curvesBoxLayout->addWidget(cbDrawAllErrors, 4, 1);

curvesBoxLayout->setRowStretch( 5, 1 );

QHBoxLayout * curvesPageLayout = new QHBoxLayout( curves );
curvesPageLayout->addWidget( curvesGroupBox );
Expand Down Expand Up @@ -2047,6 +2051,7 @@ void ConfigDialog::apply()
app->defaultCurveLineWidth = boxCurveLineWidth->value();
app->defaultSymbolSize = 2*boxSymbolSize->value() + 1;
app->applyCurveStyleToMantid = cbApplyToMantid->isChecked();
app->drawAllErrors = cbDrawAllErrors->isChecked();
// 2D plots page: ticks tab
app->majTicksLength = boxMajTicksLength->value();
app->minTicksLength = boxMinTicksLength->value();
Expand Down
1 change: 1 addition & 0 deletions Code/Mantid/MantidPlot/src/ConfigDialog.h
Expand Up @@ -241,6 +241,7 @@ class ConfigDialog : public QDialog
QSpinBox *undoStackSizeBox;
QComboBox *boxEndLine;
QCheckBox* cbApplyToMantid;
QCheckBox* cbDrawAllErrors;
QCheckBox* cbEnableQtiPlotFitting;

QLabel *labelGraphAxesLabelsDist, *labelTickLabelsDist;
Expand Down
5 changes: 3 additions & 2 deletions Code/Mantid/MantidPlot/src/ErrDialog.cpp
Expand Up @@ -28,6 +28,7 @@
***************************************************************************/
#include "ErrDialog.h"
#include "Table.h"
#include "ApplicationWindow.h"

#include <QHBoxLayout>
#include <QVBoxLayout>
Expand All @@ -45,7 +46,7 @@
#include <QCheckBox>


ErrDialog::ErrDialog( QWidget* parent, Qt::WFlags fl )
ErrDialog::ErrDialog( ApplicationWindow* parent, Qt::WFlags fl )
: QDialog( parent, fl )
{
setFocusPolicy( Qt::StrongFocus );
Expand Down Expand Up @@ -80,7 +81,7 @@ ErrDialog::ErrDialog( QWidget* parent, Qt::WFlags fl )

drawAllErrors = new QCheckBox(this);
drawAllErrors->setText("Draw all errors");
drawAllErrors->setChecked( false );
drawAllErrors->setChecked( parent->drawAllErrors );
gridLayout->addWidget(drawAllErrors, 0, 1);

columnBox = new QRadioButton();
Expand Down
3 changes: 2 additions & 1 deletion Code/Mantid/MantidPlot/src/ErrDialog.h
Expand Up @@ -40,6 +40,7 @@ class QGroupBox;
class QButtonGroup;
class QCheckBox;
class MdiSubWindow;
class ApplicationWindow;

//! Add error bars dialog
class ErrDialog : public QDialog
Expand All @@ -52,7 +53,7 @@ class ErrDialog : public QDialog
* @param parent :: parent widget
* @param fl :: window flags
*/
ErrDialog( QWidget* parent = 0, Qt::WFlags fl = 0 );
ErrDialog( ApplicationWindow* parent, Qt::WFlags fl = 0 );

private:
QLabel* textLabel1;
Expand Down
5 changes: 5 additions & 0 deletions Code/Mantid/MantidPlot/src/Mantid/MantidMatrixCurve.cpp
Expand Up @@ -158,6 +158,11 @@ void MantidMatrixCurve::init(Graph* g,bool distr,Graph::CurveType style)
}
g->insertCurve(this,lineWidth);

// set the option to draw all error bars from the global settings
if ( hasErrorBars() )
{
setErrorBars( true, g->multiLayer()->applicationWindow()->drawAllErrors );
}
// Initialise error bar colour to match curve colour
m_errorSettings->m_color = pen().color();
m_errorSettings->setWidth(pen().widthF());
Expand Down

0 comments on commit 15d927a

Please sign in to comment.