mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2778 Observed error bars. Display error bars in the same color as data points
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimEnsembleCurveSetCollection.h"
|
||||
#include "RimSummaryCrossPlot.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryCurveCollection.h"
|
||||
#include "RimSummaryCurveFilter.h"
|
||||
@@ -110,6 +111,8 @@ RimPlotCurve::RimPlotCurve()
|
||||
|
||||
CAF_PDM_InitField(&m_showLegend, "ShowLegend", true, "Contribute To Legend", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_showErrorBars, "ShowErrorBars", true, "Show Error Bars", "", "", "");
|
||||
|
||||
m_qwtPlotCurve = new RiuRimQwtPlotCurve(this);
|
||||
|
||||
m_parentQwtPlot = nullptr;
|
||||
@@ -170,7 +173,11 @@ void RimPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, con
|
||||
{
|
||||
updateLegendEntryVisibilityAndPlotLegend();
|
||||
}
|
||||
|
||||
else if (changedField == &m_showErrorBars)
|
||||
{
|
||||
m_qwtPlotCurve->showErrorBars(m_showErrorBars);
|
||||
updateCurveAppearance();
|
||||
}
|
||||
if (m_parentQwtPlot) m_parentQwtPlot->replot();
|
||||
}
|
||||
|
||||
@@ -362,6 +369,9 @@ void RimPlotCurve::appearanceUiOrdering(caf::PdmUiOrdering& uiOrdering)
|
||||
uiOrdering.add(&m_curveThickness);
|
||||
uiOrdering.add(&m_lineStyle);
|
||||
uiOrdering.add(&m_curveInterpolation);
|
||||
|
||||
if(isCrossPlotCurve()) m_showErrorBars = false;
|
||||
else uiOrdering.add(&m_showErrorBars);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -464,6 +474,20 @@ void RimPlotCurve::updateCurveAppearance()
|
||||
m_qwtPlotCurve->setStyle(curveStyle);
|
||||
m_qwtPlotCurve->setSymbol(symbol);
|
||||
m_qwtPlotCurve->setSymbolSkipPixelDistance(m_symbolSkipPixelDistance());
|
||||
|
||||
m_qwtPlotCurve->setErrorBarsColor(curveColor);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPlotCurve::isCrossPlotCurve() const
|
||||
{
|
||||
RimSummaryCrossPlot* crossPlot = nullptr;
|
||||
this->firstAncestorOrThisOfType(crossPlot);
|
||||
if (crossPlot) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -101,6 +101,7 @@ public:
|
||||
void setZOrder(double z);
|
||||
|
||||
virtual void updateCurveAppearance();
|
||||
bool isCrossPlotCurve() const;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -135,7 +136,7 @@ protected:
|
||||
caf::PdmField<cvf::Color3f> m_curveColor;
|
||||
caf::PdmField<int> m_curveThickness;
|
||||
caf::PdmField<float> m_symbolSkipPixelDistance;
|
||||
|
||||
caf::PdmField<bool> m_showErrorBars;
|
||||
|
||||
caf::PdmField< caf::AppEnum< PointSymbolEnum > > m_pointSymbol;
|
||||
caf::PdmField< caf::AppEnum< LineStyleEnum > > m_lineStyle;
|
||||
|
||||
@@ -457,7 +457,18 @@ void RimSummaryCurve::onLoadDataAndUpdate(bool updateParentPlot)
|
||||
{
|
||||
if (plot->timeAxisProperties()->timeMode() == RimSummaryTimeAxisProperties::DATE)
|
||||
{
|
||||
m_qwtPlotCurve->setSamplesFromTimeTAndYValues(curveTimeStepsY, curveValuesY, isLogCurve);
|
||||
auto reader = summaryCaseY()->summaryReader();
|
||||
auto errAddress = reader->errorAddress(summaryAddressY());
|
||||
if (errAddress.isValid())
|
||||
{
|
||||
std::vector<double> errValues;
|
||||
reader->values(errAddress, &errValues);
|
||||
m_qwtPlotCurve->setSamplesFromTimeTAndYValues(curveTimeStepsY, curveValuesY, errValues, isLogCurve);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_qwtPlotCurve->setSamplesFromTimeTAndYValues(curveTimeStepsY, curveValuesY, isLogCurve);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -492,6 +503,8 @@ void RimSummaryCurve::onLoadDataAndUpdate(bool updateParentPlot)
|
||||
updateZoomInParentPlot();
|
||||
m_parentQwtPlot->replot();
|
||||
}
|
||||
|
||||
m_qwtPlotCurve->showErrorBars(m_showErrorBars);
|
||||
}
|
||||
|
||||
if (updateParentPlot) updateQwtPlotAxis();
|
||||
@@ -594,18 +607,6 @@ void RimSummaryCurve::appendOptionItemsForSummaryAddresses(QList<caf::PdmOptionI
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryCurve::isCrossPlotCurve() const
|
||||
{
|
||||
RimSummaryCrossPlot* crossPlot = nullptr;
|
||||
this->firstAncestorOrThisOfType(crossPlot);
|
||||
if (crossPlot) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -97,8 +97,6 @@ private:
|
||||
RimSummaryCase* summaryCase,
|
||||
RimSummaryFilter* summaryFilter);
|
||||
|
||||
bool isCrossPlotCurve() const;
|
||||
|
||||
private:
|
||||
// Y values
|
||||
caf::PdmPtrField<RimSummaryCase*> m_yValuesSummaryCase;
|
||||
|
||||
Reference in New Issue
Block a user