Skip to content

Commit

Permalink
Refs #11710 Start correcting automatic axis labelling
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry Jeffery committed May 7, 2015
1 parent 89f1778 commit 9bcf317
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
7 changes: 7 additions & 0 deletions Code/Mantid/MantidPlot/src/Graph.cpp
Expand Up @@ -3074,6 +3074,13 @@ void Graph::updateScale()
updateSecondaryAxis(QwtPlot::yRight);
}

auto firstCurve = dynamic_cast<MantidCurve*>(curve(0));
if (firstCurve)
{
setXAxisTitle(firstCurve->mantidData()->getXAxisLabel());
setYAxisTitle(firstCurve->mantidData()->getYAxisLabel());
}

d_plot->replot();//TODO: avoid 2nd replot!
d_zoomer[0]->setZoomBase(false);
}
Expand Down
11 changes: 3 additions & 8 deletions Code/Mantid/MantidPlot/src/Mantid/MantidUI.cpp
Expand Up @@ -617,11 +617,7 @@ MultiLayer* MantidUI::plotMDList(const QStringList& wsNames, const int plotAxis,

// Using information from the first graph
if( i == 0 && isGraphNew )
{
g->setXAxisTitle(data->getXAxisLabel());
g->setYAxisTitle(data->getYAxisLabel());
g->setAutoScale();
}
}

}
Expand Down Expand Up @@ -2770,6 +2766,7 @@ void MantidUI::importNumSeriesLog(const QString &wsName, const QString &logName,
g->setCurvePen(iFilterCurve, pn);
}
}
// THIS SECTION NEEDS TO BE FIXED REF #11710
g->setXAxisTitle(t->colLabel(0));
g->setYAxisTitle(t->colLabel(1).section(".",0,0));
g->setTitle(label);
Expand Down Expand Up @@ -2994,8 +2991,6 @@ void MantidUI::setUpBinGraph(MultiLayer* ml, const QString& Name, Mantid::API::M
{
xtitle = MantidQt::API::PlotAxis(*workspace, 1).title();
}
g->setXAxisTitle(xtitle);
g->setYAxisTitle(MantidQt::API::PlotAxis(false, *workspace).title());
}

/**
Expand Down Expand Up @@ -3221,8 +3216,6 @@ MultiLayer* MantidUI::plot1D(const QMultiMap<QString,int>& toPlot, bool spectrum
return NULL;
}

g->setXAxisTitle(firstCurve->mantidData()->getXAxisLabel());
g->setYAxisTitle(firstCurve->mantidData()->getYAxisLabel());
g->setAutoScale();
/* The 'setAutoScale' above is needed to make sure that the plot initially encompasses all the
* data points. However, this has the side-effect suggested by its name: all the axes become
Expand Down Expand Up @@ -3275,6 +3268,7 @@ void MantidUI::showSequentialPlot(Ui::SequentialFitDialog* ui, MantidQt::MantidW
MultiLayer* ml = appWindow()->multilayerPlot(t,colNames,ui->cbCurveType->currentIndex());
// set plot titles
Graph* g = ml->activeGraph();
// THIS SECTION NEEDS TO BE FIXED REF #11710
if (g)
{
if (ui->ckbLogPlot->isChecked())
Expand Down Expand Up @@ -3405,6 +3399,7 @@ MultiLayer* MantidUI::drawSingleColorFillPlot(const QString & wsName, Graph::Cur

plot->setTitle(wsName);
using MantidQt::API::PlotAxis;
// THIS SECTION NEEDS TO BE FIXED REF #11710
plot->setXAxisTitle(PlotAxis(*workspace, 0).title());
plot->setYAxisTitle(PlotAxis(*workspace, 1).title());

Expand Down

0 comments on commit 9bcf317

Please sign in to comment.