Commit b8267657 authored by Matt Cumber's avatar Matt Cumber
Browse files

Re #31554 ALC Saved Axis Scales

parent cc004f97
......@@ -58,6 +58,9 @@ Improvements
- The interface saves previous settings if possible instead of resetting.
- The interface can now load runs from different directories/cycles
Bug fixes
#########
- Fixed a bug where after changing the axis scales of the plot, when loading new data the default scale would be used instead.
Elemental Analysis
------------------
......
......@@ -182,6 +182,10 @@ private:
char *m_style;
bool m_useOffset;
// Axis scales
std::string m_xAxisScale;
std::string m_yAxisScale;
// Context menu actions
QActionGroup *m_contextPlotTools;
QAction *m_contextResetView;
......
......@@ -57,8 +57,8 @@ namespace MantidWidgets {
PreviewPlot::PreviewPlot(QWidget *parent, bool observeADS)
: QWidget(parent), m_canvas{new FigureCanvasQt(111, MANTID_PROJECTION, parent)}, m_panZoomTool(m_canvas),
m_wsRemovedObserver(*this, &PreviewPlot::onWorkspaceRemoved),
m_wsReplacedObserver(*this, &PreviewPlot::onWorkspaceReplaced), m_axis("both"), m_style("sci"),
m_useOffset(true) {
m_wsReplacedObserver(*this, &PreviewPlot::onWorkspaceReplaced), m_axis("both"), m_style("sci"), m_useOffset(true),
m_xAxisScale("linear"), m_yAxisScale("linear") {
createLayout();
createActions();
......@@ -122,6 +122,8 @@ void PreviewPlot::addSpectrum(const QString &lineName, const Mantid::API::Matrix
removeSpectrum(lineName);
auto axes = m_canvas->gca<MantidAxes>();
axes.setXScale(m_xAxisScale.c_str());
axes.setYScale(m_yAxisScale.c_str());
if (m_linesErrorsCache.value(lineName)) {
m_lines[lineName] = true;
axes.errorbar(ws, wsIndex, lineColour.name(QColor::HexRgb), lineName, plotKwargs);
......@@ -699,9 +701,11 @@ void PreviewPlot::setScaleType(AxisID id, const QString &actionName) {
switch (id) {
case AxisID::XBottom:
axes.setXScale(scaleType.constData());
m_xAxisScale = actionName.toLower().toStdString();
break;
case AxisID::YLeft:
axes.setYScale(scaleType.constData());
m_yAxisScale = actionName.toLower().toStdString();
break;
default:
break;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment