Fix log axis crash in Grid Cross Plot and refactor log axis range code

This commit is contained in:
Gaute Lindkvist
2019-03-13 10:16:46 +01:00
parent 0ce69d41dd
commit 52d2eed98b
10 changed files with 186 additions and 70 deletions

View File

@@ -635,32 +635,25 @@ void RimSummaryPlot::updateZoomForAxis(RiaDefines::PlotAxis plotAxis)
{
if (yAxisProps->isLogarithmicScaleEnabled)
{
std::vector<double> yValues;
std::vector<QwtPlotCurve*> plotCurves;
std::vector<const QwtPlotCurve*> plotCurves;
for (RimSummaryCurve* c : visibleSummaryCurvesForAxis(plotAxis))
{
std::vector<double> curveValues = c->valuesY();
yValues.insert(yValues.end(), curveValues.begin(), curveValues.end());
plotCurves.push_back(c->qwtPlotCurve());
}
for (RimGridTimeHistoryCurve* c : visibleTimeHistoryCurvesForAxis(plotAxis))
{
std::vector<double> curveValues = c->yValues();
yValues.insert(yValues.end(), curveValues.begin(), curveValues.end());
plotCurves.push_back(c->qwtPlotCurve());
}
for (RimAsciiDataCurve* c : visibleAsciiDataCurvesForAxis(plotAxis))
{
std::vector<double> curveValues = c->yValues();
yValues.insert(yValues.end(), curveValues.begin(), curveValues.end());
plotCurves.push_back(c->qwtPlotCurve());
}
double min, max;
RimPlotAxisRangeCalculator calc(QwtPlot::yLeft, plotCurves, yValues);
RimPlotAxisLogRangeCalculator calc(QwtPlot::yLeft, plotCurves);
calc.computeAxisRange(&min, &max);
if (yAxisProps->isAxisInverted())